T - the pdo typepublic class PdoFieldPanel<T extends PersistentDomainObject<T>> extends FormFieldComponentPanel implements DropTargetListener
PdoLinkPanel,
Serialized FormJPanel.AccessibleJPanelJComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
protected long |
linkedId |
protected T |
linkedObject |
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTADJUST_LEFT, ADJUST_NONE, ADJUST_RIGHT, ADJUST_TRIM, CONVERT_LC, CONVERT_NONE, CONVERT_UCABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
PdoFieldPanel()
Creates an application database object field panel.
|
| Modifier and Type | Method and Description |
|---|---|
protected Object |
checkObject(Object object,
Class<T> clazz)
Checks the returned object against null and creates the error popup if enabled.
|
PdoSearchDialog<T> |
createSearchDialog()
Creates the search dialog.
|
void |
dragEnter(DropTargetDragEvent event) |
void |
dragExit(DropTargetEvent event) |
void |
dragOver(DropTargetDragEvent event) |
void |
drop(DropTargetDropEvent event) |
void |
dropActionChanged(DropTargetDragEvent event) |
T |
findByKey(Class<T> clazz,
DomainContext contextDb,
Object key)
Finds an PersistentDomainObject of given class by the key entered in the formfield component.
|
FormButton |
getEditButton()
Returns the editButton.
|
Object |
getFormValue() |
int |
getInfoColumns()
Get columns of info field
|
T |
getLink()
Gets the object.
|
long |
getLinkId()
Gets the object Id of the link.
|
FormButton |
getSearchButton()
Returns the searchButton.
|
PdoSearch<T> |
getSearchPlugin()
Gets the search plugin.
|
boolean |
isCheckExistsEnabled()
Gets the check exists feature.
|
boolean |
isDropEnabled()
Returns whether the infofield of this linkpanel is a dropzone.
|
boolean |
isEditButtonVisible()
Gets the visibility of the edit button.
|
boolean |
isInfoFieldVisible()
Gets the infofield's visibility.
|
boolean |
isSearchButtonVisible()
Gets the visibility of the search button.
|
protected void |
loadObject()
Loads the object
|
void |
runEdit()
Edits the object
|
void |
runSearch()
Runs the search
|
void |
setCellEditorUsage(boolean flag) |
void |
setChangeable(boolean changeable) |
void |
setCheckExistsEnabled(boolean checkExistsEnabled)
Sets whether the object exists for given domain key.
If there is no object for given key an error popup will be shown. |
void |
setDropEnabled(boolean dropEnabled)
Sets the infofield of this linkpanel to be a drop zone.
|
void |
setEditButtonVisible(boolean visible)
Sets the visibility of the edit button.
Some apps don't want the user to edit the object. |
void |
setFormComponent(FormComponent comp) |
void |
setFormValue(Object obj) |
void |
setInfoColumns(int col)
Sets columns of the info field.
|
void |
setInfoFieldVisible(boolean visible)
Sets the infofield's visibility.
|
void |
setLink(Class<T> clazz,
DomainContext context,
long linkedId)
Sets the link with default plugin.
|
void |
setLink(Class<T> clazz,
DomainContext context,
long linkedId,
boolean keepPlugin)
Sets the link with default plugin.
|
void |
setLink(PdoSearch<T> pdoSearch,
long linkedId)
Sets the link.
|
void |
setLink(T pdo)
sets the link object (if plugin matches)
|
void |
setName(String name) |
void |
setSearchButtonVisible(boolean visible)
Sets the visibility of the search button.
The default is visible. |
protected void |
setup()
Sets up the component, drop enabled and clears the object
|
void |
updateCodeAndInfoField(T linkedObject)
Updates both the code- and the info field.
|
protected void |
updateInfoFieldDropAndColor()
Updates the background color of the infofield.
|
clearText, doFormat, downRight, getAdjust, getCaretPosition, getColumns, getConvert, getConverter, getDefaultColumns, getErrorMessage, getErrorOffset, getFiller, getFormat, getFormComponent, getHorizontalAlignment, getInvalidChars, getMaxColumns, getText, getToolTipText, getValidChars, getVerticalAlignment, isAutoNext, isAutoSelect, isCaretLeft, isCaretRight, isEmpty, isEraseFirst, isInhibitAutoSelect, isOverwrite, isStartEditLeftmost, postActionEvent, setAdjust, setAutoNext, setAutoSelect, setCaretLeft, setCaretPosition, setCaretRight, setColumns, setConvert, setConverter, setDefaultColumns, setEraseFirst, setErrorMessage, setErrorOffset, setFiller, setFormat, setHorizontalAlignment, setInhibitAutoSelect, setInvalidChars, setMaxColumns, setOverwrite, setStartEditLeftmost, setText, setToolTipText, setValidChars, setVerticalAlignment, upLeftaddValueListener, clearValueShownModified, fireValueChanged, fireValueEntered, getBaseline, getBinding, getBindingPath, getComponentPath, getFocusTraversalGroup, getHelpURL, getParentWindow, getPropertyGroup, getValueShown, hasFocus, invalidateParentInfo, isAutoUpdate, isBindable, isCellEditorUsage, isChangeable, isFireRunning, isFormTraversable, isHonourChangeable, isMandatory, isSmartValueEntered, isTriggerValueChangedEnabled, isValueChanged, isValueShownModified, prepareFocusLost, removeValueListener, requestFocus, requestFocus, requestFocusInWindow, requestFocusLater, saveValue, setAutoUpdate, setBindable, setBinding, setBindingPath, setComponentPath, setFireRunning, setFocusTraversalGroup, setFormTraversable, setFormWrapWindow, setHelpURL, setHonourChangeable, setMandatory, setPropertyGroup, setSmartValueEntered, setTriggerValueChangedEnabled, showErrorPopup, showHelp, triggerValueChanged, updateAllChangeable, wasFocusGainedFromTransfer, wasFocusGainedFromTransferBackward, wasTransferFocus, wasTransferFocusBackward, wasTransferFocusByEnteraddActionListener, areValuesChanged, componentAdded, componentRemoved, createBinder, fireActionPerformed, getBinder, getFormValues, getTitle, isTriggerValuesChangedEnabled, removeActionListener, saveValues, setFormValues, setFormValuesKeepChanged, setTitle, setTriggerValuesChangedEnabled, triggerValuesChangedgetAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddValueListener, clearValueShownModified, fireValueChanged, fireValueEntered, getBaseline, getBinding, getBindingPath, getComponentPath, getFocusTraversalGroup, getHelpURL, getParentWindow, getPropertyGroup, getValueShown, hasFocus, invalidateParentInfo, isAutoUpdate, isBindable, isCellEditorUsage, isFireRunning, isFormTraversable, isMandatory, isSmartValueEntered, isTriggerValueChangedEnabled, isValueChanged, isValueShownModified, prepareFocusLost, removeValueListener, requestFocusLater, saveValue, setAutoUpdate, setBindable, setBinding, setBindingPath, setComponentPath, setFireRunning, setFocusTraversalGroup, setFormTraversable, setFormWrapWindow, setHelpURL, setMandatory, setPropertyGroup, setSmartValueEntered, setTriggerValueChangedEnabled, showErrorPopup, showHelp, transferFocus, transferFocusBackward, triggerValueChanged, wasFocusGainedFromTransfer, wasFocusGainedFromTransferBackward, wasTransferFocus, wasTransferFocusBackward, wasTransferFocusByEnterupdateAllChangeableisChangeable, isHonourChangeable, setHonourChangeableprotected long linkedId
protected T extends PersistentDomainObject<T> linkedObject
public PdoFieldPanel()
Pressing F2 in the key field will open a search dialog.
F3 will edit the object.
Drag and drop is supported as well.
By default, the editing component is a StringFormField.
protected void setup()
public void setName(String name)
Overridden to set the names in subcomponents.
public void setCheckExistsEnabled(boolean checkExistsEnabled)
checkExistsEnabled - true to enable check, false to disablepublic boolean isCheckExistsEnabled()
public void setFormComponent(FormComponent comp)
setFormComponent in class FormComponentPanelpublic void setFormValue(Object obj)
Overridden due to binding.
Notice that obj may be null. In such a case the domain context will
be retrieved from the bindingProperty DomainContext.class from the formcontainer.
setFormValue in interface FormComponentsetFormValue in class FormComponentPanelpublic Object getFormValue()
Overridden due to binding.
getFormValue in interface FormComponentgetFormValue in class FormComponentPanelprotected Object checkObject(Object object, Class<T> clazz)
object - the returned objectclazz - the PDO-classpublic void setDropEnabled(boolean dropEnabled)
The default is true.
dropEnabled - true if this is a drop zone, false if notpublic boolean isDropEnabled()
public T findByKey(Class<T> clazz, DomainContext contextDb, Object key)
The default implementation just invokes DomainObject.findByUniqueDomainKey(java.lang.Object).
clazz - the object classcontextDb - the domain contextkey - the domain keypublic void setLink(PdoSearch<T> pdoSearch, long linkedId)
pdoSearch - is the PdoSearch to be usedlinkedId - the original, i.e. current Id of the linked objectpublic void setLink(T pdo)
pdo - the data objectpublic void setLink(Class<T> clazz, DomainContext context, long linkedId, boolean keepPlugin)
clazz - the class of the linked object, e.g. Konto.classcontext - is the db-connection with contextlinkedId - the original, i.e. current Id of the linked objectkeepPlugin - is true if keep plugin if already initializedpublic void setLink(Class<T> clazz, DomainContext context, long linkedId)
clazz - the class of the linked object, e.g. Konto.classcontext - is the db-connection with contextlinkedId - the original, i.e. current Id of the linked objectpublic long getLinkId()
public T getLink()
public PdoSearch<T> getSearchPlugin()
public void setInfoColumns(int col)
col - the columnspublic int getInfoColumns()
public void updateCodeAndInfoField(T linkedObject)
linkedObject - the data objectpublic void setInfoFieldVisible(boolean visible)
visible - true if info field is visible (default)public boolean isInfoFieldVisible()
public void setChangeable(boolean changeable)
setChangeable in interface FormChangeablesetChangeable in class FormComponentPanelpublic void setCellEditorUsage(boolean flag)
setCellEditorUsage in interface FormComponentsetCellEditorUsage in class FormComponentPanelprotected void loadObject()
protected void updateInfoFieldDropAndColor()
public PdoSearchDialog<T> createSearchDialog()
Invoked from runSearch().
public void runSearch()
public void runEdit()
public void setEditButtonVisible(boolean visible)
visible - true if editbutton is visiblepublic boolean isEditButtonVisible()
public void setSearchButtonVisible(boolean visible)
visible - true if searchbutton is visiblepublic boolean isSearchButtonVisible()
public FormButton getEditButton()
public FormButton getSearchButton()
public 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 DropTargetListenerTentackle - a domain driven enterprise framework