GWT implement something like a Desktop Icon - gwt

I have a VerticalPanel consisting of an Image and a Label with some text in it. What I'm trying to implement is something like a Desktop Icon - when you click it - it gets 'marked' and probably a menu will appear. When you click outside of the icon - the menu should disappear and the icon will get unmarked.
Currently I'm trying to achieve this by wrapping the VerticalPanel in a FocusPanel and playing with some focus handling but I have not achieved any satisfying results so far.
I would appreciate if you could give me some guidance on how to best implement this.
Thanks.

You're on the right track with the FocusPanel wrapper. The key point about the FocusPanel for what you want to do is that it captures clicks (by implementing HasClickHandlers). You can then handle clicks and assign the panel CSS rules e.g. border-width, border-color, or background-color, etc., according to however you'd like to indicate your icon as pressed/selected.

Its seems that you need a ToggleButton and a basic PopupPanel

Related

How can i make a moving button in GWT, so that users can move it to anywhere they want?

I just want to make a moving button , Is there a way to do that in GWT? Thanks in advance.
BS
Out of the box, you can use a DialogBox to display your button. DialogBox can be moved around, but you will need to display something in a Caption that is used for dragging.
Another option is to use PopupPanel. It can be completely invisible (no Caption), but you will have to implement dragging functionality on your own. The advantage is that a PopupPanel floats on top of all the other layers in your UI.
Finally, you can simply add dragging functionality to a regular button. Just remember to check for the boundaries so that a user cannot drag your button outside of the visible browser area - or obscure some important elements of the UI.

How to use Focus on GWT?

I have strange problem..
I want to do this:
I have a focuspanel. In default I want to give him focus:
this.setFocus(true);
I have function onBlur which is able to save all information from focuspanel. But the focus panel doesn's have focus... I must click on him, and in other place to start function onBlur..
Second problem is a... When I have focus and I click on other widget in my focus panel I lose focus.. (Which I have from click on this panel.) It is not expect.
Only way to save information is to fill it in the focus panel, click on the blank space in focus panel and in other place out focus panel.. I don't know how to fix it..
Please, help!
A FlowPanel is a div and can't have focus by default, you need to set the tabindex: https://stackoverflow.com/a/3656524/66416

IDEA/Eclipse class finder like GWT widget with keyboard handling

Brief:
I have a GWT TextBox and CellList. I would like the up/down keys to do keyboard selection in the CellList while focus is still in the Textbox (search filter). How do I do that?
Details:
Right now, if I focus the celllist, it behaves as I want, however, I don't want to have to leave the search field to select an element with the up/down keys. The up/down keys seem to have a behavior I don't need in the Textbox (move to beginning/end of text).
It's actually rather easy: use a SuggestBox and provide your own SuggestionDisplay, which can be a CellList or Menu widget (or whatever) sitting anywhere you want it.
The DefaultSuggestionDisplay opens a Menu in a PopupPanel, but that's just the default implementation. If you ever used Google Wave, what you're asking for looks a lot like the person chooser when inviting people to your waves, and it was a SuggestBox AFAICT.

SmartGWT: hide current element showing in Canvas

I'm working something like a dynamic menu, where you click some radio buttons and it shows a specific form, each radio control matches to a different form.
Examples from the showcase always base themselves on the Tabs widget and I don't need that behaviour.
I opted for placing all the forms inside one Canvas and hide/show them accordingly (Not sure this was the best idea, if someone knows better I would like to hear it)
Now my problem is that every onClick event has to .show() one form and .hide() the other 9. that is annoying.
Is there a way to "get" the current displayed child in the Canvas and hide it?
If what you want is basically mutex display, you could put all the components as members of a Layout instead of a Canvas, then use setVisibleMember(). That hides all other members.

GWT custom popuppanel or dialogbox

I would like to create popup or dialog box which should be like another window where i need to have cross (*) mark to close window. please any one can suggeston this..
Gwt has a dialog box. You add layout panels to it and arrange what you want to show in it.
You can use custom button
to add your cross.