public ColorPickerField(iColorFactory colorFactory) { this.colorFactory = colorFactory; this.colorPicker = new ColorPicker(); this.colorPicker.addColorChangeListener(new ColorChangeListener() { private static final long serialVersionUID = 1L; @Override public void colorChanged(ColorChangeEvent event) { setValue(ColorPickerField.this.colorFactory.createColor(event.getColor())); } }); }
private void fillTable() { colorTable.removeAllItems(); int rowIndex = 0; final Map<String, String> valueColourMap = getPreferenceValue(DiagrammePreference.VALUE_COLOUR_MAP, preferences); Iterator<Map.Entry<String, String>> it = valueColourMap.entrySet().iterator(); while (it.hasNext()) { final Map.Entry<String, String> entry = it.next(); int[] d = ColourUtil.decode(entry.getValue()); final Color c = new SolidColor(d[0], d[1], d[2]); ColorPicker picker = new ColorPicker(); picker.setColor(new com.vaadin.shared.ui.colorpicker.Color(ColourUtil.decode(c.toString())[0], ColourUtil.decode(c.toString())[1], ColourUtil.decode(c.toString())[2])); picker.setPosition(Page.getCurrent().getBrowserWindowWidth() / 2 - 246 / 2, Page.getCurrent().getBrowserWindowHeight() / 2 - 507 / 2); picker.addColorChangeListener(new ColorChangeListener() { @Override public void colorChanged(ColorChangeEvent event) { valueColourMap.put(entry.getKey(), event.getColor().getCSS()); preferences.getItemDataSource().getItemProperty(DiagrammePreference.VALUE_COLOUR_MAP).setValue(valueColourMap); // chartLayout.getConfigurationLayout().getLookAndFeelLayout().renderChart(); } }); colorTable.addItem(new Object[]{entry.getKey(), picker}, rowIndex); rowIndex++; } }
public ColorPickerField() { colorPicker = new ColorPicker(); colorPicker.addColorChangeListener(new ColorChangeListener() { @Override public void colorChanged(ColorChangeEvent event) { setColorToField(event.getColor().getRGB()); } }); colorPicker.setHistoryVisibility(false); }
@Override public void addColorChangeListener(final ColorChangeListener listener) { }
@Override public void removeColorChangeListener(final ColorChangeListener listener) { }
@Override public void addColorChangeListener(final ColorChangeListener listener) { LOG.debug("inside addColorChangeListener"); }
@Override public void removeColorChangeListener(final ColorChangeListener listener) { LOG.debug("inside removeColorChangeListener"); }