Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

ColorPicker.java 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright 2000-2018 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.ui;
  17. import com.vaadin.shared.ui.colorpicker.Color;
  18. import com.vaadin.shared.ui.colorpicker.ColorPickerState;
  19. /**
  20. * A class that defines default (button-like) implementation for a color picker
  21. * component.
  22. *
  23. * @since 7.0.0
  24. *
  25. * @see ColorPickerArea
  26. *
  27. */
  28. public class ColorPicker extends AbstractColorPicker {
  29. /**
  30. * Instantiates a new color picker.
  31. */
  32. public ColorPicker() {
  33. super();
  34. }
  35. /**
  36. * Instantiates a new color picker.
  37. *
  38. * @param popupCaption
  39. * caption of the color select popup
  40. */
  41. public ColorPicker(String popupCaption) {
  42. super(popupCaption);
  43. }
  44. /**
  45. * Instantiates a new color picker.
  46. *
  47. * @param popupCaption
  48. * caption of the color select popup
  49. * @param initialColor
  50. * the initial color
  51. */
  52. public ColorPicker(String popupCaption, Color initialColor) {
  53. super(popupCaption, initialColor);
  54. setDefaultCaptionEnabled(true);
  55. }
  56. @Override
  57. protected void setDefaultStyles() {
  58. setPrimaryStyleName(STYLENAME_BUTTON);
  59. addStyleName(STYLENAME_DEFAULT);
  60. }
  61. @Override
  62. protected ColorPickerState getState() {
  63. return (ColorPickerState) super.getState();
  64. }
  65. @Override
  66. protected ColorPickerState getState(boolean markAsDirty) {
  67. return (ColorPickerState) super.getState(markAsDirty);
  68. }
  69. }