JIDE 3.5.15

com.jidesoft.dashboard
Class AbstractGadget

java.lang.Object
  extended by com.jidesoft.dashboard.AbstractGadget
All Implemented Interfaces:
Gadget

public abstract class AbstractGadget
extends Object
implements Gadget

AbstractGadget is the abstract implementation of Gadget which implements all methods except Gadget.createGadgetComponent() and Gadget.disposeGadgetComponent(GadgetComponent).


Field Summary
static String PROPERTY_DESCRIPTION
           
static String PROPERTY_GADGET_MANAGER
           
static String PROPERTY_ICON
           
static String PROPERTY_KEY
           
static String PROPERTY_LARGE_ICON
           
static String PROPERTY_NAME
           
 
Constructor Summary
AbstractGadget(String key)
           
AbstractGadget(String key, Icon icon)
           
AbstractGadget(String key, Icon icon, Icon largeIcon)
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list.
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list for a specific property.
protected  void firePropertyChange(String propertyName, boolean oldValue, boolean newValue)
          Support for reporting bound property changes for boolean properties.
protected  void firePropertyChange(String propertyName, int oldValue, int newValue)
          Support for reporting bound property changes for integer properties.
protected  void firePropertyChange(String propertyName, Object oldValue, Object newValue)
          Support for reporting bound property changes for Object properties.
 String getDescription()
          Returns the description of the Gadget.
 GadgetManager getGadgetManager()
          Gets the gadget manager.
 Icon getIcon()
          Gets the icon.
 String getKey()
          Returns the key of the Gadget.
 Icon getLargeIcon()
          Gets the large icon.
 String getName()
          Returns the name of the Gadget.
 PropertyChangeListener[] getPropertyChangeListeners()
          Returns an array of all the property change listeners registered on this component.
 PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
          Returns an array of all the listeners which have been associated with the named property.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list.
 void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list for a specific property.
 void setDescription(String description)
          Sets the description of the Gadget.
 void setGadgetManager(GadgetManager gadgetManager)
          Sets the gadget manager that manages this gadget.
 void setIcon(Icon icon)
          Sets the icon.
 void setLargeIcon(Icon largeIcon)
          Sets the large icon.
 void setName(String name)
          Sets the name of the Gadget.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jidesoft.dashboard.Gadget
createGadgetComponent, disposeGadgetComponent
 

Field Detail

PROPERTY_KEY

public static final String PROPERTY_KEY
See Also:
Constant Field Values

PROPERTY_NAME

public static final String PROPERTY_NAME
See Also:
Constant Field Values

PROPERTY_DESCRIPTION

public static final String PROPERTY_DESCRIPTION
See Also:
Constant Field Values

PROPERTY_LARGE_ICON

public static final String PROPERTY_LARGE_ICON
See Also:
Constant Field Values

PROPERTY_ICON

public static final String PROPERTY_ICON
See Also:
Constant Field Values

PROPERTY_GADGET_MANAGER

public static final String PROPERTY_GADGET_MANAGER
See Also:
Constant Field Values
Constructor Detail

AbstractGadget

public AbstractGadget(String key)

AbstractGadget

public AbstractGadget(String key,
                      Icon icon)

AbstractGadget

public AbstractGadget(String key,
                      Icon icon,
                      Icon largeIcon)
Method Detail

getKey

public String getKey()
Returns the key of the Gadget. The key is used to uniquely identify a Gadget in one GadgetManager. The key is not displayed anywhere in the user interface so it is OK to be a non-localized string. The strings for the name should be localized although if you never set the name, the key will be used as the name.

Specified by:
getKey in interface Gadget
Returns:
a String containing this Gadget's key

getName

public String getName()
Returns the name of the Gadget. The name is displayed on the title bar of the Gadget if any. If the name is never set, the key will be used.

Specified by:
getName in interface Gadget
Returns:
the name

setName

public void setName(String name)
Sets the name of the Gadget. The name is displayed on the title bar of the Gadget if any. If the name is never set, the key will be used.

This setter will fire PROPERTY_NAME property change event.

Parameters:
name - the new name

getDescription

public String getDescription()
Returns the description of the Gadget. Description is used in the GadgetPalette to give user an idea of what the gadget is.

Specified by:
getDescription in interface Gadget
Returns:
the description.

setDescription

public void setDescription(String description)
Sets the description of the Gadget. The description is displayed on the title bar of the Gadget if any.

This setter will fire PROPERTY_DESCRIPTION property change event.

Parameters:
description - the new description

getLargeIcon

public Icon getLargeIcon()
Gets the large icon. The icon is used by the GadgetPalette to represent a gadget. You can specify two icons for each gadget. This is the larger one of the two. We didn't specify the exact size of this icon. But all gadgets' icon should have the same size to look good on the palette.

