I have two drop panels one over the other and need the ability to grab the gwt NativeEvent from a GwtQuery DND DropEvent so that I can call stopPropagation and preventDefault. Unfortunately this appears to not be available in the GwtQuery DND DropEvent class. Any ideas on how to accomplish this?
The DropEvent is the gwtquery.plugins.droppable.client.events.DropEvent which is a GwtEvent and not any kind of DomEvent.
OK, typical I find the answer a couple of minutes after posting the question. The solutions is in your DraggableWidget to getOption().setGreedy(true). This enables stopPropagation and preventDefault.
Related
elm-drag package does not work since Elm version 0.17.
Author mentioned it had no sense since when.
https://github.com/jvoigtlaender/elm-drag/issues/2
And pointed to the:
http://elm-lang.org/examples/drag
But it only has drag not drop.
The first thing I thought about is to catch onMouseUp in the drop target. And when do some on-drop actions if the drag event is somehow reflected at the model.
But I am not sure it is a right way.
What is the proper way to implement the drop at Elm 0.17?
I would say that it is not sufficient to check a drop target for a mouseover event, but rather check if it intersects the drag target. I think that the bounding-box package could be useful.
Also, there are a couple of examples online which are somehow related to drag-and-drop (although not having arbitrary drop targets). Maybe they help:
Draggble Tabs
Sortable List, using the elm-draggable package. (disclaimer: I'm the author)
I need to implement a multi-select combobox using SWT/JFace, What would be the best approach?should i go for changing the source code or i should try to extend the combo?
It is not possible to extend a Combo It is possible to extend Combo by overriding checkSubclass(), however it is highly disapproved of. The alternative is to create a wrapper for it. But that would be too much work.
Extending a CCombo is an option, but not a very good idea. Again, too much work for the functionality you need.
BUT
As sambi reddy mentioned, you could use a TableComboViewer from Nebula (scroll down to "TableCombo").
Another convenient solution (my favorite) is to have a CheckboxTreeViewer since you need to implement multi selection and such.
screenshot
https://github.com/lawhcd/SWTMultiCheckSelectionCombo
For anyone who is looking for a widget that allows user to select multiple options from a list of check box style options.
It is based on user1438038's idea and extended to provide nearly all of the api required of a widget similar to Combo.
I want to implement slider with two knobs in GWT? Can anyone help me?
If you don't mind going with third-party library there is JQuery wrapper: spiffyui (demo) and it has Slider.java. Here is what it does:
/**
* This widget wraps the JQuery UI Slider
* and allows for single slider or double slider with range.
*
* All options can be get or set using generic
* get/setIntOption, get/setStringOption, get/setBooleanOption
* methods, but some convenience methods are provided for most popular such as
* setValues and setMinimum and setMaximum. See SliderOptions for full list of options.
* #see SliderOption
*/
Or if you want it implement on your own here is step by step tutorial: Creating a GWT Wrapper for the JQuery UI Slider
You may need to code a bit of that yourself, but you can start with the one from the gwt incubator . Get the source and add another "knob" element to it. That way you can insure the two "knobs" interact the way you want them.
I ended up implementing the following to get a JQueryUI slider into GWT
http://www.zackgrossbart.com/hackito/gwt-slider/
I just downloaded a custom minimized version of JQueryUI to include the slider (only 68k) which was pretty sweet. Ended up UI Binding it and it worked like a charm;
I customized the above to implement an percentage slider (one handle, limited to 0-100) which could be re-used pretty easily. You can find my version here How to implement a JQueryUI slider in GWT
To me it seems like the new GWT 2.1 table widget (as well as the other ones) is missing a continous scrolling feature (simmilar to smartgwt's "live grid"). Overriding the AbstractPager seems to be a long way to go.
Any ideas how to implement it as easy as possible?
Thanks, Mario.
Take a look at this example and its source code. Hope this somehow helps.
I'm curious, how does a GUI builder/designer work? My guess ( for Java ), is that it actually creates a JFrame and overrides the events in some way. However, this is only a guess.
Can you offer some insight?
You are pretty much bang on ...
In Glade the fake-window that allows you to drag-and-drop components handles your mouse/keyboard events and makes the backend calls to put the GUI elements in place. These elements are then attached to handlers such as 'on click of button, goto the source element'
It is all pretty trivial when you think about it.
Looking at the glade source might give some insight into how that is done.
IIRC, Glade writes the XML and then renders that to the designer using libglade, rather than your d'n'ds actually creating the elements. Your events build XML files which contain the UI elements and internal designer handlers.
Good Luck