protected void showColorDialog(final UIObject owner) { if (readOnly) { return; } final ColorPickerDialog dlg = new ColorPickerDialog(); dlg.getElement().getStyle().setZIndex(9999); dlg.addDialogClosedHandler(event -> { if (!event.isCanceled()) { setValue("#" + dlg.getColor(), true); } }); String color = getValue(); if (color.startsWith("#")) { color = color.substring(1, color.length()); } dlg.setColor(color); dlg.showRelativeTo(owner); }
protected void openColorPickerDialog() { final ColorPickerDialog dlg = new ColorPickerDialog(); dlg.getElement().getStyle().setZIndex(9999); String color = getValue(); if (ColorValidator.isValid(color)) { dlg.setColor(color); } dlg.addDialogClosedHandler(new DialogClosedHandler() { public void dialogClosed(DialogClosedEvent event) { if (!event.isCanceled()) { colorTextBox.setValue(dlg.getColor().toUpperCase(), true); } } }); dlg.showRelativeTo(icon); }
private void handleColorSelection(MouseEvent event, Button button, Input input) { final ColorPickerDialog dlg = new ColorPickerDialog(); dlg.getElement().getStyle().setZIndex(9999); dlg.addDialogClosedHandler(closedEvent -> { if (!closedEvent.isCanceled()) { int[] rgb = ColorUtils.getRGB(dlg.getColor()); String color = "#" + dlg.getColor(); input.setValue("rgb("+rgb[0]+","+rgb[1]+","+rgb[2]+");"); } }); dlg.showRelativeTo(ElementWrapperWidget.getWidget(button)); dlg.getElement().getStyle().setBackgroundColor("white"); }
private void handleColorSelection(MouseEvent event, Button button, Input input) { final ColorPickerDialog dlg = new ColorPickerDialog(); dlg.getElement().getStyle().setZIndex(9999); dlg.addDialogClosedHandler(closedEvent -> { if (!closedEvent.isCanceled()) { int[] rgb = ColorUtils.getRGB(dlg.getColor()); String color = "#" + dlg.getColor(); input.setValue("rgb("+rgb[0]+","+rgb[1]+","+rgb[2]+");"); } }); dlg.showRelativeTo(ElementWrapperWidget.getWidget(button)); dlg.getElement().getStyle().setBackgroundColor("white"); }