com.dat.cx
Class CxComponent

java.lang.Object
  |
  +--com.dat.cx.CxComponent
All Implemented Interfaces:
CxExtendsListener, java.util.EventListener, com.d_a_t.expeval.ExpressionContext
Direct Known Subclasses:
CxAttribute, CxAttributeInstance, CxCompositeComponent, CxConfiguration, CxPackage, CxPlaceHolder, CxPort, CxProject, CxProperty, CxRoot, CxTextInstance, CxTypePackage, CxVar, CxVarInstance, CxVarSet, CxWire

public class CxComponent
extends java.lang.Object
implements CxExtendsListener, com.d_a_t.expeval.ExpressionContext

CxComponent provides base definition of all components in the cx framework, all cx components are subclasses of CxComponent.


Field Summary
static int compactDisplay
           
static int noHatDisplay
           
static int standardDisplay
           
 
Constructor Summary
CxComponent()
           
 
Method Summary
 void activate()
          Activate the component.
 void addChild(CxComponent child)
          Add a component as a child
 void addChildAt(CxComponent child, int at)
          Add a component as a child at a specific Z position
 void addChildAtNoUndo(CxComponent child, int at)
          Add a component as a child at a specific Z position
 void addChildNoUndo(CxComponent child)
          Add a component as a child
 void addChildNoUndoAssign(CxComponent child)
          Add a component as a child
 void addComponentChangeListener(CxComponentChangeListener listener)
          Add a component change listener to the list of listeners.
 void addComponentChildrenListener(CxComponentChildrenListener listener)
          Add a component children listener to the list of listeners.
 void addExtendsListener(CxExtendsListener listener)
          Add an extends listener to the list of listeners.
 void addSortedChild(CxComponent child)
           
 boolean canAddComponent(CxExtendsCanAddEvent event)
          Test if a component can be added by the name specified in the received event
 boolean canExtendsAdd(java.lang.String path, java.lang.String childName)
          Ask all registered listeners if they can add a child by a given name
 void componentAdded(CxExtendsAddEvent event)
          Receive an CxExtendsAddEvent when a component from which this component is extended has added a descendent component.
 void componentLocationChanged(CxExtendsLocationChangeEvent event)
          Receive an CxExtendsLocationChangeEvent when a component from which this component is extended has a child whose location has been changed.
 void componentNameChanged(CxExtendsNameChangeEvent event)
          Receive an CxExtendsNameChangeEvent when a component from which this component is extended has changed its name or the name of any of its contained components.
 void componentNodeChanged(CxExtendsNodeChangeEvent event)
          Recieve a CxExtendsNodeChangeEvent whenever an extends from component or any of its decendents has a change in a node value.
 void componentPropertyChanged(CxExtendsPropertyChangeEvent event)
          Receive an CxExtendsPropertyChangeEvent when a component from which this component is extended has changed a property value for it or any contained properties.
 void componentRemoved(CxExtendsRemoveEvent event)
          Receive an CxExtendsRemoveEvent when a component from which this component is extended has removed a descendent component.
 void componentWirePortChanged(CxExtendsWirePortChangeEvent event)
          Receive an CxExtendsWirePortChangeEvent when a wire from which this component is extended has changed a port assignment.
