org.tentackle.appworx
Class AppDbObjectDialog

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
                  extended by javax.swing.JDialog
                      extended by org.tentackle.ui.FormDialog
                          extended by org.tentackle.appworx.AppDbObjectDialog
All Implemented Interfaces:
DropTargetListener, ContainerListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants, FormContainer, FormWindow

public class AppDbObjectDialog
extends FormDialog
implements DropTargetListener

Edit dialog for AppDbObjects.

The dialog provides the following generic features:

Author:
harald
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialog
 
Nested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityType
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
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
static String ACTION_CANCEL
          action string for "cancel"
static String ACTION_DELETE
          action string for "delete"
static String ACTION_NEW
          action string for "new"
static String ACTION_NEXT
          action string for "next"
static String ACTION_PREVIOUS
          action string for "previous"
static String ACTION_SAVE
          action string for "save"
static String ACTION_SEARCH
          action string for "search"
static boolean defaultNewAfterSave
          global default: true if object should be cleared after save
protected  boolean deleteAllowed
          permission: true if deleting the object is allowed
protected  boolean instantiatable
          permission: true if user may create a new object
protected  boolean readAllowed
          permission: true if viewing object is allowed
static String TX_DELETE
          tx name for delete
static String TX_SAVE
          tx name for save
protected  boolean writeAllowed
          permission: true if updating object is allowed
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPE
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
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
protected AppDbObjectDialog(Window owner, AppDbObject dbObject, boolean modal)
          Creates a database object dialog.
 
Method Summary
 void addActionListener(ActionListener listener)
          Adds an action listener that will be invoked as soon as delete, save or cancel has been pressed.
protected  String applyLock(AppDbObject object)
          Applies a token lock to the object.
 boolean areValuesChanged()
          Checks whether the contents of some components in this or sub containers have changed since the last savepoint.
 void clearObject()
          Clears the object.
Implemented by replacing the current object with a new object.
protected  boolean delete()
          Deletes the current database object.
protected  boolean deleteObject(AppDbObject dbObject)
          Deletes the current object.
protected  void determinePermissions(AppDbObject dbObject)
          Determines the permissions readAllowed, writeAllowed, deleteAllowed and loads the SecurityManager.
The permissions will be determined "lazily" where possible.
 void dispose()
          Releases all of the native screen resources used by this Window, its subcomponents, and all of its owned children.
 void dragEnter(DropTargetDragEvent event)
          Called while a drag operation is ongoing, when the mouse pointer enters the operable part of the drop site for the DropTarget registered with this listener.
 void dragExit(DropTargetEvent event)
          Called while a drag operation is ongoing, when the mouse pointer has exited the operable part of the drop site for the DropTarget registered with this listener.
 void dragOver(DropTargetDragEvent event)
          Called when a drag operation is ongoing, while the mouse pointer is still over the operable part of the drop site for the DropTarget registered with this listener.
 void drop(DropTargetDropEvent event)
          Called when the drag operation has terminated with a drop on the operable part of the drop site for the DropTarget registered with this listener.
 void dropActionChanged(DropTargetDragEvent event)
          Called if the user has modified the current drop gesture.
 void fireActionPerformed(ActionEvent e)
          Notifies all Listeners that some button was pressed.
 Class<? extends AppDbObject> getDbObjectClass()
          Gets the object's class.
 AppDbObject getLastObject()
          Gets the last object (after save(), delete(), etc...).
 AppDbObject getObject()
          Gets the current object
 List getObjectList()
          Gets the linked objects list.
 int getObjectListIndex()
          Gets the object list index.
 AppDbObjectPanel getObjectPanel()
          Gets the object panel.
 TooltipAndErrorPanel getTooltipAndErrorPanel()
          Gets the tooltip- and error-panel.
By default the panel is invisible.
 boolean isCreateAllowed()
          Returns whether new objects can be created.
 boolean isDeleteAllowed()
          Returns whether the object is deletable.
 boolean isDisposeOnDeleteOrSave()
          Returns whether the dialog is disposed after delete or save.
 boolean isNewAfterSave()
          Returns whether the object is cleared after save.
 boolean isReadAllowed()
          Returns whether the object is readable (viewable).
 boolean isWriteAllowed()
          Returns whether the object is writable (editable).
