|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
org.tentackle.ui.FormDialog
org.tentackle.appworx.AppDbObjectDialog
public class AppDbObjectDialog
Edit dialog for AppDbObjects.
The dialog provides the following generic features:
| 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 java.awt.Dialog |
|---|
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setModalityType, setResizable, setUndecorated, setVisible, show, toBack |
| 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 |
|---|
public static boolean defaultNewAfterSave
public static final String TX_SAVE
public static final String TX_DELETE
public static final String ACTION_NEW
public static final String ACTION_SEARCH
public static final String ACTION_DELETE
public static final String ACTION_SAVE
public static final String ACTION_CANCEL
public static final String ACTION_PREVIOUS
public static final String ACTION_NEXT
protected boolean writeAllowed
protected boolean readAllowed
protected boolean deleteAllowed
protected boolean instantiatable
| Constructor Detail |
|---|
protected AppDbObjectDialog(Window owner,
AppDbObject dbObject,
boolean modal)
Note: applications should use Application.showEditDialog(java.awt.Component, org.tentackle.appworx.AppDbObject, boolean) instead, because
this will make use of dialog pooling!
owner - the owner window, null if no ownerdbObject - is the database objectmodal - is true if modal, else false| Method Detail |
|---|
public void setObjectList(List objectList)
If this dialog is linked to a list of objects, two navigation buttons appear to walk through the list.
objectList - the list of objects, null if none (default)public List getObjectList()
public int getObjectListIndex()
public void clearObject()
getLastObject()public boolean isReadAllowed()
public boolean isWriteAllowed()
public boolean isDeleteAllowed()
public boolean isCreateAllowed()
public boolean setObject(AppDbObject dbObject,
boolean requestFocus)
dbObject - the database object (must be the same class as current object!)requestFocus - true if initial focus should be requested
AppDbObjectPanel.setInitialFocus()public boolean setObject(AppDbObject dbObject)
dbObject - the database object (must be the same class as current object!)
setObject(org.tentackle.appworx.AppDbObject, boolean)public AppDbObject getObject()
public AppDbObject getLastObject()
public AppDbObjectPanel getObjectPanel()
public Class<? extends AppDbObject> getDbObjectClass()
public AppDbObject showDialog(boolean noPersistance)
noPersistance - true if NO changes must be made to persistance layer
public AppDbObject showDialog()
public boolean isNewAfterSave()
public void setNewAfterSave(boolean newAfterSave)
newAfterSave - true if set new object after savedefaultNewAfterSavepublic boolean isDisposeOnDeleteOrSave()
public void setDisposeOnDeleteOrSave(boolean disposeOnDeleteOrSave)
disposeOnDeleteOrSave - true if dispose after delete or savepublic TooltipAndErrorPanel getTooltipAndErrorPanel()
public void addActionListener(ActionListener listener)
listener - the listener to addpublic void removeActionListener(ActionListener listener)
listener - the listener to removepublic void removeAllListeners()
public void fireActionPerformed(ActionEvent e)
e - the action eventpublic void dragEnter(DropTargetDragEvent event)
java.awt.dnd.DropTargetListenerDropTarget
registered with this listener.
dragEnter in interface DropTargetListenerevent - the DropTargetDragEventpublic void dragExit(DropTargetEvent event)
java.awt.dnd.DropTargetListenerDropTarget registered with this listener.
dragExit in interface DropTargetListenerevent - the DropTargetEventpublic void dragOver(DropTargetDragEvent event)
java.awt.dnd.DropTargetListenerDropTarget
registered with this listener.
dragOver in interface DropTargetListenerevent - the DropTargetDragEventpublic void dropActionChanged(DropTargetDragEvent event)
java.awt.dnd.DropTargetListener
dropActionChanged in interface DropTargetListenerevent - the DropTargetDragEventpublic void drop(DropTargetDropEvent event)
java.awt.dnd.DropTargetListenerDropTarget
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.
drop in interface DropTargetListenerevent - the DropTargetDropEventpublic void setTitle(String title)
Adds " (modal)" to the title if dialog is modal
setTitle in interface FormContainersetTitle in class Dialogtitle - the title displayed in the dialog's border;
a null value results in an empty titleDialog.getTitle()public void setAllChangeable(boolean allChangeable)
Overridden to update the buttons.
setAllChangeable in interface FormContainersetAllChangeable in class FormDialogallChangeable - true if all changeable (default)public boolean areValuesChanged()
FormContainer
areValuesChanged in interface FormContainerareValuesChanged in class FormDialogpublic void triggerValuesChanged()
Overridden to enable/disable the save-button and the TooltipAndErrorPanel.
triggerValuesChanged in interface FormContainertriggerValuesChanged in class FormDialogpublic void saveValues()
Overridden to update the save-button.
saveValues in interface FormContainersaveValues in class FormDialogFormComponent.saveValue()public void dispose()
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.
dispose in class WindowComponent.isDisplayable(),
Window.pack(),
Window.show()protected void processWindowEvent(WindowEvent e)
defaultCloseOperation property.
Overridden to allow FormHelper keeping track of windows
Overridden to catch WINDOW_CLOSING event.
processWindowEvent in class FormDialoge - the window eventJDialog.setDefaultCloseOperation(int)protected void determinePermissions(AppDbObject dbObject)
dbObject - the database objectprotected boolean updateWritePermission(AppDbObject object)
object - the database object
protected boolean updateDeletePermission(AppDbObject object)
object - the database object
protected String applyLock(AppDbObject object)
object - the object to apply the lock on
protected boolean revokeLock(AppDbObject object)
object - the object to revoke the lock from
protected boolean saveObject(AppDbObject object)
object - the database object
protected boolean save()
protected boolean deleteObject(AppDbObject dbObject)
dbObject - the database object to delete
protected boolean delete()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||