Search in sources :

Example 6 with ColumnLayout

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

the class CatalogSearchWidget method onRender.

@Override
protected void onRender(Element parent, int index) {
    super.onRender(parent, index);
    LayoutContainer left = new LayoutContainer();
    left.setLayout(new ColumnLayout());
    Label searchLabel = new Label(CatalogFinderConstants.INSTANCE.CatalogSearchWidget_searchLabelText());
    searchLabel.setStyleName("catalogSearch-Label");
    left.add(searchLabel, new ColumnData(300.0));
    HorizontalPanel panel = new HorizontalPanel();
    panel.setStyleAttribute("padding-top", "8px");
    searchTextField = new GPSecureStringTextField();
    searchTextField.setWidth(250);
    searchTextField.addKeyListener(new KeyListener() {

        @Override
        public void componentKeyPress(ComponentEvent event) {
            if (searchButton.isEnabled() && event.getKeyCode() == KeyCodes.KEY_ENTER) {
                searchButton.fireEvent(Events.Select);
            }
        }

        @Override
        public void componentKeyUp(ComponentEvent event) {
            if (searchTextField.getValue() == null) {
                if (event.getKeyCode() == KeyCodes.KEY_BACKSPACE || event.getKeyCode() == KeyCodes.KEY_DELETE) {
                    resetSearch();
                }
            }
        }
    });
    panel.add(searchTextField);
    searchButton = new Button(ButtonsConstants.INSTANCE.searchText(), new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            String searchText = searchTextField.getValue();
            if (searchText != null && !optionsCheckboxgroup.isValid(true)) {
                GeoPlatformMessage.alertMessage(CatalogFinderConstants.INSTANCE.CatalogSearchWidget_errorSearchTitleText(), CatalogFinderMessages.INSTANCE.CatalogSearchWidget_errorSearchBodyMessage(searchText));
                return;
            }
            // Manual binding
            textInfo.setText(searchText);
            textInfo.setSearchTitle(titleCheckbox.getValue().booleanValue());
            textInfo.setSearchAbstract(abstractCheckbox.getValue().booleanValue());
            textInfo.setSearchSubjects(subjectsCheckbox.getValue().booleanValue());
            // Performing the search
            recordsContainer.searchRecords();
        }
    });
    searchButton.setStyleAttribute("margin-left", "20px");
    searchButton.disable();
    panel.add(searchButton);
    left.add(panel);
    // Search Panel - Right
    LayoutContainer right = new LayoutContainer();
    right.setLayout(new ColumnLayout());
    Label optionsLabel = new Label(CatalogFinderConstants.INSTANCE.CatalogSearchWidget_optionsLabelText());
    optionsLabel.setStyleName("catalogOptions-Label");
    right.add(optionsLabel, new ColumnData(240.0));
    optionsCheckboxgroup = new CheckBoxGroup();
    optionsCheckboxgroup.setOrientation(Orientation.VERTICAL);
    optionsCheckboxgroup.setValidator(new Validator() {

        @Override
        public String validate(Field<?> field, String value) {
            CheckBoxGroup group = (CheckBoxGroup) field;
            if (group.getValue() == null) {
                return CatalogFinderConstants.INSTANCE.CatalogSearchWidget_optionsCheckboxValidateText();
            }
            return null;
        }
    });
    Listener<FieldEvent> checkBoxListener = new Listener<FieldEvent>() {

        @Override
        public void handleEvent(FieldEvent fe) {
            manageAllSelectedCheckbox();
        }
    };
    titleCheckbox = new CheckBox();
    titleCheckbox.setBoxLabel(CatalogFinderConstants.INSTANCE.CatalogSearchWidget_titleLabelText());
    // Enabled by default
    titleCheckbox.setValue(true);
    titleCheckbox.addListener(Events.Change, checkBoxListener);
    optionsCheckboxgroup.add(titleCheckbox);
    abstractCheckbox = new CheckBox();
    abstractCheckbox.setBoxLabel(CatalogFinderConstants.INSTANCE.CatalogSearchWidget_abstractLabelText());
    // Enabled by default
    abstractCheckbox.setValue(true);
    abstractCheckbox.addListener(Events.Change, checkBoxListener);
    optionsCheckboxgroup.add(abstractCheckbox);
    subjectsCheckbox = new CheckBox();
    subjectsCheckbox.setBoxLabel(CatalogFinderConstants.INSTANCE.CatalogSearchWidget_keywordsLabelText());
    // Enabled by default
    subjectsCheckbox.setValue(true);
    subjectsCheckbox.addListener(Events.Change, checkBoxListener);
    optionsCheckboxgroup.add(subjectsCheckbox);
    right.add(optionsCheckboxgroup);
    allSelectedCheckbox = new CheckBox();
    allSelectedCheckbox.setBoxLabel(CatalogFinderConstants.INSTANCE.CatalogSearchWidget_allSelectLabelText());
    // Enabled by default
    allSelectedCheckbox.setValue(true);
    allSelectedCheckbox.addListener(Events.Change, new Listener<FieldEvent>() {

        @Override
        public void handleEvent(FieldEvent fe) {
            Boolean allSelected = (Boolean) fe.getValue();
            titleCheckbox.setValue(allSelected);
            abstractCheckbox.setValue(allSelected);
            subjectsCheckbox.setValue(allSelected);
        }
    });
    right.add(allSelectedCheckbox);
    add(left, new ColumnData(0.6));
    add(right, new ColumnData(0.4));
}
Also used : GPSecureStringTextField(org.geosdi.geoplatform.gui.configuration.GPSecureStringTextField) Label(com.extjs.gxt.ui.client.widget.Label) ColumnData(com.extjs.gxt.ui.client.widget.layout.ColumnData) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) Button(com.extjs.gxt.ui.client.widget.button.Button) ColumnLayout(com.extjs.gxt.ui.client.widget.layout.ColumnLayout) HorizontalPanel(com.extjs.gxt.ui.client.widget.HorizontalPanel)

