Revision: 6244 Author: [email protected] Date: Tue Sep 29 07:48:08 2009 Log: Allow for indexable and non-indexable hyperlinks. The new class IndexableHyperlink extends Hyperlink and adds the special "indexable" token to each history token.
http://code.google.com/p/google-web-toolkit/source/detail?r=6244 Added: /branches/crawlability/user/src/com/google/gwt/user/client/ui/IndexableHyperlink.java Modified: /branches/crawlability/user/src/com/google/gwt/user/client/ui/Hyperlink.java ======================================= --- /dev/null +++ /branches/crawlability/user/src/com/google/gwt/user/client/ui/IndexableHyperlink.java Tue Sep 29 07:48:08 2009 @@ -0,0 +1,40 @@ +package com.google.gwt.user.client.ui; + +import com.google.gwt.user.client.Element; +import com.google.gwt.user.client.History; + +public class IndexableHyperlink extends Hyperlink { + + public IndexableHyperlink() { + // TODO Auto-generated constructor stub + } + + public IndexableHyperlink(String text, boolean asHTML, + String targetHistoryToken) { + super(text, asHTML, targetHistoryToken); + // TODO Auto-generated constructor stub + } + + public IndexableHyperlink(String text, String targetHistoryToken) { + super(text, targetHistoryToken); + // TODO Auto-generated constructor stub + } + + public IndexableHyperlink(Element elem) { + super(elem); + // TODO Auto-generated constructor stub + } + + /** + * Sets the history token referenced by this hyperlink. This is the history + * token that will be passed to {...@link History#newItem} when this link is + * clicked. + * + * @param targetHistoryToken the new history token, which may not be null (use + * {...@link Anchor} instead if you don't need history processing) + */ + @Override + public void setTargetHistoryToken(String targetHistoryToken) { + super.setTargetHistoryToken("!" + targetHistoryToken); + } +} ======================================= --- /branches/crawlability/user/src/com/google/gwt/user/client/ui/Hyperlink.java Fri Sep 25 09:28:36 2009 +++ /branches/crawlability/user/src/com/google/gwt/user/client/ui/Hyperlink.java Tue Sep 29 07:48:08 2009 @@ -189,8 +189,8 @@ public void setTargetHistoryToken(String targetHistoryToken) { assert targetHistoryToken != null : "targetHistoryToken must not be null, consider using Anchor instead"; - this.targetHistoryToken = "!" + targetHistoryToken; - DOM.setElementProperty(anchorElem, "href", "#!" + targetHistoryToken); + this.targetHistoryToken = targetHistoryToken; + DOM.setElementProperty(anchorElem, "href", "#" + targetHistoryToken); } public void setText(String text) { --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