static com.dat.cx.Node constructNode(java.lang.String element, java.lang.String text)
          Construct a simple XML document to wrap a string.
 boolean contains(CxComponent descendent)
          Determine if a component has a decendent of this component
 void deactivate()
          Deactivate the component.
 void decrUnresolved()
          Decrement unresolve component count
 XSet export(XSet doc, CxProject project)
          Export the definition of this component (only this component)
 void exportContent(XSet doc, CxProject project)
          Export configuration content from non-cx xml file.
 void exportInfo(com.dat.cx.exec.CxExecComponentInfo info)
          Export the definition of the component into a java serializable object.
 CxComponent findPath(java.lang.String path)
          Find a component by qualified relative path.
 CxComponent findPath(java.lang.String path, boolean searchParent)
          Find a component by qualified relative path
 CxComponent getBaseType()
          Get the base type of the component.
 CxComponent getChild(int i)
          Get the ith child component
 CxComponent getChild(java.lang.String childName)
          Get a child given its name
 java.util.Enumeration getChildren()
          Get an enumeration of the children
 java.lang.String getClassClause()
          Get the class clause
 CxConfiguration getConfig(java.lang.String name)
          Get a configuration given its name
 java.lang.String getConfigValue(java.lang.String name)
          Get a configuration value given its name
 java.lang.String getConfigValue(java.lang.String name, boolean delegate)
          Get a configuration value given its name
 java.lang.String getDataPath(CxComponent varRoot)
          Get the data path of a component relative to an ancestor
 CxDataPort getDataPort(java.lang.String dataPath, boolean portDirection)
          Get a data port given is logical path and direction
 com.dat.cx.studio.CxCompDisplay getDisplay()
          Get the display peer for this component.
 int getDisplayStyle()
          Get the display style
 com.dat.cx.studio.CxInternalFrame getEditFrame(com.dat.cx.studio.CxStudio studio)
          Get at edit frame for editing this component.
 CxComponent getExtendsFrom()
          Get the extends from component
 java.util.Enumeration getExtendsListeners()
          Get the list of extends listners
 java.lang.String getIcon()
          Get the icon file name for this component
 javax.swing.ImageIcon getImageIcon()
          Get the icon image for icon of this component
 int getIndexOfChild(java.lang.Object child)
          Get the index of a child
 com.dat.cx.exec.CxExecComponentInfo getInfo()
          Get the defintion of this component into a serializable java object so that is can be sent to a client console.
 java.lang.String getName()
          Get the name of the component
 java.lang.String getNameInAncestor(CxComponent ancestor)
          Get the path name of a component relative to an ancestor
 java.lang.String getNameInContext()
          Get the full name of a component within the current component tree
 CxComponent getNextChildTo(CxComponent child)
          Get a the next child relative to a given child
 int getNoChildren()
          Get the number of child components
 CxProject getOwnerProject()
          Get the project that owns this component
 CxComponent getPackage()
           
 CxComponent getPackage(CxComponent component)
           
 CxComponent getParent()
          Get the components parent component
 CxPort getPort(java.lang.String name)
          Get a port given its name
 java.lang.String[] getPropertyNames()
          Get all property names
 java.lang.String[] getPropertyValues(java.lang.String[] propertyNames)
          Get property values for a set of property names
 CxComponent getRoot()
          Get the root ancestor component
 java.util.Enumeration getRzChildren()
          Get an enumeration of the children in reverse order
 java.util.Enumeration getRzSortedChildren()
           
 CxComponent getSortedChild(int i)
           
 java.util.Enumeration getSortedChildren()
           
 int getSortedIndexOfChild(java.lang.Object child)
           
 com.dat.cx.console.CxConsoleInternalFrame getViewFrame(com.dat.cx.console.CxConsole console)
          Get at edit frame for editing this component.
 int getX()
          Get the x coordinate
 int getXmlType()
          Get the xml type of this component
 int getY()
          Get the y coordinate
