Beispiel #1
0
 public ColorPickerField() {
   colorPicker = new ColorPicker();
   colorPicker.addColorChangeListener(
       new ColorChangeListener() {
         @Override
         public void colorChanged(ColorChangeEvent event) {
           setColorToField(event.getColor().getRGB());
         }
       });
   colorPicker.setHistoryVisibility(false);
 }
Beispiel #2
0
 @Override
 protected void setInternalValue(Integer newValue) {
   if (newValue != null) {
     super.setInternalValue(newValue);
     colorPicker.setColor(new Color(newValue));
   }
 }
 private HorizontalLayout createStyleToolbar() {
   HorizontalLayout toolbar = new HorizontalLayout();
   Button boldButton = new Button(FontAwesome.BOLD);
   boldButton.addClickListener(
       new ClickListener() {
         @Override
         public void buttonClick(ClickEvent event) {
           updateSelectedCellsBold();
         }
       });
   ColorPicker backgroundColor = new ColorPicker();
   backgroundColor.setCaption("Background Color");
   backgroundColor.addColorChangeListener(
       new ColorChangeListener() {
         @Override
         public void colorChanged(ColorChangeEvent event) {
           updateSelectedCellsBackgroundColor(event.getColor());
         }
       });
   ColorPicker fontColor = new ColorPicker();
   fontColor.setCaption("Font Color");
   fontColor.addColorChangeListener(
       new ColorChangeListener() {
         @Override
         public void colorChanged(ColorChangeEvent event) {
           updateSelectedCellsFontColor(event.getColor());
         }
       });
   toolbar.addComponent(boldButton);
   toolbar.addComponent(backgroundColor);
   toolbar.addComponent(fontColor);
   return toolbar;
 }