Search in sources :

Example 16 with FormLayout

use of com.extjs.gxt.ui.client.widget.layout.FormLayout in project geo-platform by geosdi.

the class GPPrintWidget method addComboTemplate.

private void addComboTemplate() {
    fieldSet = new FieldSet();
    fieldSet.setHeadingHtml(INSTANCE.GPPrintWidget_templateFieldSetHeadingText());
    FormLayout layout = new FormLayout();
    layout.setLabelWidth(100);
    layout.setLabelPad(5);
    fieldSet.setLayout(layout);
    this.storeTemplate = new ListStore<PrintTemplate>();
    this.storeTemplate.add(PrintUtility.getTemplate());
    this.comboTemplate = new ComboBox<PrintTemplate>();
    this.comboTemplate.setFieldLabel(INSTANCE.GPPrintWidget_comboTemplateFieldLabelText());
    // this.comboTemplate.setEmptyText("Choose Template....");
    this.comboTemplate.setValue(new PrintTemplate(PrintTemplateConstants.INSTANCE.A4_Portrait()));
    this.comboTemplate.setDisplayField(PrintTemplate.PrintEnumTemplate.TEMPLATE.getValue());
    this.comboTemplate.setEditable(false);
    this.comboTemplate.setAllowBlank(false);
    this.comboTemplate.setForceSelection(true);
    this.comboTemplate.setTypeAhead(true);
    this.comboTemplate.setTriggerAction(TriggerAction.ALL);
    this.comboTemplate.setStore(this.storeTemplate);
    fieldSet.add(this.comboTemplate);
    super.formPanel.add(fieldSet);
    comboTemplate.addSelectionChangedListener(new SelectionChangedListener<PrintTemplate>() {

        @Override
        public void selectionChanged(SelectionChangedEvent<PrintTemplate> se) {
            if (se != null) {
                if (GPApplicationMap.getInstance().getApplicationMap().getMap().getLayerByName(PRINT_VECTOR_NAME) != null) {
                    printExtent.removeAllFeatures();
                    String scaleString = comboScale.getValue().getScale();
                    String scaleStringRight = scaleString.substring(scaleString.indexOf(":") + 1);
                    String scaleStringWithoutDot = scaleStringRight.replaceAll("\\.", "");
                    float scale = Float.parseFloat(scaleStringWithoutDot);
                    updateRotationAndSizeForPrint(se.getSelectedItem().getTemplate());
                    printExtent.addFeature(PrintUtility.updateRectangle(GPApplicationMap.getInstance().getApplicationMap().getMap().getCenter(), scale, GPApplicationMap.getInstance().getApplicationMap().getMap(), sizeFactor, rotation));
                }
            }
        }
    });
}
Also used : FormLayout(com.extjs.gxt.ui.client.widget.layout.FormLayout) FieldSet(com.extjs.gxt.ui.client.widget.form.FieldSet) PrintTemplate(org.geosdi.geoplatform.gui.client.model.PrintTemplate)

Example 17 with FormLayout

use of com.extjs.gxt.ui.client.widget.layout.FormLayout in project geo-platform by geosdi.

the class INCQLButton method addParameterFieldRow.

private void addParameterFieldRow() {
    GPSecureStringTextField parameterField = new GPSecureStringTextField();
    parameterField.setFieldLabel(LayerFiltersModuleMessages.INSTANCE.INCQLButton_parameterFieldLabelMessage(this.fieldList.size() + 1));
    parameterField.addListener(Events.OnKeyUp, keyUplistener);
    this.fieldList.add(parameterField);
    this.insertButton.disable();
    HorizontalPanel fieldRow = new HorizontalPanel();
    LayoutContainer layoutContainer = new LayoutContainer(new FormLayout());
    layoutContainer.add(parameterField);
    fieldRow.setSpacing(2);
    fieldRow.add(layoutContainer);
    Button deleteRowButton = this.generateDeleteButton(parameterField, fieldRow);
    fieldRow.add(deleteRowButton);
    this.parameterPanel.add(fieldRow, formData);
    this.parameterPanel.layout();
}
Also used : FormLayout(com.extjs.gxt.ui.client.widget.layout.FormLayout) GPSecureStringTextField(org.geosdi.geoplatform.gui.configuration.GPSecureStringTextField) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) Button(com.extjs.gxt.ui.client.widget.button.Button) HorizontalPanel(com.extjs.gxt.ui.client.widget.HorizontalPanel)