static void handleException(java.lang.Throwable t)
           
 boolean hasChild(CxComponent child)
          Determine if a component has a specific child
 boolean hasChild(java.lang.String childName)
          Determine if a component has a specific child by name
 boolean hasChildren()
          Determine if a component has children
 boolean hasDisplay()
          Determine if this component has a display peer.
 boolean hasOverride()
          Determine if the inherited component has an override.
 boolean hasProperties()
          Determine if the component has any properties
 void importContent(XSet doc)
          Import configuration content from non-cx xml file.
 void importInfo(com.dat.cx.exec.CxExecComponentInfo info)
          Import the definition of the component from a java serializable object.
 java.util.Vector importSpec(XSet spec)
          Import specification from an XML element
 void importTemplate(CxComponent from, boolean copy, boolean inherit, boolean inverse)
          Import the definition of a component from another component.
 void incrUnresolved()
          Increment unresolve component count
 void init()
          init is called after a CxComponent is added to the component tree in the GUI by an editor.
 CxComponent instantiateChildComponent(java.lang.String className, java.lang.String childName)
          Instantiate a new child component given as a clone of another component.
 CxComponent instantiateChildComponentAt(java.lang.String className, java.lang.String childName, CxPlaceHolder placeHolder)
          Instantiate a new child component given its class name replacing a place holder.
 boolean isActive()
          Determine if the component is currently active.
 boolean isAttribute()
          Determines if the component is an attribute
 boolean isAttributeInstance()
          Determines if the component is an attribute instance
 boolean isBaseProperty()
          Determines if the component is a base property (component defined)
 boolean isCompositeComponent()
          Determines if the component is a composite component
 boolean isConfiguration()
          Determines if the component is a configuration property
 boolean isContentComponent()
          Determines if the component is a content component, ie a component contained in a composite component that is not a port or interface.
 boolean isDataMgr()
          Determines if the component is a data manager
 boolean isDataPort()
          Determines if the component is a data port
 boolean isErrorCatchPort()
          Determines if the component is an error or catch port
 boolean isExtendable()
          Determine if the component can be used in an extends clause.
 boolean isExtended()
           
 boolean isInherited()
          Determine if the component is inherited as part of an extends clause.
 boolean isInterface()
          Determines if the component is a interface
 boolean isLibraryComponent()
          Determines if the component is a liberary component
 boolean isMiniPort()
          Determines if the component is a mini port
 boolean isName()
          Determines if the component is a name
 boolean isNative()
          Determine if the component is a native java component, ie defined by java code.
 boolean isPackage()
          Determines if the component is a package
 boolean isPalette()
          Determines if the component is a palette
 boolean isPin()
          Determines if the component is a pin
 boolean isPort()
          Determines if the component is a port
 boolean isPortMgr()
          Determines if the component is a port manager
 boolean isProperty()
          Determines if the component is a property
 boolean isRoot()
          Determines if the component is the root
 boolean isSubPortOf(CxComponent comp)
           
 boolean isTextInstance()
          Determines if the component is a text instance
 boolean isTypePackage()
          Determines if the component is a type package
 boolean isVar()
          Determines if the component is a variable
 boolean isVarInstance()
          Determines if the component is a variable instance
 boolean isVarSet()
          Determines if the component is a variable
 boolean isWire()
          Determines if the component is a wire
 boolean isXmlPort()
          Determines if the component is an xml port
 boolean isXmlPrimative()
          Determines if the component is of an XML primative type (ie content type String, Integer etc.)
 boolean isXmlString()
          Determines if the component is of an XML String type
 com.dat.cx.exec.CxExecComponentInfo makeInfo()
          Make an empty serializable object to hold the components definition.
 boolean omitExport(CxComponent child)
          Indicate if the specified child is not to be processed by the Cx file export processor.
 void removeChild(CxComponent child)
          Remove a component from the list of children
 void removeChild(int i)
          Remove the ith child from the list of children
 void removeChildNoUndo(CxComponent child)
          Remove a component from the list of children
 void removeComponentChangeListener(CxComponentChangeListener listener)
          Remove a component change listener to the list of listeners.
 void removeComponentChildrenListener(CxComponentChildrenListener listener)
          Remove a component children listener to the list of listeners.
 void removeExtendsListener(CxExtendsListener listener)
          Remove an extends listener to the list of listeners.
 void renameSortedChild()
           
 java.lang.Class resolveClass(java.lang.String identifier)
          Returns the Class object identified by "identifier" or null if none exists.
 com.d_a_t.expeval.EEConstructor resolveConstructor(java.lang.Class constructorClass, java.lang.Class[] parameterTypes)
          Returns the EEConstruct object identified by "identifier" and the parameter type list or null if none exists.
 com.d_a_t.expeval.EEField resolveField(java.lang.String identifier)
          Returns the EEField object identified by "identifier" or null if none exists.
 com.d_a_t.expeval.EEMethod resolveMethod(java.lang.String identifier, java.lang.Class[] parameterTypes)
          Returns the EEMethod object identified by "identifier" and the parameter type list or null if none exists.
 void setClassClause(java.lang.String classClause)
          Set the class clause
 void setComponentDefinitionServer(com.dat.cx.exec.CxExecInterface componentServer)
          Set the component definition server.
 void setDisplayStyle(int displayStyle)
          Set the display style
 void setDisplayStyleFromInfo(int displayStyle)
          Set the display style
 void setExtendsFrom(CxComponent extendsFrom)
          Set the extends from component
 void setInherited()
          Set the component as inherited.
 void setLocation(java.awt.Point newLocation)
          Set the location
 void setLocationNoUndo(java.awt.Point newLocation)
          Set the location
 void setName(java.lang.String name)
          Set the component
 void setNameNoTrigger(java.lang.String name)
          Set the component without triggering listeners
 void setNameNoUndo(java.lang.String name)
          Set the component
 void setNative()
          Set the component as native.
 void setOwnerProject(CxProject project)
          Set the project that owns this component
 void setParent(CxComponent parent)
          Set the parent of this component
 void setPropertyValues(java.lang.String[] propertyNames, java.lang.String[] propertyValues)
          Set property values
 void setX(int x)
          Set the x coordinate
 void setY(int y)
          Set the y coordinate
 java.lang.String toString()
          Get string representation
 void triggerExtendsNodeChanged(java.lang.String path, java.lang.String nodeName, com.dat.cx.Node oldNodeValue, com.dat.cx.Node newNodeValue)
          Send an extends node value changed event to all registered listeners
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

standardDisplay

public static final int standardDisplay

noHatDisplay

public static final int noHatDisplay

compactDisplay

public static final int compactDisplay
Constructor Detail

CxComponent

public CxComponent()
Method Detail

isRoot

public boolean isRoot()
Determines if the component is the root
Returns:
true if the component is the root, otherwise false

isWire

public boolean isWire()
Determines if the component is a wire
Returns:
true if the component is a wire, otherwise false

isPort

public boolean isPort()
Determines if the component is a port
Returns:
true if the component is a port, otherwise false

isPin

public boolean isPin()
Determines if the component is a pin
Returns:
true if the component is a pin, otherwise false

isDataPort

public boolean isDataPort()
Determines if the component is a data port
Returns:
true if the component is a data port, otherwise false

isXmlPort

public boolean isXmlPort()
Determines if the component is an xml port
Returns:
true if the component is an xml port, otherwise false

isMiniPort

