com.togethersoft.openapi.ide.inspector
Class IdeInspector

java.lang.Object
  |
  +--java.beans.FeatureDescriptor
        |
        +--com.togethersoft.openapi.ide.inspector.IdeInspector

public class IdeInspector
extends FeatureDescriptor

Represents abstract inspector which is used to control properties of ide components. Inspector contains a number of IdeInspectorComponents to store the properties and other information about ide components. All inspector components are categorized into visible and non-visible by specifying visibility condition for each component. Inspector sorts all components by weights - double numbers, one for each inspector component. This numbers are double in order to insert any number of new inspector components between the existing ones.

Author:
TogetherSoft
See Also: IdeInspectorComponent, Condition

Field Summary
 protected VectormyComponents
           
 protected VectormyConditions
           
 protected IdeContextmyContext
           
 protected doublemyMaxWeight
           
 protected VectormyVisibleComponents
           
 protected VectormyWeights
           
 final static StringPROP_SELECTED_COMPONENT
           
 final static StringPROP_VISIBLE_COMPONENTS
           

Constructor Summary
IdeInspector(IdeContext context)
           Creates new inspector for specified context.

Method Summary
 voidaddComponent(IdeInspectorComponent component, Condition condition)
           Adds new component to this inspector and sets it's weight for to be greater by one than the maximum weight.
 voidaddComponent(IdeInspectorComponent component, Condition condition, double weight)
           Adds new component with the specified visibility condition and weight.
 voidaddPropertyChangeListener(PropertyChangeListener listener)
           Adds new listener of property change event.
 voidclear()
           Clears this inspector, that is removes all components, visibility conditions and weights.
 IdeInspectorComponentfindComponent(String name)
           Seeks for the component specified by it's name.
 protected voidfirePropertyChange(String propertyName, Object oldValue, Object newValue)
           Initiates change of the specified property.
 IdeInspectorComponent[]getComponents()
           Returns components of this inspector .
 ConditiongetCondition(IdeInspectorComponent component)
           Returns condition of visibility for the specified inspector component.
 IdeInspectorComponentgetSelectedComponent()
           Returns visually selected component.
 ObjectgetService(Class clazz)
           Returns Object that provides a service for this inspector.
 IdeInspectorComponent[]getVisibleComponents()
           Returns visible inspector components.
 doublegetWeight(IdeInspectorComponent component)
           Returns the weight for the specified inspector component.
 voidremoveComponent(IdeInspectorComponent component)
           Removes specified component, it's visibility condition and weight.
 voidremovePropertyChangeListener(PropertyChangeListener listener)
           Removes specified listener of property change event.
 voidsetSelectedComponent(IdeInspectorComponent component)
           Sets visually selected component and fires change of the property PROP_SELECTED_COMPONENT.
 voidsetService(Class clazz, Object service)
           Adds new service for this inspector.
 voidupdate()
           Rebuildes the list of visible components, re-calculates their weights and fires the change of PROP_VISIBLE_COMPONENTS property.

Methods inherited from class java.beans.FeatureDescriptor
getName, setName, getDisplayName, setDisplayName, isExpert, setExpert, isHidden, setHidden, isPreferred, setPreferred, getShortDescription, setShortDescription, setValue, getValue, attributeNames

Methods inherited from class java.lang.Object
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize

Field Detail

myComponents

protected Vector myComponents
associates
clientCardinality 1..*
label getComponents()
link aggregation

myConditions

protected Vector myConditions
associates
clientCardinality 1..*

myContext

protected IdeContext myContext

myMaxWeight

protected double myMaxWeight

myVisibleComponents

protected Vector myVisibleComponents
associates
clientCardinality 1..*
label getVisibleComponents()

myWeights

protected Vector myWeights

PROP_SELECTED_COMPONENT

public final static String PROP_SELECTED_COMPONENT

PROP_VISIBLE_COMPONENTS

public final static String PROP_VISIBLE_COMPONENTS
Constructor Detail

IdeInspector

