Class FormComponent
java.lang.Object
com.jformdesigner.model.FormObject
com.jformdesigner.model.FormComponent
- All Implemented Interfaces:
FormSelectable
- Direct Known Subclasses:
FormContainer, FormNonVisual
A form component represents a
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);
-
Field Summary
FieldsFields inherited from class FormObject
NULL_VALUE -
Constructor Summary
ConstructorsConstructorDescriptionFormComponent(String className) Constructs a form component for the specified class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccept(FormComponentVisitor visitor) Accepts the given visitor.voidAdds a form event to the end of this form component.voidAdds a form event to this form component at the specified position.Returns a object that contains auxiliary property.clone()Clones this form component.booleangetAuxiliaryPropertyBoolean(String name, boolean def) Convenience method to get an auxiliary boolean property value.intgetAuxiliaryPropertyInt(String name, int def) Convenience method to get an auxiliary integer property value.getAuxiliaryPropertyString(String name, String def) Convenience method to get an auxiliary String property value.Returns the class name of this form component.Returns the form layout constraints of this form component if the parent container has a form layout manager which uses constraints.getEvent(int index) Returns the form event atindex.intReturns the number of form events in this form component.Returns all form events in this form component.getModel()Returns the form model of this form component.getName()Returns the name of this form component.Returns the parent of this form component.booleanReturns whether this form component has auxiliary properties or not.voidremoveEvent(int index) Removes the form event at the specified index from this form component.voidremoveEvent(FormEvent event) Removes the specified form event from this form component.voidsetClassName(String className) Sets the class name of this form component.voidSets the name of this form component.toString()Returns a string representation of the object.Methods inherited from class FormObject
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
-
Field Details
-
FIELD_NAME
- See Also:
-
FIELD_CLASS_NAME
- See Also:
-
-
Constructor Details
-
FormComponent
Constructs a form component for the specified class.
-
-
Method Details
-
clone
-
getName
Returns the name of this form component. -
setName
Sets the name of this form component. -
getClassName
Returns the class name of this form component. -
setClassName
-
getParent
Returns the parent of this form component. Ornullif the form component has no parent. -
getModel
Returns the form model of this form component. -
auxiliary
Returns a object that contains auxiliary property. Auxiliary properties are used to store additional information for a form component (e.g. code generation options). -
hasAuxiliary
public boolean hasAuxiliary()Returns whether this form component has auxiliary properties or not. -
getAuxiliaryPropertyString
-
getAuxiliaryPropertyInt
Convenience method to get an auxiliary integer property value. Returnsdefif the auxiliary property is not an integer or does not exist. -
getAuxiliaryPropertyBoolean
Convenience method to get an auxiliary boolean property value. Returnsdefif the auxiliary property is not a boolean or does not exist. -
getConstraints
Returns the form layout constraints of this form component if the parent container has a form layout manager which uses constraints. -
accept
Accepts the given visitor. The visitor'sFormComponentVisitor.visit(FormComponent)is called with this form component.- Parameters:
visitor- The visitor.- Returns:
- The result of
FormComponentVisitor.visit(FormComponent). - Since:
- 3.0
-
getEventCount
public int getEventCount()Returns the number of form events in this form component.- Since:
- 2.0
-
getEvent
-
getEvents
-
addEvent
Adds a form event to the end of this form component.- Since:
- 2.0
-
addEvent
Adds a form event to this form component at the specified position.- Parameters:
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 end- Since:
- 2.0
-
removeEvent
Removes the specified form event from this form component.- Since:
- 2.0
-
removeEvent
public void removeEvent(int index) Removes the form event at the specified index from this form component.- Since:
- 2.0
-
toString
Returns a string representation of the object.- Overrides:
toStringin classFormObject
-