public boolean isMiniPort()
Determines if the component is a mini port
Returns:
true if the component is a mini port, otherwise false

isErrorCatchPort

public boolean isErrorCatchPort()
Determines if the component is an error or catch port
Returns:
true if the component is an error or catch port, otherwise false

isInterface

public boolean isInterface()
Determines if the component is a interface
Returns:
true if the component is a interface, otherwise false

isProperty

public boolean isProperty()
Determines if the component is a property
Returns:
true if the component is a property, otherwise false

isBaseProperty

public boolean isBaseProperty()
Determines if the component is a base property (component defined)
Returns:
true if the component is a base property, otherwise false

isName

public boolean isName()
Determines if the component is a name
Returns:
true if the component is a name, otherwise false

isPackage

public boolean isPackage()
Determines if the component is a package
Returns:
true if the component is a package, otherwise false

isPalette

public boolean isPalette()
Determines if the component is a palette
Returns:
true if the component is a palette, otherwise false

isTypePackage

public boolean isTypePackage()
Determines if the component is a type package
Returns:
true if the component is a type package, otherwise false

isLibraryComponent

public boolean isLibraryComponent()
Determines if the component is a liberary component
Returns:
true if the component is a liberary component, otherwise false

isCompositeComponent

public boolean isCompositeComponent()
Determines if the component is a composite component
Returns:
true if the component is a composite component, otherwise false

isContentComponent

public boolean isContentComponent()
Determines if the component is a content component, ie a component contained in a composite component that is not a port or interface.
Returns:
true if the component is a composite component, otherwise false

isVar

public boolean isVar()
Determines if the component is a variable
Returns:
true if the component is a variable , otherwise false

isVarSet

public boolean isVarSet()
Determines if the component is a variable
Returns:
true if the component is a variable set, otherwise false

isAttribute

public boolean isAttribute()
Determines if the component is an attribute
Returns:
true if the component is an attribute, otherwise false

isVarInstance

public boolean isVarInstance()
Determines if the component is a variable instance
Returns:
true if the component is a variable instance, otherwise false

isAttributeInstance

public boolean isAttributeInstance()
Determines if the component is an attribute instance
Returns:
true if the component is an attribute instance, otherwise false

isTextInstance

public boolean isTextInstance()
Determines if the component is a text instance
Returns:
true if the component is a text instance, otherwise false

isDataMgr

public boolean isDataMgr()
Determines if the component is a data manager
Returns:
true if the component is a data manager, otherwise false

isPortMgr

public boolean isPortMgr()
Determines if the component is a port manager
Returns:
true if the component is a port manager, otherwise false

isConfiguration

public boolean isConfiguration()
Determines if the component is a configuration property
Returns:
true if the component is a configuration property, otherwise false

isXmlPrimative

public boolean isXmlPrimative()
Determines if the component is of an XML primative type (ie content type String, Integer etc.)
Returns:
true if the component is of an XML primative type, otherwise false

isXmlString

public boolean isXmlString()
Determines if the component is of an XML String type
Returns:
true if the component is of an XML primative type, otherwise false

getXmlType

public int getXmlType()
Get the xml type of this component
Returns:
the xml type, if the component is not of an xml type, returns CxXmlTypes.INVALID

getOwnerProject

public CxProject getOwnerProject()
Get the project that owns this component
Returns:
the project that owns this component

setOwnerProject

public void setOwnerProject(CxProject project)
Set the project that owns this component
Parameters:
project - the project that owns this component

getName

public java.lang.String getName()
Get the name of the component
Returns:
name the name of the component

setName

public void setName(java.lang.String name)
Set the component
Parameters:
name - the new name for the component

setNameNoUndo

public void setNameNoUndo(java.lang.String name)
Set the component
Parameters:
name - the new name for the component

setNameNoTrigger

public void setNameNoTrigger(java.lang.String name)
Set the component without triggering listeners
Parameters:
name - the new name for the component

getNameInContext

public java.lang.String getNameInContext()
Get the full name of a component within the current component tree
Returns:
the full path name of the component

getNameInAncestor

public java.lang.String getNameInAncestor(CxComponent ancestor)
Get the path name of a component relative to an ancestor
Parameters:
ancestor - some component that is an ancestor of this component
Returns:
the path name from the ancestor to the component

isSubPortOf

public boolean isSubPortOf(CxComponent comp)

getDataPath

public java.lang.String getDataPath(CxComponent varRoot)
Get the data path of a component relative to an ancestor
Parameters:
varRoot - some component that is a root variable of this component
Returns:
the dataPath name from the varRoot to the component

getEditFrame

public com.dat.cx.studio.CxInternalFrame getEditFrame(com.dat.cx.studio.CxStudio studio)
Get at edit frame for editing this component.
Returns:
the edit frame

getViewFrame

public com.dat.cx.console.CxConsoleInternalFrame getViewFrame(com.dat.cx.console.CxConsole console)
Get at edit frame for editing this component.
Returns:
the edit frame

