T - the pdo typepublic class PdoEditDialog<T extends PersistentDomainObject<T>> extends FormDialog implements DropTargetListener, KeyEventDispatcher
PersistentDomainObjects.
The dialog provides the following generic features:
JDialog.AccessibleJDialogDialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityTypeWindow.AccessibleAWTWindow, Window.TypeContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
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
|
static String |
TX_DELETE
tx name for delete
|
static String |
TX_SAVE
tx name for save
|
accessibleContext, rootPane, rootPaneCheckingEnabledDEFAULT_MODALITY_TYPEBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTDISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSEABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Modifier | Constructor and Description |
|---|---|
protected |
PdoEditDialog(Window owner,
T pdo,
boolean modal)
Creates a database object dialog.
|
| Modifier and Type | Method and Description |
|---|---|
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(T pdo)
Applies a token lock to the object.
|
boolean |
areValuesChanged() |
protected void |
begin(String txName)
Begin a transaction.
|
protected void |
clearEditedBy()
clears the editedby token.
|
void |
clearPdo()
Clears the pdo.
Implemented by replacing the current pdo with a new pdo. |
protected void |
commit()
Commit the current transaction
|
protected boolean |
delete()
Deletes the current database object.
|
protected void |
deleteObject()
Deletes the current object.
|
protected void |
determinePermissions()
Determines the permissions viewable, writable, deletable and loads the SecurityManager.
They will be verified again in the TX. |
protected Throwable |
determineRealCause(Throwable ex)
Determines the real cause of an exception.
|
boolean |
dispatchKeyEvent(KeyEvent e)
dispatch the special keys
|
void |
dispose() |
protected void |
doClose(ActionEvent evt)
Closes the dialog.
|
protected boolean |
doDelete(ActionEvent evt)
Runs the delete operation.
|
protected void |
doNew(ActionEvent evt)
Runs the new object operation.
|
protected void |
doPrint(ActionEvent evt)
Runs the print operation.
|
protected boolean |
doSave(ActionEvent evt)
Runs the save operation.
|
protected boolean |
doSaveAndDispose(ActionEvent evt)
Runs the save operation and disposes the dialog.
|
protected void |
doSearch(ActionEvent evt)
Runs the new search operation.
|
void |
dragEnter(DropTargetDragEvent event) |
void |
dragExit(DropTargetEvent event) |
void |
dragOver(DropTargetDragEvent event) |
void |
drop(DropTargetDropEvent event) |
void |
dropActionChanged(DropTargetDragEvent event) |
void |
fireActionPerformed(ActionEvent e)
Notifies all Listeners that some button was pressed.
|
T |
getLastPdo()
Gets the last object (after save(), delete(), etc...).
|
int |
getLinkedPdoIndex()
Gets the linked pdo list list index.
|
List<T> |
getLinkedPdoList()
Gets the linked pdo list.
|
T |
getPdo()
Gets the current object
|
Class<T> |
getPdoClass()
Gets the PDO's class.
|
PdoPanel<T> |
getPdoPanel()
Gets the object panel.
|
TooltipAndErrorPanel |
getTooltipAndErrorPanel()
Gets the tooltip- and error-panel.
By default the panel is invisible. |
boolean |
isBrowserButtonAvailable()
Gets the general availability of the browser button.
|
boolean |
isDeleteButtonAvailable()
Gets the general availability of the delete button.
|
boolean |
isDisposeOnDeleteOrSave()
Returns whether the dialog is disposed after delete or save.
|
boolean |
isIdButtonAvailable()
Gets the general availability of the id button.
|
boolean |
isNewAfterSave()
Returns whether the object is cleared after save.
|
boolean |
isNewButtonAvailable()
Gets the general availability of the new button.
|
boolean |
isNextButtonAvailable()
Gets the general availability of the next button.
|
boolean |
isPdoDeletable()
Returns whether the pdo is deletable.
|
boolean |
isPdoEditable()
Returns whether the pdo is editable.
|
boolean |
isPdoViewable()
Returns whether the pdo is viewable.
|
boolean |
isPreviousButtonAvailable()
Gets the general availability of the previous button.
|
boolean |
isPrintButtonAvailable()
Gets the general availability of the print button.
|
boolean |
isSaveButtonAvailable()
Gets the general availability of the save button.
|
boolean |
isSearchButtonAvailable()
Gets the general availability of the search button.
|
protected void |
processWindowEvent(WindowEvent e) |
void |
removeActionListener(ActionListener listener)
Removes an action Listener.
|
void |
removeAllListeners()
Removes all Listeners.
|
protected void |
revokeLock()
Revokes a token lock to the object that has not been saved.
This method is is only provided to be overridden (see poolkeeper.replication). |
protected void |
rollback()
Rollback the current transaction
|
boolean |
save()
Saves the current object.
|
protected void |
saveObject()
Saves the object.
|
void |
saveValues() |
void |
setBrowserButtonAvailable(boolean browserButtonAvailable)
Sets the general availability of the browser button.
|
void |
setChangeable(boolean changeable) |
void |
setDeleteButtonAvailable(boolean deleteButtonAvailable)
Sets the general availability of the delete button.
|
void |
setDisposeOnDeleteOrSave(boolean disposeOnDeleteOrSave)
Sets whether the dialog will be disposed after delete or save.
|
void |
setIdButtonAvailable(boolean idButtonAvailable)
Sets the general availability of the id button.
|
void |
setLinkedPdoList(List<T> linkedPdoList)
Sets a list of linked PDOs.
|
void |
setNewAfterSave(boolean newAfterSave)
Sets whether the object is cleared after save.
|
void |
setNewButtonAvailable(boolean newButtonAvailable)
Sets the general availability of the new button.
|
void |
setNextButtonAvailable(boolean nextButtonAvailable)
Sets the general availability of the next button.
|
boolean |
setPdo(T pdo)
Sets the object and requests the initial focus.
|
boolean |
setPdo(T pdo,
boolean requestFocus)
Sets the object.
|
void |
setPreviousButtonAvailable(boolean previousButtonAvailable)
Sets the general availability of the previous button.
|
void |
setPrintButtonAvailable(boolean printButtonAvailable)
Sets the general availability of the print button.
|
void |
setSaveButtonAvailable(boolean saveButtonAvailable)
Sets the general availability of the save button.
|
void |
setSearchButtonAvailable(boolean searchButtonAvailable)
Sets the general availability of the search button.
|
void |
setTitle(String title) |
void |
setupButtons()
sets visibility of buttons
|
T |
showDialog()
Shows the dialog.
The dialog can be either modal or non-modal. |
T |
showDialog(boolean noPersistance)
Shows the dialog.
The dialog can be either modal or non-modal. |
protected boolean |
showErrorOnSave(Throwable ex,
long editedBy)
Shows an error message to the user if saving the PDO has failed.
|
protected void |
showValidationResults(List<org.tentackle.validate.ValidationResult> validationResults)
Shows the validation results.
|
void |
triggerValuesChanged() |
addFormWrapListener, alignLocation, checkAutoClose, componentAdded, componentRemoved, createBinder, fireFormWrappedFocus, getAutoClose, getBinder, getFormValues, getHelpURL, getKeepChangedValues, getParentWindow, getRelatedWindow, getTimeOfLastValuesChanged, getTooltipDisplay, getUIVersion, invalidateParentInfo, isAutoCloseable, isAutoPosition, isAutoUpdate, isBindable, isChangeable, isHonourChangeable, isTriggerValuesChangedEnabled, pack, paint, removeFormWrapListener, setAutoClose, setAutoPosition, setAutoUpdate, setBindable, setFormValues, setFormValuesKeepChanged, setHelpURL, setHonourChangeable, setKeepChangedValues, setRelatedWindow, setTimeOfLastValuesChanged, setTooltipDisplay, setTriggerValuesChangedEnabled, setUIVersion, showHelpaddImpl, 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, updateaddNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setUndecorated, setVisible, show, toBackaddPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFrontadd, 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, transferFocusDownCycle, validate, validateTreeaction, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, 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, 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, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetTitlepublic 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
public boolean isBrowserButtonAvailable()
public void setBrowserButtonAvailable(boolean browserButtonAvailable)
browserButtonAvailable - true if available as needed, false if never visiblepublic boolean isDeleteButtonAvailable()
public void setDeleteButtonAvailable(boolean deleteButtonAvailable)
deleteButtonAvailable - true if available as needed, false if never visiblepublic boolean isIdButtonAvailable()
public void setIdButtonAvailable(boolean idButtonAvailable)
idButtonAvailable - true if available as needed, false if never visiblepublic boolean isNewButtonAvailable()
public void setNewButtonAvailable(boolean newButtonAvailable)
newButtonAvailable - true if available as needed, false if never visiblepublic boolean isNextButtonAvailable()
public void setNextButtonAvailable(boolean nextButtonAvailable)
nextButtonAvailable - true if available as needed, false if never visiblepublic boolean isPreviousButtonAvailable()
public void setPreviousButtonAvailable(boolean previousButtonAvailable)
previousButtonAvailable - true if available as needed, false if never visiblepublic boolean isPrintButtonAvailable()
public void setPrintButtonAvailable(boolean printButtonAvailable)
printButtonAvailable - true if available as needed, false if never visiblepublic boolean isSaveButtonAvailable()
public void setSaveButtonAvailable(boolean saveButtonAvailable)
saveButtonAvailable - true if available as needed, false if never visiblepublic boolean isSearchButtonAvailable()
public void setSearchButtonAvailable(boolean searchButtonAvailable)
searchButtonAvailable - true if available as needed, false if never visiblepublic void setLinkedPdoList(List<T> linkedPdoList)
If this dialog is linked to a list of pdos, two navigation buttons appear to walk through the list.
linkedPdoList - the list of pdos, null if none (default)public List<T> getLinkedPdoList()
public int getLinkedPdoIndex()
public void clearPdo()
getLastPdo()public boolean isPdoViewable()
public boolean isPdoEditable()
public boolean isPdoDeletable()
public boolean setPdo(T pdo, boolean requestFocus)
pdo - the database object (must be the same class as current object!)requestFocus - true if initial focus should be requestedPdoPanel.setInitialFocus()public boolean setPdo(T pdo)
pdo - the database object (must be the same class as current object!)public T getPdo()
public T getLastPdo()
public PdoPanel<T> getPdoPanel()
public T showDialog(boolean noPersistance)
noPersistance - true if NO changes must be made to persistance layerpublic T 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 boolean dispatchKeyEvent(KeyEvent e)
dispatchKeyEvent in interface KeyEventDispatcherpublic void dragEnter(DropTargetDragEvent event)
dragEnter in interface DropTargetListenerpublic void dragExit(DropTargetEvent event)
dragExit in interface DropTargetListenerpublic void dragOver(DropTargetDragEvent event)
dragOver in interface DropTargetListenerpublic void dropActionChanged(DropTargetDragEvent event)
dropActionChanged in interface DropTargetListenerpublic void drop(DropTargetDropEvent event)
drop in interface DropTargetListenerpublic void setTitle(String title)
Adds " (modal)" to the title if dialog is modal
setTitle in interface FormContainersetTitle in class Dialogpublic void setChangeable(boolean changeable)
Overridden to update the buttons.
setChangeable in interface FormChangeablesetChangeable in class FormDialogpublic boolean areValuesChanged()
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 FormDialogpublic void dispose()
Overridden to remove all Listeners.
protected void processWindowEvent(WindowEvent e)
Overridden to catch WINDOW_CLOSING event.
processWindowEvent in class FormDialogprotected void determinePermissions()
protected String applyLock(T pdo)
pdo - the object to apply the lock onprotected void revokeLock()
protected void saveObject()
public boolean save()
Will announce, 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:
protected Throwable determineRealCause(Throwable ex)
ex - the thrown exceptionprotected void showValidationResults(List<org.tentackle.validate.ValidationResult> validationResults)
validationResults - the validation resultsprotected boolean showErrorOnSave(Throwable ex, long editedBy)
ex - the exceptioneditedBy - the editedBy value before saveprotected void deleteObject()
protected boolean delete()
Will announce, start a transaction, prepares thre delete and deletes the object.
protected void begin(String txName)
txName - the transaction nameprotected void commit()
protected void rollback()
public void setupButtons()
protected void doClose(ActionEvent evt)
evt - the closing eventprotected boolean doSave(ActionEvent evt)
evt - the closing eventprotected boolean doSaveAndDispose(ActionEvent evt)
evt - the closing eventprotected void doPrint(ActionEvent evt)
evt - the action eventprotected boolean doDelete(ActionEvent evt)
evt - the action event that triggered this delete operationprotected void doNew(ActionEvent evt)
evt - the action eventprotected void doSearch(ActionEvent evt)
evt - the action eventprotected void clearEditedBy()
Tentackle - distributed, domain- and model-driven