JFormDesigner 5.0.4 Runtime API

com.jformdesigner.model
Class FormComponent

java.lang.Object
  extended by com.jformdesigner.model.FormObject
      extended by com.jformdesigner.model.FormComponent
All Implemented Interfaces:
FormSelectable
Direct Known Subclasses:
FormContainer, FormNonVisual

public class FormComponent
extends FormObject
implements FormSelectable

A form component represents a java.awt.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 java.awt.Window and derived components; FormNonVisual for non-visual JavaBeans (not derived from java.awt.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
static java.lang.String FIELD_NAME
           
 
Fields inherited from class com.jformdesigner.model.FormObject
NULL_VALUE
 
Constructor Summary
FormComponent(java.lang.String className)
          Constructs a form component for the specified class.
 
Method Summary
 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.
 java.lang.Object clone()
          Clones this form component.
 boolean getAuxiliaryPropertyBoolean(java.lang.String name, boolean def)
          Convenience method to get an auxiliary boolean property value.
 int getAuxiliaryPropertyInt(java.lang.String name, int def)
          Convenience method to get an auxiliary integer property value.
 java.lang.String getAuxiliaryPropertyString(java.lang.String name, java.lang.String def)
          Convenience method to get an auxiliary String property value.
 java.lang.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.
 java.lang.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 setName(java.lang.String name)
          Sets the name of this form component.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class com.jformdesigner.model.FormObject
getProperties, getProperty, getProperty, getPropertyBoolean, getPropertyBoolean, getPropertyCount, getPropertyDouble, getPropertyDouble, getPropertyInt, getPropertyInt, getPropertyNames, getPropertyString, getPropertyString, getReferenceCount, properties, propertyNames, setProperty, setProperty, setProperty, setPropertyBoolean, setPropertyBoolean, setPropertyDouble, setPropertyDouble, setPropertyInt, setPropertyInt, setPropertyString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FIELD_NAME

public static final java.lang.String FIELD_NAME
See Also:
Constant Field Values
Constructor Detail

FormComponent

public FormComponent(java.lang.String className)
Constructs a form component for the specified class.

Method Detail

clone

public java.lang.Object clone()
Clones this form component.

Overrides:
clone in class java.lang.Object

getName

public java.lang.String getName()
Returns the name of this form component.


setName

public void setName(java.lang.String name)
Sets the name of this form component.


getClassName

public java.lang.String getClassName()
Returns the class name of this form component.


getParent

public FormContainer getParent()
Returns the parent of this form component. Or null if the form component has no parent.


getModel

public FormModel getModel()
Returns the form model of this form component.


auxiliary

public FormObject 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

public java.lang.String getAuxiliaryPropertyString(java.lang.String name,
                                                   java.lang.String def)
Convenience method to get an auxiliary String property value. Returns def if the auxiliary property is not a String or does not exist.


getAuxiliaryPropertyInt

public int getAuxiliaryPropertyInt(java.lang.String name,
                                   int def)
Convenience method to get an auxiliary integer property value. Returns def if the auxiliary property is not an integer or does not exist.


getAuxiliaryPropertyBoolean

public boolean getAuxiliaryPropertyBoolean(java.lang.String name,
                                           boolean def)
Convenience method to get an auxiliary boolean property value. Returns def if the auxiliary property is not a boolean or does not exist.


getConstraints

public FormLayoutConstraints getConstraints()
Returns the form layout constraints of this form component if the parent container has a form layout manager which uses constraints.


accept

public boolean accept(FormComponentVisitor visitor)
Accepts the given visitor. The visitor's FormComponentVisitor.visit(com.jformdesigner.model.FormComponent) is called with this form component.

Parameters:
visitor - The visitor.
Returns:
The result of FormComponentVisitor.visit(com.jformdesigner.model.FormComponent).
Since:
3.0

getEventCount

public int getEventCount()
Returns the number of form events in this form component.

Since:
2.0

getEvent

public FormEvent getEvent(int index)
Returns the form event at index.

Since:
2.0

getEvents

public FormEvent[] getEvents()
Returns all form events in this form component.

Since:
2.0

addEvent

public void addEvent(FormEvent event)
Adds a form event to the end of this form component.

Since:
2.0

addEvent

public void addEvent(FormEvent event,
                     int index)
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

public void removeEvent(FormEvent event)
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

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class FormObject

JFormDesigner 5.0.4 Runtime API

Copyright (C) 2004-2012 FormDev Software GmbH. All rights reserved.