Search in sources :

Example 1 with INCQLButton

use of org.geosdi.geoplatform.gui.client.widget.cql.button.INCQLButton in project geo-platform by geosdi.

the class CQLFilterAdvancedTab method addComponents.

@Override
public void addComponents() {
    setSize(CQLFilterTabWidget.TAB_WIDGET_WIDTH, CQLFilterTabWidget.TAB_WIDGET_HEIGHT);
    this.filterTextArea = new TextArea();
    this.guideFilterWidget = new GuideFilterWidget(Boolean.TRUE);
    HorizontalPanel uniqueValuePanel = new HorizontalPanel();
    uniqueValuePanel.setSpacing(2);
    final CQLUniqueValuesComboBox uniqueValueComboBox = new CQLUniqueValuesComboBox(this.treePanel);
    uniqueValueComboBox.setEmptyText(LayerFiltersModuleConstants.INSTANCE.CQLFilterAdvancedTab_uniqueOperatorTooltipText());
    uniqueValueComboBox.setEnabled(false);
    uniqueValueComboBox.addSelectionChangedListener(new SelectionChangedListener<GPUniqueValues>() {

        @Override
        public void selectionChanged(SelectionChangedEvent<GPUniqueValues> se) {
            GPUniqueValues gpUniqueValues = se.getSelectedItem();
            if (gpUniqueValues != null) {
                String uniqueValue = gpUniqueValues.get(GPUniqueValues.GPUniqueValueKey.UNIQUE_VALUE.toString()).toString();
                if (isString)
                    uniqueValue = "'".concat(uniqueValue).concat("'");
                insertTextIntoFilterArea(uniqueValue);
                uniqueValueComboBox.reset();
            }
        }
    });
    uniqueValuePanel.add(uniqueValueComboBox);
    HorizontalPanel functionPanel = new HorizontalPanel();
    functionPanel.setSpacing(2);
    final CQLLayerAttributesComboBox attributesComboBox = new CQLLayerAttributesComboBox(this.treePanel);
    attributesComboBox.addSelectionChangedListener(new SelectionChangedListener<GPLayerAttributes>() {

        @Override
        public void selectionChanged(SelectionChangedEvent<GPLayerAttributes> se) {
            GPLayerAttributes layerAttribute = se.getSelectedItem();
            if (layerAttribute != null) {
                insertTextIntoFilterArea(layerAttribute.get(GPAttributeKey.ATTRIBUTE_VALUE.toString()).toString());
                attributesComboBox.reset();
                uniqueValueComboBox.setEnabled(true);
                isString = layerAttribute.get(GPAttributeKey.ATTRIBUTE_TYPE.toString()).toString().equals("java.lang.String");
                uniqueValueComboBox.setLayerAttribute(layerAttribute.get(GPAttributeKey.ATTRIBUTE_VALUE.toString()).toString());
            }
        }
    });
    attributesComboBox.setEmptyText(LayerFiltersModuleConstants.INSTANCE.CQLFilterAdvancedTab_attributeEmptyText());
    functionPanel.add(attributesComboBox);
    final CQLLogicalOperatorComboBox logicalOperatorComboBox = new CQLLogicalOperatorComboBox();
    logicalOperatorComboBox.setEmptyText(LayerFiltersModuleConstants.INSTANCE.CQLFilterAdvancedTab_logicalOperatorEmptyText());
    logicalOperatorComboBox.addSelectionChangedListener(new SelectionChangedListener<LogicalOperator>() {

        @Override
        public void selectionChanged(SelectionChangedEvent<LogicalOperator> se) {
            LogicalOperator logicalOperator = se.getSelectedItem();
            if (logicalOperator != null) {
                insertTextIntoFilterArea(logicalOperator.getKeyValue());
                logicalOperatorComboBox.reset();
            }
        }
    });
    functionPanel.add(logicalOperatorComboBox);
    final ListStore<CQLOperatorValue> operatorListStore = new ListStore<CQLOperatorValue>();
    operatorListStore.add(CQLOperatorValue.getOperatorList());
    final ComboBox<CQLOperatorValue> operatorComboBox = new ComboBox<CQLOperatorValue>();
    operatorComboBox.setStore(operatorListStore);
    operatorComboBox.setDisplayField(CQLOperatorValue.LimitConditionEnum.OPERATOR.toString());
    operatorComboBox.setEditable(Boolean.FALSE);
    operatorComboBox.setForceSelection(Boolean.TRUE);
    operatorComboBox.setTypeAhead(Boolean.TRUE);
    operatorComboBox.setTriggerAction(ComboBox.TriggerAction.ALL);
    operatorComboBox.setEmptyText(LayerFiltersModuleConstants.INSTANCE.CQLFilterAdvancedTab_operatorEmptyText());
    operatorComboBox.addSelectionChangedListener(new SelectionChangedListener<CQLOperatorValue>() {

        @Override
        public void selectionChanged(SelectionChangedEvent<CQLOperatorValue> se) {
            CQLOperatorValue cQLOperatorValue = se.getSelectedItem();
            if (cQLOperatorValue != null) {
                insertTextIntoFilterArea(((CQLOperatorEnum) cQLOperatorValue.get(CQLOperatorValue.LimitConditionEnum.OPERATOR.toString())).getValue());
                operatorComboBox.reset();
            }
        }
    });
    functionPanel.add(operatorComboBox);
    HorizontalPanel symbolPanel = new HorizontalPanel();
    symbolPanel.setSpacing(2);
    Button openBracket = new Button("(", new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            insertTextIntoFilterArea("(");
        }
    });
    symbolPanel.add(openBracket);
    Button openSquareBracket = new Button("[", new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            insertTextIntoFilterArea("]");
        }
    });
    symbolPanel.add(openSquareBracket);
    Button closedBracket = new Button(")", new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            insertTextIntoFilterArea(")");
        }
    });
    symbolPanel.add(closedBracket);
    Button closedSquareBracket = new Button("]", new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            insertTextIntoFilterArea("]");
        }
    });
    symbolPanel.add(closedSquareBracket);
    Button plusOperator = new Button("+", new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            insertTextIntoFilterArea("+");
        }
    });
    symbolPanel.add(plusOperator);
    Button minusOperator = new Button("-", new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            insertTextIntoFilterArea("-");
        }
    });
    symbolPanel.add(minusOperator);
    Button timesOperator = new Button("*", new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            insertTextIntoFilterArea("*");
        }
    });
    symbolPanel.add(timesOperator);
    Button divisionOperator = new Button("/", new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            insertTextIntoFilterArea("/");
        }
    });
    symbolPanel.add(divisionOperator);
    Button apexElement = new Button("'", new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            insertTextIntoFilterArea("'");
        }
    });
    apexElement.setToolTip(LayerFiltersModuleConstants.INSTANCE.CQLFilterAdvancedTab_apexElementTooltipText());
    symbolPanel.add(apexElement);
    Button jollyCharacter = new Button("%", new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            insertTextIntoFilterArea("%");
        }
    });
    jollyCharacter.setToolTip(LayerFiltersModuleConstants.INSTANCE.CQLFilterAdvancedTab_jollyCharacterTooltipText());
    symbolPanel.add(jollyCharacter);
    Button notOperator = new Button("NOT", new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            insertTextIntoFilterArea("NOT");
        }
    });
    notOperator.setTitle(LayerFiltersModuleConstants.INSTANCE.CQLFilterAdvancedTab_notOperatorTooltipText());
    symbolPanel.add(notOperator);
    Button isNullOperator = new Button("IS NULL", new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            insertTextIntoFilterArea("IS NULL");
        }
    });
    isNullOperator.setTitle(LayerFiltersModuleConstants.INSTANCE.CQLFilterAdvancedTab_isNullOperatorTooltipText());
    symbolPanel.add(isNullOperator);
    Button existOperator = new Button("EXIST", new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            insertTextIntoFilterArea("EXIST");
        }
    });
    existOperator.setTitle(LayerFiltersModuleConstants.INSTANCE.CQLFilterAdvancedTab_existOperatorTooltipText());
    symbolPanel.add(existOperator);
    Button doesNotExistOperator = new Button("DOES-NOT-EXIST", new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            insertTextIntoFilterArea("DOES-NOT-EXIST");
        }
    });
    doesNotExistOperator.setTitle(LayerFiltersModuleConstants.INSTANCE.CQLFilterAdvancedTab_doesNotExistOperatorTooltipText());
    symbolPanel.add(doesNotExistOperator);
    HorizontalPanel spatialPanel = new HorizontalPanel();
    spatialPanel.setSpacing(2);
    BetweenCQLButton betweenCQLButton = new BetweenCQLButton(filterTextArea);
    spatialPanel.add(betweenCQLButton);
    INCQLButton incqlb = new INCQLButton(filterTextArea, this.treePanel);
    spatialPanel.add(incqlb);
    BBOXCQLButton bboxcqlb = new BBOXCQLButton(filterTextArea, this.treePanel);
    spatialPanel.add(bboxcqlb);
    Button includeOperator = new Button("INCLUDE", new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            insertTextIntoFilterArea("INCLUDE");
        }
    });
    includeOperator.setTitle(LayerFiltersModuleConstants.INSTANCE.CQLFilterAdvancedTab_includeOperatorTooltipText());
    spatialPanel.add(includeOperator);
    Button excludeOperator = new Button("EXCLUDE", new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            insertTextIntoFilterArea("EXCLUDE");
        }
    });
    excludeOperator.setTitle(LayerFiltersModuleConstants.INSTANCE.CQLFilterAdvancedTab_excludeOperatorTooltipText());
    spatialPanel.add(excludeOperator);
    TimeCQLButton timeCQLButton = new TimeCQLButton(filterTextArea);
    spatialPanel.add(timeCQLButton);
    Button infoButton = new Button("", AbstractImagePrototype.create(BasicWidgetResources.ICONS.info()), new SelectionListener<ButtonEvent>() {

        @Override
        public void componentSelected(ButtonEvent ce) {
            guideFilterWidget.show();
        }
    });
    infoButton.setTitle(LayerFiltersModuleConstants.INSTANCE.CQLFilterAdvancedTab_cqlGuideTooltipText());
    spatialPanel.add(infoButton);
    super.add(symbolPanel);
    super.add(spatialPanel);
    super.add(functionPanel);
    super.add(uniqueValuePanel);
    this.filterTextArea.setSize(CQLFilterTabWidget.TAB_WIDGET_WIDTH, CQLFilterTabWidget.TAB_WIDGET_HEIGHT - 80);
    super.add(this.filterTextArea, new FormData("98%"));
}
Also used : CQLLogicalOperatorComboBox(org.geosdi.geoplatform.gui.client.widget.cql.combobox.CQLLogicalOperatorComboBox) TextArea(com.extjs.gxt.ui.client.widget.form.TextArea) BBOXCQLButton(org.geosdi.geoplatform.gui.client.widget.cql.button.BBOXCQLButton) CQLOperatorEnum(org.geosdi.geoplatform.gui.client.widget.cql.enumeration.CQLOperatorEnum) INCQLButton(org.geosdi.geoplatform.gui.client.widget.cql.button.INCQLButton) GPUniqueValues(org.geosdi.geoplatform.gui.client.model.GPUniqueValues) ListStore(com.extjs.gxt.ui.client.store.ListStore) BetweenCQLButton(org.geosdi.geoplatform.gui.client.widget.cql.button.BetweenCQLButton) BBOXCQLButton(org.geosdi.geoplatform.gui.client.widget.cql.button.BBOXCQLButton) INCQLButton(org.geosdi.geoplatform.gui.client.widget.cql.button.INCQLButton) TimeCQLButton(org.geosdi.geoplatform.gui.client.widget.cql.button.TimeCQLButton) Button(com.extjs.gxt.ui.client.widget.button.Button) HorizontalPanel(com.extjs.gxt.ui.client.widget.HorizontalPanel) CQLLayerAttributesComboBox(org.geosdi.geoplatform.gui.client.widget.cql.combobox.CQLLayerAttributesComboBox) TimeCQLButton(org.geosdi.geoplatform.gui.client.widget.cql.button.TimeCQLButton) FormData(com.extjs.gxt.ui.client.widget.layout.FormData) GPLayerAttributes(org.geosdi.geoplatform.gui.model.tree.GPLayerAttributes) ComboBox(com.extjs.gxt.ui.client.widget.form.ComboBox) CQLLogicalOperatorComboBox(org.geosdi.geoplatform.gui.client.widget.cql.combobox.CQLLogicalOperatorComboBox) CQLLayerAttributesComboBox(org.geosdi.geoplatform.gui.client.widget.cql.combobox.CQLLayerAttributesComboBox) CQLUniqueValuesComboBox(org.geosdi.geoplatform.gui.client.widget.cql.combobox.CQLUniqueValuesComboBox) LogicalOperator(org.geosdi.geoplatform.gui.client.widget.cql.combobox.LogicalOperator) CQLUniqueValuesComboBox(org.geosdi.geoplatform.gui.client.widget.cql.combobox.CQLUniqueValuesComboBox) BetweenCQLButton(org.geosdi.geoplatform.gui.client.widget.cql.button.BetweenCQLButton) ButtonEvent(com.extjs.gxt.ui.client.event.ButtonEvent)