getDisplay

public com.dat.cx.studio.CxCompDisplay getDisplay()
Get the display peer for this component. The display peer handles the rendering of the component within the studio.
Returns:
the display peer

hasDisplay

public boolean hasDisplay()
Determine if this component has a display peer.
Returns:
true if the component has a display peer, otherwise false

instantiateChildComponent

public CxComponent instantiateChildComponent(java.lang.String className,
                                             java.lang.String childName)
Instantiate a new child component given as a clone of another component. Component is assigned the specified name and is added to the list of children.
Parameters:
className - the java class name string
childName - the name to assign the new component
Returns:
the new component

instantiateChildComponentAt

public CxComponent instantiateChildComponentAt(java.lang.String className,
                                               java.lang.String childName,
                                               CxPlaceHolder placeHolder)
Instantiate a new child component given its class name replacing a place holder. Component is assigned the specified name and added to the list of children at the place holder location.
Parameters:
className - the java class name string
childName - the name to assign the new component
Returns:
the new component

addChildNoUndo

public void addChildNoUndo(CxComponent child)
Add a component as a child
Parameters:
child - the component to be added as a child

addChildNoUndoAssign

public void addChildNoUndoAssign(CxComponent child)
Add a component as a child
Parameters:
child - the component to be added as a child

addChild

public void addChild(CxComponent child)
Add a component as a child
Parameters:
child - the component to be added as a child

addChildAtNoUndo

public void addChildAtNoUndo(CxComponent child,
                             int at)
Add a component as a child at a specific Z position
Parameters:
child - the component to be added as a child

addChildAt

public void addChildAt(CxComponent child,
                       int at)
Add a component as a child at a specific Z position
Parameters:
child - the component to be added as a child

getChildren

public java.util.Enumeration getChildren()
Get an enumeration of the children
Returns:
an enumeration of all children

getSortedChildren

public java.util.Enumeration getSortedChildren()

getRzChildren

public java.util.Enumeration getRzChildren()
Get an enumeration of the children in reverse order
Returns:
an enumeration of all children

getRzSortedChildren

public java.util.Enumeration getRzSortedChildren()

getChild

public CxComponent getChild(int i)
Get the ith child component
Parameters:
i - the index of the desired child
Returns:
the ith child

getSortedChild

public CxComponent getSortedChild(int i)

getIndexOfChild

public int getIndexOfChild(java.lang.Object child)
Get the index of a child
Returns:
the index of the child beginning with 0, -1 if not found

getSortedIndexOfChild

public int getSortedIndexOfChild(java.lang.Object child)

hasChild

public boolean hasChild(CxComponent child)
Determine if a component has a specific child
Parameters:
child - component to be tested as a child
Returns:
true if the component is a child, otherwise false

contains

public boolean contains(CxComponent descendent)
Determine if a component has a decendent of this component
Parameters:
decendent - component to be tested
Returns:
true if the decendent component is a descendent of this component, otherwise false

hasChild

public boolean hasChild(java.lang.String childName)
Determine if a component has a specific child by name
Parameters:
childName - name of the child
Returns:
true if a child by the given name exists, otherwise false

hasChildren

public boolean hasChildren()
Determine if a component has children
Returns:
true if the component is a children, otherwise false

getNoChildren

public int getNoChildren()
Get the number of child components
Returns:
number of child components

removeChild

public void removeChild(CxComponent child)
Remove a component from the list of children
Parameters:
child - the component to be removed

removeChildNoUndo

public void removeChildNoUndo(CxComponent child)
Remove a component from the list of children
Parameters:
child - the component to be removed

removeChild

public void removeChild(int i)
Remove the ith child from the list of children
Parameters:
i - the index of the child to be removed

getChild

public CxComponent getChild(java.lang.String childName)
Get a child given its name
Parameters:
childName - the name of the child

getNextChildTo

public CxComponent getNextChildTo(CxComponent child)
Get a the next child relative to a given child
Parameters:
child - the relative child

findPath

public CxComponent findPath(java.lang.String path)
Find a component by qualified relative path. Note this will NOT search the parent scope.
Parameters:
path - path name to the desire component either relative to this component or relative to the root component (ie begins with "/")
Returns:
the found component, if not found return null
See Also:
findPath

findPath

public CxComponent findPath(java.lang.String path,
                            boolean searchParent)
Find a component by qualified relative path
Parameters:
path - path name to the desire component either relative to this component or relative to the root component (ie begins with "/")
searchParent - searches parent for symbol if not found within scope
Returns:
the found component, if not found return null

getRoot

public CxComponent getRoot()
Get the root ancestor component
Returns:
the root component

getParent

public CxComponent getParent()
Get the components parent component
Returns:
the parent component

setParent

public void setParent(CxComponent parent)
Set the parent of this component
Parameters:
parent - the new parent component

getExtendsFrom