Example 18 with FormLayout

use of com.extjs.gxt.ui.client.widget.layout.FormLayout in project geo-platform by geosdi.

the class TimeCQLButton method initialize.

@Override
protected void initialize() {
    formData = new FormData("98%");
    final RadioGroup radioGroup = new RadioGroup(LayerFiltersModuleConstants.INSTANCE.TimeCQLButton_radioGroupText());
    radioGroup.setFieldLabel(LayerFiltersModuleConstants.INSTANCE.TimeCQLButton_radioGroupFieldLabelText());
    final Radio beforeRadioButton = new Radio();
    beforeRadioButton.setData(RADIO_KEY_VALUE, "BEFORE");
    beforeRadioButton.setBoxLabel(LayerFiltersModuleConstants.INSTANCE.TimeCQLButton_beforeRadioGroupLabelText());
    beforeRadioButton.setHideLabel(Boolean.TRUE);
    final Radio afterRadioButton = new Radio();
    afterRadioButton.setData(RADIO_KEY_VALUE, "AFTER");
    afterRadioButton.setBoxLabel(LayerFiltersModuleConstants.INSTANCE.TimeCQLButton_afterRadioGroupLabelText());
    afterRadioButton.setHideLabel(Boolean.TRUE);
    final Radio duringRadioButton = new Radio();
    duringRadioButton.setData(RADIO_KEY_VALUE, "DURING");
    duringRadioButton.setBoxLabel(LayerFiltersModuleConstants.INSTANCE.TimeCQLButton_duringRadioGroupLabelText());
    duringRadioButton.setHideLabel(Boolean.TRUE);
    final Radio beforeOrDuringRadioButton = new Radio();
    beforeOrDuringRadioButton.setData(RADIO_KEY_VALUE, "BEFORE OR DURING");
    beforeOrDuringRadioButton.setBoxLabel(LayerFiltersModuleConstants.INSTANCE.TimeCQLButton_beforeOrDuringRadioGroupLabelText());
    beforeOrDuringRadioButton.setHideLabel(Boolean.TRUE);
    final Radio duringOrAfterRadioButton = new Radio();
    duringOrAfterRadioButton.setData(RADIO_KEY_VALUE, "DURING OR AFTER");
    duringOrAfterRadioButton.setBoxLabel(LayerFiltersModuleConstants.INSTANCE.TimeCQLButton_duringOrAfterRadioGroupLabelText());
    duringOrAfterRadioButton.setHideLabel(Boolean.TRUE);
    radioGroup.add(beforeRadioButton);
    radioGroup.add(beforeOrDuringRadioButton);
    radioGroup.add(duringRadioButton);
    radioGroup.add(duringOrAfterRadioButton);
    radioGroup.add(afterRadioButton);
    timeContainer = new LayoutContainer(new FormLayout());
    timeContainer.setVisible(Boolean.FALSE);
    this.addDateAndTimeToContainer(timeContainer, DATE_KEY_VALUE, TIME_KEY_VALUE);
    periodContainer = new LayoutContainer(new FormLayout());
    periodContainer.setVisible(Boolean.FALSE);
    this.addDateAndTimeToContainer(periodContainer, DATE_START_KEY_VALUE, TIME_START_KEY_VALUE);
    this.addDateAndTimeToContainer(periodContainer, DATE_END_KEY_VALUE, TIME_END_KEY_VALUE);
    Listener<FieldEvent> timeListener = new Listener<FieldEvent>() {

        @Override
        public void handleEvent(FieldEvent fe) {
            if ((Boolean) fe.getValue()) {
                timeContainer.setVisible(true);
                periodContainer.setVisible(false);
            }
        }
    };
    afterRadioButton.addListener(Events.Change, timeListener);
    beforeRadioButton.addListener(Events.Change, timeListener);
    Listener<FieldEvent> periodListener = new Listener<FieldEvent>() {

        @Override
        public void handleEvent(FieldEvent fe) {
            if ((Boolean) fe.getValue()) {
                periodContainer.setVisible(true);
                timeContainer.setVisible(false);
            }
        }
    };
    beforeOrDuringRadioButton.addListener(Events.Change, periodListener);
    duringOrAfterRadioButton.addListener(Events.Change, periodListener);
    duringRadioButton.addListener(Events.Change, periodListener);
    final Button insertButton = new Button(ButtonsConstants.INSTANCE.insertText(), new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent be) {
            String temporalPredicate = radioGroup.getValue().getData(RADIO_KEY_VALUE);
            // System.out.println("Temporal predicate: " + temporalPredicate);
            StringBuilder timeBuilder = new StringBuilder(temporalPredicate);
            timeBuilder.append(" ");
            if (timeContainer.isVisible()) {
                DateField dateField = timeContainer.getData(DATE_KEY_VALUE);
                // System.out.println("Data: " + DateTimeFormat.getFormat("yyyy-MM-dd").format(dateField.getValue()));
                TimeField timeField = timeContainer.getData(TIME_KEY_VALUE);
                // System.out.println("Time: " + timeField.getValue().getText());
                timeBuilder.append(DateTimeFormat.getFormat("yyyy-MM-dd").format(dateField.getValue()));
                timeBuilder.append("T");
                timeBuilder.append(timeField.getValue().getText());
                timeBuilder.append(":00Z");
            } else if (periodContainer.isVisible()) {
                DateField dateStartField = periodContainer.getData(DATE_START_KEY_VALUE);
                TimeField timeStartField = periodContainer.getData(TIME_START_KEY_VALUE);
                timeBuilder.append(DateTimeFormat.getFormat("yyyy-MM-dd").format(dateStartField.getValue()));
                timeBuilder.append("T");
                timeBuilder.append(timeStartField.getValue().getText());
                timeBuilder.append(":00Z/");
                DateField dateEndField = periodContainer.getData(DATE_END_KEY_VALUE);
                TimeField timeEndField = periodContainer.getData(TIME_END_KEY_VALUE);
                timeBuilder.append(DateTimeFormat.getFormat("yyyy-MM-dd").format(dateEndField.getValue()));
                timeBuilder.append("T");
                timeBuilder.append(timeEndField.getValue().getText());
                timeBuilder.append(":00Z");
            } else {
                return;
            }
            TimeCQLButton.super.insertTextIntoFilterArea(timeBuilder.toString());
            window.hide();
        }
    });
    super.window = new GeoPlatformWindow(true) {

        @Override
        public void addComponent() {
            add(new Label(LayerFiltersModuleConstants.INSTANCE.TimeCQLButton_windowSelectLabelText()));
            add(radioGroup, formData);
            add(timeContainer, formData);
            add(periodContainer, formData);
            add(new Label(LayerFiltersModuleConstants.INSTANCE.TimeCQLButton_windowResultLabelText()));
            addButton(insertButton);
        }

        @Override
        public void initSize() {
            super.setSize("570", "270");
        }

        @Override
        public void setWindowProperties() {
            super.setHeadingHtml(LayerFiltersModuleConstants.INSTANCE.TimeCQLButton_windowHeadingText());
            super.setLayout(new FormLayout());
        }
    };
    super.initialized = Boolean.TRUE;
}
Also used : FormData(com.extjs.gxt.ui.client.widget.layout.FormData) FormLayout(com.extjs.gxt.ui.client.widget.layout.FormLayout) Listener(com.extjs.gxt.ui.client.event.Listener) SelectionListener(com.extjs.gxt.ui.client.event.SelectionListener) RadioGroup(com.extjs.gxt.ui.client.widget.form.RadioGroup) FieldEvent(com.extjs.gxt.ui.client.event.FieldEvent) Label(com.extjs.gxt.ui.client.widget.Label) Radio(com.extjs.gxt.ui.client.widget.form.Radio) GeoPlatformWindow(org.geosdi.geoplatform.gui.client.widget.GeoPlatformWindow) TimeField(com.extjs.gxt.ui.client.widget.form.TimeField) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) Button(com.extjs.gxt.ui.client.widget.button.Button) ButtonEvent(com.extjs.gxt.ui.client.event.ButtonEvent) DateField(com.extjs.gxt.ui.client.widget.form.DateField)

