Holger's Java API

## com.antelmann.util.gui
Interface Form

All Superinterfaces:
  EventListener, PropertyChangeListener

All Known Implementing Classes:
  FormDialog, FormFrame, FormInternalFrame, FormPanel

    public interface Form

extends PropertyChangeListener

a Form represents a way to edit objects through a specialized GUI that provides all save/cancel and optionally apply functionality.

Since:
  18.06.2008, 19:30:12
Author:
  Holger Antelmann
See Also:
  `FormValidator`

Field Summary
`static String` `EDIT_PROPERTY_KEY` form components are to use this key when firing PropertyChangeEvents indicating that the form is altered; this way, the Form can listen to changes of the component that are to mark the Form 'dirty'

Method Summary
`void` `addListener(FormListener listener)`
`boolean` `disposeForm(boolean forceWithoutConfirm)` allows to programmatically close the form.
`JComponent` `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()`
`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.
`boolean` `removeListener(FormListener listener)`
`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 interface java.beans.PropertyChangeListener
`propertyChange`

Field Detail

### EDIT_PROPERTY_KEY

    static final String EDIT_PROPERTY_KEY

  form components are to use this key when firing PropertyChangeEvents indicating that the form is altered; this way, the Form can listen to changes of the component that are to mark the Form 'dirty'

  See Also:
    Constant Field Values

Method Detail

### getFormValidator

    FormValidator<?> getFormValidator()

### getFormComponent

    JComponent getFormComponent()

### addListener

    void addListener(FormListener listener)

### removeListener

    boolean removeListener(FormListener listener)

### getFormListeners

    FormListener[] getFormListeners()

### getWarnOnClose

    boolean getWarnOnClose()

  determines whether a warning is displayed upon cancel if the form is marked as changed (false by default)

### setWarnOnClose

    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

### performSaveAction

    Object performSaveAction()

  programmatically performs the action that would commonly be performed upon pressing 'save' on the form. Commonly, this method would first call `FormValidator.validateForm(Component)` and then call `FormValidator.commitFormAction(Component)`; also this method resets the `isDirty()` status if the commit was successful.

  Returns:
    the object saved or null if that didn't happen

### disposeForm

    boolean disposeForm(boolean forceWithoutConfirm)

  allows to programmatically close the form.

  Parameters:
    `forceWithoutConfirm` - 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
  Returns:
    true only if the form has been closed (and the listeners were informed accordingly)

### isDirty

    boolean isDirty()

  determines whether the form is currently considered to be in a 'changed'-mode. The form is in a changed mode after it received a PropertyChangeEvent until it is saved again.

### getButtonContainer

    JComponent getButtonContainer()

  provides the container that contains the functional buttons of the Form, so that other additional buttons may be added here

### getFormContainer

    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

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads