I have a GWT Places/Activities web application. I use Anchor's click event to move user in a new "place", so there's no way user can open any "link" in a new window or tab. The question is - how do I make all these links real?
GWT Places/Activities - what should be used for navigation?
1.1k views Asked by Andrey Agibalov At
2
There are 2 answers
2
Thomas Broyer
On
While using a Hyperlink (or InlineHyperlink) works, I'd rather use a ClickHandler on an Anchor, because if any activity returns a non-null value in mayStop the URL wouldn't have changed yet (whereas with a Hyperlink, it would have, even if the user chooses to cancel the navigation).
To set the target (href) on the Anchor, simply use your PlaceHistoryMapper. And to correctly handle the ctrl+click, middle-click and right-click, reuse the HyperlinkImpl:
Anchor anchor = new Anchor("text", "#" + placeHistoryMapper.getToken(targetPlace));
anchor.addClickHandler(new ClickHandler() {
private static final HyperlinkImpl IMPL = GWT.create(HyperlinkImpl.class);
@Override
public void onClick(ClickEvent event) {
if (IMPL.handleAsClick(event)) {
placeController.goTo(targetPlace);
event.preventDefault();
}
}
});
Related Questions in JAVA
- I need the BIRT.war that is compatible with Java 17 and Tomcat 10
- Creating global Class holder
- No method found for class java.lang.String in Kafka
- Issue edit a jtable with a pictures
- getting error when trying to launch kotlin jar file that use supabase "java.lang.NoClassDefFoundError"
- Does the && (logical AND) operator have a higher precedence than || (logical OR) operator in Java?
- Mixed color rendering in a JTable
- HTTPS configuration in Spring Boot, server returning timeout
- How to use Layout to create textfields which dont increase in size?
- Function for making the code wait in javafx
- How to create beans of the same class for multiple template parameters in Spring
- How could you print a specific String from an array with the values of an array from a double array on the same line, using iteration to print all?
- org.telegram.telegrambots.meta.exceptions.TelegramApiException: Bot token and username can't be empty
- Accessing Secret Variables in Classic Pipelines through Java app in Azure DevOps
- Postgres && statement Error in Mybatis Mapper?
Related Questions in GWT
- When accessing the page with gwt it is blank, it does not load
- Encountering bindException when running CodeServer
- How to get variable from GWT Callback
- IntelliJ Idea won't stop on breakpoints while GWT debugging in Super Dev Mode
- How to debug GWT project in Idea
- [Resolved]How to set up gwt super dev mode with the new gwt maven plugin with a web application using Errai framework?
- Integrate DominoKit/-UI Elements Into Existing GWT Application
- Avro after upgrading to JDK 17
- Draw graph in GWT
- How do I stop maven-jetty-plugin jetty:run output warnings: scanned from multiple locations
- Type incoherence when compiling Java code through GWT
- Application not loading with new GWT Maven Plugin
- Getting the error while updating GWT 2.5.1 to 2.11.0 and sencha GXT 3.1.1 to 4.1
- Playing an audio in the front-end without storing any cache to avoid illegal downloading
- how to add a static value to a FlexTable in the ui.xml file GWT?
Related Questions in ANCHOR
- I want to show another second tag on the click of first anchor tag and hide the first anchor tag
- How do I make my website Header clickable so it redirects me to the home page?
- Displaying and hiding links based on access permissions
- JavaScript anchor file download - override file name from Content-Disposition header
- Angular 17 standalone link for the other section of the page on the same page
- The anchor menu inside the scroll block does not work correctly
- JavaScript - Get fragment value after Scroll To Text Hash Fragment '#:~:text=' from a URL
- Javascript that displays different page every hour needs to open in new window
- Anchor Link scroll not working correctly when Javascript component included in page
- Error: IDL doesnt exist. | Rust | Solana | Anchor
- Clicking anchor links rendering incorrect scrollTop value (all browsers)
- When I run "anchor test", I am getting this error (for a sample Solana program"
- How to troubleshoot third-party cookie restrictions?
- Elementor anchor links to another page disables smooth scroll on homepage
- How to test Metaplex instructions with Anchor on localnet?
Related Questions in GWT-ACTIVITIES
- Send data between activities with custom variable
- GWT tokenizer: How to change URL
- GWT Activities: Widget added to view again when using browser back button
- gwtupload conflict with Activities and places framework
- How to handle invalid GWT token in places
- What's the point of CachingActivityMapper?
- Activities unexpectedly killed
- ActivityMapper, dealing with regions which don't change a lot
- GWT Activities & Places - Panel in EntryPoint
- Google layer appears wrong with gwt-openlayers
- Understanding GWT onModuleLoad
- Understanding GWT AbstractActivity's start method
- How to generate a navigable URL for a particular slotted place?
- How to achieve nested activities gwt
- GWT: A way to cancel PlaceChangeEvent?
Related Questions in GWT-PLACES
- GWTP how to execute code on application initialization/start
- GWT tokenizer: How to change URL
- How to handle invalid GWT token in places
- What's the point of CachingActivityMapper?
- How to create a Dynamic table in GWTP
- latest SmartGWT 4.1 to solve IE 11 issues
- GWT Activities and places: Reusing modal dialogs?
- URL fragment lost as part of SAML token authentication; workaround / standard pattern?
- Understanding GWT onModuleLoad
- Understanding GWT AbstractActivity's start method
- How to generate a navigable URL for a particular slotted place?
- GWT: A way to cancel PlaceChangeEvent?
- Getting rid of GWT MVP boilerplate
- GWT Places/Activities versus GWTP PlaceManager
- Why is GWT app not displaying?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Maybe instead of using
Anchorand listening to theClickEventuseHyperlinkwith thetargetHistoryTokenset to the Place name.e.g.
<g:Hyperlink text="Home" targetHistoryToken="home" />