Link,Hyperlink to pages

GWT Designer allows you to quickly create the modules, composites, panels, remote services and other elements that comprise Google Web Tookit applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Re: Link,Hyperlink to pages

Postby peterblazejewicz » Fri Feb 22, 2008 1:57 pm

hi,

I think you're misunderstanding "page" and "view" concepts in web development and "links"/"hyperlinks" terms, specifically hyperlink term in GWT Toolkit,
I've posted extensive reply on GWT group providign even GWT Designer compatible anchor tag implementation and as I noticed you've repeated your topic on grup and even started it here again (that are 3 places with the same subject),
http://groups.google.com/group/Google-W ... f83b22baa/
The answer to your questions is probably very simple and quick however poeple need to know what you are after (I though that you're looking for anchor thing when I've read about domains names/uri/urls),
regards,
Peter
Peter Blazejewicz
GWT groups profile
peterblazejewicz
 
Posts: 153
Joined: Fri Jul 27, 2007 7:09 pm
Location: Europe/Poland/Warsaw

Re: Link,Hyperlink to pages

Postby peterblazejewicz » Sat Feb 23, 2008 4:36 am

hi,

I've already posted example on GWT toolkit group, I don't think it was very complicated to use,
anyway, again example implementation for GWT Designer:

Widget:

Code: Select all
package com.mycompany.project.client;

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.HasHTML;
import com.google.gwt.user.client.ui.HasName;
import com.google.gwt.user.client.ui.Widget;

/**
* Basic implementation of raw Anchor <a> widget
*
* @see http://www.w3schools.com/tags/tag_a.asp
* @author Peter Blazejewicz
*
*/
public class HtmlLink extends Widget implements HasHTML, HasName {
  public HtmlLink() {
    setElement(DOM.createAnchor());
  }

  public String getHref() {
    return DOM.getElementAttribute(getElement(), "href");
  }

  public String getHTML() {
    return DOM.getInnerHTML(getElement());
  }

  public String getId() {
    return DOM.getElementAttribute(getElement(), "id");
  }

  public String getName() {
    return DOM.getElementAttribute(getElement(), "name");
  }

  public int getTabIndex() {
    return $getTabIndex(getElement());
  }

  public String getTarget() {
    return DOM.getElementAttribute(getElement(), "target");
  }

  public String getText() {
    return DOM.getInnerText(getElement());
  }

  public void setHref(String href) {
    DOM.setElementAttribute(getElement(), "href", href == null ? "" : href);
  }

  public void setHTML(String html) {
    DOM.setInnerHTML(getElement(), html == null ? "" : html);
  }

  public void setId(String id) {
    DOM.setElementAttribute(getElement(), "id", id == null ? "" : id);
  }

  public void setName(String name) {
    DOM.setElementAttribute(getElement(), "name", name == null ? "" : name);
  }

  public void setTabIndex(int index) {
    $setTabIndex(getElement(), index);
  }

  public void setTarget(String target) {
    DOM.setElementAttribute(getElement(), "target", target == null ? ""
        : target);
  }

  public void setText(String text) {
    DOM.setInnerText(getElement(), text == null ? "" : text);
  }

  private native int $getTabIndex(Element element)
  /*-{
      return element.tabIndex;
  }-*/;

  private native void $setTabIndex(Element element, int index)
  /*-{
      element.tabIndex = index;
  }-*/;

}



use in project (all code generated via D&D then modified using properties window):

entry point:
Code: Select all
package com.mycompany.project.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.mycompany.project.client.HtmlLink;