public CxComponent getExtendsFrom()
Get the extends from component
Returns:
the extends from component

setExtendsFrom

public void setExtendsFrom(CxComponent extendsFrom)
Set the extends from component
Parameters:
extendsFrom - the extends from component

getBaseType

public CxComponent getBaseType()
Get the base type of the component. The base type of a component is derived by unravelling the applied extends back to the component root.
Returns:
the extends from component

importTemplate

public void importTemplate(CxComponent from,
                           boolean copy,
                           boolean inherit,
                           boolean inverse)
Import the definition of a component from another component. For composite components this will result in instantiating new child components for each of the children of the from component and importing their definition recursively. Note: special handing is provided by each subclass, CxPort, CxInterface, CxProperty, CxLibraryComponent, etc.
Parameters:
from - the component from which to import a definition
copy - indicate that this is a copy 'vs' extends
inherit - indicate that the definition is inherited as part of an extends
inverse - indicate that polarity is to be inversed (see CxPort and CxInterface)

importSpec

public java.util.Vector importSpec(XSet spec)
Import specification from an XML element
Parameters:
spec - the xml element containing the specification
Returns:
Vector of exception nodes, DOM nodes that have been processed as part of this import and should not be processed by the component factory

export

public XSet export(XSet doc,
                   CxProject project)
Export the definition of this component (only this component)
Parameters:
doc - the XSet document being constructed. The definition is added to this document
Returns:
the XSet document relative to the new definition

omitExport

public boolean omitExport(CxComponent child)
Indicate if the specified child is not to be processed by the Cx file export processor.
Parameters:
child - the child in question

importContent

public void importContent(XSet doc)
Import configuration content from non-cx xml file. See CxXslFileFilter for example of use.
Parameters:
doc - document containing the configuration info.

exportContent

public void exportContent(XSet doc,
                          CxProject project)
Export configuration content from non-cx xml file. See CxXslFileFilter for example of use.
Parameters:
doc - document where configuration information is to be placed.

hasOverride

public boolean hasOverride()
Determine if the inherited component has an override. That is a property or x/y that is different from the component it was extended from
Returns:
true if the component has an override, otherwise false

isExtendable

public boolean isExtendable()
Determine if the component can be used in an extends clause. A component can be used in an extends clause only if it has no unresolved children.

incrUnresolved

public void incrUnresolved()
Increment unresolve component count

decrUnresolved

public void decrUnresolved()
Decrement unresolve component count

isInherited

public boolean isInherited()
Determine if the component is inherited as part of an extends clause.
Returns:
true if the component is inherited, false otherwise

setInherited

public void setInherited()
Set the component as inherited. This is used only by CxLibrarayComponent to indicate that ports and properties defined by the native class are to be treated as if inherited through an extends.

isNative

public boolean isNative()
Determine if the component is a native java component, ie defined by java code.
Returns:
true if the component is native, false otherwise

setNative

public void setNative()
Set the component as native. This is used only by CxLibrarayComponent to indicate that ports and properties defined by the native class.

isActive

public boolean isActive()
Determine if the component is currently active.
Returns:
true if the component is currently active, false otherwise

activate

public void activate()
Activate the component. Recursively activates all children

deactivate

public void deactivate()
Deactivate the component. Recursively deactivates all children.

addExtendsListener

public void addExtendsListener(CxExtendsListener listener)
Add an extends listener to the list of listeners. All listners will be notified whenever a component or any of its decendests changes name, x, y, property value, addss a child, or removes a child.
Parameters:
listener - the extends listener to add

removeExtendsListener

public void removeExtendsListener(CxExtendsListener listener)
Remove an extends listener to the list of listeners.
Parameters:
listener - the component change listener to remove

getExtendsListeners

public java.util.Enumeration getExtendsListeners()
Get the list of extends listners
Returns:
an enumeration of the extends listeners, it there are no listeners then it returns null;

canExtendsAdd

public boolean canExtendsAdd(java.lang.String path,
                             java.lang.String childName)
Ask all registered listeners if they can add a child by a given name
Parameters:
path - path relative to the this component where the child has been added
child - the name of the child component

triggerExtendsNodeChanged

public void triggerExtendsNodeChanged(java.lang.String path,
                                      java.lang.String nodeName,
                                      com.dat.cx.Node oldNodeValue,
                                      com.dat.cx.Node newNodeValue)
Send an extends node value changed event to all registered listeners
Parameters:
path - the path of the descendent property relative to this component
nodeName - the name used to identify the set and get methods for the node within a component
oldNodeValue - the original node value within component whose location has been changed
newNodeValue - the new node value

addComponentChangeListener

public void addComponentChangeListener(CxComponentChangeListener listener)
Add a component change listener to the list of listeners. All listners will be notified whenever the component changes name, x, or y.
Parameters:
listener - the component change listener to add

removeComponentChangeListener

