Package com.sun.javatest.tool
Class Tool
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.sun.javatest.tool.Tool
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
- Direct Known Subclasses:
ExecTool
A base class for tools to appear on the JT Harness desktop.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
An observer interface for use by those that wishing to monitor changes to a tool.Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final UIFactory
The UI factory used to create GUI components.Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Tool
(ToolManager m, String uiKey) Create a tool object.protected
Tool
(ToolManager m, String uiKey, String helpID) Create a tool object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an observer to be notified of changes to a tool.void
dispose()
Release any resources this tool may be referencing.protected String[]
Get a list (if any) of the reasons why it might be inadvisable to close the tool at this point.long
Get the creation time for this tool.Get the desktop for this tool.com.sun.javatest.tool.jthelp.HelpBroker
Get the help broker used to provide help for this tool.Get a list of any test suites that are being used by this tool.Get a list of any work directories that are being used by this tool.Get the manager for this tool.abstract JMenuBar
Get the menu bar for a tool.Get a short title for the tool.getTitle()
Get the title string for the tool.Get an array containing the set of ToolDialogs owned by this tool.void
Remove a previously registered observer so that it will no longer be notified of changes to a tool.protected abstract void
Restore information about a tool from a map, and configure the tool according this information.protected abstract void
Save information about a tool in a map, so that the tool can be restored in a later invocation of JT Harness.protected void
Set the helpID for a specific component.protected void
Set the helpID for this component.protected void
setHelpOnButton
(Component comp, String helpID) Set a button to be a Help button and to invoke the help view set to a specific helpID.protected void
setI18NTitle
(String key) Set the title string for the tool.protected void
setI18NTitle
(String key, Object arg) Set the title string for the tool.protected void
setI18NTitle
(String key, Object... args) Set the title string for the tool.void
setShortTitle
(String newShortTitle) Set a short title for the tool.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods inherited from class javax.swing.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, update
Methods inherited from class java.awt.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, validateTree
Methods inherited from class java.awt.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, transferFocusUpCycle
-
Field Details
-
uif
The UI factory used to create GUI components.
-
-
Constructor Details
-
Tool
Create a tool object. The resources used are from your resource bundle:uiKey.name accessible name text - Parameters:
m
- the manager for this tooluiKey
- the component name for this tool
-
Tool
Create a tool object.- Parameters:
m
- the manager for this tooluiKey
- the component name for this toolhelpID
- the help ID for context-sensitive help for this tool
-
-
Method Details
-
addObserver
Add an observer to be notified of changes to a tool.- Parameters:
o
- the observer to be added- See Also:
-
removeObserver
Remove a previously registered observer so that it will no longer be notified of changes to a tool.- Parameters:
o
- the observer to be removed- See Also:
-
getMenuBar
Get the menu bar for a tool. This should just contain the tool-specific menus. The desktop will automatically add and display the standard menus on the menu bar.- Returns:
- a menu bar containing tool-specific menus
-
setI18NTitle
Set the title string for the tool. This will normally the displayed by the desktop in the title bar of the window containing the tool.- Parameters:
key
- key to be used to get title text from resource bundle- See Also:
-
setI18NTitle
Set the title string for the tool. This will normally the displayed by the desktop in the title bar of the window containing the tool.- Parameters:
key
- key to be used to get title text from resource bundlearg
- item for substitution into string from resource bundle- See Also:
-
setI18NTitle
Set the title string for the tool. This will normally the displayed by the desktop in the title bar of the window containing the tool.- Parameters:
key
- key to be used to get title text from resource bundleargs
- items for substitution into string from resource bundle- See Also:
-
getTitle
Get the title string for the tool.- Returns:
- the title string for the tool
- See Also:
-
getShortTitle
Get a short title for the tool.- Returns:
- the short title string for the tool
- See Also:
-
setShortTitle
Set a short title for the tool. This will normally be displayed by the desktop in situations where there is not room for the full title.- Parameters:
newShortTitle
- the short title string for the tool- See Also:
-
getLoadedTestSuites
Get a list of any test suites that are being used by this tool.- Returns:
- a list of test suites being used by the tool, or null if none
-
getLoadedWorkDirectories
Get a list of any work directories that are being used by this tool.- Returns:
- a list of work directories being used by the tool, or null if none
-
getCreationTime
public long getCreationTime()Get the creation time for this tool. This is used by the desktop to help preserve a consistent order when changing between desktop styles.- Returns:
- a standard long cvalue, as returned by System.currentTimeMillis, indicating the time the tool was created
-
dispose
public void dispose()Release any resources this tool may be referencing. This is for "destroying" this tool instance. -
getManager
Get the manager for this tool.- Returns:
- the manager for this tool
-
getDesktop
Get the desktop for this tool.- Returns:
- the desktop for this tool
-
getHelpBroker
public com.sun.javatest.tool.jthelp.HelpBroker getHelpBroker()Get the help broker used to provide help for this tool.- Returns:
- the help broker used to provide help for this tool
-
save
Save information about a tool in a map, so that the tool can be restored in a later invocation of JT Harness. The tool must also implement the following methodpublic static Tool restore(Map m)
which will be invoked to recreate the tool.- Parameters:
m
- the map in which to store the significant state of the tool
-
restore
Restore information about a tool from a map, and configure the tool according this information.- Parameters:
m
- the map in which to store the significant state of the tool
-
getCloseAlerts
Get a list (if any) of the reasons why it might be inadvisable to close the tool at this point. This will normally include information about unsaved data or tasks in progress.- Returns:
- a list of alerts about why the user might not want to close the tool at this time; the list may be empty or null to indicate that there are no such reasons
-
setHelp
Set the helpID for this component. The help will be shown if and when the focus is on this component and the standard Help key (F1) is pressed.- Parameters:
helpID
- the ID for the help to be displayed
-
setHelp
Set the helpID for a specific component. The help will be shown if and when the focus is on the specified component and the standard Help key (F1) is pressed.- Parameters:
comp
- the component in questionhelpID
- the ID for the help to be displayed
-
setHelpOnButton
Set a button to be a Help button and to invoke the help view set to a specific helpID.- Parameters:
comp
- the button to be made into a help buttonhelpID
- the ID for the help to be displayed when the button is pressed
-
getToolDialogs
Get an array containing the set of ToolDialogs owned by this tool.- Returns:
- an array containing the set of ToolDialogs owned by this tool
-