Package ca.corbett.extras.properties
Class PropertiesDialog
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
ca.corbett.extras.properties.PropertiesDialog
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,Accessible,RootPaneContainer,WindowConstants
Generated by the generateDialog() method in PropertiesManager. This dialog displays
all the non-hidden properties managed by the PropertiesManager and allows user editing.
If there are more than one category of properties, a tabbed pane is generated automatically.
For each category, if there is more than one subcategory, header labels will be generated
on the FormPanel as needed. Basically, this provides a very easy way for applications
to expose their properties in a simple but extensible way.
Custom form handling - it may be the case that you need to do custom form handling (eg. field B should only be visible/enabled if field A contains a certain value). In that case, you shouldn't go through generateDialog() in PropertiesManager, but rather create the dialog yourself. This isn't as hard as it sounds... see javadocs on generateDialog() for more information.
- Since:
- 2024-12-30
- Author:
- scorbo2
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialogNested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityTypeNested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.TypeNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final FormPanelstatic final intstatic final intstatic final intstatic final intprotected final Windowprotected final PropertiesManagerprotected final JTabbedPaneprotected booleanFields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabledFields inherited from class java.awt.Dialog
DEFAULT_MODALITY_TYPEFields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE -
Constructor Summary
ConstructorsConstructorDescriptionPropertiesDialog(PropertiesManager manager, Window owner, String title, List<FormPanel> formPanelList) -
Method Summary
Modifier and TypeMethodDescriptionprotected JPanelstatic JScrollPanebuildScrollPane(Component component) A static convenience method to generate a JScrollPane with more sensible default values.static JScrollPanebuildScrollPane(Component component, int unitIncrement) A static convenience method to generate a JScrollPane with more sensible default values.findFormField(String identifier) Returns the FormField with the given identifier if it exists on this dialog.getFormPanelAt(int index) Returns the FormPanel from the tab with the given index.voidsetVisible(boolean visible) Overridden to update our position if the owner window moves.protected voidbooleanReports whether this dialog was closed via the OK button, meaning that the form was validated and all values are acceptable.Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, updateMethods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBackMethods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, 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, pack, paint, 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, toFrontMethods 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, transferFocusDownCycle, validate, validateTreeMethods 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, 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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
INITIAL_WIDTH
public static final int INITIAL_WIDTH- See Also:
-
INITIAL_HEIGHT
public static final int INITIAL_HEIGHT- See Also:
-
MINIMUM_WIDTH
public static final int MINIMUM_WIDTH- See Also:
-
MINIMUM_HEIGHT
public static final int MINIMUM_HEIGHT- See Also:
-
propsManager
-
owner
-
tabPane
-
formPanel
-
wasOkayed
protected boolean wasOkayed
-
-
Constructor Details
-
PropertiesDialog
public PropertiesDialog(PropertiesManager manager, Window owner, String title, List<FormPanel> formPanelList)
-
-
Method Details
-
setVisible
public void setVisible(boolean visible) Overridden to update our position if the owner window moves.- Overrides:
setVisiblein classDialog- Parameters:
visible- Whether to show or hide the dialog.
-
wasOkayed
public boolean wasOkayed()Reports whether this dialog was closed via the OK button, meaning that the form was validated and all values are acceptable.- Returns:
- true if the form was validated and closed via the OK button, false otherwise.
-
findFormField
Returns the FormField with the given identifier if it exists on this dialog.- Parameters:
identifier- The string identifier of the field in question.- Returns:
- A FormField instance representing that field, or null if not found.
-
buildScrollPane
A static convenience method to generate a JScrollPane with more sensible default values. Seriously, why is the default behaviour to scroll 1 pixel at a time when you mouse wheel?- Parameters:
component- Any Component that needs scrolling.- Returns:
- A JScrollPane that won't take a million years to scroll through.
-
buildScrollPane
A static convenience method to generate a JScrollPane with more sensible default values. Seriously, why is the default behaviour to scroll 1 pixel at a time when you mouse wheel?- Parameters:
component- Any Component that needs scrolling.unitIncrement- How much to scroll by (I believe this is a pixel value).- Returns:
- A JScrollPane that won't take a million years to scroll through.
-
getFormPanelAt
Returns the FormPanel from the tab with the given index. If the tab is out of range, or if no FormPanel can be found on that tab for any reason, this returns null.- Parameters:
index- The tab index in question.- Returns:
- A FormPanel instance, or null if not found.
-
validateFormAndClose
protected void validateFormAndClose() -
buildButtonPanel
-