org.vostok.vaadin.addon.dialog
Class SimpleColourWindow

java.lang.Object
  extended by com.vaadin.server.AbstractClientConnector
      extended by com.vaadin.ui.AbstractComponent
          extended by com.vaadin.ui.AbstractSingleComponentContainer
              extended by com.vaadin.ui.Panel
                  extended by com.vaadin.ui.Window
                      extended by org.vostok.vaadin.addon.dialog.ActionWindow
                          extended by org.vostok.vaadin.addon.dialog.SimpleColourWindow
All Implemented Interfaces:
com.vaadin.event.Action.Container, com.vaadin.event.Action.Notifier, com.vaadin.event.ConnectorEventListener, com.vaadin.event.ContextClickEvent.ContextClickNotifier, com.vaadin.event.FieldEvents.BlurNotifier, com.vaadin.event.FieldEvents.FocusNotifier, com.vaadin.event.MethodEventSource, com.vaadin.server.ClientConnector, com.vaadin.server.Scrollable, com.vaadin.server.Sizeable, com.vaadin.server.VariableOwner, com.vaadin.shared.Connector, com.vaadin.ui.Component, com.vaadin.ui.Component.Focusable, com.vaadin.ui.HasComponents, com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier, com.vaadin.ui.LegacyComponent, com.vaadin.ui.SingleComponentContainer, java.io.Serializable, java.lang.Iterable<com.vaadin.ui.Component>, java.util.EventListener

public class SimpleColourWindow
extends ActionWindow

SimpleColourWindow takes advantage of org.vostok.vaadin.addon.dialog.ActionWindow and com.vaadin.ui.components.colorpicker.ColorPickerSelect to create a new simple and easy to use colour picker.
It introduce a new listener, SimpleColourWindow.ColorChangeListener, which is only called when user changes colour. SimpleColourDialog also provide a preview button. Note for both look and feel rely on some css rules.

See sample at http://vaadin.vostoksystem.eu

Author:
levreau.jerome@vostoksystem.eu
See Also:
Serialized Form

Nested Class Summary
static class SimpleColourWindow.ColourButton
          A friendly button lanncher with a preview.
 
Nested classes/interfaces inherited from class org.vostok.vaadin.addon.dialog.ActionWindow
ActionWindow.Action, ActionWindow.DialogClickListener
 
Nested classes/interfaces inherited from class com.vaadin.ui.Window
com.vaadin.ui.Window.CloseEvent, com.vaadin.ui.Window.CloseListener, com.vaadin.ui.Window.CloseShortcut, com.vaadin.ui.Window.ResizeEvent, com.vaadin.ui.Window.ResizeListener, com.vaadin.ui.Window.WindowModeChangeEvent, com.vaadin.ui.Window.WindowModeChangeListener
 
Nested classes/interfaces inherited from interface com.vaadin.ui.Component
com.vaadin.ui.Component.ErrorEvent, com.vaadin.ui.Component.Event, com.vaadin.ui.Component.Focusable, com.vaadin.ui.Component.Listener
 
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
com.vaadin.server.ClientConnector.AttachEvent, com.vaadin.server.ClientConnector.AttachListener, com.vaadin.server.ClientConnector.ConnectorErrorEvent, com.vaadin.server.ClientConnector.DetachEvent, com.vaadin.server.ClientConnector.DetachListener
 
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable
com.vaadin.server.Sizeable.Unit
 
Nested classes/interfaces inherited from interface com.vaadin.ui.HasComponents
com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier, com.vaadin.ui.HasComponents.ComponentAttachEvent, com.vaadin.ui.HasComponents.ComponentAttachListener, com.vaadin.ui.HasComponents.ComponentDetachEvent, com.vaadin.ui.HasComponents.ComponentDetachListener
 
Field Summary
 
Fields inherited from class org.vostok.vaadin.addon.dialog.ActionWindow
bpComponent, CANCEL, clickListener, CLOSE, closed, innerComponent, items, MODAL, OK
 
Fields inherited from class com.vaadin.ui.Panel
actionManager
 
Fields inherited from class com.vaadin.ui.AbstractComponent
DESIGN_ATTR_PLAIN_TEXT
 
Fields inherited from interface com.vaadin.server.Sizeable
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
 
Constructor Summary
SimpleColourWindow(java.lang.String caption, com.vaadin.shared.ui.colorpicker.Color colour, com.vaadin.ui.components.colorpicker.ColorChangeListener listener)
          Create a new simple colour selector.
 
Method Summary
 void addColourChangeListener(com.vaadin.ui.components.colorpicker.ColorChangeListener listener)
          add a new custom ColorChangeListener to inner ColorPickerSelect in case you need more control
Note this clickListener is directly linked to inner ColorPickerSelect and going to be called on any colour change.
 com.vaadin.shared.ui.colorpicker.Color getColour()
          get current colour
 void removeColourChangeListener(com.vaadin.ui.components.colorpicker.ColorChangeListener listener)
          remove a custon ColorChangeListener
 void setColour(com.vaadin.shared.ui.colorpicker.Color colour)
          set default colour, update selector and preview
 