protected  void processWindowEvent(WindowEvent e)
          Handles window events depending on the state of the defaultCloseOperation property.
 void removeActionListener(ActionListener listener)
          Removes an action Listener.
 void removeAllListeners()
          Removes all Listeners.
protected  boolean revokeLock(AppDbObject object)
          Revokes a token lock to the object that has not been saved.
protected  boolean save()
          Saves the current object.
Will start a transaction, check for prepare, apply the editedby token, save and remove the token, commit -- or rollback.
protected  boolean saveObject(AppDbObject object)
          Saves the object.
 void saveValues()
          Sets a savepoint for all components in this container and all sub containers.
 void setAllChangeable(boolean allChangeable)
          Sets the changeable attribute of all components of this container and all sub containers.
 void setDisposeOnDeleteOrSave(boolean disposeOnDeleteOrSave)
          Sets whether the dialog will be disposed after delete or save.
 void setNewAfterSave(boolean newAfterSave)
          Sets whether the object is cleared after save.
 boolean setObject(AppDbObject dbObject)
          Sets the object and requests the initial focus.
 boolean setObject(AppDbObject dbObject, boolean requestFocus)
          Sets the object.
 void setObjectList(List objectList)
          Links to a list of objects.
 void setTitle(String title)
          Sets the title of the Dialog.
 AppDbObject showDialog()
          Shows the dialog.
The dialog can be either modal or non-modal.
 AppDbObject showDialog(boolean noPersistance)
          Shows the dialog.
The dialog can be either modal or non-modal.
 void triggerValuesChanged()
          Signals that values in the components of the container may have changed.
protected  boolean updateDeletePermission(AppDbObject object)
          Updates the delete permission.
Invoked before performing the TX.
protected  boolean updateWritePermission(AppDbObject object)
          Updates the write permission.
Invoked before performing the TX.
 
Methods inherited from class org.tentackle.ui.FormDialog
addFormWrapListener, alignLocation, checkAutoClose, componentAdded, componentRemoved, fireFormWrappedFocus, getAutoClose, getFormValues, getHelpURL, getKeepChangedValues, getParentWindow, getRelatedWindow, getTimeOfLastValuesChanged, getTooltipDisplay, getUIVersion, invalidateParentInfo, isAllChangeable, isAutoCloseable, isAutoPosition, isHonourAllChangeable, pack, paint, removeFormWrapListener, setAutoClose, setAutoPosition, setFormValues, setFormValuesKeepChanged, setHelpURL, setHonourAllChangeable, setKeepChangedValues, setRelatedWindow, setTimeOfLastValuesChanged, setTooltipDisplay, setUIVersion, showHelp
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setModalityType, setResizable, setUndecorated, setVisible, show, toBack
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.tentackle.ui.FormContainer
getTitle
 

Field Detail

defaultNewAfterSave

public static boolean defaultNewAfterSave
global default: true if object should be cleared after save


TX_SAVE

public static final String TX_SAVE
tx name for save

See Also:
Constant Field Values

TX_DELETE

public static final String TX_DELETE
tx name for delete

See Also:
Constant Field Values

ACTION_NEW

public static final String ACTION_NEW
action string for "new"

See Also:
Constant Field Values

ACTION_SEARCH

public static final String ACTION_SEARCH
action string for "search"

See Also:
Constant Field Values

ACTION_DELETE

public static final String ACTION_DELETE
action string for "delete"

See Also:
Constant Field Values

ACTION_SAVE

public static final String ACTION_SAVE
action string for "save"

See Also:
Constant Field Values

ACTION_CANCEL

public static final String ACTION_CANCEL
action string for "cancel"

See Also:
Constant Field Values

ACTION_PREVIOUS

public static final String ACTION_PREVIOUS
action string for "previous"

See Also:
Constant Field Values

ACTION_NEXT

public static final String ACTION_NEXT
action string for "next"

See Also:
Constant Field Values

writeAllowed

protected boolean writeAllowed
permission: true if updating object is allowed


readAllowed

protected boolean readAllowed
permission: true if viewing object is allowed


deleteAllowed

