|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.jeta.open.gui.framework.JETAPanel
com.jeta.forms.components.panel.FormPanel
public class FormPanel
This is the main panel class used to load and view a form during runtime. Usage:
FormPanel panel = new FormPanel("com/mycorp/app/gui/login/loginView.jfrm");It assumed that all form files are located in your classpath.
You should only use the published APIs to programmatically add, remove, or
access Swing Components from a form. If you need to programmatically change a
form, you use a FormAccessor, see getFormAccessor(String)
. If you
pass a valid form name, this method will return a FormAccessor instance. Use
FormAccessors to access the FormLayout or to add, remove, change, or
enumerate components in the underlying container.
FormPanel myform = new FormPanel( "test.jfrm" ); // where the main form in test.jfrm is named "settings" FormAccessor form_accessor = (FormAccessor)myform.getFormAccessor( "settings" ); // adds a component at column 2 and row 5 form_accessor.addBean( new JButton("Test"), new CellConstraints( 2, 5 ) ); // or replace the component named 'wizard.view' with a different component. FormPanel wiz_view = new FormPanel( "pane2.jfrm" ); form_accessor.replaceBean( "wizard.view", wiz_view ); // use FormAccessor to iterate over components in a form as well Iterator iter = formaccessor.beanIterator(); while( iter.hasNext() ) { Component comp = (Component)iter.next(); if ( comp instanceof FormAccessor ) { // found a nested form. // if this iterator is nested, the next call to next() will // return components in the nested form. } else { // found a standard Java Bean } }
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
FormPanel(FormComponent fc)
FormPanel constructor. |
|
FormPanel(InputStream istream)
FormPanel constructor. |
|
FormPanel(String formPath)
FormPanel constructor. |
Method Summary | |
---|---|
protected void |
addForm(FormComponent form,
LayoutManager layout,
Object constraints)
Adds the form to this panel using the given layout manager and constraints |
void |
applyComponentOrientation(ComponentOrientation orientation)
|
Iterator |
beanIterator(boolean nested)
Returns an iterator for a collection of Java Beans (java.awt.Component objects) contained by this form and its nested forms. |
Object |
get(String objName)
Returns the user object associated with the given name. |
FormAccessor |
getFormAccessor()
Return an instance of a FormAccessor that is associated with the top-most form in this panel (recall that a form can have nested forms). |
FormAccessor |
getFormAccessor(String compName)
Return an instance of a FormAccessor that has the given name. |
Container |
getFormContainer()
Returns the parent container that contains the top-level form in this panel. |
void |
put(String objName,
Object obj)
Puts the given object into the user objects map. |
void |
revalidate()
Revalidates this panel. |
void |
setFocusTraversalPolicy(FocusTraversalPolicy policy)
Sets the focus traversal policy for this panel. |
void |
updateFocusPolicy()
If this form panel contains a form with a custom focus policy, you should call updateFocusPolicy whenever you programatically add or remove components from the form or any nested forms. |
void |
updateUI()
Override so we can update the underlying FormComponent |
Methods inherited from class com.jeta.open.gui.framework.JETAPanel |
---|
createComponentFinder, enableComponent, getAllNamedComponents, getBoolean, getButton, getCheckBox, getComboBox, getComponentByName, getComponentFinder, getComponentsByName, getController, getInteger, getLabel, getList, getPanel, getProgressBar, getRadioButton, getSelectedItem, getSpinner, getTabbedPane, getTable, getText, getTextComponent, getTextField, getTree, getUIDirector, isSelected, removeDescendent, removeFromParent, reset, setComponentFinder, setController, setSelected, setSelectedItem, setText, setUIDirector, setVisible, updateComponents, updateComponents |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FormPanel(String formPath)
formPath
- the path to the form file. This path can be absolute or
relative to the classpath.public FormPanel(InputStream istream) throws FormException
FormException
- if any type of I/O error occurs or the input stream is not a
valid form file.public FormPanel(FormComponent fc)
Method Detail |
---|
protected void addForm(FormComponent form, LayoutManager layout, Object constraints)
public Iterator beanIterator(boolean nested)
public Object get(String objName)
JETAPanel.getComponentByName(java.lang.String)
).
Rather, this method returns any user object that was associated with this
panel by calling put(String,Object)
. Null is returned if the
object does not exist.
public Container getFormContainer()
getFormAccessor(String)
public FormAccessor getFormAccessor()
public FormAccessor getFormAccessor(String compName)
compName
- the name of the form to retrieve.
public void put(String objName, Object obj)
get( String )
objName
- the name of the objectobj
- the objectpublic void revalidate()
revalidate
in class JComponent
public void applyComponentOrientation(ComponentOrientation orientation)
applyComponentOrientation
in class Container
public void setFocusTraversalPolicy(FocusTraversalPolicy policy)
setFocusTraversalPolicy
in class Container
public void updateFocusPolicy()
public void updateUI()
updateUI
in class JPanel
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |