public class FormComponent extends FormObject implements FormSelectable
Component
in the form model.
It has a name, a class name and properties.
The name is used by the Java code generator as variable name or by the
FormLoader to access the Swing component.
FormContainer
must be used for container components;
FormWindow
for Window
and derived components;
FormNonVisual
for non-visual JavaBeans (not derived from
Component
).
Example:
FormComponent label = new FormComponent("javax.swing.JLabel"); label.setProperty("text", "hello"); label.setProperty("foreground", Color.red);The same in Swing:
JLabel label = new JLabel(); label.setText("hello"); label.setForeground(Color.red);
Modifier and Type | Field and Description |
---|---|
static String |
FIELD_CLASS_NAME |
static String |
FIELD_NAME |
NULL_VALUE
Constructor and Description |
---|
FormComponent(String className)
Constructs a form component for the specified class.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(FormComponentVisitor visitor)
Accepts the given visitor.
|
void |
addEvent(FormEvent event)
Adds a form event to the end of this form component.
|
void |
addEvent(FormEvent event,
int index)
Adds a form event to this form component at the specified position.
|
FormObject |
auxiliary()
Returns a object that contains auxiliary property.
|
Object |
clone()
Clones this form component.
|
boolean |
getAuxiliaryPropertyBoolean(String name,
boolean def)
Convenience method to get an auxiliary boolean property value.
|
int |
getAuxiliaryPropertyInt(String name,
int def)
Convenience method to get an auxiliary integer property value.
|
String |
getAuxiliaryPropertyString(String name,
String def)
Convenience method to get an auxiliary String property value.
|
String |
getClassName()
Returns the class name of this form component.
|
FormLayoutConstraints |
getConstraints()
Returns the form layout constraints of this form component if the
parent container has a form layout manager which uses constraints.
|
FormEvent |
getEvent(int index)
Returns the form event at
index . |
int |
getEventCount()
Returns the number of form events in this form component.
|
FormEvent[] |
getEvents()
Returns all form events in this form component.
|
FormModel |
getModel()
Returns the form model of this form component.
|
String |
getName()
Returns the name of this form component.
|
FormContainer |
getParent()
Returns the parent of this form component.
|
boolean |
hasAuxiliary()
Returns whether this form component has auxiliary properties or not.
|
void |
removeEvent(FormEvent event)
Removes the specified form event from this form component.
|
void |
removeEvent(int index)
Removes the form event at the specified index from this form component.
|
void |
setClassName(String className)
Sets the class name of this form component.
|
void |
setName(String name)
Sets the name of this form component.
|
String |
toString()
Returns a string representation of the object.
|
equals, getClientProperty, getProperties, getProperty, getProperty, getPropertyBoolean, getPropertyBoolean, getPropertyCount, getPropertyDouble, getPropertyDouble, getPropertyInt, getPropertyInt, getPropertyNames, getPropertyString, getPropertyString, getReferenceCount, hashCode, properties, propertyNames, putClientProperty, setProperty, setProperty, setProperty, setPropertyBoolean, setPropertyBoolean, setPropertyDouble, setPropertyDouble, setPropertyInt, setPropertyInt, setPropertyString
public static final String FIELD_NAME
public static final String FIELD_CLASS_NAME
public FormComponent(String className)
public String getName()
public void setName(String name)
public String getClassName()
public void setClassName(String className)
public FormContainer getParent()
null
if the form component has no parent.public FormModel getModel()
public FormObject auxiliary()
public boolean hasAuxiliary()
public String getAuxiliaryPropertyString(String name, String def)
def
if the auxiliary property is not a String or does not exist.public int getAuxiliaryPropertyInt(String name, int def)
def
if the auxiliary property is not an integer or does not exist.public boolean getAuxiliaryPropertyBoolean(String name, boolean def)
def
if the auxiliary property is not a boolean or does not exist.public FormLayoutConstraints getConstraints()
public boolean accept(FormComponentVisitor visitor)
FormComponentVisitor.visit(com.jformdesigner.model.FormComponent)
is called
with this form component.visitor
- The visitor.FormComponentVisitor.visit(com.jformdesigner.model.FormComponent)
.public int getEventCount()
public FormEvent getEvent(int index)
index
.public FormEvent[] getEvents()
public void addEvent(FormEvent event)
public void addEvent(FormEvent event, int index)
event
- The form event to be added.index
- The position in the component's event list at which
to insert the event; or -1 to insert at the endpublic void removeEvent(FormEvent event)
public void removeEvent(int index)
public String toString()
toString
in class FormObject
Copyright (C) 2004-2019 FormDev Software GmbH. All rights reserved.