/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class LinkExample implements EntryPoint {
  private HtmlLink solutionsLink;
  private HtmlLink forumLink;
  private HtmlLink javaLink;
  private HtmlLink ajaxLink;

  public void onModuleLoad() {
    RootPanel rootPanel = RootPanel.get();
    final FlowPanel flowPanel = new FlowPanel();
    rootPanel.add(flowPanel);
    flowPanel.setStyleName("banner-lower");
    solutionsLink = new HtmlLink();
    flowPanel.add(solutionsLink);
    solutionsLink.setTarget("_blank");
    solutionsLink.setHref("http://www.instantiations.com/solutions/");
    solutionsLink.setStyleName("menuLink");
    solutionsLink.setText("Solutions");
    javaLink = new HtmlLink();
    flowPanel.add(javaLink);
    javaLink.setTarget("_blank");
    javaLink.setHref("http://www.instantiations.com/prods/docs/java.html");
    javaLink.setStyleName("menuLink");
    javaLink.setText("Java Products");
    ajaxLink = new HtmlLink();
    flowPanel.add(ajaxLink);
    ajaxLink.setTarget("_blank");
    ajaxLink.setHref("http://www.instantiations.com/prods/docs/ajax.html");
    ajaxLink.setStyleName("menuLink");
    ajaxLink.setText("Ajax Products");
    forumLink = new HtmlLink();
    flowPanel.add(forumLink);
    forumLink.setTarget("_blank");
    forumLink.setStyleName("menuLink");
    forumLink.setHref("http://www.instantiations.com/forum/viewforum.php?f=11");
    forumLink.setText("GWT Designer Forum");

  }
}


css:
Code: Select all
body {
   font-family: Helvetica, Arial, sans-serif;
   line-height: 1.15;
   background-color: #CADCEB;
}

a:link,a:visited {
   text-decoration: none;
}

a:hover {
   text-decoration: underline;
}

.banner-lower {
   padding: 10px;
   background-color: #6C1F88;
   color: white;
   font-size: 65%;
   display: block
}


.menuLink {
   margin: 5px;
   background-color: #6C1F88;
   color: white;
   font-weight: bold;
   text-decoration: none;
}


screenshot in design view when working with project:
designView.jpg
project design view (GWT Designer)
designView.jpg (123.9 KiB) Viewed 2400 times


screenshot of browser mode view:
browserView.jpg
project compiled view in browser (Safari/Win)
browserView.jpg (26.51 KiB) Viewed 2395 times


regards,
Peter
Peter Blazejewicz
GWT groups profile
peterblazejewicz
 
Posts: 153
Joined: Fri Jul 27, 2007 7:09 pm
Location: Europe/Poland/Warsaw

Re: Link,Hyperlink to pages

Postby Eric Clayberg » Sat Feb 23, 2008 2:54 pm

metegs wrote:you have give http://www.instantiations.com/prods/docs/java.html as example and now I am using gwt designer, this java.html page is what? is this composition or popup or module or what is it?

That is just a simple HTML page on our web site.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Link,Hyperlink to pages

Postby Eric Clayberg » Mon Feb 25, 2008 7:14 am

General GWT questions like this should be posted to Google's GWT forum.

This forum should only be used for GWT Designer specific issues.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Link,Hyperlink to pages

Postby kracey » Tue Jun 15, 2010 1:41 am

How do I create a Hyperlink to a paragraph in a document? I want to create a Hyperlink to a specific paragraph in a document, not to the entire document, so that when one follows the hyperlink, he would first get exactly to that paragraph, and then can read the all text of the document if he wishes. Do you know how to do that?
_____________________
yahoo keyword tool ~ overture ~ traffic estimator ~ adwords traffic estimator
Last edited by kracey on Fri Jun 18, 2010 1:46 am, edited 1 time in total.
kracey
 
Posts: 1
Joined: Wed Jun 09, 2010 11:00 pm

Re: Link,Hyperlink to pages

Postby Eric Clayberg » Tue Jun 15, 2010 4:00 am

kracey wrote:How do I create a Hyperlink to a paragraph in a document? I want to create a Hyperlink to a specific paragraph in a document, not to the entire document, so that when one follows the hyperlink, he would first get exactly to that paragraph, and then can read the all text of the document if he wishes. Do you know how to do that?

Use an anchor/bookmark in your target document and link to that.

Note that this question is inappropriate for this forum. This forum is for GWT Designer specific issues.

General questions concerning HTML or GWT should be posted elsewhere.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to GWT Designer

Who is online

Users browsing this forum: No registered users and 3 guests