Class FWFormPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
net.simplace.ui.panel.FWDefaultPanel
net.simplace.pipe.util.FWFormPanel
- All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, FWFormComponentFactory
Form panel that shows the form components described by a form element of the layout provider. The child
elements are turned into form components by their element name (
label, text,
integer, double, file, dir, choice,
date, result, image, processbutton,
memorymonitor, cal, extend, plus group); further element
names can be handled by registered component factories
(addComponentFactory(FWFormComponentFactory)), unknown ones become text fields. All components observe
the parameters of the functionality; before going on, required fields are checked. The form can be exported as
PDF, RTF or HTML document.- Author:
- Andreas Enders
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
Fields inherited from class FWDefaultPanel
iFunctionalityFields inherited from class JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionFWFormPanel(org.jdom2.Element aFormElement, net.simplace.core.FWObservable aObservable) Constructs the panel from the form element without functionality.FWFormPanel(org.jdom2.Element aFormElement, FormFunctionality aFunctionality) Constructs the panel from the form element using the parameters of the functionality. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddComponentFactory(FWFormComponentFactory aFactory) Registers a factory for additional form component types (used by all form panels).protected voidback()Goes back to the previous function; detached windows are closed.protected voidcancel()Cancels the process; detached windows are closed.voidChecks that all required, enabled and visible components have a value; for the first empty one a warning dialog is shown.createFormComponent(org.jdom2.Element aElement, boolean aShowLabel) Creates and registers the form component for an element (built-in types, then the registered factories, otherwise a text component).createFormComponent(org.jdom2.Element aElement, String aID, String aFormID, net.simplace.core.FWObservable aObservable, boolean aShowLabel, int aDetachibility) Creates the built-in form component for the element name (see class description).voidfillGroupComponent(List<org.jdom2.Element> aComponentList, FWGroupFormComponent aGroupPanel) Replaces the components of a group (the old ones are unregistered and their parameters removed).com.lowagie.text.DocumentgetDocument(int aType, String aFile) Writes the form as a two-column table (caption, value) to a document file.protected StringgetLocaleValue(String aKey) Reads a localised text<locale prefix>.FormComponent.<key>.net.simplace.core.FWObservableprotected voidgo()Goes on to the next function, if all required fields are filled; detached windows are closed.intparseDetachability(org.jdom2.Element aElement) protected voidreset()Resets all components to their default values; called by the reset button.Methods inherited from class FWDefaultPanel
actionPerformed, export, getFunctionality, info, print, setBackButtonEnabled, setCancelButtonEnabled, setComponentToView, setExportButtonEnabled, setGoButtonEnabled, setInfoButtonEnabled, setPrintButtonEnabled, setResetButtonEnabledMethods inherited from class JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, 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, 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, requestFocus, requestFocus, requestFocusInWindow, 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, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class Container
add, 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, validateTreeMethods inherited from class Component
action, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ActionListener
actionPerformed
-
Constructor Details
-
FWFormPanel
Constructs the panel from the form element using the parameters of the functionality.- Parameters:
aFormElement- the form elementaFunctionality- the form functionality
-
FWFormPanel
public FWFormPanel(org.jdom2.Element aFormElement, net.simplace.core.FWObservable aObservable) Constructs the panel from the form element without functionality.- Parameters:
aFormElement- the form elementaObservable- the parameters
-
-
Method Details
-
checkRequired
Checks that all required, enabled and visible components have a value; for the first empty one a warning dialog is shown.- Throws:
RequiredFieldEmptyException- if a required field is empty
-
createFormComponent
Creates and registers the form component for an element (built-in types, then the registered factories, otherwise a text component).- Parameters:
aElement- the component elementaShowLabel-trueto show a caption label (falsee.g. for table cells)- Returns:
- the component
-
createFormComponent
public FWAbstractFormComponent createFormComponent(org.jdom2.Element aElement, String aID, String aFormID, net.simplace.core.FWObservable aObservable, boolean aShowLabel, int aDetachibility) Creates the built-in form component for the element name (see class description).- Specified by:
createFormComponentin interfaceFWFormComponentFactory- Parameters:
aElement- the component elementaID- id of the componentaFormID- id of the formaObservable- parameters of the functionalityaShowLabel-trueto show a caption labelaDetachibility- detachability, one of theDETACH_*constants- Returns:
- the component, or
nullfor unknown element names
-
parseDetachability
public int parseDetachability(org.jdom2.Element aElement) - Parameters:
aElement- the component element (attributedetachable: true, auto, button, linked)- Returns:
- the detachability, one of the
DETACH_*constants
-
fillGroupComponent
public void fillGroupComponent(List<org.jdom2.Element> aComponentList, FWGroupFormComponent aGroupPanel) Replaces the components of a group (the old ones are unregistered and their parameters removed).- Parameters:
aComponentList- elements of the new componentsaGroupPanel- the group
-
go
protected void go()Goes on to the next function, if all required fields are filled; detached windows are closed.- Overrides:
goin classFWDefaultPanel
-
back
protected void back()Goes back to the previous function; detached windows are closed.- Overrides:
backin classFWDefaultPanel
-
reset
protected void reset()Resets all components to their default values; called by the reset button.- Overrides:
resetin classFWDefaultPanel
-
cancel
protected void cancel()Cancels the process; detached windows are closed.- Overrides:
cancelin classFWDefaultPanel
-
getLocaleValue
Reads a localised text<locale prefix>.FormComponent.<key>.- Overrides:
getLocaleValuein classFWDefaultPanel- Parameters:
aKey- key of the text- Returns:
- the localised text, or the key if it is missing or there is no main frame
-
getObservable
public net.simplace.core.FWObservable getObservable()- Returns:
- the parameters of the form
-
getDocument
Writes the form as a two-column table (caption, value) to a document file.- Parameters:
aType- document type:PrintHelper.TYPE_RTF,PrintHelper.TYPE_HTML, otherwise PDFaFile- path of the file to write- Returns:
- the (closed) document
-
addComponentFactory
Registers a factory for additional form component types (used by all form panels).- Parameters:
aFactory- the factory
-