public IdeInspector(IdeContext context)
Creates new inspector for specified context.
Parameters:
context - IdeContext for which teh new inspector is created
Method Detail

addComponent

public void addComponent(IdeInspectorComponent component, Condition condition)
Adds new component to this inspector and sets it's weight for to be greater by one than the maximum weight.
Parameters:
component - IdeInspectorComponent to be added
condition - Condition of Visibility for this component

addComponent

public void addComponent(IdeInspectorComponent component, Condition condition, double weight)
Adds new component with the specified visibility condition and weight.
Parameters:
component - IdeInspectorComponent to be added
condition - Condition of Visibility for this component
weight - double weight for this component to inserted between the existing ones

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds new listener of property change event.
Parameters:
listener - PropertyChangeListener object that listens to the property change event

clear

public void clear()
Clears this inspector, that is removes all components, visibility conditions and weights.

findComponent

public IdeInspectorComponent findComponent(String name)
Seeks for the component specified by it's name.
Parameters:
name - String name of the component
Returns: IdeInspectorComponent if found, null otherwise

firePropertyChange

protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
Initiates change of the specified property.
Parameters:
propertyName - String name of the property to be changed
oldValue - Object initial value of this property
newValue - Object to be assigned to this property

getComponents

public IdeInspectorComponent[] getComponents()
Returns components of this inspector .
Returns: IdeInspectorComponent[] Array of inspector components

getCondition

public Condition getCondition(IdeInspectorComponent component)
Returns condition of visibility for the specified inspector component.
Parameters:
component - IdeInspectorComponent whose visibility condition is to be obtained
Returns: Condition of visibility for the specified component
Throws:
IllegalArgumentException

getSelectedComponent

public IdeInspectorComponent getSelectedComponent()
Returns visually selected component.
Returns: IdeInspectorComponent object

getService

public Object getService(Class clazz)
Returns Object that provides a service for this inspector. In the HashTable of services the key for the service object is the class of this object.
Parameters:
clazz - Class that defines the key for the service
Returns: Object that provides the service

getVisibleComponents

public IdeInspectorComponent[] getVisibleComponents()
Returns visible inspector components.
Returns: IdeInspectorComponent[] Array of visible components

getWeight

public double getWeight(IdeInspectorComponent component)
Returns the weight for the specified inspector component.
Parameters:
component - IdeInspectorComponent whose weight is to be obtained
Returns: double Weight for this inspector component.
Throws:
IllegalArgumentException

removeComponent

public void removeComponent(IdeInspectorComponent component)
Removes specified component, it's visibility condition and weight. If this component has maximum weight, then recalculates maximum weight.
Parameters:
component - IdeInspectorComponent to be removed

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes specified listener of property change event.
Parameters:
listener - PropertyChangeListener object that listens to the property change event

setSelectedComponent

public void setSelectedComponent(IdeInspectorComponent component)
Sets visually selected component and fires change of the property PROP_SELECTED_COMPONENT.
Parameters:
component - IdeInspectorComponent

setService

public void setService(Class clazz, Object service)
Adds new service for this inspector.
Parameters:
clazz - Class that provides the service
service - Object instance of this class.

update

public void update()
Rebuildes the list of visible components, re-calculates their weights and fires the change of PROP_VISIBLE_COMPONENTS property. Then updates all visible components.

Association Links

to Class java.lang.String

to Class java.lang.String

to Class com.togethersoft.openapi.ide.IdeContext

to Class com.togethersoft.openapi.ide.inspector.IdeInspectorComponent

Label getVisibleComponents()
Client Cardinality 1..*
associates

to Class com.togethersoft.openapi.ide.inspector.IdeInspectorComponent

Label getComponents()
Client Cardinality 1..*
Type aggregation
associates

to Class com.togethersoft.openapi.ide.inspector.Condition

Client Cardinality 1..*
associates

to Class java.util.Vector

to Class java.beans.PropertyChangeSupport

to Class java.util.Hashtable

to Class com.togethersoft.openapi.ide.inspector.IdeInspectorComponent