protected boolean deleteAllowed
permission: true if deleting the object is allowed


instantiatable

protected boolean instantiatable
permission: true if user may create a new object

Constructor Detail

AppDbObjectDialog

protected AppDbObjectDialog(Window owner,
                            AppDbObject dbObject,
                            boolean modal)
Creates a database object dialog.

Note: applications should use Application.showEditDialog(java.awt.Component, org.tentackle.appworx.AppDbObject, boolean) instead, because this will make use of dialog pooling!

Parameters:
owner - the owner window, null if no owner
dbObject - is the database object
modal - is true if modal, else false
Method Detail

setObjectList

public void setObjectList(List objectList)
Links to a list of objects.

If this dialog is linked to a list of objects, two navigation buttons appear to walk through the list.

Parameters:
objectList - the list of objects, null if none (default)

getObjectList

public List getObjectList()
Gets the linked objects list.

Returns:
the list of objects, null if none (default)

getObjectListIndex

public int getObjectListIndex()
Gets the object list index.

Returns:
the index of the object being displayed in the objectList, -1 if not in list

clearObject

public void clearObject()
Clears the object.
Implemented by replacing the current object with a new object. The current object is saved.

See Also:
getLastObject()

isReadAllowed

public boolean isReadAllowed()
Returns whether the object is readable (viewable).

Returns:
true if dialog consideres object as readable

isWriteAllowed

public boolean isWriteAllowed()
Returns whether the object is writable (editable).

Returns:
true if dialog consideres object as modifyable by the user

isDeleteAllowed

public boolean isDeleteAllowed()
Returns whether the object is deletable.

Returns:
true if dialog consideres object removeable by the user

isCreateAllowed

public boolean isCreateAllowed()
Returns whether new objects can be created.

Returns:
true if dialog consideres object as createable by the user

setObject

public boolean setObject(AppDbObject dbObject,
                         boolean requestFocus)
Sets the object.

Parameters:
dbObject - the database object (must be the same class as current object!)
requestFocus - true if initial focus should be requested
Returns:
true if object accepted
See Also:
AppDbObjectPanel.setInitialFocus()

setObject

public boolean setObject(AppDbObject dbObject)
Sets the object and requests the initial focus.

Parameters:
dbObject - the database object (must be the same class as current object!)
Returns:
true if object accepted
See Also:
setObject(org.tentackle.appworx.AppDbObject, boolean)

getObject

public AppDbObject getObject()
Gets the current object

Returns:
the current object

getLastObject

public AppDbObject getLastObject()
Gets the last object (after save(), delete(), etc...).

Returns:
the previous (last) object

getObjectPanel

public AppDbObjectPanel getObjectPanel()
Gets the object panel.

Returns:
the database object panel

getDbObjectClass

public Class<? extends AppDbObject> getDbObjectClass()
Gets the object's class.

Returns:
the database object class

showDialog

public AppDbObject showDialog(boolean noPersistance)
Shows the dialog.
The dialog can be either modal or non-modal. If modal the method blocks until the dialog is closed.

Parameters:
noPersistance - true if NO changes must be made to persistance layer
Returns:
the current object

showDialog

public AppDbObject showDialog()
Shows the dialog.
The dialog can be either modal or non-modal. If modal the method blocks until the dialog is closed.

Returns:
the current object

isNewAfterSave

public boolean isNewAfterSave()
Returns whether the object is cleared after save.

Returns:
true if set new object after save

setNewAfterSave

public void setNewAfterSave(boolean newAfterSave)
Sets whether the object is cleared after save.

Parameters:
newAfterSave - true if set new object after save
See Also:
defaultNewAfterSave

isDisposeOnDeleteOrSave

public boolean isDisposeOnDeleteOrSave()
Returns whether the dialog is disposed after delete or save.

Returns:
true if dispose after delete or save

setDisposeOnDeleteOrSave

public void setDisposeOnDeleteOrSave(boolean disposeOnDeleteOrSave)
Sets whether the dialog will be disposed after delete or save.

Parameters:
disposeOnDeleteOrSave - true if dispose after delete or save

getTooltipAndErrorPanel

public TooltipAndErrorPanel getTooltipAndErrorPanel()
Gets the tooltip- and error-panel.
By default the panel is invisible.

