use of com.extjs.gxt.ui.client.widget.form.SpinnerField in project geo-platform by geosdi.
the class TimePeriodDateMultifield method addComponents.
protected void addComponents() {
super.setSpacing(20);
this.dtFormat = DateTimeFormat.getFormat("dd-MM-yyyy");
this.dateField = new DateField();
this.dateField.setToolTip(dateTooltip());
this.dateField.getPropertyEditor().setFormat(dtFormat);
this.dateField.setWidth(90);
this.dateField.setEditable(false);
this.dateField.setAllowBlank(Boolean.FALSE);
DatePicker datePicker = this.dateField.getDatePicker();
datePicker.addListener(Events.Select, new Listener<DatePickerEvent>() {
@Override
public void handleEvent(DatePickerEvent dpe) {
date = dpe.getDate();
hourField.clear();
hourField.enable();
minuteField.setEnabled(Boolean.TRUE);
Date dateWithZeroTime = FORMATTER_DATE.parse(FORMATTER_DATE.format(limitDate));
afterDateSelected(dateWithZeroTime);
refreshDate();
}
});
this.hourField = new SpinnerField();
this.hourField.addListener(Events.Change, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
minuteField.clear();
minuteField.enable();
Date time = FORMATTER_TIME.parse(FORMATTER_TIME.format(limitDate));
Date dateWithZeroTime = FORMATTER_DATE.parse(FORMATTER_DATE.format(limitDate));
afterHourSelected(dateWithZeroTime, time);
refreshDate();
}
});
this.hourField.setToolTip(hourTooltip());
this.hourField.setWidth(40);
this.hourField.disable();
this.hourField.setAllowBlank(Boolean.FALSE);
this.minuteField = new SpinnerField();
this.minuteField.setToolTip(minuteTooltip());
this.minuteField.disable();
this.minuteField.setWidth(40);
this.minuteField.setAllowBlank(Boolean.FALSE);
this.minuteField.addListener(Events.Change, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
refreshDate();
}
});
super.setFieldLabel(fieldLabel());
super.setOrientation(Style.Orientation.HORIZONTAL);
super.add(this.dateField);
super.add(this.hourField);
super.add(this.minuteField);
super.addStyleName("dateMultifield");
super.setValidator(addValidator());
setMaxMinValue();
}
use of com.extjs.gxt.ui.client.widget.form.SpinnerField in project geo-platform by geosdi.
the class TimePeriodFormPanel method addComponents.
/**
*/
private void addComponents() {
super.setHeaderVisible(Boolean.FALSE);
super.setFrame(Boolean.TRUE);
super.setBorders(Boolean.FALSE);
super.setHeight(WIDGET_HEIGHT);
super.setAutoWidth(Boolean.TRUE);
this.labelRange = new LabelField();
this.labelPeriod = new LabelField();
this.labelPeriod.addStyleName("label_period");
this.labelRange.addStyleName("label_period");
this.labelRange.setFieldLabel(LayerModuleConstants.INSTANCE.LayerTimeFilterWidget_rangeLabelText());
this.labelPeriod.setFieldLabel(LayerModuleConstants.INSTANCE.LayerTimeFilterWidget_periodLabelText());
this.labelPeriod.setLabelSeparator(":");
this.labelRange.setLabelSeparator(":");
super.add(labelRange, new FlowData(5));
super.add(labelPeriod, new FlowData(5));
super.add(this.startDateMultifield, new FlowData(5));
this.endDateCheckBox = new CheckBox();
this.endDateCheckBox.setValue(true);
this.endDateCheckBox.setBoxLabel(LayerModuleConstants.INSTANCE.LayerTimeFilterWidget_enableToDate());
this.endDateCheckBox.addListener(Events.Change, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
endDateMultifield.setEnabled(endDateCheckBox.getValue());
endDateMultifield.reset();
endDateMultifield.clearInvalid();
refreshDateTo(!endDateCheckBox.getValue() ? ((Date) iStrategyView.getExtentValues().get(DATE_TO)) : null);
}
});
LayoutContainer container = new LayoutContainer();
container.setLayout(new ColumnLayout());
container.add(this.endDateCheckBox);
super.add(container, new FlowData(5));
super.add(this.endDateMultifield, new FlowData(5));
this.showAllCheckBox = new CheckBox();
this.showAllCheckBox.setValue(false);
this.showAllCheckBox.setBoxLabel(LayerModuleConstants.INSTANCE.LayerTimeFilterWidget_showAllTimeLayers());
this.showAllCheckBox.addListener(Events.Change, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
timerAnimation.setEnabled(!showAllCheckBox.getValue());
periodSlider.setEnabled(!showAllCheckBox.getValue());
}
});
LayoutContainer containerShow = new LayoutContainer();
containerShow.setLayout(new ColumnLayout());
containerShow.add(this.showAllCheckBox, new ColumnData(.3));
this.labelDates = new Label(DATE_SEPARATOR);
this.labelDates.setStyleAttribute("margin-top", "5px");
containerShow.add(this.labelDates, new ColumnData(.7));
super.add(containerShow, new FlowData(5));
// buildDatesAvailables();
this.labelCurrenteTime = new LabelField();
this.labelCurrenteTime.setFieldLabel(LayerModuleConstants.INSTANCE.LayerTimeFilterWidget_currentDateTooltipText());
this.labelCurrenteTime.setLabelSeparator(":");
this.timerAnimation = new SpinnerField();
this.timerAnimation.setFieldLabel(LayerModuleConstants.INSTANCE.LayerTimeFilterWidget_refreshTooltipText());
// this.timerAnimation.setWidth("76px");
this.timerAnimation.addStyleName("label_animation");
this.timerAnimation.setMinValue(1);
this.timerAnimation.setValue(1);
this.timerAnimation.setAllowBlank(Boolean.FALSE);
super.add(this.timerAnimation, new FlowData(5));
this.buildTimeTimension();
super.add(this.labelCurrenteTime, new FlowData(5));
this.labelStep = new LabelField();
this.labelStep.setFieldLabel(LayerModuleConstants.INSTANCE.LayerTimeFilterWidget_stepTooltipText());
this.labelStep.setLabelSeparator(":");
super.add(this.labelStep, new FlowData(5));
this.apply = new Button(ButtonsConstants.INSTANCE.applyText());
this.apply.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
validateForm();
}
});
super.addButton(this.apply);
Button close = new Button(ButtonsConstants.INSTANCE.closeText(), new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
stopPlayer();
WidgetPropertiesHandlerManager.fireEvent(new GPHideFilterWidgetEvent());
}
});
this.addButton(close);
}
Aggregations