Example 19 with FormLayout

use of com.extjs.gxt.ui.client.widget.layout.FormLayout in project geo-platform by geosdi.

the class TimeInputWidget method addComponent.

@Override
public void addComponent() {
    final Button insertButton = new Button("Insert", new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent be) {
            StringBuilder timeBuilder = new StringBuilder();
            if (timeContainer.isVisible()) {
                DateField dateField = timeContainer.getData(DATE_KEY_VALUE);
                TimeField timeField = timeContainer.getData(TIME_KEY_VALUE);
                timeBuilder.append(DateTimeFormat.getFormat("yyyy-MM-dd").format(dateField.getValue()));
                timeBuilder.append("T");
                timeBuilder.append(timeField.getValue().getText());
                timeBuilder.append(":00Z");
            }
            dateSelectedEvent.setDate(timeBuilder.toString());
            bus.fireEventFromSource(dateSelectedEvent, TimeInputWidget.this);
            TimeInputWidget.super.hide();
        }
    });
    addButton(insertButton);
    formData = new FormData("98%");
    timeContainer = new LayoutContainer(new FormLayout());
    this.addDateAndTimeToContainer(timeContainer, DATE_KEY_VALUE, TIME_KEY_VALUE);
    add(new Label("Please, select the required parameters."));
    add(timeContainer, formData);
}
Also used : FormData(com.extjs.gxt.ui.client.widget.layout.FormData) FormLayout(com.extjs.gxt.ui.client.widget.layout.FormLayout) TimeField(com.extjs.gxt.ui.client.widget.form.TimeField) Button(com.extjs.gxt.ui.client.widget.button.Button) ButtonEvent(com.extjs.gxt.ui.client.event.ButtonEvent) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) Label(com.extjs.gxt.ui.client.widget.Label) DateField(com.extjs.gxt.ui.client.widget.form.DateField)

