public abstract class UIElementBase extends Object
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
autoEnable |
protected boolean |
autoHide |
protected static org.apache.commons.logging.Log |
log |
protected int |
maxChildren |
| Constructor and Description |
|---|
UIElementBase() |
| Modifier and Type | Method and Description |
|---|---|
void |
about()
Displays an about dialog for the UI element.
|
void |
activate(boolean activate)
Activates or inactivates a UI element.
|
protected void |
activateChildren(boolean activate)
Default behavior is to pass activation/inactivation event to children.
|
void |
addChild(UIElementBase child)
Adds the specified child element.
|
protected void |
addChild(UIElementBase child,
boolean doEvent)
Adds the specified child element.
|
protected void |
afterAddChild(UIElementBase 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 |
afterMoveTo(int index)
Element has been moved to a different position under its parent.
|
protected void |
afterParentChanged(UIElementBase oldParent)
Called after the parent has been changed.
|
protected void |
afterRemoveChild(UIElementBase child)
Called after a child is logically removed from the parent.
|
protected void |
applyColor()
Provides a default implementation for setting the color of a UI element.
|
protected void |
applyColor(Object cmpt)
Applies the current color setting to the wrapped component.
|
protected void |
applyHint()
Provides a default implementation for setting the hint text of a UI element.
|
protected void |
applyHint(Object cmpt)
Applies the current hint text to the wrapped component.
|
protected void |
beforeAddChild(UIElementBase 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(UIElementBase newParent)
Called before the parent has been changed.
|
protected void |
beforeRemoveChild(UIElementBase child)
Called before a child is logically removed from the parent.
|
protected void |
bind()
Override to bind wrapped components to the UI.
|
void |
bringToFront()
Brings this element to the front of the user interface.
|
boolean |
canAcceptChild()
Returns true if this element may accept a child.
|
boolean |
canAcceptChild(Class<? extends UIElementBase> clazz)
Returns true if this element may accept a child of the specified class.
|
static boolean |
canAcceptChild(Class<? extends UIElementBase> parentClass,
Class<? extends UIElementBase> childClass)
Returns true if childClass can be a child of the parentClass.
|
boolean |
canAcceptChild(UIElementBase 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 UIElementBase> clazz)
Returns true if this element may accept a parent of the specified class.
|
static boolean |
canAcceptParent(Class<? extends UIElementBase> childClass,
Class<? extends UIElementBase> parentClass)
Returns true if parentClass can be a parent of childClass.
|
boolean |
canAcceptParent(UIElementBase 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()
Displays a property editor for the component.
|
<T extends UIElementBase> |
findChildElement(Class<T> clazz)
Recurses the component subtree for a child belonging to the specified class.
|
<T extends UIElementBase> |
getAncestor(Class<T> clazz)
Returns the first ancestor corresponding to the specified class.
|
<T extends UIElementBase> |
getChild(Class<T> clazz,
UIElementBase last)
Locates and returns a child that is an instance of the specified class.
|
UIElementBase |
getChild(int index)
Gets the UI element child at the specified index.
|
int |
getChildCount()
Returns the number of children.
|
Iterable<UIElementBase> |
getChildren()
Returns an iterable of this component's children.
|
String |
getColor()
Returns the color (as an HTML-formatted RGB string) for this element.
|
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.
|
UIElementBase |
getFirstChild()
Returns the first child, or null if there are no children.
|
UIElementBase |
getFirstVisibleChild()
Returns the first visible child.
|
String |
getHint()
Returns the tool tip text.
|
int |
getIndex()
Returns this element's index in its parent's list of children.
|
Object |
getInnerComponent()
Returns the innermost wrapped UI component.
|
String |
getInstanceName()
Returns the instance name of this element.
|
UIElementBase |
getLastChild()
Returns the last child, or null if there are no children.
|
UIElementBase |
getLastVisibleChild()
Returns the last visible child.
|
UIElementBase |
getNextSibling(boolean visibleOnly)
Returns this element's next sibling.
|
Object |
getOuterComponent()
Returns the outermost wrapped UI component.
|
UIElementBase |
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.
|
UIElementBase |
getRoot()
Returns the UI element at the root of the component tree.
|
Iterable<UIElementBase> |
getSerializableChildren()
Returns an iterable of this component's serializable children.
|
boolean |
hasAncestor(UIElementBase element)
Returns true if specified element is an ancestor of this element.
|
boolean |
hasChild(UIElementBase element)
Returns true if the specified element is a child of this element.
|
int |
indexOfChild(UIElementBase child)
Returns the index of the specified child.
|
boolean |
isActivated()
Returns the activation status of the element.
|
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.
|
boolean |
isVisible()
Returns the visible state of the UI element.
|
static void |
raise(String text) |
static void |
raise(String text,
Throwable t) |
protected static void |
registerAllowedChildClass(Class<? extends UIElementBase> clazz,
Class<? extends UIElementBase> childClass)
A UIElementBase subclass should call this in its static initializer block to register any
subclasses that may be a child.
|
protected static void |
registerAllowedParentClass(Class<? extends UIElementBase> clazz,
Class<? extends UIElementBase> parentClass)
A UIElementBase 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(UIElementBase child,
boolean destroy)
Removes the specified element as a child of this parent.
|
void |
removeChildren()
Remove all children associated with this element.
|
void |
setColor(String value)
Provides a default implementation for setting the color of a ZK-based UI element.
|
void |
setDefinition(Class<? extends UIElementBase> 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 |
setHint(String value)
Sets the tool tip text.
|
void |
setIndex(int index)
Sets this element's index to the specified value.
|
protected void |
setInnerComponent(Object value)
Sets the innermost wrapped UI component.
|
void |
setLocked(boolean locked)
Sets the locked status of the element.
|
protected void |
setOuterComponent(Object value)
Sets the outermost wrapped UI component.
|
void |
setParent(UIElementBase 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.
|
void |
setVisible(boolean visible)
Sets the visibility state of the component.
|
protected void |
unbind()
Override to unbind wrapped components from the UI.
|
protected void |
updateParentState()
Calls updateState on the parent if one exists.
|
protected void |
updateState()
Update a UI element based on the state of its children.
|
protected void |
updateVisibility()
Calls updateVisibility with current settings.
|
protected void |
updateVisibility(boolean visible,
boolean activated)
Override to set the visibility of wrapped components.
|
protected static final org.apache.commons.logging.Log log
protected int maxChildren
protected boolean autoHide
protected boolean autoEnable
protected static void registerAllowedParentClass(Class<? extends UIElementBase> clazz, Class<? extends UIElementBase> 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 UIElementBase> clazz, Class<? extends UIElementBase> childClass)
clazz - Class whose valid child classes are to be registered.childClass - Class that may be a child of clazz.public static boolean canAcceptChild(Class<? extends UIElementBase> parentClass, Class<? extends UIElementBase> childClass)
parentClass - Parent classchildClass - Child classpublic static boolean canAcceptParent(Class<? extends UIElementBase> childClass, Class<? extends UIElementBase> parentClass)
childClass - The child class.parentClass - The parent class.public static void raise(String text, Throwable t) throws UIException
UIExceptionpublic static void raise(String text) throws UIException
UIExceptionpublic boolean isDesignMode()
public void setDesignMode(boolean designMode)
designMode - The design mode flag.public void addChild(UIElementBase child)
child - Element to add as a child.protected void addChild(UIElementBase child, boolean doEvent)
child - Element to add as a child.doEvent - Fires the add child events if true.protected void afterAddChild(UIElementBase child)
child - The child element added.protected void beforeAddChild(UIElementBase child)
child - The new child element.public void removeChild(UIElementBase child, boolean destroy)
child - Child element to remove.destroy - If true the child is explicitly destroyed.protected void afterRemoveChild(UIElementBase child)
child - The child UI element.protected void beforeRemoveChild(UIElementBase child)
child - The child UI element.protected void afterParentChanged(UIElementBase oldParent)
oldParent - The value of the parent property prior to the change.protected void beforeParentChanged(UIElementBase 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()
protected void bind()
protected void unbind()
public Object getInnerComponent()
protected void setInnerComponent(Object value)
value - The innermost wrapped UI component.public Object getOuterComponent()
protected void setOuterComponent(Object value)
value - The outermost wrapped UI component.protected void afterMoveTo(int index)
index - New position for element.public final PluginDefinition getDefinition()
public void setDefinition(PluginDefinition definition)
definition - The plugin definition.public void setDefinition(Class<? extends UIElementBase> clazz)
clazz - The UI element class.public void about()
public void editProperties()
public void activate(boolean activate)
activate - The activate status.protected void activateChildren(boolean activate)
activate - The activate status.public final boolean isActivated()
protected org.carewebframework.api.event.IEventManager getEventManager()
public UIElementBase getChild(int index)
index - Index of the child to retrieve.public <T extends UIElementBase> T getChild(Class<T> clazz, UIElementBase last)
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<UIElementBase> getChildren()
public Iterable<UIElementBase> getSerializableChildren()
public int getChildCount()
public UIElementBase getFirstChild()
public UIElementBase getFirstVisibleChild()
public UIElementBase getLastChild()
public UIElementBase getLastVisibleChild()
public UIElementBase getNextSibling(boolean visibleOnly)
visibleOnly - If true, skip any non-visible siblings.public int indexOfChild(UIElementBase child)
child - The child component whose index is sought.public boolean hasChild(UIElementBase element)
element - The UI element to test.public <T extends UIElementBase> T findChildElement(Class<T> clazz)
clazz - Class of child being sought.public boolean hasAncestor(UIElementBase element)
element - A UI element.public int getIndex()
public void setIndex(int index)
index - The index.public void bringToFront()
public String getDisplayName()
public String getInstanceName()
public Class<? extends Object> getPropEditClass()
public boolean isLocked()
public void setLocked(boolean locked)
locked - The locked status.public UIElementBase getParent()
public final void setParent(UIElementBase parent)
parent - The new parent.public void setEnabled(boolean enabled)
enabled - The enabled state.public final boolean isEnabled()
public final void setVisible(boolean visible)
visible - The visibility state.protected final void updateVisibility()
protected void updateVisibility(boolean visible,
boolean activated)
visible - The current visibility state.activated - The current activation state.public final boolean isVisible()
public final String getColor()
public final void setColor(String value)
value - A correctly formatted HTML color specification.protected void applyColor()
protected void applyColor(Object cmpt)
cmpt - Component to receive the color setting.public final String getHint()
public final void setHint(String value)
value - The tool tip text.protected void applyHint()
protected void applyHint(Object cmpt)
cmpt - Component to receive the hint text.protected final void updateParentState()
protected void updateState()
public boolean isContainer()
public boolean canAcceptChild()
public boolean canAcceptChild(Class<? extends UIElementBase> clazz)
clazz - Child class to test.public boolean canAcceptChild(UIElementBase child)
child - Child instance to test.public boolean canAcceptParent()
public boolean canAcceptParent(Class<? extends UIElementBase> clazz)
clazz - Parent class to test.public boolean canAcceptParent(UIElementBase parent)
parent - Parent instance to test.public void setRejectReason(String rejectReason)
rejectReason - Reason for rejection.public String getRejectReason()
public UIElementBase getRoot()
public <T extends UIElementBase> T getAncestor(Class<T> clazz)
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.Copyright © 2016 Regenstrief Center for Biomedical Informatics. All rights reserved.