public abstract class PredictWindowBase extends InternalWindow
Modifier and Type | Class and Description |
---|---|
protected static interface |
PredictWindowBase.BackgroundTask |
(package private) class |
PredictWindowBase.FieldInfo |
(package private) class |
PredictWindowBase.FileFieldInfo |
static class |
PredictWindowBase.PredictTaskBase |
InternalWindow.CommandInfo
javax.swing.JInternalFrame.AccessibleJInternalFrame, javax.swing.JInternalFrame.JDesktopIcon
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
private static java.lang.String[] |
controlPrefixes |
private java.util.HashMap<javax.swing.JComponent,PredictWindowBase.FieldInfo> |
fields |
private java.util.HashMap<java.lang.String,PredictWindowBase.FileFieldInfo> |
fileFields |
protected java.text.DecimalFormat |
numberFormatter |
protected javax.swing.JPanel |
pnlClient |
protected javax.swing.JPanel |
pnlContent |
private PredictWindowBase.BackgroundTask |
runningTask |
static double |
TEMP_37C |
private javax.swing.Timer |
uiUpdateTimer |
backend, changeListener, frameListener, log, warnings
closable, CONTENT_PANE_PROPERTY, desktopIcon, FRAME_ICON_PROPERTY, frameIcon, GLASS_PANE_PROPERTY, iconable, IS_CLOSED_PROPERTY, IS_ICON_PROPERTY, IS_MAXIMUM_PROPERTY, IS_SELECTED_PROPERTY, isClosed, isIcon, isMaximum, isSelected, LAYERED_PANE_PROPERTY, maximizable, MENU_BAR_PROPERTY, resizable, ROOT_PANE_PROPERTY, rootPane, rootPaneCheckingEnabled, title, TITLE_PROPERTY
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
PredictWindowBase() |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e) |
protected void |
addField(javax.swing.JComponent c,
java.lang.String description,
java.lang.String settingsName) |
protected void |
addFileField(java.lang.String actionLookupName,
javax.swing.text.JTextComponent txt,
java.lang.String filters) |
protected void |
addFileField(java.lang.String actionLookupName,
javax.swing.text.JTextComponent txt,
java.lang.String filters,
boolean isOutput) |
protected void |
addFileField(java.lang.String actionLookupName,
javax.swing.text.JTextComponent txt,
java.lang.String filters,
boolean isOutput,
java.lang.String action) |
protected void |
autoSetFieldNames()
Automatically set the names of controls (JComponents) that are
direct Fields of this class.
|
protected boolean |
browseFile(javax.swing.text.JTextComponent field,
java.lang.String filter,
boolean forSave) |
protected boolean |
browseFile(PredictWindowBase.FileFieldInfo field) |
protected void |
browseRecentFile(javax.swing.JComponent displayTarget,
PredictWindowBase.FileFieldInfo field) |
protected boolean |
cancelRunningTask()
Cancel the active background task (if there is one) if it is cancelable.
|
protected void |
enableDescendants(java.awt.Container parent,
boolean enabled,
java.awt.Component... exclude) |
protected void |
focusField(javax.swing.JComponent c)
Attempts to show the field and set focus to it, possibly by activating the tab on which the control is placed.
|
protected java.lang.String |
formatValue(java.lang.Object value) |
protected boolean |
frameClosing(javax.swing.event.InternalFrameEvent e)
Indicates that the InternalFrame is closing.
|
protected java.lang.String |
getControlDescription(javax.swing.JComponent c) |
protected java.lang.Object |
getControlValue(javax.swing.JComponent c) |
protected PredictWindowBase.FileFieldInfo |
getFileField(javax.swing.text.JTextComponent txt,
boolean showErrorIfMissing) |
protected PredictWindowBase.FileFieldInfo |
getFileField(java.lang.String fieldName,
boolean showErrorIfMissing) |
protected PredictWindowBase.BackgroundTask |
getRunningTask() |
protected java.lang.String |
getSettingsName(javax.swing.JComponent c) |
protected java.lang.Number |
getSpin(javax.swing.JSpinner spn) |
protected double |
getSpinDbl(javax.swing.JSpinner spn) |
protected int |
getSpinInt(javax.swing.JSpinner spn) |
protected void |
handleRecentControlValues(boolean writeValues,
java.lang.String nodeName,
java.lang.Iterable<javax.swing.JComponent> fields) |
protected abstract void |
handleSettings(boolean writeValues) |
protected static DrawingWindow |
launchDrawing(java.lang.String file,
FileType type,
java.lang.String addFile,
FileType addType,
int strand) |
protected void |
listenForActions(javax.swing.AbstractButton... buttons) |
protected void |
listenForActions(javax.swing.JComponent parent) |
protected void |
listenForActions(javax.swing.JComponent parent,
java.lang.Class<? extends javax.swing.AbstractButton> type,
java.awt.event.ActionListener listener) |
protected void |
loadRecent(java.lang.String nodeName,
javax.swing.JComponent... fields) |
void |
pack() |
protected <TTask extends PredictWindowBase.BackgroundTask> |
runInBackground(TTask task,
java.util.function.Consumer<TTask> done) |
protected void |
saveRecent(java.lang.String nodeName,
javax.swing.JComponent... fields) |
protected void |
saveRecentFiles(javax.swing.JTextField... fields) |
(package private) void |
setContent(javax.swing.JPanel content) |
protected void |
setControlValue(javax.swing.JComponent c,
java.lang.Object value) |
protected void |
setSpin(javax.swing.JSpinner spn,
double value) |
protected void |
setSpin(javax.swing.JSpinner spn,
double value,
double min,
double max) |
protected void |
setSpin(javax.swing.JSpinner spn,
double value,
double min,
double max,
double step)
Initialize a spinner with a SpinnerNumberModel.
|
protected void |
setSpin(javax.swing.JSpinner spn,
int value) |
protected void |
setSpin(javax.swing.JSpinner spn,
int value,
int min,
int max) |
protected void |
setSpin(javax.swing.JSpinner spn,
int value,
int min,
int max,
int step) |
void |
showWindow()
View the window.
|
protected void |
startUiTimer() |
protected void |
stopUiTimer() |
protected java.lang.String |
stripControlPrefix(java.lang.String name) |
protected abstract void |
updateFormUI()
Called periodically by a timer to update the user interface.
|
protected void |
validateFailed(javax.swing.JComponent control,
java.lang.String message,
java.lang.Object... args) |
protected void |
validateFileField(javax.swing.text.JTextComponent txt,
boolean allowEmpty) |
protected void |
validateFileField(javax.swing.text.JTextComponent txt,
boolean allowEmpty,
boolean forOutput)
Verifies the existence of a file in a JTextComponent that has been added as a named file-field.
|
protected void |
validateRequiredField(javax.swing.text.JTextComponent txt) |
createCustomMenus, frameActivated, frameClosed, getCustomMenus, invokeCommand, invokeCommand, invokeCommand, isActiveFrame, notifyUpdated, onFocusGained, processCommand, propertyChanged, setCaption, setCustomMenus
addImpl, addInternalFrameListener, createRootPane, dispose, doDefaultCloseAction, fireInternalFrameEvent, getAccessibleContext, getContentPane, getDefaultCloseOperation, getDesktopIcon, getDesktopPane, getFocusCycleRootAncestor, getFocusOwner, getFrameIcon, getGlassPane, getInternalFrameListeners, getJMenuBar, getLastCursor, getLayer, getLayeredPane, getMenuBar, getMostRecentFocusOwner, getNormalBounds, getRootPane, getTitle, getUI, getUIClassID, getWarningString, hide, isClosable, isClosed, isFocusCycleRoot, isIcon, isIconifiable, isMaximizable, isMaximum, isResizable, isRootPaneCheckingEnabled, isSelected, moveToBack, moveToFront, paintComponent, paramString, remove, removeInternalFrameListener, reshape, restoreSubcomponentFocus, setClosable, setClosed, setContentPane, setCursor, setDefaultCloseOperation, setDesktopIcon, setFocusCycleRoot, setFrameIcon, setGlassPane, setIcon, setIconifiable, setJMenuBar, setLayer, setLayer, setLayeredPane, setLayout, setMaximizable, setMaximum, setMenuBar, setNormalBounds, setResizable, setRootPane, setRootPaneCheckingEnabled, setSelected, setTitle, setUI, show, toBack, toFront, updateUI
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, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, 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, 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, update
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate, validateTree
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, 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, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
private static java.lang.String[] controlPrefixes
private java.util.HashMap<javax.swing.JComponent,PredictWindowBase.FieldInfo> fields
private java.util.HashMap<java.lang.String,PredictWindowBase.FileFieldInfo> fileFields
protected java.text.DecimalFormat numberFormatter
protected javax.swing.JPanel pnlClient
protected javax.swing.JPanel pnlContent
private PredictWindowBase.BackgroundTask runningTask
public static final double TEMP_37C
private javax.swing.Timer uiUpdateTimer
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
actionPerformed
in class InternalWindow
protected void addField(javax.swing.JComponent c, java.lang.String description, java.lang.String settingsName)
protected void addFileField(java.lang.String actionLookupName, javax.swing.text.JTextComponent txt, java.lang.String filters)
protected void addFileField(java.lang.String actionLookupName, javax.swing.text.JTextComponent txt, java.lang.String filters, boolean isOutput)
protected void addFileField(java.lang.String actionLookupName, javax.swing.text.JTextComponent txt, java.lang.String filters, boolean isOutput, java.lang.String action)
protected void autoSetFieldNames()
protected boolean browseFile(javax.swing.text.JTextComponent field, java.lang.String filter, boolean forSave)
protected boolean browseFile(PredictWindowBase.FileFieldInfo field)
protected void browseRecentFile(javax.swing.JComponent displayTarget, PredictWindowBase.FileFieldInfo field)
protected boolean cancelRunningTask()
protected void enableDescendants(java.awt.Container parent, boolean enabled, java.awt.Component... exclude)
protected void focusField(javax.swing.JComponent c)
c
- The JComponent to show and set focus to.protected java.lang.String formatValue(java.lang.Object value)
protected boolean frameClosing(javax.swing.event.InternalFrameEvent e)
InternalWindow
frameClosing
in class InternalWindow
protected java.lang.String getControlDescription(javax.swing.JComponent c)
protected java.lang.Object getControlValue(javax.swing.JComponent c)
protected PredictWindowBase.FileFieldInfo getFileField(javax.swing.text.JTextComponent txt, boolean showErrorIfMissing)
protected PredictWindowBase.FileFieldInfo getFileField(java.lang.String fieldName, boolean showErrorIfMissing)
protected PredictWindowBase.BackgroundTask getRunningTask()
protected java.lang.String getSettingsName(javax.swing.JComponent c)
protected java.lang.Number getSpin(javax.swing.JSpinner spn)
protected double getSpinDbl(javax.swing.JSpinner spn)
protected int getSpinInt(javax.swing.JSpinner spn)
protected void handleRecentControlValues(boolean writeValues, java.lang.String nodeName, java.lang.Iterable<javax.swing.JComponent> fields)
protected abstract void handleSettings(boolean writeValues)
protected static DrawingWindow launchDrawing(java.lang.String file, FileType type, java.lang.String addFile, FileType addType, int strand)
protected void listenForActions(javax.swing.AbstractButton... buttons)
protected void listenForActions(javax.swing.JComponent parent)
protected void listenForActions(javax.swing.JComponent parent, java.lang.Class<? extends javax.swing.AbstractButton> type, java.awt.event.ActionListener listener)
protected void loadRecent(java.lang.String nodeName, javax.swing.JComponent... fields)
public void pack()
pack
in class javax.swing.JInternalFrame
protected <TTask extends PredictWindowBase.BackgroundTask> void runInBackground(TTask task, java.util.function.Consumer<TTask> done)
protected void saveRecent(java.lang.String nodeName, javax.swing.JComponent... fields)
protected void saveRecentFiles(javax.swing.JTextField... fields)
void setContent(javax.swing.JPanel content)
protected void setControlValue(javax.swing.JComponent c, java.lang.Object value)
protected void setSpin(javax.swing.JSpinner spn, double value)
protected void setSpin(javax.swing.JSpinner spn, double value, double min, double max)
protected void setSpin(javax.swing.JSpinner spn, double value, double min, double max, double step)
spn
- The spinnervalue
- The initial value.min
- The minimum value.max
- The maximim value.step
- Teh step size.protected void setSpin(javax.swing.JSpinner spn, int value)
protected void setSpin(javax.swing.JSpinner spn, int value, int min, int max)
protected void setSpin(javax.swing.JSpinner spn, int value, int min, int max, int step)
public void showWindow()
InternalWindow
showWindow
in class InternalWindow
protected void startUiTimer()
protected void stopUiTimer()
protected java.lang.String stripControlPrefix(java.lang.String name)
protected abstract void updateFormUI()
protected void validateFailed(javax.swing.JComponent control, java.lang.String message, java.lang.Object... args) throws FormValidationException
FormValidationException
protected void validateFileField(javax.swing.text.JTextComponent txt, boolean allowEmpty) throws FormValidationException
FormValidationException
protected void validateFileField(javax.swing.text.JTextComponent txt, boolean allowEmpty, boolean forOutput) throws FormValidationException
txt
- The JTextComponent used to accept file entry.allowEmpty
- Whether the field is optional (and so can be empty and still be valid input).forOutput
- Whether the field is the name of an output file. (If so, it does not need to exist, but must be in a valid directory.FormValidationException
- if txt fails validation.protected void validateRequiredField(javax.swing.text.JTextComponent txt) throws FormValidationException
FormValidationException