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
Since: Together 3.1
See Also: IdeInspectorComponent, Condition

Field Summary
 private final static StringDEFAULT_COMPONENT_NAME
           
 private static intmyComponentNameCount
           
 protected VectormyComponents
           
 protected VectormyConditions
           
 protected IdeContextmyContext
           
 protected doublemyMaxWeight
           
 private PropertyChangeSupportmyPropertyChangeSupport
           
 private IdeInspectorComponentmySelectedComponent
           
 private HashtablemyServices
           
 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.
 private voidcalculateVisibleComponents()
           
 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.
 private StringgenerateComponentName()
           
 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.
 booleanisVisible()
          Inspector will be updated if the method returns true.
 protected voidmarkComponentsToUpdate()
           
 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.
 voidsetSelectedComponent(Enumeration path)
          Sets selected a component whose name is equal to the first string in the
passed path.
 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.
 private voidupdateComponent(IdeInspectorComponent component, boolean inSeparateCommand)
          Updates component either in the separate command in the command thread or immediatly
 private voidupdateComponent(IdeInspectorComponent component)
          Performs update component stuff

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

DEFAULT_COMPONENT_NAME

private final static String DEFAULT_COMPONENT_NAME

myComponentNameCount

private static int myComponentNameCount

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

myPropertyChangeSupport

private PropertyChangeSupport myPropertyChangeSupport

mySelectedComponent

private IdeInspectorComponent mySelectedComponent

myServices

private Hashtable myServices

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

calculateVisibleComponents

private void calculateVisibleComponents()

clear

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

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

generateComponentName

private String generateComponentName()

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
Since:
Together 4.0

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

isVisible

public boolean isVisible()
Inspector will be updated if the method returns true.

markComponentsToUpdate

protected void markComponentsToUpdate()

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
Since:
Together 4.0

setSelectedComponent

public void setSelectedComponent(Enumeration path)
Sets selected a component whose name is equal to the first string in the
passed path. If this component happened to be compound one, calls the same
method in compound component passing the tile of the path. This allows
to setup active (currently visible) branch of the component tree.
Since:
5.5

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. Updates those components
that should be explicitly updated and marks all other as "needy in update" to perform lazy update later

updateComponent

private void updateComponent(IdeInspectorComponent component, boolean inSeparateCommand)
Updates component either in the separate command in the command thread or immediatly

updateComponent

private void updateComponent(IdeInspectorComponent component)
Performs update component stuff

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

to Class java.lang.String