HorizontalPanel hPanel = new HorizontalPanel();
hPanel.setLayout(new FitLayout());
hPanel.setHorizontalAlign(Style.HorizontalAlignment.LEFT);
hPanel.setStyleName("x-date-bottom");
hours = new ComboBox() {
@Override
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
getListView().addStyleName("x-datetime-selector");
}
};
hours.setDisplayField("display");
hours.setMinListWidth(40);
hours.setWidth(40);
hours.setStore(getHours(0,23));
hours.setValue(hour != null ? hour : new HourModel(dateWrapper.getHours()));
hours.setForceSelection(true);
hours.setTriggerAction(TriggerAction.ALL);
hours.addSelectionChangedListener(new SelectionChangedListener<HourModel>() {
public void selectionChanged(SelectionChangedEvent se) {
HourModel hourModel = (HourModel) se.getSelection().get(0);
if (hourModel!=null){
hour = new HourModel(Integer.parseInt(hourModel.getValue()));
}
}
});
hours.addListener(Events.Change, new Listener<FieldEvent>() {
public void handleEvent(FieldEvent be) {
HourModel hourModel = (HourModel) be.getValue();
if (hourModel!=null){
hour = new HourModel(Integer.parseInt(hourModel.getValue()));
}
}
});
hPanel.add(hours);
HTML sep = new HTML(":");
sep.setStyleName("x-date-hours-separator");
hPanel.add(sep, new TableData(HorizontalAlignment.CENTER, VerticalAlignment.MIDDLE));
minutes = new ComboBox() {
@Override
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
getListView().addStyleName("x-datetime-selector");
}