public void removeComponentChangeListener(CxComponentChangeListener listener)
Remove a component change listener to the list of listeners.
Parameters:
listener - the component change listener to remove

addComponentChildrenListener

public void addComponentChildrenListener(CxComponentChildrenListener listener)
Add a component children listener to the list of listeners. All listners will be notified whenever a child is added, is about to be removed, or is removed.
Parameters:
listener - the component children listener to add

removeComponentChildrenListener

public void removeComponentChildrenListener(CxComponentChildrenListener listener)
Remove a component children listener to the list of listeners.
Parameters:
listener - the children change listener to remove

canAddComponent

public boolean canAddComponent(CxExtendsCanAddEvent event)
Test if a component can be added by the name specified in the received event
Specified by:
canAddComponent in interface CxExtendsListener
Parameters:
event - the recieved event

componentAdded

public void componentAdded(CxExtendsAddEvent event)
Receive an CxExtendsAddEvent when a component from which this component is extended has added a descendent component.
Specified by:
componentAdded in interface CxExtendsListener
Parameters:
event - the recieved event

componentRemoved

public void componentRemoved(CxExtendsRemoveEvent event)
Receive an CxExtendsRemoveEvent when a component from which this component is extended has removed a descendent component.
Specified by:
componentRemoved in interface CxExtendsListener
Parameters:
event - the recieved event

componentLocationChanged

public void componentLocationChanged(CxExtendsLocationChangeEvent event)
Receive an CxExtendsLocationChangeEvent when a component from which this component is extended has a child whose location has been changed.
Specified by:
componentLocationChanged in interface CxExtendsListener
Parameters:
event - the recieved event

componentNodeChanged

public void componentNodeChanged(CxExtendsNodeChangeEvent event)
Recieve a CxExtendsNodeChangeEvent whenever an extends from component or any of its decendents has a change in a node value.
Specified by:
componentNodeChanged in interface CxExtendsListener
Parameters:
event - the recieved event.

componentPropertyChanged

public void componentPropertyChanged(CxExtendsPropertyChangeEvent event)
Receive an CxExtendsPropertyChangeEvent when a component from which this component is extended has changed a property value for it or any contained properties.
Specified by:
componentPropertyChanged in interface CxExtendsListener
Parameters:
event - the recieved event

componentWirePortChanged

public void componentWirePortChanged(CxExtendsWirePortChangeEvent event)
Receive an CxExtendsWirePortChangeEvent when a wire from which this component is extended has changed a port assignment.
Specified by:
componentWirePortChanged in interface CxExtendsListener
Parameters:
event - the recieved event

componentNameChanged

public void componentNameChanged(CxExtendsNameChangeEvent event)
Receive an CxExtendsNameChangeEvent when a component from which this component is extended has changed its name or the name of any of its contained components.
Specified by:
componentNameChanged in interface CxExtendsListener
Parameters:
event - the recieved event

constructNode

public static com.dat.cx.Node constructNode(java.lang.String element,
                                            java.lang.String text)
Construct a simple XML document to wrap a string.
Parameters:
element - the outer element name
text - the text of the element

toString

public java.lang.String toString()
Get string representation
Overrides:
toString in class java.lang.Object
Returns:
a string representation which identifies the component

getConfig

public CxConfiguration getConfig(java.lang.String name)
Get a configuration given its name
Parameters:
name - the name of the configuration
Returns:
the found configuration, if not found return null

getConfigValue

public java.lang.String getConfigValue(java.lang.String name)
Get a configuration value given its name
Parameters:
name - the name of the configuration
Returns:
the value of the configuration, if not found return null

getConfigValue

public java.lang.String getConfigValue(java.lang.String name,
                                       boolean delegate)
Get a configuration value given its name
Parameters:
name - the name of the configuration
delegate - when true, the parent variable is searched as well.
Returns:
the value of the configuration, if not found return null

getPort

public CxPort getPort(java.lang.String name)
Get a port given its name
Parameters:
name - the name of the port
Returns:
the found port, if not found return null

getDataPort

public CxDataPort getDataPort(java.lang.String dataPath,
                              boolean portDirection)
Get a data port given is logical path and direction

hasProperties

public boolean hasProperties()
Determine if the component has any properties
Returns:
true if the component has a property, otherwise false

getPropertyNames

public java.lang.String[] getPropertyNames()
Get all property names
Returns:
all property names for the component

getPropertyValues

public java.lang.String[] getPropertyValues(java.lang.String[] propertyNames)
Get property values for a set of property names
Parameters:
propertyNames - an array of property names
Returns:
current values for the named properties

setPropertyValues

public void setPropertyValues(java.lang.String[] propertyNames,
                              java.lang.String[] propertyValues)
Set property values
Parameters:
propertyNames - an array of property names
propertyValues - array of new property values to be assigned to the named properties

getX

public int getX()
Get the x coordinate
Returns:
x coordinate

getY

