public abstract class ComponentBase
extends java.lang.Object
implements java.io.Externalizable
Modifier and Type | Field and Description |
---|---|
static android.graphics.RectF |
emptyRectangle |
Modifier | Constructor and Description |
---|---|
protected |
ComponentBase()
Initializes a new instance of the ComponentBase class.
|
Modifier and Type | Method and Description |
---|---|
void |
arrangeComponents(android.graphics.RectF bounds,
android.graphics.Canvas g2d)
Recursively arranges the child components, within the specified space and using the specified graphics for measurement purposes.
|
boolean |
contains(ComponentBase component)
Checks if the specified component is contained in the hierarchy defined by the current component.
|
android.graphics.Path |
createOutlinePath(android.graphics.RectF bounds,
float rotationAngle)
For internal use.
|
void |
draw(android.graphics.Canvas g2d,
RenderOptions options)
Renders the component in the specified Canvas.
|
ComponentBase |
find(java.lang.String name)
Returns the component with the specified name within the hierarchy defined by the current component.
|
android.graphics.RectF |
getBounds()
Gets the calculated bounds of this component relative to its parent.
|
int |
getChildCount()
Gets the number of child components of this component.
|
CursorHint |
getCursor(android.graphics.PointF point)
Gets the cursor to display when the mouse is at the specified position.
|
Dimension |
getDesiredSize(Dimension availableSize,
android.graphics.Canvas g2d)
Gets the desired size of this component in case the width and/or height have not been explicitly specified.
|
android.graphics.RectF |
getDocumentBounds()
For internal use.
|
boolean |
getFocusable()
Gets a value indicating whether the component can receive the input focus.
|
int |
getGridColumn()
Gets the index of the grid column this component will be associated with when added to a GridPanel.
|
int |
getGridRow()
Gets the index of the grid row this component will be associated with when added to a GridPanel.
|
float |
getHeight()
Gets the explicit height of this component.
|
int |
getHorizontalAlignment()
Gets the horizontal alignment of this component relative to its parent.
|
boolean |
getIsEnabled()
Gets a value indicating whether the component is enabled.
|
boolean |
getIsFocused()
Gets a value indicating whether this component currently holds the input focus.
|
boolean |
getIsHitTestVisible()
Gets a value indicating whether this component and all its children are subject to hit-testing operations.
|
boolean |
getIsInteractive()
Gets a value indicating whether this component can be interacted with.
|
java.lang.String |
getName()
Gets the name of the component.
|
java.lang.Object |
getParent()
Raises the Validating event.
|
protected ComponentHost |
getParentHost()
For internal use.
|
int |
getVerticalAlignment()
Gets the vertical alignment of this component relative to its parent.
|
boolean |
getVisible()
Gets a value indicating whether the component is visible.
|
float |
getWidth()
Gets the explicit width of this component.
|
void |
invalidate()
Invalidates the visual appearance of the component.
|
void |
invalidateLayout()
Invalidates the layout of this component and all its children.
|
protected void |
loadFromXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
Deserializes the component from an XML element.
|
protected void |
onAddedToParent()
Invoked when the component is added to a parent component.
|
void |
onContextChanged() |
protected void |
onGotFocus()
Invokes when the component gains the input focus.
|
void |
onKeyPress(char keyChar)
Called when a character key is pressed when this component has the input focus.
|
protected void |
onLostFocus()
Invokes when the component loses the input focus.
|
void |
onMouseDown(android.graphics.PointF point)
Called when the left mouse button is pressed while the pointer is over this component.
|
void |
onMouseMove(android.graphics.PointF point)
Called when the mouse is moved while this component tracks the mouse events.
|
void |
onMouseUp(android.graphics.PointF point)
Called when the left mouse button is released while this component tracks the mouse events.
|
protected void |
onRemovedFromParent()
Invoked when the component is removed from a parent component.
|
void |
onUnitChanged()
Invoked when the measure unit of the document containing the component has changed.
|
protected void |
onZoomChanged()
Invoked when the zoom factor of the document containing the component has changed.
|
void |
readExternal(java.io.ObjectInput in)
Implements Externalizable
|
protected void |
saveToXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
Serializes the component into an XML element.
|
protected boolean |
serializeSubcomponents()
Invoked to query whether the underlying component structure should be automatically serialized or serialized by the user.
|
void |
setBounds(android.graphics.RectF value)
Sets the calculated bounds of this component relative to its parent.
|
void |
setFocusable(boolean value)
Sets a value indicating whether the component can receive the input focus.
|
void |
setGridColumn(int value)
Sets the index of the grid row this component will be associated with when added to a GridPanel.
|
void |
setGridRow(int value)
Sets the index of the grid row this component will be associated with when added to a GridPanel.
|
void |
setHeight(float value)
Sets the explicit height of this component.
|
void |
setHorizontalAlignment(int value)
Sets the horizontal alignment of this component relative to its parent.
|
void |
setIsEnabled(boolean value)
Sets a value indicating whether the component is enabled.
|
void |
setIsFocused(boolean value)
Sets a value indicating whether this component currently holds the input focus.
|
void |
setIsHitTestVisible(boolean value)
Sets a value indicating whether this component and all its children are subject to hit-testing operations.
|
void |
setIsInteractive(boolean value)
Sets a value indicating whether this component can be interacted with.
|
void |
setName(java.lang.String value)
Sets the name of the component.
|
void |
setParent(java.lang.Object value)
For internal use.
|
void |
setVerticalAlignment(int value)
Sets the vertical alignment of this component relative to its parent.
|
void |
setVisible(boolean value)
Sets a value indicating whether the component is visible.
|
void |
setWidth(float value)
Sets the explicit width of this component.
|
android.graphics.PointF |
toDocument(android.graphics.PointF point)
Converts a point from local to document coordinates.
|
android.graphics.PointF |
toLocal(android.graphics.PointF point)
Converts a point from document to local coordinates.
|
android.graphics.PointF |
toParent(ComponentBase parent,
android.graphics.PointF point)
Converts a point from local coordinates to the specified parent's coordinates.
|
void |
writeExternal(java.io.ObjectOutput out)
Implements Externalizable
|
protected ComponentBase()
protected boolean serializeSubcomponents()
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
protected void saveToXml(org.w3c.dom.Element xmlElement, XmlPersistContext context)
xmlElement
- An Element the component's data should be stored into.context
- An XmlPersistContext object providing contextual information about the serialization process and some helper serialization methods.protected void loadFromXml(org.w3c.dom.Element xmlElement, XmlPersistContext context)
xmlElement
- An Element containing the component's data.context
- An XmlPersistContext object providing contextual information about the serialization process and some helper serialization methods.public void draw(android.graphics.Canvas g2d, RenderOptions options)
g2d
- The drawing target.options
- A RenderOptions object specifying the drawing context.public void arrangeComponents(android.graphics.RectF bounds, android.graphics.Canvas g2d)
bounds
- The space available for arrangement.g2d
- A relevant Canvas object.public ComponentBase find(java.lang.String name)
name
- The name of the component to search for.public boolean contains(ComponentBase component)
component
- The component to search for.public void invalidateLayout()
public void invalidate()
public Dimension getDesiredSize(Dimension availableSize, android.graphics.Canvas g2d)
availableSize
- The available size.g2d
- A relevant Canvas object.protected void onGotFocus()
protected void onLostFocus()
public void onMouseDown(android.graphics.PointF point)
point
- A PointF instance that specifies the current mouse position.public void onMouseMove(android.graphics.PointF point)
point
- A PointF instance that specifies the current mouse position.public void onMouseUp(android.graphics.PointF point)
point
- A PointF instance that specifies the current mouse position.public CursorHint getCursor(android.graphics.PointF point)
point
- A PointF instance that specifies the current mouse position, in document coordinates.public void onKeyPress(char keyChar)
keyChar
- The character representing the pressed key.protected void onZoomChanged()
public void onUnitChanged()
public void onContextChanged()
public android.graphics.PointF toLocal(android.graphics.PointF point)
point
- The document PointF to convert.public android.graphics.PointF toParent(ComponentBase parent, android.graphics.PointF point) throws java.lang.Exception
parent
- A ComponentBase representing a direct or indirect parent.point
- The local PointF to convert.java.lang.Exception
- This method throws an exception if the specified component is null or it does not represent a parent of the current component.public android.graphics.PointF toDocument(android.graphics.PointF point)
point
- The local PointF to convert.public android.graphics.RectF getDocumentBounds()
protected void onAddedToParent()
protected void onRemovedFromParent()
public android.graphics.Path createOutlinePath(android.graphics.RectF bounds, float rotationAngle)
public java.lang.Object getParent()
e
- An object providing the event data.public void setParent(java.lang.Object value)
protected ComponentHost getParentHost()
public android.graphics.RectF getBounds()
public void setBounds(android.graphics.RectF value)
value
- The bounds of this component relative to its parent.public float getWidth()
public void setWidth(float value)
value
- A floating point value specifying the component's width. The default is NaN.public float getHeight()
public void setHeight(float value)
value
- A floating point value specifying the component's height. The default is NaN.public int getHorizontalAlignment()
public void setHorizontalAlignment(int value)
value
- A member of the HorizontalAlignment enumeration. The default is Stretch.public int getVerticalAlignment()
public void setVerticalAlignment(int value)
value
- A member of the VerticalAlignment enumeration. The default is Stretch.public java.lang.String getName()
public void setName(java.lang.String value)
value
- A String identifying this component within its component tree.public int getChildCount()
public boolean getIsHitTestVisible()
public void setIsHitTestVisible(boolean value)
value
- true if the component can be hit-tested; otherwise, false. The default is true.public boolean getIsFocused()
public void setIsFocused(boolean value)
value
- A boolean value specifying if the component currently holds the input focus.public boolean getIsEnabled()
public void setIsEnabled(boolean value)
value
- A boolean value specifying if the component is enabled and can be interacted with. The default is true.public boolean getIsInteractive()
public void setIsInteractive(boolean value)
public boolean getFocusable()
public void setFocusable(boolean value)
value
- A boolean value specifying if the component can receive the input focus. The default is false.public int getGridRow()
public void setGridRow(int value)
value
- An integer value specifying the 0-based index of the grid row in which to place this component. The default is 0.public int getGridColumn()
public void setGridColumn(int value)
value
- An integer value specifying the 0-based index of the grid column in which to place this component. The default is 0.public boolean getVisible()
public void setVisible(boolean value)
value
- true if the component is visible; otherwise, false. The default is true.