de.mguennewig.pobjform.swing
Class PObjSwingForm

java.lang.Object
  extended by de.mguennewig.pobjform.AbstractPObjForm
      extended by de.mguennewig.pobjform.swing.PObjSwingForm
All Implemented Interfaces:
PObjForm
Direct Known Subclasses:
PClassSwingSearchForm

public abstract class PObjSwingForm
extends AbstractPObjForm

A Swing based implementation of the PObjForm interface.

It is advisable to use the provided default actions for the OK and Cancel buttons.

Author:
Michael Günnewig

Field Summary
 
Fields inherited from class de.mguennewig.pobjform.AbstractPObjForm
ERROR_INVALID_VALUE, ERROR_MANDATORY
 
Constructor Summary
PObjSwingForm(Container db)
          Creates a new PObject-enhanced Swing based form/dialog.
 
Method Summary
 void addButton(javax.swing.JButton button)
           
 void addOkCancelButtons(java.lang.String ok, java.lang.String cancel)
          Adds an default capable `OK' button and a `Cancel' button.
 FormElement createFormElement(FormEntry entry)
          Creates a FormElement for one specified FormEntry.
 void enableDefaultButton(javax.swing.JRootPane root)
          Enables the first capable button as the default one.
 javax.swing.JDialog getDialog()
           
 java.util.ResourceBundle getResourceBundle()
           
 javax.swing.JComponent getSwingComponent(FormEntry entry)
           
 boolean hasUserCancelled()
           
 void setResourceBundle(java.util.ResourceBundle resourceBundle)
           
 javax.swing.JPanel write()
          Writes this form/dialog into a new JPanel that will be returned.
 void write(java.awt.Dialog parent, java.lang.String title)
          Writes this form into a new modal dialog with given parent and title.
 void write(java.awt.Dialog parent, java.lang.String title, boolean modal)
          Writes this form into a dialog with given parent and title.
 javax.swing.JPanel write(FormEntry[] entries)
          Writes this form/dialog into a new JPanel that will be returned.
 void write(java.awt.Frame parent, java.lang.String title)
          Writes this form into a new modal dialog with given parent and title.
 void write(java.awt.Frame parent, java.lang.String title, boolean modal)
          Writes this form into a new modal dialog with given parent and title.
 
Methods inherited from class de.mguennewig.pobjform.AbstractPObjForm
addErrorMessage, addInvalidValueMessage, addMandatoryMessage, addMessage, addSuccessMessage, clearMessage, clearMessages, dumpMessages, extractIndexes, getContainer, getElementLabelKey, getElements, getMessageCount, getMessageCount, getMessageProperties, getMessages, getMessages, hasChanged, hasChanged, hasChanged, hasMessages, populateForm, populateForm, populateObject, populateObject, setContainer, setCurrentAsInitialState, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.mguennewig.pobjform.PObjForm
getElement, getFormDecl
 

Constructor Detail

PObjSwingForm

public PObjSwingForm(Container db)
Creates a new PObject-enhanced Swing based form/dialog.

Parameters:
db - The database container to use to acquire the persistent objects.
Throws:
PObjReadError - if any database error occurs for reference elements.
Method Detail

createFormElement

public FormElement createFormElement(FormEntry entry)
Description copied from interface: PObjForm
Creates a FormElement for one specified FormEntry.

Throws:
PObjReadError - if any database error occurs for reference elements.

getSwingComponent

public final javax.swing.JComponent getSwingComponent(FormEntry entry)

getDialog

public final javax.swing.JDialog getDialog()

getResourceBundle

public final java.util.ResourceBundle getResourceBundle()

setResourceBundle

public void setResourceBundle(java.util.ResourceBundle resourceBundle)

addButton

public void addButton(javax.swing.JButton button)

addOkCancelButtons

public final void addOkCancelButtons(java.lang.String ok,
                                     java.lang.String cancel)
Adds an default capable `OK' button and a `Cancel' button.

See Also:
enableDefaultButton(javax.swing.JRootPane)

hasUserCancelled

public final boolean hasUserCancelled()

write

public javax.swing.JPanel write()
Writes this form/dialog into a new JPanel that will be returned.


write

public final javax.swing.JPanel write(FormEntry[] entries)
Writes this form/dialog into a new JPanel that will be returned.


write

public final void write(java.awt.Dialog parent,
                        java.lang.String title)
Writes this form into a new modal dialog with given parent and title.


write

public final void write(java.awt.Dialog parent,
                        java.lang.String title,
                        boolean modal)
Writes this form into a dialog with given parent and title.


write

public final void write(java.awt.Frame parent,
                        java.lang.String title)
Writes this form into a new modal dialog with given parent and title.


write

public final void write(java.awt.Frame parent,
                        java.lang.String title,
                        boolean modal)
Writes this form into a new modal dialog with given parent and title.


enableDefaultButton

public final void enableDefaultButton(javax.swing.JRootPane root)
Enables the first capable button as the default one.

See Also:
JButton.setDefaultCapable(boolean), JRootPane.setDefaultButton(javax.swing.JButton)