Specified by:
getLargeIcon in interface Gadget
Returns:
the large icon.

setLargeIcon

public void setLargeIcon(Icon largeIcon)
Sets the large icon. The icon is used by the GadgetPalette to represent a gadget. You can specify two icons for each gadget. This is the larger one of the two. We didn't specify the exact size of this icon. But all gadgets' icon should have the same size to look good on the palette.

Parameters:
largeIcon - the large icon.

getIcon

public Icon getIcon()
Gets the icon. The icon is usually displayed on the title bar of the gadget component, although it depends on how the gadget component is implemented. You can specify two icons for each gadget. This is the smaller one of the two. We didn't specify the exact size of this icon. But all gadgets' icon should have the same size to look good on when they displayed on the dashboard.

Specified by:
getIcon in interface Gadget
Returns:
the icon.

setIcon

public void setIcon(Icon icon)
Sets the icon. The icon is usually displayed on the title bar of the gadget component, although it depends on how the gadget component is implemented. You can specify two icons for each gadget. This is the smaller one of the two. We didn't specify the exact size of this icon. But all gadgets' icon should have the same size to look good on when they displayed on the dashboard.

Parameters:
icon - the icon.

setGadgetManager

public void setGadgetManager(GadgetManager gadgetManager)
Sets the gadget manager that manages this gadget. Although this is a public method, as the user of the API, you probably should never use this setter directly. Instead, you can add the Gadget to a GadgetManager which will call this method indirectly.

Specified by:
setGadgetManager in interface Gadget
Parameters:
gadgetManager - the gadget manager.

getGadgetManager

public GadgetManager getGadgetManager()
Gets the gadget manager.

Specified by:
getGadgetManager in interface Gadget
Returns:
the gadget manager.

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list.

Parameters:
listener - the PropertyChangeListener to be added
See Also:
removePropertyChangeListener(java.beans.PropertyChangeListener), getPropertyChangeListeners(), addPropertyChangeListener(String,java.beans.PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. This method should be used to remove PropertyChangeListeners that were registered for all bound properties of this class.

If listener is null, no exception is thrown and no action is performed.

Parameters:
listener - the PropertyChangeListener to be removed
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener), getPropertyChangeListeners(), removePropertyChangeListener(String,java.beans.PropertyChangeListener)

getPropertyChangeListeners

public PropertyChangeListener[] getPropertyChangeListeners()
Returns an array of all the property change listeners registered on this component.

Returns:
all of this component's PropertyChangeListeners or an empty array if no property change listeners are currently registered
Since:
1.4
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener), removePropertyChangeListener(java.beans.PropertyChangeListener), getPropertyChangeListeners(String), PropertyChangeSupport.getPropertyChangeListeners()

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for a specific property.

Parameters:
propertyName - one of the property names listed above
listener - the PropertyChangeListener to be added
See Also:
removePropertyChangeListener(String,java.beans.PropertyChangeListener), getPropertyChangeListeners(String), addPropertyChangeListener(String,java.beans.PropertyChangeListener)

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName,
                                         PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list for a specific property. This method should be used to remove PropertyChangeListeners that were registered for a specific bound property.

If listener is null, no exception is thrown and no action is performed.

Parameters:
propertyName - a valid property name
listener - the PropertyChangeListener to be removed
See Also:
addPropertyChangeListener(String,java.beans.PropertyChangeListener), getPropertyChangeListeners(String), removePropertyChangeListener(java.beans.PropertyChangeListener)

getPropertyChangeListeners

public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
Returns an array of all the listeners which have been associated with the named property.

Parameters:
propertyName - the property name.
Returns:
all of the PropertyChangeListeners associated with the named property or an empty array if no listeners have been added
See Also:
addPropertyChangeListener(String,java.beans.PropertyChangeListener), removePropertyChangeListener(String,java.beans.PropertyChangeListener), getPropertyChangeListeners()

firePropertyChange

protected void firePropertyChange(String propertyName,
                                  Object oldValue,
                                  Object newValue)
Support for reporting bound property changes for Object properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.

Parameters:
propertyName - the property whose value has changed
oldValue - the property's previous value
newValue - the property's new value

firePropertyChange

protected void firePropertyChange(String propertyName,
                                  boolean oldValue,
                                  boolean newValue)
Support for reporting bound property changes for boolean properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.

Parameters:
propertyName - the property whose value has changed
oldValue - the property's previous value
newValue - the property's new value

firePropertyChange

protected void firePropertyChange(String propertyName,
                                  int oldValue,
                                  int newValue)
Support for reporting bound property changes for integer properties. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.

Parameters:
propertyName - the property whose value has changed
oldValue - the property's previous value
newValue - the property's new value

JIDE 3.5.15