use of org.geosdi.geoplatform.gui.client.widget.cql.combobox.LogicalOperator 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%"));
}
Aggregations