bibliothek.extension.gui.dock.preference
Class PreferenceOperation

java.lang.Object
  extended by bibliothek.extension.gui.dock.preference.PreferenceOperation

public class PreferenceOperation
extends Object

Represents an operation that a PreferenceEditor or a PreferenceModel can execute, e.g. "reset value to default". This class does not contain any code to perform the operation, it just serves as key for the operation. The actual implementation is part of the editor or the model.

Author:
Benjamin Sigg

Field Summary
static PreferenceOperation DEFAULT
          Operation for setting a property to its default value
static PreferenceOperation DELETE
          Operation for deleting a property.
 
Constructor Summary
PreferenceOperation(String key)
          Creates a new operation.
PreferenceOperation(String key, Icon icon, String description)
          Creates a new operation.
 
Method Summary
 PreferenceOperationView create(PreferenceModel model)
          Creates and returns a view of this PreferenceOperation for model.
 boolean equals(Object obj)
           
 String getDescription()
          Gets a short human readable description of this operation.
 Icon getIcon()
          Gets an icon for this operation.
 String getIconId()
          Gets the current identifier for the icon of this operation.
 int hashCode()
           
 void setDescription(String description)
          Sets a human readable description of this operation.
 void setDescriptionId(String descriptionId)
          Sets the unique identifier of the description.
 void setIcon(Icon icon)
          Sets an icon for this operation.
 void setIconId(String iconId)
          Sets the identifier for the icon, the identifier will be used to read an icon from the IconManager.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DELETE

public static final PreferenceOperation DELETE
Operation for deleting a property.


DEFAULT

public static final PreferenceOperation DEFAULT
Operation for setting a property to its default value

Constructor Detail

PreferenceOperation

public PreferenceOperation(String key)
Creates a new operation.

Parameters:
key - the unique identifier of this operation

PreferenceOperation

public PreferenceOperation(String key,
                           Icon icon,
                           String description)
Creates a new operation.

Parameters:
key - the unique identifier of this operation
icon - an icon for this operation, should have a size of 10x10 pixels
description - a small description of this operation
Method Detail

create

public PreferenceOperationView create(PreferenceModel model)
Creates and returns a view of this PreferenceOperation for model.

Parameters:
model - the model using the operation
Returns:
the view

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getIcon

public Icon getIcon()
Gets an icon for this operation. The icon should have a size of 10x10 pixels.

Returns:
the icon for this operation

setIcon

public void setIcon(Icon icon)
Sets an icon for this operation. The icon should have a size of 10x10 pixels.

Parameters:
icon - the new icon, can be null

getIconId

public String getIconId()
Gets the current identifier for the icon of this operation.

Returns:
the identifier
See Also:
setIconId(String)

setIconId

public void setIconId(String iconId)
Sets the identifier for the icon, the identifier will be used to read an icon from the IconManager.

Parameters:
iconId - the new id, can not be null

getDescription

public String getDescription()
Gets a short human readable description of this operation.

Returns:
the short description

setDescriptionId

public void setDescriptionId(String descriptionId)
Sets the unique identifier of the description. The identifier is used to read a string from the TextManager.

Parameters:
descriptionId - the identifier, not null

setDescription

public void setDescription(String description)
Sets a human readable description of this operation.

Parameters:
description - the description