Package muntjac :: Package addon :: Package colorpicker :: Module color_picker :: Class ColorPicker
[hide private]
[frames] | no frames]

Class ColorPicker

source code

                          object --+                
                                   |                
                 util.IEventListener --+            
                                       |            
           terminal.paintable.IPaintable --+        
                                           |        
                              object --+   |        
                                       |   |        
  terminal.variable_owner.IVariableOwner --+        
                                           |        
                              object --+   |        
                                       |   |        
             terminal.sizeable.ISizeable --+        
                                           |        
                     ui.component.IComponent --+    
                                               |    
                                  object --+   |    
                                           |   |    
event.method_event_source.IMethodEventSource --+    
                                               |    
         ui.abstract_component.AbstractComponent --+
                                                   |
                                      object --+   |
                                               |   |
                        ui.window.ICloseListener --+
                                                   |
                                      object --+   |
                                               |   |
                   color_selector.IColorSelector --+
                                                   |
                                      object --+   |
                                               |   |
                            IColorChangeListener --+
                                                   |
                                                  ColorPicker

ColorPicker


Authors:
John Ahlroos / ITMill Oy, Richard Lincoln
Instance Methods [hide private]
 
__init__(self, caption='Colors', initialColor=None)
Instantiates a new color picker.
source code
 
setColor(self, color)
Sets the color.
source code
 
getColor(self)
Gets the color.
source code
 
setPosition(self, x, y)
Sets the position of the popup window
source code
 
addListener(self, listener, iface=None)
Registers a new (generic) component event listener for the component:
source code
 
addCallback(self, callback, eventType=None, *args) source code
 
removeListener(self, listener, iface=None)
Removes a previously registered component event listener from this component.
source code
 
removeCallback(self, callback, eventType=None) source code
 
paintContent(self, target)
Paints any needed component-specific things to the given UIDL stream.
source code
 
changeVariables(self, source, variables)
Called when one or more variables handled by the implementing class are changed.
source code
 
windowClose(self, e)
Called when the user closes a window.
source code
 
colorChanged(self, event)
Fired when a color change event occurs
source code
 
fireColorChanged(self)
Notifies the listeners that the selected color has changed
source code
 
setButtonStyle(self, style)
Sets the style of the button
source code
 
setPopupStyle(self, style)
The style for the popup window
source code
 
setButtonCaption(self, caption)
Sets the caption of the button.
source code
 
setRGBVisibility(self, visible)
Set the visibility of the RGB Tab
source code
 
setHSVVisibility(self, visible)
Set the visibility of the HSV Tab
source code
 
setSwatchesVisibility(self, visible)
Set the visibility of the Swatches Tab
source code
 
setHistoryVisibility(self, visible)
Sets the visibility of the Color History
source code
 
setTextfieldVisibility(self, visible)
Sets tje visibility of the CSS color code text field
source code

Inherited from ui.abstract_component.AbstractComponent: __getstate__, __setstate__, addStyleName, attach, childRequestedRepaint, detach, fireComponentErrorEvent, fireComponentEvent, fireEvent, fireRequestRepaintEvent, focus, getApplication, getCSSHeight, getCSSWidth, getCaption, getComponentError, getData, getDebugId, getDescription, getErrorHandler, getErrorMessage, getHeight, getHeightUnits, getIcon, getListeners, getLocale, getParent, getStyle, getStyleName, getWidth, getWidthUnits, getWindow, handleError, hasListeners, isEnabled, isImmediate, isReadOnly, isVisible, paint, parseStringSize, registerCallback, registerListener, removeStyleName, requestRepaint, requestRepaintRequests, setCaption, setComponentError, setData, setDebugId, setDescription, setEnabled, setErrorHandler, setHeight, setHeightUnits, setIcon, setImmediate, setLocale, setParent, setReadOnly, setSizeFull, setSizeUndefined, setStyle, setStyleName, setVisible, setWidth, setWidthUnits, withdrawCallback, withdrawListener

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  CLIENT_WIDGET = None
hash(x)
  TYPE_MAPPING = 'com.vaadin.addon.colorpicker.ColorPicker'

Inherited from ui.abstract_component.AbstractComponent: SIZE_PATTERN

Inherited from terminal.sizeable.ISizeable: SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS, UNIT_SYMBOLS

Instance Variables [hide private]
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, caption='Colors', initialColor=None)
(Constructor)

source code 