Methods inherited from class org.vostok.vaadin.addon.dialog.ActionWindow
addAction, addAction, addStyle, createBan, createMessage, createOkCancel, createSaveCancel, createWarning, createYesNo, doAction, getAction, getButton, getDialogClickListener, getInnerContent, noIcon, removeAction, setDialogClickListener, setStyleName, show
 
Methods inherited from class com.vaadin.ui.Window
addBlurListener, addCloseListener, addCloseShortcut, addFocusListener, addListener, addListener, addListener, addListener, addResizeListener, addWindowModeChangeListener, bringToFront, center, changeVariables, close, fireClose, fireResize, fireWindowWindowModeChange, focus, getAssistiveDescription, getAssistivePostfix, getAssistivePrefix, getAssistiveRole, getCloseShortcuts, getCustomAttributes, getPositionX, getPositionY, getState, getState, getTabStopBottomAssistiveText, getTabStopTopAssistiveText, getWindowMode, hasCloseShortcut, isClosable, isDraggable, isModal, isResizable, isResizeLazy, isTabStopEnabled, paintContent, readDesign, readDesignChildren, removeAllCloseShortcuts, removeBlurListener, removeCloseListener, removeCloseShortcut, removeCloseShortcut, removeFocusListener, removeListener, removeListener, removeListener, removeListener, removeResizeListener, removeWindowModeChangeListener, setAssistiveDescription, setAssistivePostfix, setAssistivePrefix, setAssistiveRole, setClosable, setCloseShortcut, setDraggable, setModal, setParent, setPosition, setPositionX, setPositionY, setResizable, setResizeLazy, setTabStopBottomAssistiveText, setTabStopEnabled, setTabStopTopAssistiveText, setWindowMode, writeDesign
 
Methods inherited from class com.vaadin.ui.Panel
addAction, addActionHandler, addClickListener, addListener, getActionManager, getScrollLeft, getScrollTop, getTabIndex, removeAction, removeActionHandler, removeAllActionHandlers, removeClickListener, removeListener, setCaption, setScrollLeft, setScrollTop, setTabIndex
 
Methods inherited from class com.vaadin.ui.AbstractSingleComponentContainer
addComponentAttachListener, addComponentDetachListener, fireComponentAttachEvent, fireComponentDetachEvent, getComponentCount, getContent, iterator, removeComponentAttachListener, removeComponentDetachListener, removeFromParent, setContent, setHeight, setWidth
 
Methods inherited from class com.vaadin.ui.AbstractComponent
addContextClickListener, addListener, addShortcutListener, addStyleName, attach, beforeClientResponse, detach, findAncestor, fireComponentErrorEvent, fireComponentEvent, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorMessage, getExplicitImmediateValue, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isImmediate, isOrHasAncestor, isReadOnly, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setEnabled, setHeight, setHeightUndefined, setIcon, setId, setImmediate, setLocale, setPrimaryStyleName, setReadOnly, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth, setWidthUndefined
 
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.vaadin.ui.LegacyComponent
markAsDirty
 
Methods inherited from interface com.vaadin.server.VariableOwner
isEnabled, isImmediate
 
Methods inherited from interface com.vaadin.ui.Component
addListener, addStyleName, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setPrimaryStyleName, setReadOnly, setVisible
 
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
 
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
 
Methods inherited from interface com.vaadin.server.Sizeable
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUndefined
 

Constructor Detail

SimpleColourWindow

public SimpleColourWindow(java.lang.String caption,
                          com.vaadin.shared.ui.colorpicker.Color colour,
                          com.vaadin.ui.components.colorpicker.ColorChangeListener listener)
Create a new simple colour selector. This one implement ColorPickerSelect (swatches)

Parameters:
caption - caption for the popup window
colour - default colour. set null for none
listener - clickListener for color change. only called if color changed and on "ok" button
Method Detail

getColour

public com.vaadin.shared.ui.colorpicker.Color getColour()
get current colour

Returns:
Color

setColour

public void setColour(com.vaadin.shared.ui.colorpicker.Color colour)
set default colour, update selector and preview

Parameters:
colour - Color for selector

addColourChangeListener

public void addColourChangeListener(com.vaadin.ui.components.colorpicker.ColorChangeListener listener)
add a new custom ColorChangeListener to inner ColorPickerSelect in case you need more control
Note this clickListener is directly linked to inner ColorPickerSelect and going to be called on any colour change. This is a major difference from the one passed to constructor which is only called on "ok" button

Parameters:
listener -

removeColourChangeListener

public void removeColourChangeListener(com.vaadin.ui.components.colorpicker.ColorChangeListener listener)
remove a custon ColorChangeListener

Parameters:
listener - ColorChangeListener to remove