@Override protected Component initContent() { comboBox.addValueChangeListener((ValueChangeListener<T>) event -> { if (event.getValue() != null) { //for now, we use caption as value to not introduce any JCR specific logic here tokenField.addTokenizable(new ToStringTokenizable(comboBox.getItemCaptionGenerator().apply(event.getValue()))); event.getSource().setValue(null); } }); tokenField.setTokenDragDropEnabled(true); tokenField.setEnableDefaultDeleteTokenAction(true); tokenField.setInputField(comboBox); return tokenField; }
private void colorChanged(ValueChangeEvent<Color> event) { event.getSource().setValue(event.getValue()); setValue(event.getValue()); updatingColors = true; setRgbSliderValues(selectedColor); float[] hsv = selectedColor.getHSV(); setHsvSliderValues(hsv); updatingColors = false; for (HasValue<Color> s : selectors) { if (event.getSource() != s && s != this && s.getValue() != selectedColor) { s.setValue(selectedColor); } } }
/** * The multiselect on which the Event initially occurred. * * @return the multiselect on which the Event initially occurred. */ @Override public MultiSelect<T> getSource() { return (MultiSelect<T>) super.getSource(); }
/** * The single select on which the Event initially occurred. * * @return The single select on which the Event initially occurred. */ @Override public SingleSelect<T> getSource() { return (SingleSelect<T>) super.getSource(); }