public int getY()
Get the y coordinate
Returns:
y coordinate

setX

public void setX(int x)
Set the x coordinate
Parameters:
x - the new x coordinate

setY

public void setY(int y)
Set the y coordinate
Parameters:
y - the new y coordinate

setLocationNoUndo

public void setLocationNoUndo(java.awt.Point newLocation)
Set the location
Parameters:
location - the new location

setLocation

public void setLocation(java.awt.Point newLocation)
Set the location
Parameters:
location - the new location

setDisplayStyleFromInfo

public void setDisplayStyleFromInfo(int displayStyle)
Set the display style
Parameters:
displayStyle - the new display style

setDisplayStyle

public void setDisplayStyle(int displayStyle)
Set the display style
Parameters:
displayStyle - the new display style

getDisplayStyle

public int getDisplayStyle()
Get the display style
Returns:
the display style

getClassClause

public java.lang.String getClassClause()
Get the class clause
Returns:
the class clause

setClassClause

public void setClassClause(java.lang.String classClause)
Set the class clause
Parameters:
classClause - the new class clause

getIcon

public java.lang.String getIcon()
Get the icon file name for this component
Returns:
the file name for the icon

getImageIcon

public javax.swing.ImageIcon getImageIcon()
Get the icon image for icon of this component
Returns:
icon image of the icon of this component

resolveField

public com.d_a_t.expeval.EEField resolveField(java.lang.String identifier)
                                       throws com.d_a_t.expeval.ExpressionException
Description copied from interface: com.d_a_t.expeval.ExpressionContext
Returns the EEField object identified by "identifier" or null if none exists.
Specified by:
resolveField in interface com.d_a_t.expeval.ExpressionContext

resolveConstructor

public com.d_a_t.expeval.EEConstructor resolveConstructor(java.lang.Class constructorClass,
                                                          java.lang.Class[] parameterTypes)
                                                   throws com.d_a_t.expeval.ExpressionException
Description copied from interface: com.d_a_t.expeval.ExpressionContext
Returns the EEConstruct object identified by "identifier" and the parameter type list or null if none exists.
Specified by:
resolveConstructor in interface com.d_a_t.expeval.ExpressionContext

resolveMethod

public com.d_a_t.expeval.EEMethod resolveMethod(java.lang.String identifier,
                                                java.lang.Class[] parameterTypes)
                                         throws com.d_a_t.expeval.ExpressionException
Description copied from interface: com.d_a_t.expeval.ExpressionContext
Returns the EEMethod object identified by "identifier" and the parameter type list or null if none exists.
Specified by:
resolveMethod in interface com.d_a_t.expeval.ExpressionContext

resolveClass

public java.lang.Class resolveClass(java.lang.String identifier)
                             throws com.d_a_t.expeval.ExpressionException
Description copied from interface: com.d_a_t.expeval.ExpressionContext
Returns the Class object identified by "identifier" or null if none exists.
Specified by:
resolveClass in interface com.d_a_t.expeval.ExpressionContext

handleException

public static void handleException(java.lang.Throwable t)

getPackage

public CxComponent getPackage(CxComponent component)

getPackage

public CxComponent getPackage()

isExtended

public boolean isExtended()

setComponentDefinitionServer

public void setComponentDefinitionServer(com.dat.cx.exec.CxExecInterface componentServer)
Set the component definition server. By setting a server the component will behave as a proxy to a component residing on the server.
Parameters:
componentServer - the component server proxy providing access to a remote server.

getInfo

public com.dat.cx.exec.CxExecComponentInfo getInfo()
Get the defintion of this component into a serializable java object so that is can be sent to a client console. This method is only called by the server on receiving a request to down load a components definitons.

makeInfo

public com.dat.cx.exec.CxExecComponentInfo makeInfo()
Make an empty serializable object to hold the components definition. This method should be overridden in any sub class of CxComponent where the definition of such component contains additional information not defined in CxComponent.
Returns:
an empty serializable object which will hold the defintion of a component.

exportInfo

public void exportInfo(com.dat.cx.exec.CxExecComponentInfo info)
Export the definition of the component into a java serializable object. This method should be overridden in any sub class of CxComponent where the definition of such component contains additional information not defined in CxComponent. The overridden method should call the superclass exportInfo method and then add in the additional information.
Parameters:
info - the serializable object in which the definition of this component is to be stored.

importInfo

public void importInfo(com.dat.cx.exec.CxExecComponentInfo info)
Import the definition of the component from a java serializable object. This method should be overridden in any sub class of CxComponent where the definition of such component contains additional information not defined in CxComponent. The overridden method should call the superclass importInfo method and then import the additional information.
Parameters:
info - the serializable object in which the definition of this component is stored.

addSortedChild

public void addSortedChild(CxComponent child)

renameSortedChild

public void renameSortedChild()

init

public void init()
init is called after a CxComponent is added to the component tree in the GUI by an editor.