logicalOperatorRadio.setRequired(true);
logicalOperatorRadio.setAlign(Alignment.LEFT);
logicalOperatorRadio.setWidth(250);
logicalOperatorRadio.setShowTitle(false);
HLayout optionLayout = new HLayout();
optionLayout.setHeight(50);
optionLayout.setWidth100();
VLayout leftLayout = new VLayout();
leftLayout.setAlign(Alignment.LEFT);
HLayout layerLayout = new HLayout();
layerLayout.setWidth(420);
DynamicForm layerForm = new DynamicForm();
layerForm.setHeight(30);
if (manualLayerSelection) {
layerSelect = new SelectItem();
layerSelect.setTitle(I18nProvider.getSearch().labelLayerSelected());
layerSelect.setWidth(250);
layerSelect.setHint(I18nProvider.getSearch().labelNoLayerSelected());
((SelectItem) layerSelect).setShowHintInField(true);
layerSelect.addChangedHandler(new ChangedHandler() {
public void onChanged(ChangedEvent event) {
String layerLabel = (String) event.getValue();
for (Layer<?> vLayer : mapModel.getLayers()) {
if (vLayer.getLabel().equals(layerLabel)) {
setLayer((VectorLayer) vLayer);
}
}
}
});
mapModel.addMapModelHandler(new MapModelHandler() {
public void onMapModelChange(MapModelEvent event) {
List<String> layers = new ArrayList<String>();
for (Layer<?> vLayer : mapModel.getLayers()) {
if (vLayer instanceof VectorLayer) {
layers.add(vLayer.getLabel());
}
}
layerSelect.setValueMap(layers.toArray(new String[layers.size()]));
}
});
} else {
mapModel.addLayerSelectionHandler(new LayerSelectionHandler() {
public void onDeselectLayer(LayerDeselectedEvent event) {
empty();
updateLabelTitle(I18nProvider.getSearch().labelNoLayerSelected());
}
public void onSelectLayer(LayerSelectedEvent event) {
if (event.getLayer() instanceof VectorLayer) {
setLayer((VectorLayer) event.getLayer());
if (event.getLayer() != null) {
updateLabelTitle(event.getLayer().getLabel());
}
}
}
});
layerSelect = new BlurbItem();
layerSelect.setShowTitle(true);
layerSelect.setTitle(I18nProvider.getSearch().labelLayerSelected());
layerSelect.setWidth(250);
layerSelect.setValue("<b>" + I18nProvider.getSearch().labelNoLayerSelected() + "</b>");
}
layerForm.setFields(layerSelect);
layerLayout.addMember(layerForm);
leftLayout.addMember(layerLayout);
DynamicForm logicalForm = new DynamicForm();
logicalForm.setAutoWidth();
logicalForm.setLayoutAlign(Alignment.CENTER);
logicalForm.setFields(logicalOperatorRadio);
leftLayout.setWidth(420);
leftLayout.addMember(logicalForm);
VLayout rightLayout = new VLayout();
rightLayout.setLayoutAlign(VerticalAlignment.TOP);
rightLayout.setMargin(5);
rightLayout.setMembersMargin(5);
rightLayout.setWidth(100);
searchButton = new IButton(I18nProvider.getSearch().btnSearch());
searchButton.setIcon("[ISOMORPHIC]/geomajas/silk/find.png");
searchButton.setWidth(100);
searchButton.setDisabled(true);
searchButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
search();
}
});
resetButton = new IButton(I18nProvider.getSearch().btnReset());
resetButton.setIcon("[ISOMORPHIC]/geomajas/silk/undo.png");
resetButton.setWidth(100);
resetButton.setDisabled(true);
resetButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
empty();
}
});
rightLayout.addMember(searchButton);
rightLayout.addMember(resetButton);
optionLayout.addMember(leftLayout);
optionLayout.addMember(new LayoutSpacer());
optionLayout.addMember(rightLayout);
// Create a header for the criterionStack:
HLayout headerLayout = new HLayout();
headerLayout.setHeight(26);
headerLayout.setStyleName(STYLE_HEADER_BAR);
HTMLPane attrHeader = new HTMLPane();
attrHeader.setStyleName(STYLE_SEARCH_HEADER);
attrHeader.setContents("Attribute");
attrHeader.setWidth(140);
HTMLPane operatorHeader = new HTMLPane();
operatorHeader.setContents("Operator");
operatorHeader.setWidth(140);
operatorHeader.setStyleName(STYLE_SEARCH_HEADER);
HTMLPane valueHeader = new HTMLPane();
valueHeader.setContents("Value");
valueHeader.setStyleName(STYLE_SEARCH_HEADER);
criterionStack = new VStack();
criterionStack.setAlign(VerticalAlignment.TOP);
headerLayout.addMember(attrHeader);
headerLayout.addMember(operatorHeader);
headerLayout.addMember(valueHeader);
criterionStack.addMember(headerLayout);
buttonStack = new VStack();
buttonStack.setWidth(70);
buttonStack.setAlign(VerticalAlignment.TOP);
HTMLPane btnHeader = new HTMLPane();
btnHeader.setStyleName(STYLE_HEADER_BAR);
btnHeader.setWidth(70);
btnHeader.setHeight(26);
buttonStack.addMember(btnHeader);
HLayout searchGrid = new HLayout();
searchGrid.addMember(criterionStack);
searchGrid.addMember(buttonStack);
searchGrid.setBorder("1px solid lightgrey");
layout.addMember(optionLayout);
layout.addMember(searchGrid);
addChild(layout);
}