Aggregations

ButtonEvent (com.extjs.gxt.ui.client.event.ButtonEvent)1 ListStore (com.extjs.gxt.ui.client.store.ListStore)1 HorizontalPanel (com.extjs.gxt.ui.client.widget.HorizontalPanel)1 Button (com.extjs.gxt.ui.client.widget.button.Button)1 ComboBox (com.extjs.gxt.ui.client.widget.form.ComboBox)1 TextArea (com.extjs.gxt.ui.client.widget.form.TextArea)1 FormData (com.extjs.gxt.ui.client.widget.layout.FormData)1 GPUniqueValues (org.geosdi.geoplatform.gui.client.model.GPUniqueValues)1 BBOXCQLButton (org.geosdi.geoplatform.gui.client.widget.cql.button.BBOXCQLButton)1 BetweenCQLButton (org.geosdi.geoplatform.gui.client.widget.cql.button.BetweenCQLButton)1 INCQLButton (org.geosdi.geoplatform.gui.client.widget.cql.button.INCQLButton)1 TimeCQLButton (org.geosdi.geoplatform.gui.client.widget.cql.button.TimeCQLButton)1 CQLLayerAttributesComboBox (org.geosdi.geoplatform.gui.client.widget.cql.combobox.CQLLayerAttributesComboBox)1 CQLLogicalOperatorComboBox (org.geosdi.geoplatform.gui.client.widget.cql.combobox.CQLLogicalOperatorComboBox)1 CQLUniqueValuesComboBox (org.geosdi.geoplatform.gui.client.widget.cql.combobox.CQLUniqueValuesComboBox)1 LogicalOperator (org.geosdi.geoplatform.gui.client.widget.cql.combobox.LogicalOperator)1 CQLOperatorEnum (org.geosdi.geoplatform.gui.client.widget.cql.enumeration.CQLOperatorEnum)1 GPLayerAttributes (org.geosdi.geoplatform.gui.model.tree.GPLayerAttributes)1