Revision 3254

org.pathvisio.gui.swing.propertypanel
Class PropertyDisplayManager

java.lang.Object
  extended by org.pathvisio.gui.swing.propertypanel.PropertyDisplayManager

public class PropertyDisplayManager
extends java.lang.Object

This class manages how properties should be displayed. It keeps track of TypeHandlers, which properties should be visible, and the order in which properties should be displayed.

The main entry point for plugins are registerProperty(Property) and registerTypeHandler(TypeHandler).

Author:
Mark Woon

Nested Class Summary
static class PropertyDisplayManager.PropPreference
          Preference for property display information.
 
Method Summary
static Property getDynamicProperty(java.lang.String key)
           
static int getPropertyOrder(Property prop)
          Gets the order of the given Property.
static java.util.EnumSet<ObjectType> getPropertyScope(Property prop)
          Get the scope of a property (defines on which object types it should apply).
static TypeHandler getTypeHandler(PropertyType type)
          Gets the TypeHandler for the given PropertyType.
static java.util.Set<java.lang.Object> getVisiblePropertyKeys(PathwayElement e)
          Gets the visible property keys for the given PathwayElement.
static boolean isStorePreferences()
          Gets whether visibility and order of properties is stored as a preference.
static boolean isVisible(Property prop)
          Gets whether the given Property should be visible.
static void registerProperty(Property prop)
          Register a property here.
static void registerProperty(Property prop, boolean manage)
          Register a property here.
static boolean registerTypeHandler(TypeHandler handler)
          Registers a TypeHandler.
static void setPropertyOrder(Property prop, java.lang.Integer order)
          Sets the order of the given Property.
static void setPropertyScope(Property prop, java.util.EnumSet<ObjectType> types)
          Set the scope of a dynamic property (on which object types it applies).
static void setStorePreferences(boolean storePreferences)
          Sets whether visibility and order of properties is stored as a preference.
static void setVisible(Property prop, boolean isVisible)
          Sets whether the given Property should be visible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getVisiblePropertyKeys

public static java.util.Set<java.lang.Object> getVisiblePropertyKeys(PathwayElement e)
Gets the visible property keys for the given PathwayElement.


getTypeHandler

public static TypeHandler getTypeHandler(PropertyType type)
Gets the TypeHandler for the given PropertyType.

Returns:
the TypeHandler for the given PropertyType or null if none exists

registerTypeHandler

public static boolean registerTypeHandler(TypeHandler handler)
Registers a TypeHandler.

Returns:
true if no other TypeHandler has been registered for the given PropertyType, false otherwise

registerProperty

public static void registerProperty(Property prop)
Register a property here.

Dynamic properties will automatically be managed by the display manager, which means that the property will be editable from the property panel (for all object types by default, see setPropertyScope(Property, EnumSet) to customize this behavior). Note that the property is not saved to GPML unless the property is modified.


registerProperty

public static void registerProperty(Property prop,
                                    boolean manage)
Register a property here.

Dynamic properties will only be managed by the display manager if manage is set to true. When the display manager manages a property, it means that the property will be editable from the property panel (for all object types by default, see setPropertyScope(Property, EnumSet) to customize this behavior). Note that the property is not saved to GPML unless the property is modified.

Parameters:
prop - the Property being registered
manage - true if the display manager should manage this property, false if not

setPropertyScope

public static void setPropertyScope(Property prop,
                                    java.util.EnumSet<ObjectType> types)
Set the scope of a dynamic property (on which object types it applies). The property panel will only display the property editor for the given object types.

Parameters:
prop - The property this scope applies to.
types - The object types that define the scope of this property. If null is supplied as value, the property will be displayed on all object types (default behavior).

getPropertyScope

public static java.util.EnumSet<ObjectType> getPropertyScope(Property prop)
Get the scope of a property (defines on which object types it should apply).

Returns:
The set of object types that this property applies to or null if the property has no specific scope (and should apply to all object types).

getDynamicProperty

public static Property getDynamicProperty(java.lang.String key)

getPropertyOrder

public static int getPropertyOrder(Property prop)
Gets the order of the given Property. If not is found, Integer.MAX_VALUE is returned.


setPropertyOrder

public static void setPropertyOrder(Property prop,
                                    java.lang.Integer order)
Sets the order of the given Property.


isVisible

public static boolean isVisible(Property prop)
Gets whether the given Property should be visible. Default is visible.


setVisible

public static void setVisible(Property prop,
                              boolean isVisible)
Sets whether the given Property should be visible.


isStorePreferences

public static boolean isStorePreferences()
Gets whether visibility and order of properties is stored as a preference.


setStorePreferences

public static void setStorePreferences(boolean storePreferences)
Sets whether visibility and order of properties is stored as a preference.


Generated July 29 2010