|
Holger's Java API |
|||||||||
| 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.JInternalFrame
com.antelmann.util.gui.FormInternalFrame
public class FormInternalFrame
a JInternalFrame that takes some form along with a FormValidator to edit some data. The JInternalFrame contains the form and a toolbar with a save and a close button. Upon saving, disposing or in the event of exceptions, events are generated that can be monitored via the Listener interface. Since all components sit on the embedded mainPanel using a BorderLayout, it is relatively easy to add additional components to the sides of the frame.
FormDialog,
Serialized Form| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JInternalFrame |
|---|
JInternalFrame.AccessibleJInternalFrame, JInternalFrame.JDesktopIcon |
| 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 | |
|---|---|
protected JButton |
closeButton
|
protected JPanel |
mainPanel
|
protected JButton |
saveButton
|
| Fields inherited from class javax.swing.JInternalFrame |
|---|
closable, CONTENT_PANE_PROPERTY, desktopIcon, FRAME_ICON_PROPERTY, frameIcon, GLASS_PANE_PROPERTY, iconable, IS_CLOSED_PROPERTY, IS_ICON_PROPERTY, IS_MAXIMUM_PROPERTY, IS_SELECTED_PROPERTY, isClosed, isIcon, isMaximum, isSelected, LAYERED_PANE_PROPERTY, maximizable, MENU_BAR_PROPERTY, resizable, ROOT_PANE_PROPERTY, rootPane, rootPaneCheckingEnabled, title, TITLE_PROPERTY |
| 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 com.antelmann.util.gui.Form |
|---|
EDIT_PROPERTY_KEY |
| Fields inherited from interface javax.swing.WindowConstants |
|---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
FormInternalFrame(String title,
JComponent form,
FormValidator<?> validator)
calls the next constructor with saveAlwaysEnabled=true |
|
FormInternalFrame(String title,
JComponent form,
FormValidator<?> validator,
boolean saveAlwaysEnabled)
|
|
| Method Summary | |
|---|---|
void |
addListener(FormListener l)
|
boolean |
closeAction()
|
boolean |
disposeForm(boolean forceWithoutConfirm)
allows to programmatically close the form. |
JToolBar |
getButtonContainer()
provides the container that contains the functional buttons of the Form, so that other additional buttons may be added here |
JComponent |
getFormComponent()
|
Container |
getFormContainer()
provides access to the overall window, dialog, frame, internal frame or other that holds the form with the formComponent and all the functional buttons that belong to the form |
FormListener[] |
getFormListeners()
|
FormValidator<?> |
getFormValidator()
|
JPanel |
getMainPanel()
returns the panel in the center that has the toolbar and the form on it |
boolean |
getWarnOnClose()
determines whether a warning is displayed upon cancel if the form is marked as changed (false by default) |
boolean |
isDirty()
determines whether the form is currently considered to be in a 'changed'-mode. |
Object |
performSaveAction()
programmatically performs the action that would commonly be performed upon pressing 'save' on the form. |
void |
propertyChange(PropertyChangeEvent evt)
marks the form dirty and enables the save button (in case it's not already generally enabled) |
boolean |
removeListener(FormListener l)
|
void |
setWarnOnClose(boolean flag)
if set to true, a warning is displayed when the form is closed w/o saving if it is marked changed |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final JPanel mainPanel
protected JButton saveButton
protected JButton closeButton
| Constructor Detail |
|---|
public FormInternalFrame(String title,
JComponent form,
FormValidator<?> validator)
public FormInternalFrame(String title,
JComponent form,
FormValidator<?> validator,
boolean saveAlwaysEnabled)
| Method Detail |
|---|
public JPanel getMainPanel()
public JToolBar getButtonContainer()
Form
getButtonContainer in interface Formpublic JComponent getFormComponent()
getFormComponent in interface Formpublic FormValidator<?> getFormValidator()
getFormValidator in interface Formpublic boolean isDirty()
Form
isDirty in interface Formpublic void addListener(FormListener l)
addListener in interface Formpublic boolean removeListener(FormListener l)
removeListener in interface Formpublic FormListener[] getFormListeners()
getFormListeners in interface Formpublic Object performSaveAction()
FormFormValidator.validateForm(Component)
and then call FormValidator.commitFormAction(Component); also this method
resets the Form.isDirty() status if the commit was successful.
performSaveAction in interface Formpublic boolean getWarnOnClose()
Form
getWarnOnClose in interface Formpublic void setWarnOnClose(boolean flag)
Form
setWarnOnClose in interface Formpublic boolean closeAction()
public boolean disposeForm(boolean forceWithoutConfirm)
Form
disposeForm in interface FormforceWithoutConfirm - if true, the form will be disposed no matter what;
if false, a confirmation dialog may appear if the form
is dirty and warnOnClose is true
public void propertyChange(PropertyChangeEvent evt)
propertyChange in interface PropertyChangeListenerpublic Container getFormContainer()
Form
getFormContainer in interface Form
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||