Example 20 with FormLayout

use of com.extjs.gxt.ui.client.widget.layout.FormLayout in project geo-platform by geosdi.

the class GPLayerDisplayBinding method createFormPanel.

@Override
public FormPanel createFormPanel() {
    FormPanel fp = new FormPanel();
    fp.setHeaderVisible(false);
    fp.setFrame(true);
    fp.setLayout(new FlowLayout());
    setSliderProperties();
    this.maxScale = new NumberField() {

        @Override
        public void setValue(Number value) {
            super.setValue(value);
            if (value != null) {
                NumberFormat nf = NumberFormat.getDecimalFormat();
                String formattedValue = nf.format(value.floatValue()).replaceAll(",", "");
                maxScale.setRawValue(formattedValue);
                logger.log(Level.INFO, "Updating maxScale field: " + formattedValue);
            }
        }
    };
    this.maxScale.setPropertyEditorType(Float.class);
    this.maxScale.setFieldLabel(LayerModuleConstants.INSTANCE.GPLayerDisplayBinding_maxScaleNumberFieldText());
    this.minScale = new NumberField() {

        @Override
        public void setValue(Number value) {
            super.setValue(value);
            if (value != null) {
                NumberFormat nf = NumberFormat.getDecimalFormat();
                String formattedValue = nf.format(value.floatValue()).replaceAll(",", "");
                minScale.setRawValue(formattedValue);
                logger.log(Level.INFO, "Updating minScale field: " + formattedValue);
            }
        }
    };
    this.minScale.setPropertyEditorType(Float.class);
    this.minScale.setFieldLabel(LayerModuleConstants.INSTANCE.GPLayerDisplayBinding_minScaleNumberFieldText());
    Button removeScale = new Button(LayerModuleConstants.INSTANCE.GPLayerDisplayBinding_removeLimitsButtonText(), AbstractImagePrototype.create(BasicWidgetResources.ICONS.delete()), new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            GeoPlatformMessage.confirmMessage(LayerModuleConstants.INSTANCE.GPLayerDisplayBinding_removeLimitsMessageTitleText(), LayerModuleConstants.INSTANCE.GPLayerDisplayBinding_removeLimitsMessageBodyText(), new Listener<MessageBoxEvent>() {

                @Override
                public void handleEvent(MessageBoxEvent be) {
                    if (Dialog.YES.equals(be.getButtonClicked().getItemId())) {
                        removeScaleLimits();
                    }
                }
            });
        }
    });
    final FieldSet scaleFieldSet = new FieldSet();
    scaleFieldSet.setLayout(new FormLayout());
    scaleFieldSet.setHeadingHtml(LayerModuleConstants.INSTANCE.GPLayerDisplayBinding_limitsByScaleFieldText());
    scaleFieldSet.add(maxScale);
    scaleFieldSet.add(minScale);
    scaleFieldSet.add(removeScale);
    final FieldSet opacityFieldSet = new FieldSet();
    opacityFieldSet.setHeadingHtml(LayerModuleConstants.INSTANCE.GPLayerDisplayBinding_opacityHeadingText());
    opacityFieldSet.setCollapsible(true);
    opacityFieldSet.addListener(Events.Collapse, new Listener<ComponentEvent>() {

        @Override
        public void handleEvent(ComponentEvent be) {
            ((DisplayLayersTabItem) opacityFieldSet.getParent().getParent()).updateWindowSize();
        }
    });
    sliderField = new GPSliderField(this.slider);
    sliderField.setName(GPRasterKeyValue.OPACITY.toString());
    sliderField.removeAllListeners();
    opacityFieldSet.add(sliderField);
    final FieldSet singleTileFieldSet = new FieldSet();
    singleTileFieldSet.setHeadingHtml(LayerModuleConstants.INSTANCE.GPLayerDisplayBinding_singleTileRequestHeadingText());
    this.singleTileComboBox = new ComboBox<GPBooleanBeanModel>() {

        @Override
        protected void onSelect(GPBooleanBeanModel model, int index) {
            super.onSelect(model, index);
            singleTileRequestBinding.updateModel();
        }
    };
    this.singleTileComboBoxStore = new ListStore<GPBooleanBeanModel>();
    this.singleTileComboBoxStore.add(GPBooleanBeanModel.getBooleanInstances());
    this.singleTileComboBox.setStore(this.singleTileComboBoxStore);
    this.singleTileComboBox.setWidth(200);
    // this.singleTileComboBox.setEmptyText();
    this.singleTileComboBox.setTypeAhead(true);
    this.singleTileComboBox.setTriggerAction(ComboBox.TriggerAction.ALL);
    this.singleTileComboBox.setDisplayField(GPBooleanKeyValue.Boolean.getValue());
    singleTileFieldSet.add(this.singleTileComboBox);
    fp.add(scaleFieldSet);
    fp.add(opacityFieldSet);
    fp.add(singleTileFieldSet);
    this.singleTileRequestBinding = new GPRasterComboSingleTileRequestBinding(this.singleTileComboBox, GPBooleanKeyValue.Boolean.getValue());
    return fp;
}
Also used : FormLayout(com.extjs.gxt.ui.client.widget.layout.FormLayout) FlowLayout(com.extjs.gxt.ui.client.widget.layout.FlowLayout) Button(com.extjs.gxt.ui.client.widget.button.Button) GPSliderField(org.geosdi.geoplatform.gui.client.widget.binding.field.GPSliderField) NumberFormat(com.google.gwt.i18n.client.NumberFormat) GPBooleanBeanModel(org.geosdi.geoplatform.gui.model.GPBooleanBeanModel)