Example 7 with ColumnLayout

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

the class TimePeriodFormPanel method buildTimeTimension.

/**
 */
private void buildTimeTimension() {
    HorizontalPanel buttonsContainer = new HorizontalPanel();
    buttonsContainer.setSpacing(2);
    this.periodSlider = new Slider() {

        @Override
        public void setValue(int value) {
            if (value >= 0 && !partialStore.isEmpty()) {
                super.setValue(value);
                currentValue = value;
                super.setMessage("" + fmt.format(partialStore.get(currentValue)));
                labelCurrenteTime.setValue(fmt.format(partialStore.get(currentValue)));
                saveLayer(sdf.format(partialStore.get(currentValue), TimeZone.createTimeZone(0)).concat(".000Z"));
                enableOnPlaying();
            }
        }
    };
    this.periodSlider.setIncrement(1);
    this.periodSlider.setUseTip(Boolean.TRUE);
    this.periodSlider.setDraggable(Boolean.FALSE);
    this.playButton.setToolTip(ButtonsConstants.INSTANCE.playText());
    this.reversePlayButton.setToolTip(ButtonsConstants.INSTANCE.playReverseText());
    this.forwardPlayButton.setToolTip(ButtonsConstants.INSTANCE.nextText());
    this.backwardButton.setToolTip(ButtonsConstants.INSTANCE.prevText());
    this.addListener();
    this.playButton.addSelectionListener(this.periodPlaySelectioListener);
    this.reversePlayButton.addSelectionListener(this.periodReversePlaySelectioListener);
    buttonsContainer.add((this.backwardButton));
    buttonsContainer.add((this.reversePlayButton));
    buttonsContainer.add((this.playButton));
    buttonsContainer.add((this.forwardPlayButton));
    this.periodSliderContainer.setLayout(new ColumnLayout());
    this.periodSliderContainer.add(buttonsContainer, new ColumnData(.3));
    this.periodSliderContainer.add(this.periodSlider, new ColumnData(.7));
    this.periodSlider.setAutoWidth(Boolean.TRUE);
    super.add(this.periodSliderContainer);
}
Also used : Slider(com.extjs.gxt.ui.client.widget.Slider) ColumnLayout(com.extjs.gxt.ui.client.widget.layout.ColumnLayout) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ColumnData(com.extjs.gxt.ui.client.widget.layout.ColumnData)

Example 8 with ColumnLayout

use of com.extjs.gxt.ui.client.widget.layout.ColumnLayout 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);
}
Also used : Label(com.extjs.gxt.ui.client.widget.Label) ColumnData(com.extjs.gxt.ui.client.widget.layout.ColumnData) Date(java.util.Date) FlowData(com.extjs.gxt.ui.client.widget.layout.FlowData) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) ToggleButton(com.extjs.gxt.ui.client.widget.button.ToggleButton) Button(com.extjs.gxt.ui.client.widget.button.Button) CheckBox(com.extjs.gxt.ui.client.widget.form.CheckBox) ColumnLayout(com.extjs.gxt.ui.client.widget.layout.ColumnLayout) SpinnerField(com.extjs.gxt.ui.client.widget.form.SpinnerField) GPHideFilterWidgetEvent(org.geosdi.geoplatform.gui.client.puregwt.filter.event.GPHideFilterWidgetEvent) LabelField(com.extjs.gxt.ui.client.widget.form.LabelField)

Aggregations

ColumnLayout (com.extjs.gxt.ui.client.widget.layout.ColumnLayout)8 LayoutContainer (com.extjs.gxt.ui.client.widget.LayoutContainer)7 Label (com.google.gwt.user.client.ui.Label)5 FormPanel (com.extjs.gxt.ui.client.widget.form.FormPanel)4 FormData (com.extjs.gxt.ui.client.widget.layout.FormData)4 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)4 GwtXSRFToken (org.eclipse.kura.web.shared.model.GwtXSRFToken)4 FormEvent (com.extjs.gxt.ui.client.event.FormEvent)3 ContentPanel (com.extjs.gxt.ui.client.widget.ContentPanel)3 Button (com.extjs.gxt.ui.client.widget.button.Button)3 TextArea (com.extjs.gxt.ui.client.widget.form.TextArea)3 ColumnData (com.extjs.gxt.ui.client.widget.layout.ColumnData)3 FitLayout (com.extjs.gxt.ui.client.widget.layout.FitLayout)3 Label (com.extjs.gxt.ui.client.widget.Label)2 BaseEvent (com.extjs.gxt.ui.client.event.BaseEvent)1 Margins (com.extjs.gxt.ui.client.util.Margins)1 HorizontalPanel (com.extjs.gxt.ui.client.widget.HorizontalPanel)1 Slider (com.extjs.gxt.ui.client.widget.Slider)1 ToggleButton (com.extjs.gxt.ui.client.widget.button.ToggleButton)1 CheckBox (com.extjs.gxt.ui.client.widget.form.CheckBox)1