GWT hyperlink problem - java

i am using GWT Hyperlink for Click handling.I used rpc for showing the records in a dialog box by clicking on that link.but it is moving to home page immediately and showing the dialog box there.Please suggest me the solution for this problem.

Hyperlink should be used in combination with History (http://code.google.com/intl/nl-NL/webtoolkit/doc/latest/DevGuideCodingBasicsHistory.html) changes and not for click handling alone. When using Hyperlink the History token is updated, which will probably trigger the History change which will direct to the homepage, Next the click is handled which shows the dialog
EDIT:
Just as David mentions it's better to use the Anchor widget. Because Anchor is a native html element A, it's usability is better over using a span or div.

I concur with Hilbrand, but recommend anchor tags in such cases.
<g:Anchor name="whatever">Click me</g:anchor>

For this case I would suggest you to use CustomButton instead of HypherLink. For that custom button give some styles to look like a hypherlink. If you use label you cannot focus using keyboard.
Use hypherlink only if you are planning to give history support.

Related

JavaFX 2.2 Remove Pagination's selected page label

I want to remove the Selected page label (see image below) of the Pagination control.
After digging into caspian.css I wasn't able to find any clue about how to do that. By code I also didn't find any method to remove (or eventually hide) this label.
Is there a way to do that in JavaFX without re-implementing the whole control ?
Use -fx-page-information-visible
It's described within these links:
http://docs.oracle.com/javafx/2/ui_controls/pagination.htm
https://docs.oracle.com/javase/8/javafx/user-interface-tutorial/pagination.htm#JFXUI459
https://docs.oracle.com/javase/8/javafx/api/javafx/scene/doc-files/cssref.html#pagination
I couldn't find a way either to hide just the label, but would it help to hide the whole button?
.number-button:selected{
-fx-opacity: 0;
}
That would hide the current selected button.
It's not what you actually wanted but maybe it can help you.

JavaFX: how to disable drag and drop and pasting from external sources on WebView?

I am working on a chat application where I am using a webView to show the conversation between sender and receiver and another webView to write the message which will contain text and emoticons (the reason for using webView is that it is capable to show emoticons along text using html), the 2nd webView is editable by setting its contenteditable property to true in html, now the problem is that when I drag and drop text or copy text from somewhere which contains formatting, links and images it will be shown with all the formatting that is why I want to disable dragAndDrop and pasting text from external sources such as browsers, if the text contains links then by clicking that link it will direct you to that page and the webView will become a web browser.
Tricky (i think). One way to do it is by providing your own EventDispatcher instance and intercept the actions you want to prevent, e.g. intercepting the DragEvent to prevent drops and the key events for the paste action. The downsides to this approach are, of course:
1) You'd have to code platform specific for the paste shortcut (CTRL+V vs. META+V)
2) If you want to disable pasting via the context menu this way, you'd have to prevent it from appearing at all. However I think in your case that would be intended.
So, pending a better a better solution I'd go with the dispatcher. Determine which events you want to be processed and forward those to the dispatcher chain. Consume the events you want to prevent.

GWT- PopupPanel with search?

I am looking for a way to create a popup dialog box when a user double clicks a textinput field that will contain a scroll-able list (from database table) where the user can select a field, hit ok, and have it placed into the textbox when popup closes.
The other major requirement is to have a filter/ or search field in the popup to aid the user in finding the correct option to select from quicker.
What is the best way to implement this?
Modification to gwt's popup panel? maybe a JOptionPane? are there any simple solutions already designed for free commercial use?
You could implement this with a com.google.gwt.user.client.ui.PopupPanel. You can make a PopupPanel that contains a ListBox with your data from the database, along with a OK button. When a user selects a value and hits OK, you should utilize an EventBus along with a custom Event that will pass the value to the field on the page. The page will have an event handler that will catch the event and put it into the field.
Another option is to use a com.google.gwt.user.client.ui.SuggestBox. It is a box that autocompletes / suggests values as you type, kind of like the Youtube search bar.
I can offer more resources to help you accomplish this, if you'd like.

How do we navigate from 1 page to another in GWT

I am building a project in GWT and the project requires navigation from one page to another when a button is clicked. How do I do this? Or should I simply write the entire code in the same class file? I know there has to be a way of navigation.
How should I achieve page navigation in GWT?
You should look at GWT Platform
With this library, you can define places. When the user clicks on a button, you just reveal a new place.
In addition, this framework allows you to handle the lifecycle of your GWT components and do some code splitting : page 1 and page 2 can be compiled in 2 different js so that you only load the one you need.
it is also a (and mainly) a MVP framework, like gwt-presenter.
You can do Page navigation through History mechanism of GWT. Here are the steps you should follow:
Add a history string to an iframe of your host page:
Register a ValueChangeHandler that will receive an event of history (page) change. Within this handler you need put a logic that displays the new page.
For example, History.addValueChangeHandler(object of subclass of HistoryHandler);
After doing this whenever you need to navigate to another page do the following: History.newItem("history string of your page to be displayed");

AutoCompleteDecorate implemented on JComboBox

For those who are familiar with SwingX's AutoCompleteDecorator, I have a question regarding handling of JComboBox's Popup Visibility. I used AutoCompleteDecorate.decorate(JComboBox combobox) in my current project which I already mentioned in my previous posts, the problem I encountered is when ever the user type a keyword that doesn't match any of the combobox items, the popup remains visible. For the convenience of the users, I would like to hide combobox's popup if the keyword typed doesn't match any of combobox items.
If you want the autocompletion feature, but you don't want to have a popup in the way (especially, as you mention, when entered text doesn't match any item) you might like to try the opensource JIDE Common Layer. It has a very useful (I use it a lot myself) autocompletion feature that you can apply to JComboBoxes, JTextFields, etc..
You can see a Java Web Start overview of the components by clicking on the "RUN IT" link on the above page, or by clicking here. Navigate to
Demos->AutoCompletion Demo->AutoCompletion combo box and text field->AutoCompletion JTextField with a hidden data
to try it out. You can also see the source code by clicking on Browse Source Code.
You can enable/disable a strict flag in order to prevent/allow user to enter text not matched with items.
However, as far as I have tested, JIDE's combo boxes with autocompletion also have the "issue" that keep their popup open even if no match is found, but what I'm suggesting here is to try an autocompleting textfield which has no popup at all (they autocomplete in place, highlighting the part of the matched text that you didn't manually type-in).

Categories

Resources