Aggregations

FormLayout (com.extjs.gxt.ui.client.widget.layout.FormLayout)61 FieldSet (com.extjs.gxt.ui.client.widget.form.FieldSet)37 FormPanel (com.extjs.gxt.ui.client.widget.form.FormPanel)29 FormData (com.extjs.gxt.ui.client.widget.layout.FormData)26 Button (com.extjs.gxt.ui.client.widget.button.Button)24 ButtonEvent (com.extjs.gxt.ui.client.event.ButtonEvent)19 FlowLayout (com.extjs.gxt.ui.client.widget.layout.FlowLayout)18 SelectionListener (com.extjs.gxt.ui.client.event.SelectionListener)15 GPSecureStringTextField (org.geosdi.geoplatform.gui.configuration.GPSecureStringTextField)15 FitLayout (com.extjs.gxt.ui.client.widget.layout.FitLayout)12 BaseEvent (com.extjs.gxt.ui.client.event.BaseEvent)11 LabelField (com.extjs.gxt.ui.client.widget.form.LabelField)10 NumberField (com.extjs.gxt.ui.client.widget.form.NumberField)9 CheckBox (com.extjs.gxt.ui.client.widget.form.CheckBox)7 TextField (com.extjs.gxt.ui.client.widget.form.TextField)7 ComponentEvent (com.extjs.gxt.ui.client.event.ComponentEvent)6 Margins (com.extjs.gxt.ui.client.util.Margins)6 Label (com.extjs.gxt.ui.client.widget.Label)6 Radio (com.extjs.gxt.ui.client.widget.form.Radio)6 RadioGroup (com.extjs.gxt.ui.client.widget.form.RadioGroup)6