public abstract class ElementBase extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.commons.logging.Log |
log |
| Constructor and Description |
|---|
ElementBase() |
| Modifier and Type | Method and Description |
|---|---|
void |
about()
Displays an about dialog for the UI element.
|
void |
addChild(ElementBase child)
Adds the specified child element.
|
protected void |
addChild(ElementBase child,
boolean doEvent)
Adds the specified child element.
|
protected void |
afterAddChild(ElementBase child)
Called after a child is logically added to the parent.
|
void |
afterInitialize(boolean deserializing)
Subclasses may override this to implement any additional operations that are necessary after
this element is initialized (i.e., after property values and parent element are set).
|
protected void |
afterMoveChild(ElementBase child,
ElementBase before)
Called after an element has been moved to a different position under this parent.
|
protected void |
afterParentChanged(ElementBase oldParent)
Called after the parent has been changed.
|
protected void |
afterRemoveChild(ElementBase child)
Called after a child is logically removed from the parent.
|
protected void |
beforeAddChild(ElementBase child)
Called before a child is logically added to the parent.
|
void |
beforeInitialize(boolean deserializing)
Subclasses may override this to implement any additional operations that are necessary before
this element is initialized (i.e., before property values and parent element are set).
|
protected void |
beforeParentChanged(ElementBase newParent)
Called before the parent has been changed.
|
protected void |
beforeRemoveChild(ElementBase child)
Called before a child is logically removed from the parent.
|
boolean |
canAcceptChild()
Returns true if this element may accept a child.
|
boolean |
canAcceptChild(Class<? extends ElementBase> childClass)
Returns true if this element may accept a child of the specified class.
|
static boolean |
canAcceptChild(Class<? extends ElementBase> parentClass,
Class<? extends ElementBase> childClass)
Returns true if childClass can be a child of the parentClass.
|
boolean |
canAcceptChild(ElementBase child)
Returns true if this element may accept the specified child.
|
boolean |
canAcceptParent()
Returns true if this element may accept a parent.
|
boolean |
canAcceptParent(Class<? extends ElementBase> clazz)
Returns true if this element may accept a parent of the specified class.
|
static boolean |
canAcceptParent(Class<? extends ElementBase> childClass,
Class<? extends ElementBase> parentClass)
Returns true if parentClass can be a parent of childClass.
|
boolean |
canAcceptParent(ElementBase parent)
Returns true if this element may accept the specified element as a parent.
|
void |
destroy()
Override to implement special cleanup when an object is destroyed.
|
void |
editProperties()
Invokes the property grid with this element as its target.
|
<T extends ElementBase> |
findChildElement(Class<T> clazz)
Recurses the component subtree for a child belonging to the specified class.
|
<T extends ElementBase> |
getAncestor(Class<T> clazz)
Returns the first ancestor corresponding to the specified class.
|
<T extends ElementBase> |
getChild(Class<T> clazz,
ElementBase last)
Locates and returns a child that is an instance of the specified class.
|
ElementBase |
getChild(int index)
Gets the UI element child at the specified index.
|
int |
getChildCount()
Returns the number of children.
|
int |
getChildCount(Class<? extends ElementBase> clazz)
Returns the number of children.
|
Iterable<ElementBase> |
getChildren()
Returns an iterable of this component's children.
|
<T extends ElementBase> |
getChildren(Class<T> clazz)
Returns an iterable of this component's children restricted to the specified type.
|
PluginDefinition |
getDefinition()
Return the definition used to create this instance.
|
String |
getDisplayName()
Returns the display name of this element.
|
protected org.carewebframework.api.event.IEventManager |
getEventManager()
Returns instance of the event manager.
|
ElementBase |
getFirstChild()
Returns the first child, or null if there are no children.
|
int |
getIndex()
Returns this element's index in its parent's list of children.
|
String |
getInstanceName()
Returns the instance name of this element.
|
ElementBase |
getLastChild()
Returns the last child, or null if there are no children.
|
ElementBase |
getParent()
Returns the parent of this element.
|
Class<? extends Object> |
getPropEditClass()
Returns the class of the property editor associated with this UI element.
|
String |
getRejectReason()
Returns the reject reason.
|
ElementBase |
getRoot()
Returns the UI element at the root of the component tree.
|
Iterable<ElementBase> |
getSerializableChildren()
Returns an iterable of this component's serializable children.
|
boolean |
hasAncestor(ElementBase element)
Returns true if specified element is an ancestor of this element.
|
boolean |
hasChild(ElementBase element)
Returns true if the specified element is a child of this element.
|
int |
indexOfChild(ElementBase child)
Returns the index of the specified child.
|
boolean |
isContainer()
Returns true if this UI element can contain other UI elements.
|
boolean |
isDesignMode()
Returns design mode status.
|
boolean |
isEnabled()
Returns the enabled state of the UI element.
|
boolean |
isLocked()
Returns true if the element is locked.
|
protected void |
listenToChild(String eventName,
INotificationListener listener)
Register/unregister a child notification listener.
|
protected void |
listenToParent(String eventName,
INotificationListener listener)
Register/unregister a parent notification listener.
|
protected void |
moveChild(org.fujion.component.BaseUIComponent child,
org.fujion.component.BaseUIComponent before)
Moves a child to before another component.
|
void |
moveChild(int from,
int to)
Moves a child from one position to another under the same parent.
|
void |
notifyChildren(String eventName,
Object eventData,
boolean recurse)
Allows a parent element to notify its children of an event of interest.
|
void |
notifyParent(String eventName,
Object eventData,
boolean recurse)
Allows a child element to notify its parent of an event of interest.
|
protected static void |
registerAllowedChildClass(Class<? extends ElementBase> clazz,
Class<? extends ElementBase> childClass,
int maxOccurrences)
A ElementBase subclass should call this in its static initializer block to register any
subclasses that may be a child.
|
protected static void |
registerAllowedParentClass(Class<? extends ElementBase> clazz,
Class<? extends ElementBase> parentClass)
A ElementBase subclass should call this in its static initializer block to register any
subclasses that may act as a parent.
|
void |
remove(boolean destroy)
Removes this element from its parent and optionally destroys it.
|
void |
removeChild(ElementBase child,
boolean destroy)
Removes the specified element as a child of this parent.
|
void |
removeChildren()
Remove and destroy all children associated with this element.
|
void |
setDefinition(Class<? extends ElementBase> clazz)
Sets the plugin definition based on the specified class.
|
void |
setDefinition(PluginDefinition definition)
Sets the plugin definition for this element.
|
void |
setDesignMode(boolean designMode)
Sets design mode status for this component and all its children.
|
void |
setEnabled(boolean enabled)
Sets the enabled state of the component.
|
void |
setIndex(int index)
Sets this element's index to the specified value.
|
void |
setLocked(boolean locked)
Sets the locked status of the element.
|
void |
setParent(ElementBase parent)
Sets the parent of this element, subject to the parent/child constraints applicable to each.
|
void |
setRejectReason(String rejectReason)
Sets the reject reason to the specified value.
|
protected void |
updateParentState()
Calls updateState on the parent if one exists.
|
protected void |
updateState()
Update an element based on the state of its children.
|
protected static void registerAllowedParentClass(Class<? extends ElementBase> clazz, Class<? extends ElementBase> parentClass)
clazz - Class whose valid parent classes are to be registered.parentClass - Class that may act as a parent to clazz.protected static void registerAllowedChildClass(Class<? extends ElementBase> clazz, Class<? extends ElementBase> childClass, int maxOccurrences)
clazz - Class whose valid child classes are to be registered.childClass - Class that may be a child of clazz.maxOccurrences - Maximum occurrences for the child class.public static boolean canAcceptChild(Class<? extends ElementBase> parentClass, Class<? extends ElementBase> childClass)
parentClass - Parent classchildClass - Child classpublic static boolean canAcceptParent(Class<? extends ElementBase> childClass, Class<? extends ElementBase> parentClass)
childClass - The child class.parentClass - The parent class.public void addChild(ElementBase child)
child - Element to add as a child.protected void addChild(ElementBase child, boolean doEvent)
child - Element to add as a child.doEvent - Fires the add child events if true.protected void afterAddChild(ElementBase child)
child - The child element added.protected void beforeAddChild(ElementBase child)
child - The new child element.public void removeChild(ElementBase child, boolean destroy)
child - Child element to remove.destroy - If true the child is explicitly destroyed.protected void afterRemoveChild(ElementBase child)
child - The child UI element.protected void beforeRemoveChild(ElementBase child)
child - The child UI element.protected void afterParentChanged(ElementBase oldParent)
oldParent - The value of the parent property prior to the change.protected void beforeParentChanged(ElementBase newParent)
newParent - The value of the parent property prior to the change.public void remove(boolean destroy)
destroy - If true, the element is also destroyed.public void removeChildren()
public void destroy()
public final PluginDefinition getDefinition()
public void setDefinition(PluginDefinition definition)
definition - The plugin definition.public void setDefinition(Class<? extends ElementBase> clazz)
clazz - The UI element class.public boolean isDesignMode()
public void setDesignMode(boolean designMode)
designMode - The design mode flag.public void about()
public void editProperties()
protected org.carewebframework.api.event.IEventManager getEventManager()
public ElementBase getChild(int index)
index - Index of the child to retrieve.public <T extends ElementBase> T getChild(Class<T> clazz, ElementBase last)
T - The type of child being sought.clazz - Class of the child being sought.last - If specified, the search begins after this child. If null, the search begins with
the first child.public Iterable<ElementBase> getChildren()
public <T extends ElementBase> Iterable<T> getChildren(Class<T> clazz)
T - Type of children returned by iterable.clazz - Restrict to children of this type.public Iterable<ElementBase> getSerializableChildren()
public int getChildCount()
public int getChildCount(Class<? extends ElementBase> clazz)
clazz - Restrict to children of this type.public ElementBase getFirstChild()
public ElementBase getLastChild()
public int indexOfChild(ElementBase child)
child - The child component whose index is sought.public boolean hasChild(ElementBase element)
element - The UI element to test.public <T extends ElementBase> T findChildElement(Class<T> clazz)
T - The type of child being sought.clazz - Class of child being sought.public boolean hasAncestor(ElementBase element)
element - A UI element.public int getIndex()
public void moveChild(int from,
int to)
from - Current position of child.to - New position of child.protected void afterMoveChild(ElementBase child, ElementBase before)
child - Child element that was moved.before - Child element was moved before this one.public void setIndex(int index)
index - The index.public String getDisplayName()
public String getInstanceName()
public Class<? extends Object> getPropEditClass()
public boolean isLocked()
public void setLocked(boolean locked)
locked - The locked status.public ElementBase getParent()
public final void setParent(ElementBase parent)
parent - The new parent.public void setEnabled(boolean enabled)
enabled - The enabled state.public final boolean isEnabled()
protected void moveChild(org.fujion.component.BaseUIComponent child,
org.fujion.component.BaseUIComponent before)
child - Child to movebefore - Move child to this component.protected final void updateParentState()
protected void updateState()
public boolean isContainer()
public boolean canAcceptChild()
public boolean canAcceptChild(Class<? extends ElementBase> childClass)
childClass - Child class to test.public boolean canAcceptChild(ElementBase child)
child - Child instance to test.public boolean canAcceptParent()
public boolean canAcceptParent(Class<? extends ElementBase> clazz)
clazz - Parent class to test.public boolean canAcceptParent(ElementBase parent)
parent - Parent instance to test.public void setRejectReason(String rejectReason)
rejectReason - Reason for rejection.public String getRejectReason()
public ElementBase getRoot()
public <T extends ElementBase> T getAncestor(Class<T> clazz)
T - The type of ancestor sought.clazz - Class of ancestor sought.public void beforeInitialize(boolean deserializing)
throws Exception
deserializing - If true, initialization is occurring as a result of deserialization.Exception - Unspecified exception.public void afterInitialize(boolean deserializing)
throws Exception
deserializing - If true, initialization is occurring as a result of deserialization.Exception - Unspecified exception.public void notifyParent(String eventName, Object eventData, boolean recurse)
eventName - Name of the event.eventData - Data associated with the event.recurse - If true, recurse up the parent chain.protected void listenToChild(String eventName, INotificationListener listener)
eventName - The event name.listener - A notification listener. If null, any existing listener is removed. If not
null and a listener is already registered, it will be replaced.public void notifyChildren(String eventName, Object eventData, boolean recurse)
eventName - Name of the event.eventData - Data associated with the event.recurse - If true, recurse over all child levels.protected void listenToParent(String eventName, INotificationListener listener)
eventName - The event name.listener - A notification listener. If null, any existing listener is removed. If not
null and a listener is already registered, it will be replaced.Copyright © 2017 Regenstrief Center for Biomedical Informatics. All rights reserved.