Returns:
the tooltip and error panel

addActionListener

public void addActionListener(ActionListener listener)
Adds an action listener that will be invoked as soon as delete, save or cancel has been pressed.

Parameters:
listener - the listener to add

removeActionListener

public void removeActionListener(ActionListener listener)
Removes an action Listener.

Parameters:
listener - the listener to remove

removeAllListeners

public void removeAllListeners()
Removes all Listeners.


fireActionPerformed

public void fireActionPerformed(ActionEvent e)
Notifies all Listeners that some button was pressed.

Parameters:
e - the action event

dragEnter

public void dragEnter(DropTargetDragEvent event)
Description copied from interface: java.awt.dnd.DropTargetListener
Called while a drag operation is ongoing, when the mouse pointer enters the operable part of the drop site for the DropTarget registered with this listener.

Specified by:
dragEnter in interface DropTargetListener
Parameters:
event - the DropTargetDragEvent

dragExit

public void dragExit(DropTargetEvent event)
Description copied from interface: java.awt.dnd.DropTargetListener
Called while a drag operation is ongoing, when the mouse pointer has exited the operable part of the drop site for the DropTarget registered with this listener.

Specified by:
dragExit in interface DropTargetListener
Parameters:
event - the DropTargetEvent

dragOver

public void dragOver(DropTargetDragEvent event)
Description copied from interface: java.awt.dnd.DropTargetListener
Called when a drag operation is ongoing, while the mouse pointer is still over the operable part of the drop site for the DropTarget registered with this listener.

Specified by:
dragOver in interface DropTargetListener
Parameters:
event - the DropTargetDragEvent

dropActionChanged

public void dropActionChanged(DropTargetDragEvent event)
Description copied from interface: java.awt.dnd.DropTargetListener
Called if the user has modified the current drop gesture.

Specified by:
dropActionChanged in interface DropTargetListener
Parameters:
event - the DropTargetDragEvent

drop

public void drop(DropTargetDropEvent event)
Description copied from interface: java.awt.dnd.DropTargetListener
Called when the drag operation has terminated with a drop on the operable part of the drop site for the DropTarget registered with this listener.

This method is responsible for undertaking the transfer of the data associated with the gesture. The DropTargetDropEvent provides a means to obtain a Transferable object that represents the data object(s) to be transfered.

From this method, the DropTargetListener shall accept or reject the drop via the acceptDrop(int dropAction) or rejectDrop() methods of the DropTargetDropEvent parameter.

Subsequent to acceptDrop(), but not before, DropTargetDropEvent's getTransferable() method may be invoked, and data transfer may be performed via the returned Transferable's getTransferData() method.

At the completion of a drop, an implementation of this method is required to signal the success/failure of the drop by passing an appropriate boolean to the DropTargetDropEvent's dropComplete(boolean success) method.

Note: The data transfer should be completed before the call to the DropTargetDropEvent's dropComplete(boolean success) method. After that, a call to the getTransferData() method of the Transferable returned by DropTargetDropEvent.getTransferable() is guaranteed to succeed only if the data transfer is local; that is, only if DropTargetDropEvent.isLocalTransfer() returns true. Otherwise, the behavior of the call is implementation-dependent.

Specified by:
drop in interface DropTargetListener
Parameters:
event - the DropTargetDropEvent

setTitle

public void setTitle(String title)
Sets the title of the Dialog.

Adds " (modal)" to the title if dialog is modal

Specified by:
setTitle in interface FormContainer
Overrides:
setTitle in class Dialog
Parameters:
title - the title displayed in the dialog's border; a null value results in an empty title
See Also:
Dialog.getTitle()

setAllChangeable

public void setAllChangeable(boolean allChangeable)
Sets the changeable attribute of all components of this container and all sub containers.

Overridden to update the buttons.

Specified by:
setAllChangeable in interface FormContainer
Overrides:
setAllChangeable in class FormDialog
Parameters:
allChangeable - true if all changeable (default)

areValuesChanged

public boolean areValuesChanged()
Description copied from interface: FormContainer
Checks whether the contents of some components in this or sub containers have changed since the last savepoint.

