Custom component for Label with Text box and image in GWT - gwt

I need to create a custom component which can have Label then Textfield and Image, by clicking the image i should select date, that selected date should be populated in TextField,
Is there way i can develop a custom component.
Thanks in Advance!!!

Absolutely!
You need to create a custom widget, and the way to do that is to extend the Composite class.
From the documentation:
A composite is a specialized widget that can contain another component (typically, a Panel) but behaves as if it were its contained widget. You can easily combine groups of existing widgets into a composite that is itself a reusable widget. Some of the UI components provided in GWT are composites: for example, the TabPanel (a composite of a TabBar and a DeckPanel) and the SuggestBox.
Rather than create complex widgets by subclassing Panel or another Widget type, it's better to create a composite because a composite usually wants to control which methods are publicly accessible without exposing those methods that it would inherit from its Panel superclass.
There is a good example to get you started here:
http://code.google.com/webtoolkit/doc/latest/DevGuideUiCustomWidgets.html

The GWT showcase give an example of somthing similar to what you are looking for along with the source code:
"Date Picker" - GWT Showcase
If you want to develop a custom component, look at #Jon Vaughan's answer!

You may also use third party libraries with widgets, like Ext GWT or SmartGWT. Date picker is one of the base widgets that everyone provides.

Related

Is it possible to put my own custom control or composite inside listviewer of Jface

I wanted to display list of custom controls or composite in a list .I was thinking to use listview But I stumbled that listview only supports text or image it does not support to put composite inside (Even I see its same with atble viewer too .Is there any way this can be done
You can accomplish that, with some extra effort, have a look to this:Snippet
https://github.com/eclipse/eclipse.platform.ui/blob/master/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet010OwnerDraw.java
in the "CountryEntries classes" you can find different methods that draw the parts:
drawFlag
drawName
drawCupYear

Kendo grid MVVM

I have kendo grid with column re-sizable option. When I double click on column header that column should re-size to auto width (ref:"jsfiddle.net/YF7ny/").
I need this options through MVVM (Model-View-View Model). I am new to this kendo & mvvm concepts, please help me.
To add your double-click handler you would need to make a custom MVVM binder.
There is some documentation on making a custom binder here: http://docs.telerik.com/kendo-ui/getting-started/framework/mvvm/bindings/custom
Then your grid element could have something like
data-bind="gridColumnResize: x"
Another alternative is to extend the default Grid widget and make your own, and in the init you can add your double-click handler.
Since this is JavaScript, you could even overwrite the existing Kendo Grid widget and add this feature to all grids.

GWT Checkbox Selectable Tree

I'm using GWT 2.5 and am looking for a Tree widget which will allow me to have a multi-selection model controlled by checkboxes adjacent to each TreeNode. Something similar to the JQuery plugin described here with the following results:
As you might expect, I'd hope that checking a box would select all children of the checked node, and if any children are unchecked, you'd get the "half-checked" icon (shown by the "Solutions" node) -- so I'll need a three-state checkbox.
Does this widget exist in GWT already, or would I need to code it myself?
There is no default widget in GWT 2.5 that supports this.
Your options:
Use third-party library
Implement you own widget
I used to implement my own based on CellTree and although it's feasible - it requires lots of work (custom tree model, cell widgets with renderers and value updater-s). If you flexible on choosing libraries - have a look at Smart GWT's checkbox tree.

Show/Hide Labels - Adding and Removing vs Setting Visible in GWT

I suppose this could be a general javascript question, but I have a widget that, by default, has a label. I need a way to have a label-less widget. I currently have a special constructor with a boolean indicating whether or not to show this label.
Instead, if I were to add a method to show/hide this label, would it be better use visibility in CSS, or add/remove the label from its parent?
CSS visibility.
However, if you are using GWT and its other cohorts (smartgwt, gxt), setVisible(boolean), show(), hide() is already crafted into their visual components.
When introducing new visual components, you should simply extend the Widget class or any of its subclasses, in order to make full use of GWT features for your new component. The heavy weight of a GWT class Java features is already segregated by the GWT compiler as fixed costs in javascript code - so you might as well extend the Widget class.
And why would you not use the already existent Label class found in GWT (or smartgwt or gxt) and then use the setVisible (or show() hide()) property methods?

placing widget in listbox/dropdown in gwt

i am using gwt to build my web site.
i would like to create a dropdown/listbox that contains no just text but also images, meaning that in the drop down there will be a what ever widget that ill create.
please advise
jaimon
You won't be able to do this with a ListBox, because it just creates an HTML < select> element.
You can use a MenuBar that has one menu with MenuItems in it to simulate a dropdown with complex widgets inside it. You will also be able to style the dropdown rather than rely on browser-styled form elements.
Take a look at the Combobox or Suggestion box in Advanced GWT Components.
Another widget is the DropDownListBox in the GWT incubator. I have not used it, but the stated intent is to provide a rich, stylable ListBox. You can pass raw HTML to the addItem() method.
DropDownListBox
it is possible to use Tree inside ScrollPanel, without using nested items
Tree allows TreeItem to be a Widget