use of com.extjs.gxt.ui.client.widget.form.ComboBox in project jahia by Jahia.
the class ChannelDisplayActionItem method initMainComponent.
/**
* init main component
*/
private void initMainComponent() {
final ComboBox<GWTJahiaChannel> comboBox = new ComboBox<GWTJahiaChannel>();
comboBox.setDisplayField("display");
comboBox.setTriggerAction(ComboBox.TriggerAction.ALL);
comboBox.setStore(new ListStore<GWTJahiaChannel>());
comboBox.getStore().add(JahiaGWTParameters.getChannels());
comboBox.setTemplate(getChannelTemplate());
comboBox.setItemSelector("div.thumb-wrap");
comboBox.addSelectionChangedListener(new SelectionChangedListener<GWTJahiaChannel>() {
@Override
public void selectionChanged(SelectionChangedEvent<GWTJahiaChannel> event) {
GWTJahiaChannel selectedChannel = event.getSelectedItem();
if (linker instanceof EditLinker) {
((EditLinker) linker).getMainModule().switchChannel(selectedChannel, null);
}
}
});
horizontalPanel = new HorizontalPanel();
horizontalPanel.add(comboBox);
horizontalPanel.addStyleName(getGwtToolbarItem().getClassName());
horizontalPanel.addStyleName("action-bar-menu-item");
setEnabled(true);
}
use of com.extjs.gxt.ui.client.widget.form.ComboBox in project jahia by Jahia.
the class CalendarPicker method initHours.
protected void initHours() {
Date date = getValue();
DateWrapper dateWrapper = null;
if (date == null) {
dateWrapper = new DateWrapper();
} else {
dateWrapper = new DateWrapper(date);
}
hoursPanel = new HorizontalPanel();
hoursPanel.setTableWidth("100%");
hoursPanel.setHorizontalAlign(HorizontalAlignment.CENTER);
hoursPanel.setStyleName("x-date-hours-panel");
hoursPanel.sinkEvents(Event.ONCHANGE);
if (GXT.isIE) {
hoursPanel.setWidth(175);
}
HorizontalPanel hPanel = new HorizontalPanel();
hPanel.setLayout(new FitLayout());
hPanel.setHorizontalAlign(Style.HorizontalAlignment.LEFT);
hPanel.setStyleName("x-date-bottom");
hours = new ComboBox() {
@Override
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
getListView().addStyleName("x-datetime-selector");
}
};
hours.setDisplayField("display");
hours.setMinListWidth(40);
hours.setWidth(40);
hours.setStore(getHours(0, 23));
hours.setValue(hour != null ? hour : new HourModel(dateWrapper.getHours()));
hours.setForceSelection(true);
hours.setTriggerAction(TriggerAction.ALL);
hours.addSelectionChangedListener(new SelectionChangedListener<HourModel>() {
public void selectionChanged(SelectionChangedEvent se) {
HourModel hourModel = (HourModel) se.getSelection().get(0);
if (hourModel != null) {
hour = new HourModel(Integer.parseInt(hourModel.getValue()));
}
}
});
hours.addListener(Events.Change, new Listener<FieldEvent>() {
public void handleEvent(FieldEvent be) {
HourModel hourModel = (HourModel) be.getValue();
if (hourModel != null) {
hour = new HourModel(Integer.parseInt(hourModel.getValue()));
}
}
});
hPanel.add(hours);
HTML sep = new HTML(":");
sep.setStyleName("x-date-hours-separator");
hPanel.add(sep, new TableData(HorizontalAlignment.CENTER, VerticalAlignment.MIDDLE));
minutes = new ComboBox() {
@Override
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
getListView().addStyleName("x-datetime-selector");
}
};
minutes.setDisplayField("display");
minutes.setMinListWidth(40);
minutes.setWidth(40);
minutes.setStore(getMinutes(0, 59));
minutes.setValue(minute != null ? minute : new MinuteModel(dateWrapper.getMinutes()));
minutes.setForceSelection(true);
minutes.setTriggerAction(TriggerAction.ALL);
minutes.getListView().addStyleName("x-datetime-selector");
minutes.addSelectionChangedListener(new SelectionChangedListener<MinuteModel>() {
public void selectionChanged(SelectionChangedEvent se) {
MinuteModel minuteModel = (MinuteModel) se.getSelection().get(0);
if (minuteModel != null) {
minute = new MinuteModel(Integer.parseInt(minuteModel.getValue()));
}
}
});
minutes.addListener(Events.Change, new Listener<FieldEvent>() {
public void handleEvent(FieldEvent be) {
MinuteModel minuteModel = (MinuteModel) be.getValue();
if (minuteModel != null) {
minute = new MinuteModel(Integer.parseInt(minuteModel.getValue()));
}
}
});
hPanel.add(minutes);
hoursPanel.add(hPanel, new TableData(HorizontalAlignment.CENTER, VerticalAlignment.MIDDLE));
}
use of com.extjs.gxt.ui.client.widget.form.ComboBox in project geo-platform by geosdi.
the class GeocodingGridWidget method addComboGeocodingServices.
private void addComboGeocodingServices() {
List<GPGeocodingServiceBean> serviceList = Lists.<GPGeocodingServiceBean>newArrayList();
serviceList.add(new GPGeocodingServiceBean(ReverseGeoCoderProvider.GOOGLE));
// serviceList.add(new GPGeocodingServiceBean(
// ReverseGeoCoderProvider.YAHOO));
ListStore<GPGeocodingServiceBean> serviceStore = new ListStore<GPGeocodingServiceBean>();
serviceStore.add(serviceList);
geocodingServiceCombo = new ComboBox<GPGeocodingServiceBean>();
geocodingServiceCombo.setId("geocodingServiceSelector");
geocodingServiceCombo.setFieldLabel(GeocodingModuleConstants.INSTANCE.GeocodingGridWidget_providerText());
geocodingServiceCombo.setDisplayField(GPGeocodingSeviceKeyValue.GEOCODINGSERVICE.getValue());
geocodingServiceCombo.setToolTip("Geocoding service selector");
geocodingServiceCombo.setForceSelection(true);
geocodingServiceCombo.setEditable(false);
geocodingServiceCombo.setStore(serviceStore);
geocodingServiceCombo.setTypeAhead(true);
geocodingServiceCombo.setTriggerAction(TriggerAction.ALL);
searchFieldSet.add(geocodingServiceCombo);
geocodingServiceCombo.addListener(Events.Select, new Listener<FieldEvent>() {
@Override
public void handleEvent(FieldEvent fe) {
if (search.getValue() != null) {
ComboBox<GPGeocodingServiceBean> comboBox = (ComboBox<GPGeocodingServiceBean>) fe.getComponent();
GPGeocodingServiceBean selectedBean = comboBox.getValue();
String selectedGeocodingService = selectedBean.getGeocodingService();
operation.onBeginGeocodingSearch(search.getValue());
}
}
});
geocodingServiceCombo.setValue(new GPGeocodingServiceBean(ReverseGeoCoderProvider.GOOGLE));
}
use of com.extjs.gxt.ui.client.widget.form.ComboBox in project geo-platform by geosdi.
the class GeocodingGridWidget method addSearchTextField.
private void addSearchTextField() {
search = new GPSecureStringTextField();
search.setFieldLabel(GeocodingModuleConstants.INSTANCE.GeocodingGridWidget_searchFieldLabelText());
search.setEmptyText(GeocodingModuleConstants.INSTANCE.GeocodingGridWidget_searchFieldEmptyText());
search.addKeyListener(new KeyListener() {
@Override
public void componentKeyUp(ComponentEvent event) {
if (((event.getKeyCode() == KeyCodes.KEY_BACKSPACE) || (event.getKeyCode() == KeyCodes.KEY_DELETE)) && (search.getValue() == null)) {
removeMarkersOnMap();
cleanUpTheStore();
}
}
@Override
public void componentKeyPress(ComponentEvent event) {
if ((event.getKeyCode() == KeyCodes.KEY_ENTER) && (!search.getValue().equals(""))) {
ComboBox<GPGeocodingServiceBean> comboBox = (ComboBox<GPGeocodingServiceBean>) searchFieldSet.getItemByItemId("geocodingServiceSelector");
GPGeocodingServiceBean selectedBean = comboBox.getValue();
String selectedGeocodingService = selectedBean.getGeocodingService();
operation.onBeginGeocodingSearch(search.getValue());
}
}
});
searchFieldSet.add(search);
}
use of com.extjs.gxt.ui.client.widget.form.ComboBox 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