public class EditComponent extends ComponentBase
eventListenerList
Constructor and Description |
---|
EditComponent()
Initializes a new instance of the EditComponent class.
|
Modifier and Type | Method and Description |
---|---|
boolean |
acceptsReturn()
Gets a value indicating whether the edit component will insert new line when
the user presses the ENTER key.
|
void |
addComponentKeyEventListener(ComponentKeyEventListener listener)
Registers an event listener.
|
void |
addEditComponentListener(EditComponentListener listener)
Registers an event listener.
|
void |
draw(java.awt.Graphics2D g2d,
RenderOptions options)
ComponentBase.draw override.
|
Brush |
getBrush()
Gets the background brush of the edit component.
|
CursorHint |
getCursor(java.awt.geom.Point2D point)
ComponentBase.getCursor override.
|
XDimension2D.Double |
getDesiredSize(XDimension2D.Double availableSize,
java.awt.Graphics2D g2d)
ComponentBase.getDesiredSize override.
|
java.awt.Font |
getFont()
Gets the font of the text.
|
java.awt.Color |
getInactiveSelectionColor()
Gets the color of the selection when the edit component does not have input focus.
|
Pen |
getPen()
Gets the border pen of the edit component.
|
int |
getScrollFirstLine()
Gets the index of the first visible line in the edit component.
|
java.awt.Color |
getSelectionColor()
Gets the color of the selection.
|
int |
getSelectionLength()
Gets the length of the selection in the edit component.
|
int |
getSelectionStart()
Gets the start of the selection in the edit component.
|
java.lang.String |
getText()
Gets the text of the edit component.
|
Align |
getTextAlignment()
Gets the horizontal alignment of the text in the edit component.
|
java.awt.Color |
getTextColor()
Gets the color of the text.
|
float |
getTextPadding()
Gets the padding of the edit component.
|
TextWrapping |
getTextWrapping()
Gets the wrapping of of the text in the edit component.
|
boolean |
isHideSelection()
Gets a value indicating whether to hide the selection
when the edit component does not have input focus.
|
protected void |
loadFromJson(com.mindfusion.common.JsonObject obj,
JsonPersistContext context)
Deserializes the component from a JsonObject.
|
protected void |
loadFromXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
ComponentBase.loadFromXml override.
|
protected void |
onAddedToParent()
ComponentBase.onAddedToParent override.
|
protected void |
onClicked(ComponentMouseEvent e)
Raises the mouseClicked event.
|
void |
onContextChanged()
ComponentBase.onContextChanged override.
|
void |
onGotFocus(ComponentEvent e)
ComponentBase.onGotFocus override.
|
protected void |
onKeyDown(ComponentKeyEvent e)
Raises the keyDown event.
|
boolean |
onKeyDown(int keyCode,
int modifiers)
ComponentBase.onKeyDown override.
|
void |
onKeyPress(char keyChar)
ComponentBase.onKeyPress override.
|
protected void |
onKeyPressed(ComponentKeyEvent e)
Raises the keyPressed event.
|
protected void |
onKeyUp(ComponentKeyEvent e)
Raises the keyUp event.
|
void |
onKeyUp(int keyCode,
int modifiers)
ComponentBase.onKeyUp override.
|
void |
onLostFocus()
ComponentBase.onLostFocus override.
|
void |
onMouseDown(java.awt.geom.Point2D point)
ComponentBase.onMouseDown override.
|
void |
onMouseMove(java.awt.geom.Point2D point)
ComponentBase.onMouseMove override.
|
void |
onMouseUp(java.awt.geom.Point2D point)
ComponentBase.onMouseUp override.
|
protected void |
onTextChanged(ComponentTextEvent e)
Raises the textChanged event.
|
protected void |
onTextChanging(ComponentTextValidationEvent e)
Raises the textChanging event.
|
void |
onUnitChanged()
ComponentBase.onUnitChanged override.
|
protected void |
onZoomChanged()
ComponentBase.onZoomChanged override.
|
void |
readExternal(java.io.ObjectInput in)
ComponentBase.readExternal override.
|
void |
removeComponentKeyEventListener(ComponentKeyEventListener listener)
Unregisters an event listener.
|
void |
removeEditComponentListener(EditComponentListener listener)
Unregisters an event listener.
|
protected void |
saveToJson(com.mindfusion.common.JsonObject obj,
JsonPersistContext context)
Serializes the component into a JsonObject.
|
protected void |
saveToXml(org.w3c.dom.Element xmlElement,
XmlPersistContext context)
ComponentBase.saveToXml override.
|
void |
setAcceptsReturn(boolean value)
Sets a value indicating whether the edit component will insert new line when
the user presses the ENTER key.
|
void |
setBrush(Brush value)
Sets the background brush of the edit component.
|
void |
setFont(java.awt.Font value)
Sets the font of the text.
|
void |
setHideSelection(boolean value)
Sets a value indicating whether to hide the selection
when the edit component does not have input focus.
|
void |
setInactiveSelectionColor(java.awt.Color value)
Sets the color of the selection when the edit component does not have input focus.
|
void |
setPen(Pen value)
Sets the border pen of the edit component.
|
void |
setScrollFirstLine(int value)
Sets the index of the first visible line in the edit component.
|
void |
setSelectionColor(java.awt.Color value)
Sets the color of the selection.
|
void |
setSelectionLength(int value)
Sets the length of the selection in the edit component.
|
void |
setSelectionStart(int value)
Sets the start of the selection in the edit component.
|
void |
setText(java.lang.String value)
Sets the text of the edit component.
|
void |
setTextAlignment(Align value)
Sets the horizontal alignment of the text in the edit component.
|
void |
setTextColor(java.awt.Color value)
Sets the color of the text.
|
void |
setTextPadding(float value)
Sets the padding of the edit component.
|
void |
setTextWrapping(TextWrapping value)
Sets the wrapping of of the text in the edit component.
|
void |
writeExternal(java.io.ObjectOutput out)
ComponentBase.writeExternal override.
|
addComponentEventListener, addComponentMouseEventListener, addComponentValidationEventListener, arrangeComponents, confirmValidating, contains, createOutlinePath, find, getBounds, getChildCount, getDocumentBounds, getFocusable, getGridColumn, getGridRow, getHeight, getHorizontalAlignment, getIsEnabled, getIsFocused, getIsHitTestVisible, getIsInteractive, getName, getParent, getParentHost, getVerticalAlignment, getVisible, getWidth, invalidate, invalidateLayout, onGotFocus, onLostFocus, onMouseDown, onMouseMove, onMouseUp, onRemovedFromParent, onValidated, onValidating, raiseValidated, removeComponentEventListener, removeComponentMouseEventListener, removeComponentValidationEventListener, serializeSubcomponents, setBounds, setFocusable, setGridColumn, setGridRow, setHeight, setHorizontalAlignment, setIsEnabled, setIsFocused, setIsHitTestVisible, setIsInteractive, setName, setParent, setVerticalAlignment, setVisible, setWidth, toDocument, toLocal, toParent
public EditComponent()
protected void onAddedToParent()
onAddedToParent
in class ComponentBase
public void onContextChanged()
onContextChanged
in class ComponentBase
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
writeExternal
in class ComponentBase
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
readExternal
in class ComponentBase
java.io.IOException
java.lang.ClassNotFoundException
protected void saveToXml(org.w3c.dom.Element xmlElement, XmlPersistContext context)
saveToXml
in class ComponentBase
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) throws javax.xml.transform.TransformerException
loadFromXml
in class ComponentBase
xmlElement
- An Element containing the component's data.context
- An XmlPersistContext object providing contextual information about the serialization process and some helper serialization methods.javax.xml.transform.TransformerException
protected void saveToJson(com.mindfusion.common.JsonObject obj, JsonPersistContext context)
saveToJson
in class ComponentBase
obj
- An JsonObject containing the EditComponent datacontext
- An JsonPersistContext object providing information
about the serialization process and some helper methods.protected void loadFromJson(com.mindfusion.common.JsonObject obj, JsonPersistContext context)
loadFromJson
in class ComponentBase
obj
- An JsonObject containing the EditComponent datacontext
- An JsonPersistContext object providing information
about the serialization process and some helper methods.public void draw(java.awt.Graphics2D g2d, RenderOptions options)
draw
in class ComponentBase
g2d
- The drawing target.options
- A RenderOptions object specifying the drawing context.public void onMouseDown(java.awt.geom.Point2D point)
onMouseDown
in class ComponentBase
point
- A Point2D.Float instance that specifies the current mouse position.public void onMouseMove(java.awt.geom.Point2D point)
onMouseMove
in class ComponentBase
point
- A Point2D.Float instance that specifies the current mouse position.public void onMouseUp(java.awt.geom.Point2D point)
onMouseUp
in class ComponentBase
point
- A Point2D.Float instance that specifies the current mouse position.public CursorHint getCursor(java.awt.geom.Point2D point)
getCursor
in class ComponentBase
point
- A Point2D.Float instance that specifies the current mouse position, in document coordinates.public boolean onKeyDown(int keyCode, int modifiers)
onKeyDown
in class ComponentBase
public void onKeyUp(int keyCode, int modifiers)
onKeyUp
in class ComponentBase
public void onKeyPress(char keyChar)
onKeyPress
in class ComponentBase
keyChar
- The character representing the pressed key.public void onGotFocus(ComponentEvent e)
onGotFocus
in class ComponentBase
e
- An object providing the event data.public void onLostFocus()
onLostFocus
in class ComponentBase
protected void onZoomChanged()
onZoomChanged
in class ComponentBase
public void onUnitChanged()
onUnitChanged
in class ComponentBase
protected void onTextChanged(ComponentTextEvent e)
e
- An object containing the event data.protected void onTextChanging(ComponentTextValidationEvent e)
e
- An object containing the event data.protected void onKeyPressed(ComponentKeyEvent e)
e
- An object containing the event data.protected void onKeyDown(ComponentKeyEvent e)
e
- An object containing the event data.protected void onKeyUp(ComponentKeyEvent e)
e
- An object containing the event data.protected void onClicked(ComponentMouseEvent e)
e
- An object containing the event data.public XDimension2D.Double getDesiredSize(XDimension2D.Double availableSize, java.awt.Graphics2D g2d)
getDesiredSize
in class ComponentBase
availableSize
- The available size.g2d
- A relevant Graphics2D object.public java.lang.String getText()
public void setText(java.lang.String value)
value
- A String containing the component's text.public int getSelectionStart()
public void setSelectionStart(int value)
value
- An integer specifying the start of the current selection.public int getSelectionLength()
public void setSelectionLength(int value)
value
- An integer specifying the length of the current selection.public java.awt.Color getTextColor()
public void setTextColor(java.awt.Color value)
value
- A jawa.awt.Color instance.public java.awt.Color getSelectionColor()
public void setSelectionColor(java.awt.Color value)
value
- A jawa.awt.Color instance.public java.awt.Color getInactiveSelectionColor()
public void setInactiveSelectionColor(java.awt.Color value)
value
- A jawa.awt.Color instance.public java.awt.Font getFont()
public void setFont(java.awt.Font value)
value
- A jawa.awt.Font instance.public Brush getBrush()
public void setBrush(Brush value)
value
- A Brush instance.public Pen getPen()
public void setPen(Pen value)
value
- A Pen instance.public float getTextPadding()
public void setTextPadding(float value)
value
- A floating point value specifying the spacing between the component border and displayed text.public TextWrapping getTextWrapping()
public void setTextWrapping(TextWrapping value)
value
- A member of the TextWrapping enumeration.public boolean acceptsReturn()
public void setAcceptsReturn(boolean value)
value
- true to insert new line when the user presses ENTER, or false to ignore the key.public boolean isHideSelection()
public void setHideSelection(boolean value)
value
- true, to hide selection when the edit component does not have input focus, or false otherwise.public Align getTextAlignment()
public void setTextAlignment(Align value)
value
- A member of the Align enumeration.public int getScrollFirstLine()
public void setScrollFirstLine(int value)
value
- An integer value specifying the scroll position.public void addComponentKeyEventListener(ComponentKeyEventListener listener)
listener
- An object implementing ComponentKeyEventListener interface.public void removeComponentKeyEventListener(ComponentKeyEventListener listener)
listener
- An object implementing ComponentKeyEventListener interface.public void addEditComponentListener(EditComponentListener listener)
listener
- An object implementing EditComponentListener interface.public void removeEditComponentListener(EditComponentListener listener)
listener
- An object implementing EditComponentListener interface.