Package com.nuix.nx.dialogs
Class TabbedCustomDialog
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Dialog
-
- javax.swing.JDialog
-
- com.nuix.nx.dialogs.TabbedCustomDialog
-
- All Implemented Interfaces:
java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,javax.accessibility.Accessible,javax.swing.RootPaneContainer,javax.swing.WindowConstants
public class TabbedCustomDialog extends javax.swing.JDialogAllows you to build a settings dialog with multiple tabs. Each tab is aCustomTabPanelwhich suports easily adding various controls such as check boxes, text field, radio buttons and so on.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
-
Nested classes/interfaces inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
-
Field Summary
-
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
-
Constructor Summary
Constructors Constructor Description TabbedCustomDialog()Create a new instance.TabbedCustomDialog(java.lang.String title)Create a new instance with the specified title.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMenu(java.lang.String parentMenuLabel, java.lang.String menuItemLabel, java.lang.Runnable action)Adds a menu entry to the menu bar and then a menu item to that menu.ScrollableCustomTabPaneladdScrollableTab(java.lang.String id, java.lang.String label)CustomTabPaneladdTab(java.lang.String id, java.lang.String label)Adds a new tab to the dialog.booleanallAreChecked(java.lang.String... identifiers)booleananyAreChecked(java.lang.String... identifiers)voiddisplay()Displays this custom dialog.voiddisplayNonModal(java.util.function.Consumer<java.lang.Boolean> callback)Similar todisplay()except that the dialog will be displayed non-modal and will invoke the provided callback when the dialog is closed and the result ofgetDialogResult()returns true.voidenabledIfAnyChecked(java.lang.String dependentControlIdentifier, java.lang.String... targetCheckableIdentifiers)Similar toenabledOnlyWhenChecked(String, String), this method registers event handlers on one or more checkable controls such that a given dependent control is only enabled when at least one of the specified target checkable controls are checked.voidenabledOnlyWhenAllChecked(java.lang.String dependentControlIdentifier, java.lang.String... targetCheckableIdentifiers)Similar toenabledOnlyWhenChecked(String, String), this method registers event handlers on one or more checkable controls such that a given dependent control is only enabled when all of the specified target checkable controls are checked.voidenabledOnlyWhenChecked(java.lang.String dependentControlIdentifier, java.lang.String targetCheckableIdentifier)Registers an event handle such that a given control is only enabled when another checkable control is checked.voidenabledOnlyWhenNoneChecked(java.lang.String dependentControlIdentifier, java.lang.String... targetCheckableIdentifiers)Similar toenabledOnlyWhenChecked(String, String), this method registers event handlers on one or more checkable controls such that a given dependent control is only enabled when none of the specified target checkable controls are checked.voidenabledOnlyWhenNotChecked(java.lang.String dependentControlIdentifier, java.lang.String targetCheckableIdentifier)Registers an event handle such that a given control is only enabled when another checkable control is not checked.voidenableStickySettings(java.lang.String filePath)This enables "sticky settings" where the dialog will save a JSON file of settings when 'Okay' is clicked and will attempt to load previously saved settings when the dialog is displayed.voidfillScreen(int margins)Resizes the dialog to fill the screen, less the specified margin on all sides.java.awt.ComponentgetControl(java.lang.String identifier)Allows you to get the actual Java Swing control.ControlDeserializationHandlergetDeserializer(java.lang.String identifier)Gets the previously provided deserialization handler for a particular controlbooleangetDialogResult()Gets the result of showing the dialog.java.io.FilegetHelpFile()The File currently associated to the "Help" menu "View Documentation" entryControlSerializationHandlergetSerializer(java.lang.String identifier)Gets the previously provided serialization handler for a particular controlCustomTabPanelgetTab(java.lang.String id)Gets the tab with the specified IDjava.lang.StringgetText(java.lang.String identifier)Gets the text present in a TextField or PasswordField.voidhideFileMenu()Hides the file menu from the user (effectively disabling save and load).booleanisChecked(java.lang.String identifier)Gets whether a particular Checkbox or RadioButton is checked.voidloadJson(java.lang.String json)Attempts to set control values based on entries in JSON file.voidloadJson(java.lang.String json, java.lang.String tabIdentifier)Loads JSON but only to the controls contained within the specified tab.voidloadJson(java.lang.String json, java.util.Map<java.lang.String,java.awt.Component> controlMap)Attempts to set control values based on entries in JSON file.voidloadJsonFile(java.lang.String filePath)Loads the settings of this dialog from a JSON filebooleannoneAreChecked(java.lang.String... identifiers)voidsaveJsonFile(java.lang.String filePath)Saves the settings of this dialog to a JSON filevoidsetChecked(java.lang.String identifier, boolean isChecked)Sets whether a particular Checkbox or RadioButton is checked.voidsetHelpFile(java.io.File helpFile)Sets the path to a help file which will be associated to the "Help" menu "View Documentation" entryvoidsetHelpFile(java.lang.String helpFile)Sets the path to a help file which will be associated to the "Help" menu "View Help" entryvoidsetHelpUrl(java.lang.String helpUrl)Sets the URL which will be associated to the "Help" menu "View Online Help" entry.voidsetSelectedTabIndex(int index)Sets which tab is currently selected.voidsetTabLabel(java.lang.String tabId, java.lang.String label)Updates the label for given tab to a new valuevoidsetTabPlacement(int tabPlacement)Allows you to change the orientation of the tabs in the dialog by providing one of the JTabbedPane alignment constantsvoidsetTabPlacementLeft()Changes the orientation of the dialogs tabs to be along the left side of the dialogvoidsetText(java.lang.String identifier, java.lang.String text)Sets the text present in a TextField or PasswordField.java.lang.StringtoJson()Gets a JSON String equivalent of the dialog values.java.util.Map<java.lang.String,java.lang.Object>toMap()Returns a Map of the control values.java.util.Map<java.lang.String,java.lang.Object>toMap(boolean forJsonCreation)Returns a Map of the control values.voidvalidateBeforeClosing(ValidationCallback callback)Allows code to implement and provide a callback which can validate whether things are okay.voidwhenDeserializing(java.lang.String identifier, ControlDeserializationHandler handler)Advanced! Allows you to define a callback which will handle deserialization of a particular control from JSON.voidwhenJsonFileLoaded(java.lang.Runnable callback)Allows you to provide a callback to run when a JSON file is loaded.voidwhenSerializing(java.lang.String identifier, ControlSerializationHandler handler)Advanced! Allows you to define a callback which will handle serialization of a particular control to JSON.-
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, update
-
Methods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, show, toBack
-
Methods 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, toFront
-
Methods 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, validateTree
-
Methods 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
-
-
-
-
Method Detail
-
display
public void display()
Displays this custom dialog. Dialog is modal so this call will block caller until dialog is closed. To determine whether user clicked "Ok", "Cancel" or closed the dialog, callgetDialogResult()afterwards.
-
displayNonModal
public void displayNonModal(java.util.function.Consumer<java.lang.Boolean> callback)
Similar todisplay()except that the dialog will be displayed non-modal and will invoke the provided callback when the dialog is closed and the result ofgetDialogResult()returns true. Note that invoking this from a script essentially behaves as asynchronous call from the script's perspective!- Parameters:
callback- The callback to invoke when the dialog is closed.
-
fillScreen
public void fillScreen(int margins)
Resizes the dialog to fill the screen, less the specified margin on all sides.- Parameters:
margins- The margin size on all sides
-
getTab
public CustomTabPanel getTab(java.lang.String id)
Gets the tab with the specified ID- Parameters:
id- The ID specified when the tab was created- Returns:
- The tab associated with the specified ID
-
addTab
public CustomTabPanel addTab(java.lang.String id, java.lang.String label)
Adds a new tab to the dialog.- Parameters:
id- The case sensitive unique identifier used to reference this tablabel- The label for the tab- Returns:
- A newly created tab associated to this dialog
-
addScrollableTab
public ScrollableCustomTabPanel addScrollableTab(java.lang.String id, java.lang.String label)
-
setTabLabel
public void setTabLabel(java.lang.String tabId, java.lang.String label)Updates the label for given tab to a new value- Parameters:
tabId- Id assigned to the tab when it was addedlabel- The new label value for the tab
-
setTabPlacement
public void setTabPlacement(int tabPlacement)
Allows you to change the orientation of the tabs in the dialog by providing one of the JTabbedPane alignment constants- Parameters:
tabPlacement- A JTabbedPane alignment constant, such as JTabbedPane.LEFT
-
setTabPlacementLeft
public void setTabPlacementLeft()
Changes the orientation of the dialogs tabs to be along the left side of the dialog
-
getDialogResult
public boolean getDialogResult()
Gets the result of showing the dialog.- Returns:
- True if the user clicked the 'Ok' button. False if otherwise ('Cancel' button or closed the dialog).
-
toMap
public java.util.Map<java.lang.String,java.lang.Object> toMap()
Returns a Map of the control values.- Returns:
- Map where the assigned identifier is the key and the control's value is the value.
-
toMap
public java.util.Map<java.lang.String,java.lang.Object> toMap(boolean forJsonCreation)
Returns a Map of the control values.- Parameters:
forJsonCreation- Set to true if the output is intended to be serialized to JSON. Some of the values in the map may be generated differently to better cooperate with what JSON is capable of storing.- Returns:
- Map where the assigned identifier is the key and the control's value is the value.
-
enabledOnlyWhenChecked
public void enabledOnlyWhenChecked(java.lang.String dependentControlIdentifier, java.lang.String targetCheckableIdentifier) throws java.lang.ExceptionRegisters an event handle such that a given control is only enabled when another checkable control is checked.- Parameters:
dependentControlIdentifier- The identifier of the already added control for which the enabled state depends on another checkable control.targetCheckableIdentifier- The identifier of the already added checkable control which will determine the enabled state of the dependent control.- Throws:
java.lang.Exception- This could be caused by various things such as invalid identifiers or the identifier provided in targetCheckableIdentifier does not point to a checkable control (CheckBox or RadioButton).
-
enabledOnlyWhenAllChecked
public void enabledOnlyWhenAllChecked(java.lang.String dependentControlIdentifier, java.lang.String... targetCheckableIdentifiers) throws java.lang.ExceptionSimilar toenabledOnlyWhenChecked(String, String), this method registers event handlers on one or more checkable controls such that a given dependent control is only enabled when all of the specified target checkable controls are checked.- Parameters:
dependentControlIdentifier- The identifier of the already added control for which the enabled state depends on another checkable control.targetCheckableIdentifiers- The identifier of the one or more already added checkable controls which will determine the enabled state of the dependent control.- Throws:
java.lang.Exception- This could be caused by various things such as invalid identifiers or the identifier provided in targetCheckableIdentifier does not point to a checkable control (CheckBox or RadioButton).
-
enabledOnlyWhenNoneChecked
public void enabledOnlyWhenNoneChecked(java.lang.String dependentControlIdentifier, java.lang.String... targetCheckableIdentifiers) throws java.lang.ExceptionSimilar toenabledOnlyWhenChecked(String, String), this method registers event handlers on one or more checkable controls such that a given dependent control is only enabled when none of the specified target checkable controls are checked.- Parameters:
dependentControlIdentifier- The identifier of the already added control for which the enabled state depends on another checkable control.targetCheckableIdentifiers- The identifier of the one or more already added checkable controls which will determine the enabled state of the dependent control.- Throws:
java.lang.Exception- This could be caused by various things such as invalid identifiers or the identifier provided in targetCheckableIdentifier does not point to a checkable control (CheckBox or RadioButton).
-
enabledIfAnyChecked
public void enabledIfAnyChecked(java.lang.String dependentControlIdentifier, java.lang.String... targetCheckableIdentifiers) throws java.lang.ExceptionSimilar toenabledOnlyWhenChecked(String, String), this method registers event handlers on one or more checkable controls such that a given dependent control is only enabled when at least one of the specified target checkable controls are checked.- Parameters:
dependentControlIdentifier- The identifier of the already added control for which the enabled state depends on another checkable control.targetCheckableIdentifiers- The identifier of the one or more already added checkable controls which will determine the enabled state of the dependent control.- Throws:
java.lang.Exception- This could be caused by various things such as invalid identifiers or the identifier provided in targetCheckableIdentifier does not point to a checkable control (CheckBox or RadioButton).
-
enabledOnlyWhenNotChecked
public void enabledOnlyWhenNotChecked(java.lang.String dependentControlIdentifier, java.lang.String targetCheckableIdentifier) throws java.lang.ExceptionRegisters an event handle such that a given control is only enabled when another checkable control is not checked.- Parameters:
dependentControlIdentifier- The identifier of the already added control for which the enabled state depends on another checkable control.targetCheckableIdentifier- The identifier of the already added checkable control which will determine the enabled state of the dependent control.- Throws:
java.lang.Exception- This could be caused by various things such as invalid identifiers or the identifier provided in targetCheckableIdentifier does not point to a checkable control (CheckBox or RadioButton).
-
isChecked
public boolean isChecked(java.lang.String identifier) throws java.lang.ExceptionGets whether a particular Checkbox or RadioButton is checked.- Parameters:
identifier- The unique identifier assigned to the control when it was appended to this dialog.- Returns:
- True if the control is checked, false otherwise.
- Throws:
java.lang.Exception- Thrown if identifier is invalid or identifier does not refer to a Checkbox or RadioButton.
-
allAreChecked
public boolean allAreChecked(java.lang.String... identifiers) throws java.lang.Exception- Throws:
java.lang.Exception
-
noneAreChecked
public boolean noneAreChecked(java.lang.String... identifiers) throws java.lang.Exception- Throws:
java.lang.Exception
-
anyAreChecked
public boolean anyAreChecked(java.lang.String... identifiers) throws java.lang.Exception- Throws:
java.lang.Exception
-
setChecked
public void setChecked(java.lang.String identifier, boolean isChecked) throws java.lang.ExceptionSets whether a particular Checkbox or RadioButton is checked.- Parameters:
identifier- The unique identifier assigned to the control when it was appended to this dialog.isChecked- True to check the control, false to uncheck the control.- Throws:
java.lang.Exception- Thrown if identifier is invalid or identifier does not refer to a Checkbox or RadioButton.
-
getText
public java.lang.String getText(java.lang.String identifier) throws java.lang.ExceptionGets the text present in a TextField or PasswordField.- Parameters:
identifier- The unique identifier assigned to the control when it was appended to this dialog.- Returns:
- The text present in the control.
- Throws:
java.lang.Exception- Thrown if identifier is invalid or identifier does not refer to a TextField or PasswordField.
-
setText
public void setText(java.lang.String identifier, java.lang.String text) throws java.lang.ExceptionSets the text present in a TextField or PasswordField.- Parameters:
identifier- The unique identifier assigned to the control when it was appended to this dialog.text- The text value to set.- Throws:
java.lang.Exception- Thrown if identifier is invalid or identifier does not refer to a TextField or PasswordField.
-
getControl
public java.awt.Component getControl(java.lang.String identifier)
Allows you to get the actual Java Swing control. You will likely need to cast it to the appropriate type before use.- Parameters:
identifier- The unique identifier assigned to the control when it was appended to this dialog.- Returns:
- The control as base class Component. See documentation for various append methods for control types.
-
enableStickySettings
public void enableStickySettings(java.lang.String filePath)
This enables "sticky settings" where the dialog will save a JSON file of settings when 'Okay' is clicked and will attempt to load previously saved settings when the dialog is displayed. This currently only works with controls added to the dialog which supportsetText(java.lang.String,java.lang.String)andsetChecked(java.lang.String,boolean). SeetoJson()andloadJson(java.lang.String).- Parameters:
filePath- The full file path where you expect the settings JSON file to be located. Likely you will generate a path relative to your script at runtime.
-
validateBeforeClosing
public void validateBeforeClosing(ValidationCallback callback)
Allows code to implement and provide a callback which can validate whether things are okay.- Parameters:
callback- Callback should return false if things are not satisfactory, true otherwise.
-
toJson
public java.lang.String toJson()
Gets a JSON String equivalent of the dialog values. This is a convenience method for callingtoMap()and then converting that Map to a JSON string.- Returns:
- A JSON string representation of the dialogs values (based on the Map returned by
toMap()).
-
loadJson
public void loadJson(java.lang.String json)
Attempts to set control values based on entries in JSON file. Entries which are unknown or cause errors are ignored. Loads JSON onto any controls in any tabs contained by this TabbedCustomDialog instance.- Parameters:
json- A JSON string to attempt to load.
-
loadJson
public void loadJson(java.lang.String json, java.lang.String tabIdentifier)Loads JSON but only to the controls contained within the specified tab.- Parameters:
json- A JSON string to attempt to loadtabIdentifier- Identifier of existing tab to which you would like to load the JSON into.
-
loadJson
public void loadJson(java.lang.String json, java.util.Map<java.lang.String,java.awt.Component> controlMap)Attempts to set control values based on entries in JSON file. Entries which are unknown or cause errors are ignored.- Parameters:
json- A JSON string to attempt to load.controlMap- A map of components to load the JSON onto.
-
saveJsonFile
public void saveJsonFile(java.lang.String filePath) throws java.lang.ExceptionSaves the settings of this dialog to a JSON file- Parameters:
filePath- Path to the JSON file settings will be saved to- Throws:
java.lang.Exception- Thrown if there are exceptions while saving the file
-
loadJsonFile
public void loadJsonFile(java.lang.String filePath) throws java.io.IOExceptionLoads the settings of this dialog from a JSON file- Parameters:
filePath- Path to the JSON file settings will be loaded from- Throws:
java.io.IOException- Thrown if there are exceptions while loading the file
-
getHelpFile
public java.io.File getHelpFile()
The File currently associated to the "Help" menu "View Documentation" entry- Returns:
- The currently associated help file
-
setHelpFile
public void setHelpFile(java.io.File helpFile)
Sets the path to a help file which will be associated to the "Help" menu "View Documentation" entry- Parameters:
helpFile- Path to a help file (set null to hide help menu, default is null)
-
setHelpFile
public void setHelpFile(java.lang.String helpFile)
Sets the path to a help file which will be associated to the "Help" menu "View Help" entry- Parameters:
helpFile- Path to a help file (set null to hide help menu, default is null)
-
setHelpUrl
public void setHelpUrl(java.lang.String helpUrl)
Sets the URL which will be associated to the "Help" menu "View Online Help" entry.- Parameters:
helpUrl- URL to a web site
-
hideFileMenu
public void hideFileMenu()
Hides the file menu from the user (effectively disabling save and load). Mostly included for situations where settings cannot be reasonably saved to JSON so you wish to hide those choices from the user.
-
whenJsonFileLoaded
public void whenJsonFileLoaded(java.lang.Runnable callback)
Allows you to provide a callback to run when a JSON file is loaded.- Parameters:
callback- The callback to run
-
whenSerializing
public void whenSerializing(java.lang.String identifier, ControlSerializationHandler handler)Advanced! Allows you to define a callback which will handle serialization of a particular control to JSON.- Parameters:
identifier- The identifier provided when the control was added to the dialog.handler- The callback which will handle serializing the controls data.
-
whenDeserializing
public void whenDeserializing(java.lang.String identifier, ControlDeserializationHandler handler)Advanced! Allows you to define a callback which will handle deserialization of a particular control from JSON.- Parameters:
identifier- The identifier provided when the control was added to the dialog.handler- The callback which will handle deserializing the controls data.
-
getDeserializer
public ControlDeserializationHandler getDeserializer(java.lang.String identifier)
Gets the previously provided deserialization handler for a particular control- Parameters:
identifier- Control id to which the desired deserializer was assigned- Returns:
- The deserialization handler if one was provided
-
getSerializer
public ControlSerializationHandler getSerializer(java.lang.String identifier)
Gets the previously provided serialization handler for a particular control- Parameters:
identifier- Control id to which the desired serializer was assigned- Returns:
- The serialization handler if one was provided
-
addMenu
public void addMenu(java.lang.String parentMenuLabel, java.lang.String menuItemLabel, java.lang.Runnable action)Adds a menu entry to the menu bar and then a menu item to that menu.- Parameters:
parentMenuLabel- The label of the menu to be added to the menu bar. If one already exists with this name (exact matching) then the created menu item will be added to that existing menu. If a menu with this label does not already exist, it is created.menuItemLabel- The label of the menu item to be added to the specified parent menu.action- The action to perform when the given menu item is clicked. Example:dialog.addMenu("Add Queries","Add Custodian Queries") do $current_case.getAllCustodians.each do |custodian_name| record = { :name => "Custodian: #{custodian_name}", :query => "custodian:\"#{custodian_name}\"", } dynamic_table.getModel.addRecord(record) end dialog.setSelectedTabIndex(2) end
-
setSelectedTabIndex
public void setSelectedTabIndex(int index)
Sets which tab is currently selected.- Parameters:
index- The index of the tab to make selected (index starts at 0).
-
-