Instantiates a new color picker.

Parameters:
  • caption - the caption
  • initialColor - the initial color
Overrides: object.__init__

setColor(self, color)

source code 

Sets the color.

Parameters:
  • color - the new color
Overrides: color_selector.IColorSelector.setColor
(inherited documentation)

getColor(self)

source code 

Gets the color.

Returns:
the color
Overrides: color_selector.IColorSelector.getColor
(inherited documentation)

setPosition(self, x, y)

source code 

Sets the position of the popup window

Parameters:
  • x - the x-coordinate
  • y - the y-coordinate

addListener(self, listener, iface=None)

source code 

Registers a new (generic) component event listener for the component:

 class Listening(CustomComponent, IListener):

     # Stored for determining the source of an event
     ok = None

     status = None  # For displaying info about the event

     def __init__(self):
         layout = VerticalLayout()

         # Some miscellaneous component
         name = TextField("Say it all here")
         name.addListener(self)
         name.setImmediate(true)
         layout.addComponent(name)

         # Handle button clicks as generic events instead
         # of Button.ClickEvent events
         ok = new Button("OK")
         ok.addListener(self)
         layout.addComponent(ok)

         # For displaying information about an event
         status = new Label("")
         layout.addComponent(status)

         setCompositionRoot(layout)


     def componentEvent(event):
         # Act according to the source of the event
         if (event.getSource() == ok):
             getWindow().showNotification("Click!")

         status.setValue("Event from " +
                 event.getSource().__class__.__name__
                 + ": " + event.__class__.__name__)


 listening = Listening()
 layout.addComponent(listening)
Parameters:
  • listener - the new IListener to be registered.
Raises:
  • ValueError - unless method has a match in object
Overrides: event.method_event_source.IMethodEventSource.addListener
(inherited documentation)

addCallback(self, callback, eventType=None, *args)

source code 
Overrides: terminal.paintable.IPaintable.addCallback

removeListener(self, listener, iface=None)

source code 

Removes a previously registered component event listener from this component.

Parameters:
  • listener - the listener to be removed.
Overrides: event.method_event_source.IMethodEventSource.removeListener
(inherited documentation)

removeCallback(self, callback, eventType=None)

source code 
Overrides: terminal.paintable.IPaintable.removeCallback

paintContent(self, target)

source code 

Paints any needed component-specific things to the given UIDL stream. The more general paint method handles all general attributes common to all components, and it calls this method to paint any component-specific attributes to the UIDL stream.

Parameters:
  • target - the target UIDL stream where the component should paint itself to
Raises:
Overrides: ui.abstract_component.AbstractComponent.paintContent
(inherited documentation)

changeVariables(self, source, variables)

source code 

Called when one or more variables handled by the implementing class are changed.

Parameters:
  • source - the Source of the variable change. This is the origin of the event. For example in Web Adapter this is the request.
  • variables - the Mapping from variable names to new variable values.
Overrides: terminal.variable_owner.IVariableOwner.changeVariables
(inherited documentation)

windowClose(self, e)

source code 

Called when the user closes a window. Use CloseEvent.getWindow to get a reference to the Window that was closed.

Parameters:
  • e - Event containing
Overrides: ui.window.ICloseListener.windowClose
(inherited documentation)

colorChanged(self, event)

source code 

Fired when a color change event occurs

Parameters:
  • event - The color change event
Overrides: IColorChangeListener.colorChanged

setButtonStyle(self, style)

source code 

Sets the style of the button

Parameters:
  • style - The style

setPopupStyle(self, style)

source code 

The style for the popup window

Parameters:
  • style - The style

setButtonCaption(self, caption)

source code 

Sets the caption of the button. This replaces the css color code displayed as the caption.

Parameters:
  • caption - The caption of the button

setRGBVisibility(self, visible)

source code 

Set the visibility of the RGB Tab

Parameters:
  • visible - The visibility

setHSVVisibility(self, visible)

source code 

Set the visibility of the HSV Tab

Parameters:
  • visible - The visibility

setSwatchesVisibility(self, visible)

source code 

Set the visibility of the Swatches Tab

Parameters:
  • visible - The visibility

setHistoryVisibility(self, visible)

source code 

Sets the visibility of the Color History

Parameters:
  • visible - The visibility

setTextfieldVisibility(self, visible)

source code 

Sets tje visibility of the CSS color code text field

Parameters:
  • visible - The visibility