@Override public void onAnything() { Device oldDevice = deviceCombo.getValue(); if (oldDevice != null) { deviceCombo.setValue(deviceStore.findModel(oldDevice)); } else if (deviceStore.size() == 1) { deviceCombo.setValue(deviceStore.get(0)); } }
/** * Creates combobox used to select molecular viewer. * * @return viewer selector */ private ComboBox<String> createViewerTypeCombobox() { ListStore<String> store = new ListStore<String>( new ModelKeyProvider<String>() { @Override public String getKey(String item) { return item; } }); store.add(AppPropertiesManager.CONSTANTS.viewer_local()); store.add(AppPropertiesManager.CONSTANTS.viewer_jmol()); store.add(AppPropertiesManager.CONSTANTS.viewer_pse()); final ComboBox<String> viewerTypeComboBox = new ComboBox<String>( store, new LabelProvider<String>() { @Override public String getLabel(String item) { return item; } }); viewerTypeComboBox.setId("viewercombo"); viewerTypeComboBox.setTriggerAction(TriggerAction.ALL); viewerTypeComboBox.setEditable(false); viewerTypeComboBox.setWidth(100); viewerTypeComboBox.setToolTipConfig(createViewerTypeComboBoxToolTipConfig()); String viewerCookie = Cookies.getCookie("crkviewer"); if (viewerCookie != null) { viewerTypeComboBox.setValue(viewerCookie); } else { viewerTypeComboBox.setValue(AppPropertiesManager.CONSTANTS.viewer_jmol()); } ApplicationContext.setSelectedViewer(viewerTypeComboBox.getValue()); viewerTypeComboBox.addSelectionHandler( new SelectionHandler<String>() { @Override public void onSelection(SelectionEvent<String> event) { Cookies.setCookie("crkviewer", event.getSelectedItem()); ApplicationContext.setSelectedViewer(event.getSelectedItem()); } }); return viewerTypeComboBox; }
@Override public void onRemoveLayer(List<Layer> allVectorLayers) { setVectorLayers(allVectorLayers); /* * Puesto que al eliminar una capa, ninguna de las restantes queda * seleccionada en el LayerManager, se limpia la capa seleccionada de la * combo de capas */ layerCombo.setValue(null); }
/** This method is used to update this widget to reflect the given argument validator */ void setArgumentValidator(final ArgumentValidator av) { // Set the comboBox item and corresponding card. validatorTypeCB.setValue(av.getType(), true); cardLC.setActiveWidget(validatorTypeToCardMap.get(av.getType())); Splittable params = av.getParams(); switch (av.getType()) { case Regex: String regex = params.get(0).asString(); regexField.setValue(regex); break; case CharacterLimit: int charLimit = Double.valueOf(params.get(0).asNumber()).intValue(); charLimitField.setValue(charLimit); break; case IntAbove: int intAbove = Double.valueOf(params.get(0).asNumber()).intValue(); intAboveField.setValue(intAbove); break; case IntBelow: int intBelow = Double.valueOf(params.get(0).asNumber()).intValue(); intBelowField.setValue(intBelow); break; case IntRange: int intRangeAbove = Double.valueOf(params.get(0).asNumber()).intValue(); int intRangeBelow = Double.valueOf(params.get(1).asNumber()).intValue(); intRangeAboveField.setValue(intRangeAbove); intRangeBelowField.setValue(intRangeBelow); break; case DoubleAbove: double dblAbove = params.get(0).asNumber(); dblAboveField.setValue(dblAbove); break; case DoubleBelow: double dblBelow = params.get(0).asNumber(); dblBelowField.setValue(dblBelow); break; case DoubleRange: double dblRangeAbove = params.get(0).asNumber(); double dblRangeBelow = params.get(1).asNumber(); dblRangeAboveField.setValue(dblRangeAbove); dblRangeBelowField.setValue(dblRangeBelow); break; default: break; } }
private void updateStatusInfo() { if (vectorLayers != null) { List<VectorLayerInfo> vectors = new ArrayList<VectorLayerInfo>(); for (Layer layer : vectorLayers) { vectors.add(new VectorLayerInfo((Vector) layer)); } layerStore.clear(); layerStore.addAll(vectors); layerCombo.redraw(); } if (selectedLayer != null) { layerCombo.setValue(new VectorLayerInfo(selectedLayer)); } }
/** @param supportedValidatorTypes use these to construct content of the combo box */ AddValidatorDialog( Set<ArgumentValidatorType> supportedValidatorTypes, ArgumentValidatorMessages avMessages) { this.avMessages = avMessages; setHeadingText(avMessages.validatorDialogHeading()); setAutoHide(false); setSize("400", "250"); // Initialize the ComboBox list store with the given Set<..> ListStore<ArgumentValidatorType> validatorTypes = new ListStore<>(new AVTLabelKeyProvider()); validatorTypes.addAll(supportedValidatorTypes); // Initialize the ComboBox validatorTypeCB = new ComboBox<>(validatorTypes, new AVTLabelKeyProvider()); validatorTypeCB.setForceSelection(true); validatorTypeCB.setAllowBlank(false); validatorTypeCB.setTriggerAction(TriggerAction.ALL); // Construct all "provided" fields. constructDoubleSpinnerFields(); constructIntegerSpinnerFields(); charLimitField = new NumberField<>(new NumberPropertyEditor.IntegerPropertyEditor()); charLimitField.setAllowBlank(false); charLimitField.addValidHandler(this); charLimitField.addInvalidHandler(this); add(BINDER.createAndBindUi(this)); // Initialize validatorTypeToCardMap validatorTypeToCardMap = Maps.newHashMap(); validatorTypeToCardMap.put(ArgumentValidatorType.DoubleAbove, dblAboveValidatorCon); validatorTypeToCardMap.put(ArgumentValidatorType.DoubleBelow, dblBelowValidatorCon); validatorTypeToCardMap.put(ArgumentValidatorType.DoubleRange, dblRangeValidatorCon); validatorTypeToCardMap.put(ArgumentValidatorType.IntAbove, intAboveValidatorCon); validatorTypeToCardMap.put(ArgumentValidatorType.IntBelow, intBelowValidatorCon); validatorTypeToCardMap.put(ArgumentValidatorType.IntRange, intRangeValidatorCon); validatorTypeToCardMap.put(ArgumentValidatorType.Regex, regexValidatorCon); validatorTypeToCardMap.put(ArgumentValidatorType.CharacterLimit, characterLimitValidatorCon); // Set default values. ArgumentValidatorType next = supportedValidatorTypes.iterator().next(); validatorTypeCB.setValue(next, true); cardLC.setActiveWidget(validatorTypeToCardMap.get(next)); }
public void selectDevice(Device device) { deviceCombo.setValue(device, false); }