y.option
Class ColorOptionItem

java.lang.Object
  |
  +--y.option.OptionItem
        |
        +--y.option.ColorOptionItem

public class ColorOptionItem
extends OptionItem

An option item for Color values.

Provides an editor based on a colored button that shows the standard color chooser when being pressed.


Field Summary
 
Fields inherited from class y.option.OptionItem
COLOR_UNDEFINED, name, UNDEFINED
 
Constructor Summary
ColorOptionItem(String name, Color value)
          Creates a new instance of ColorOptionItem.
ColorOptionItem(String name, Color value, boolean showNoColor, boolean showSomeColors, boolean showMostRecentlyUsedColors, boolean showMoreColors)
          Creates a new instance of ColorOptionItem.
 
Method Summary
 boolean adoptEditorValue()
          Adopts the value from the editor component to the item.
 JComponent getEditor()
          Returns the editor component for the this option item.
 JComponent getEditor(GuiFactory gf, String parentName)
          Returns the editor component for the this option item.
 String getType()
          Returns "Color"
 Object getValue()
          Returns the value of this option item
 void resetValue()
          Resets the value of this item to its initial value.
 void setValue(Object v)
          Sets the value of this option item
 void setValueUndefined(boolean undef)
          Whether or not the editor should start up displaying an undefined value.
 
Methods inherited from class y.option.OptionItem
checkEditorValue, getClassType, getName, getStringValue, getTipText, isValueUndefined, setClassType, setStringValue, setTipText, wantsVisibleName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorOptionItem

public ColorOptionItem(String name,
                       Color value)
Creates a new instance of ColorOptionItem.

Parameters:
name - the name of this item
value - the initial Color value

ColorOptionItem

public ColorOptionItem(String name,
                       Color value,
                       boolean showNoColor,
                       boolean showSomeColors,
                       boolean showMostRecentlyUsedColors,
                       boolean showMoreColors)
Creates a new instance of ColorOptionItem.

Parameters:
name - the name of this item
value - the initial Color value
showNoColor - the editor will allow to specify a null color.
showSomeColors - the editor will provide a color choser popup for some colors.
showMostRecentlyUsedColors - the editor will provide a color choser popup for the most recently used colors.
showMoreColors - the editor will provide a color chooser for all colors.
Method Detail

getType

public String getType()
Returns "Color"

Specified by:
getType in class OptionItem

getValue

public Object getValue()
Description copied from class: OptionItem
Returns the value of this option item

Specified by:
getValue in class OptionItem

setValue

public void setValue(Object v)
Description copied from class: OptionItem
Sets the value of this option item

Specified by:
setValue in class OptionItem

adoptEditorValue

public boolean adoptEditorValue()
Description copied from class: OptionItem
Adopts the value from the editor component to the item.

Specified by:
adoptEditorValue in class OptionItem

resetValue

public void resetValue()
Description copied from class: OptionItem
Resets the value of this item to its initial value.

Specified by:
resetValue in class OptionItem

getEditor

public JComponent getEditor()
Description copied from class: OptionItem
Returns the editor component for the this option item. Note: Use the getEditor(GuiFactory,String) variant instead.

Specified by:
getEditor in class OptionItem

getEditor

public JComponent getEditor(GuiFactory gf,
                            String parentName)
Description copied from class: OptionItem
Returns the editor component for the this option item. Uses the given GuiFactory the create its content. The default implementation calls the no-arg getEditor() method to preserve backward compatibility. However it is suggested to override this method in order to make use of the GuiFactory.

Overrides:
getEditor in class OptionItem

setValueUndefined

public void setValueUndefined(boolean undef)
Description copied from class: OptionItem
Whether or not the editor should start up displaying an undefined value.

Overrides:
setValueUndefined in class OptionItem

© Copyright 2000-2003,
yWorks GmbH.
All rights reserved.

2003