Specified by:
areValuesChanged in interface FormContainer
Overrides:
areValuesChanged in class FormDialog
Returns:
true if changed

triggerValuesChanged

public void triggerValuesChanged()
Signals that values in the components of the container may have changed. The container typically uses that to invoke areValuesChanged() and enabling/disabling a button (e.g. "save", see AppDbObjectDialog).

Overridden to enable/disable the save-button and the TooltipAndErrorPanel.

Specified by:
triggerValuesChanged in interface FormContainer
Overrides:
triggerValuesChanged in class FormDialog

saveValues

public void saveValues()
Sets a savepoint for all components in this container and all sub containers.

Overridden to update the save-button.

Specified by:
saveValues in interface FormContainer
Overrides:
saveValues in class FormDialog
See Also:
FormComponent.saveValue()

dispose

public void dispose()
Releases all of the native screen resources used by this Window, its subcomponents, and all of its owned children. That is, the resources for these Components will be destroyed, any memory they consume will be returned to the OS, and they will be marked as undisplayable.

The Window and its subcomponents can be made displayable again by rebuilding the native resources with a subsequent call to pack or show. The states of the recreated Window and its subcomponents will be identical to the states of these objects at the point where the Window was disposed (not accounting for additional modifications between those actions).

Note: When the last displayable window within the Java virtual machine (VM) is disposed of, the VM may terminate. See AWT Threading Issues for more information.

Overridden to remove all Listeners.

Overrides:
dispose in class Window
See Also:
Component.isDisplayable(), Window.pack(), Window.show()

processWindowEvent

protected void processWindowEvent(WindowEvent e)
Handles window events depending on the state of the defaultCloseOperation property.

Overridden to allow FormHelper keeping track of windows

Overridden to catch WINDOW_CLOSING event.

Overrides:
processWindowEvent in class FormDialog
Parameters:
e - the window event
See Also:
JDialog.setDefaultCloseOperation(int)

determinePermissions

protected void determinePermissions(AppDbObject dbObject)
Determines the permissions readAllowed, writeAllowed, deleteAllowed and loads the SecurityManager.
The permissions will be determined "lazily" where possible. They will be verified again in the TX.

Parameters:
dbObject - the database object

updateWritePermission

protected boolean updateWritePermission(AppDbObject object)
Updates the write permission.
Invoked before performing the TX.

Parameters:
object - the database object
Returns:
true if permission granted

updateDeletePermission

protected boolean updateDeletePermission(AppDbObject object)
Updates the delete permission.
Invoked before performing the TX.

Parameters:
object - the database object
Returns:
true if permission granted

applyLock

protected String applyLock(AppDbObject object)
Applies a token lock to the object. This method is invoked from setObject() and is only provided to be overridden (see poolkeeper.replication).

Parameters:
object - the object to apply the lock on
Returns:
null if applied, else an errormessage.

revokeLock

protected boolean revokeLock(AppDbObject object)
Revokes a token lock to the object that has not been saved. This method is is only provided to be overridden (see poolkeeper.replication).

Parameters:
object - the object to revoke the lock from
Returns:
true if a lock has been revoked or there was no lock, false if removing the lock failed

saveObject

protected boolean saveObject(AppDbObject object)
Saves the object. Default implementation simply updates the write permission and invokes object.save().

Parameters:
object - the database object
Returns:
true if saved

save

protected boolean save()
Saves the current object.
Will start a transaction, check for prepare, apply the editedby token, save and remove the token, commit -- or rollback. If the update fails, the user will be told so in a message window. The update may fail due to the following reasons:
  1. unique violation
  2. serial-no has changed
  3. write permission revoked
  4. the lock timed out and another user grabbed the object
  5. object modified in the meantime (if no lock)

Returns:
true if saved

deleteObject

protected boolean deleteObject(AppDbObject dbObject)
Deletes the current object. The default implementation updates the delete permission and then deletes.

Parameters:
dbObject - the database object to delete
Returns:
true if deleted

delete

protected boolean delete()
Deletes the current database object. Will start a transaction, prepares thre delete and deletes the object.

Returns:
true if object deleted


Copyright © 2001-2008 Harald Krake, Bergstr. 48, 78098 Triberg, Germany, harald@krake.de