Search this API

y.option
Class ImageOptionItem

java.lang.Object
  extended by y.option.OptionItem
      extended by y.option.ObjectOptionItem
          extended by y.option.ImageOptionItem
All Implemented Interfaces:
AttributeOwner, BackupValueOwner, PropertyChangeReporter, VetoableChangeReporter

public class ImageOptionItem
extends ObjectOptionItem

OptionItem implementation for Image values which allows for specification of an image universe. By default, the Editor for this item displays a popup menu where values can be chosen or selected through a file browser.

 

Nested Class Summary
static interface ImageOptionItem.ImageProvider
          Utility interface that serves as "universe" of available image descriptions.
 
Field Summary
static java.lang.String ALLOW_BROWSE
          Attribute key that controls whether editors should display an item to browse for images.
static java.lang.String ALLOW_EMPTY_IMAGE
          Attribute key that controls whether empty (null) image values can be selected through the editor.
static java.lang.String ATTRIBUTE_FILE_CHOOSER
          Attribute key used to store a pre-configured instance of JFileChooser to be used by editors.
static java.lang.String ATTRIBUTE_LISTCELL_RENDERER
          Attribute key to register a customized renderer instance for list and table cell views
static java.lang.String ATTRIBUTE_SHOW_URL
          Attribute key that controls whether or not the image URL should be displayed in the editor in addition to the actual image.
static java.lang.String AUTOUPDATE_IMAGELIST
          Attribute key that controls whether the list of available image values should be automatically updated when an image has been selected through the browser.
 
Fields inherited from class y.option.OptionItem
ATTRIBUTE_CONTEXT, ATTRIBUTE_GROUPS, ATTRIBUTE_LONG_DESCRIPTION, COLOR_UNDEFINED, name, PROPERTY_CLASS_TYPE, PROPERTY_ENABLED, PROPERTY_TIP_TEXT, PROPERTY_VALUE, PROPERTY_VALUE_UNDEFINED, UNDEFINED
 
Constructor Summary
ImageOptionItem(java.lang.String name, ImageOptionItem.ImageProvider initialImageURLs, java.lang.Object value)
          Creates a new instance of ImageOptionItem.
ImageOptionItem(java.lang.String name, java.lang.Object value)
          Creates a new instance of ImageOptionItem.
 
Method Summary
 java.awt.Image getImage()
          Returns the current value of this item as an Image instance.
 ImageOptionItem.ImageProvider getImageProvider()
          Gets the currently registered ImageOptionItem.ImageProvider instance for this item.
 java.lang.String getStringValue()
          Returns the stringified value of this option item if the classType property is set, it uses the y.util.ObjectStringConversion class to perform its task, otherwise it will return null.
 java.lang.String getType()
          Returns "Object".
 java.lang.Object getValue()
          Returns the value of this item.
 boolean hasNoImageSet()
          Check whether the item contains a valid image value
 void setImageProvider(ImageOptionItem.ImageProvider availableImageURLs)
          Register an ImageOptionItem.ImageProvider instance that provides a collection of images that can be chosen through this item.
 void setStringValue(java.lang.String value)
          Sets the stringified value of this option item if the classType property is set, it uses the y.util.ObjectStringConversion class to perform its task, otherwise it will return null.
 void setValue(java.lang.Object value)
          Sets the value of this item.
 
Methods inherited from class y.option.ObjectOptionItem
getBackupValue, resetValue
 
Methods inherited from class y.option.OptionItem
addEditor, addEditorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, adoptEditorValue, checkEditorValue, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getAttribute, getClassType, getEditor, getEditor, getEditors, getName, getTipText, isEnabled, isValueUndefined, publishEnabled, publishValue, publishValueUndefined, removeAttribute, removeEditor, removeEditorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener, setAttribute, setClassType, setEnabled, setTipText, setValueUndefined, wantsVisibleName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTRIBUTE_FILE_CHOOSER

public static final java.lang.String ATTRIBUTE_FILE_CHOOSER
Attribute key used to store a pre-configured instance of JFileChooser to be used by editors.

See Also:
Constant Field Values

ATTRIBUTE_LISTCELL_RENDERER

public static final java.lang.String ATTRIBUTE_LISTCELL_RENDERER
Attribute key to register a customized renderer instance for list and table cell views

See Also:
Constant Field Values

ATTRIBUTE_SHOW_URL

public static final java.lang.String ATTRIBUTE_SHOW_URL
Attribute key that controls whether or not the image URL should be displayed in the editor in addition to the actual image. Default value is true.

See Also:
Constant Field Values

ALLOW_BROWSE

public static final java.lang.String ALLOW_BROWSE
Attribute key that controls whether editors should display an item to browse for images. Default value is true.

See Also:
Constant Field Values

ALLOW_EMPTY_IMAGE

public static final java.lang.String ALLOW_EMPTY_IMAGE
Attribute key that controls whether empty (null) image values can be selected through the editor. Default value is true.

See Also:
Constant Field Values

AUTOUPDATE_IMAGELIST

public static final java.lang.String AUTOUPDATE_IMAGELIST
Attribute key that controls whether the list of available image values should be automatically updated when an image has been selected through the browser. Default value is false.

See Also:
Constant Field Values
Constructor Detail

ImageOptionItem

public ImageOptionItem(java.lang.String name,
                       ImageOptionItem.ImageProvider initialImageURLs,
                       java.lang.Object value)
Creates a new instance of ImageOptionItem.

Parameters:
name - the name of this item

ImageOptionItem

public ImageOptionItem(java.lang.String name,
                       java.lang.Object value)
Creates a new instance of ImageOptionItem. No images are registered by default

Parameters:
name - the name of this item
Method Detail

setImageProvider

public void setImageProvider(ImageOptionItem.ImageProvider availableImageURLs)
Register an ImageOptionItem.ImageProvider instance that provides a collection of images that can be chosen through this item.

Parameters:
availableImageURLs - The provider instance that provides the list of available images.
See Also:
getImageProvider()

getType

public java.lang.String getType()
Description copied from class: ObjectOptionItem
Returns "Object".

Overrides:
getType in class ObjectOptionItem

getImageProvider

public ImageOptionItem.ImageProvider getImageProvider()
Gets the currently registered ImageOptionItem.ImageProvider instance for this item.

Returns:
the currently registered image provider for this item.
See Also:
setImageProvider(y.option.ImageOptionItem.ImageProvider)

setValue

public void setValue(java.lang.Object value)
Sets the value of this item.

Overrides:
setValue in class ObjectOptionItem
See Also:
OptionItem.publishValue(Object)

getValue

public java.lang.Object getValue()
Returns the value of this item.

Overrides:
getValue in class ObjectOptionItem

getImage

public java.awt.Image getImage()
Returns the current value of this item as an Image instance.

Returns:
the current value of this item as an Image instance, or null if the current value does not describe an image.

setStringValue

public void setStringValue(java.lang.String value)
Description copied from class: OptionItem
Sets the stringified value of this option item if the classType property is set, it uses the y.util.ObjectStringConversion class to perform its task, otherwise it will return null.

Overrides:
setStringValue in class OptionItem

getStringValue

public java.lang.String getStringValue()
Description copied from class: OptionItem
Returns the stringified value of this option item if the classType property is set, it uses the y.util.ObjectStringConversion class to perform its task, otherwise it will return null.

Overrides:
getStringValue in class OptionItem

hasNoImageSet

public boolean hasNoImageSet()
Check whether the item contains a valid image value

Returns:
true iff this item currently describes a valid image.

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