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:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,javax.accessibility.Accessible
- Direct Known Subclasses:
ExecTool
public abstract class Tool extends javax.swing.JPanel
A base class for tools to appear on the JT Harness desktop.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Tool.Observer
An observer interface for use by those that wishing to monitor changes to a tool.-
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
Fields Modifier and Type Field Description protected UIFactory
uif
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
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Tool(ToolManager m, java.lang.String uiKey)
Create a tool object.protected
Tool(ToolManager m, java.lang.String uiKey, java.lang.String helpID)
Create a tool object.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addObserver(Tool.Observer o)
Add an observer to be notified of changes to a tool.void
dispose()
Release any resources this tool may be referencing.protected java.lang.String[]
getCloseAlerts()
Get a list (if any) of the reasons why it might be inadvisable to close the tool at this point.long
getCreationTime()
Get the creation time for this tool.Desktop
getDesktop()
Get the desktop for this tool.com.sun.javatest.tool.jthelp.HelpBroker
getHelpBroker()
Get the help broker used to provide help for this tool.TestSuite[]
getLoadedTestSuites()
Get a list of any test suites that are being used by this tool.WorkDirectory[]
getLoadedWorkDirectories()
Get a list of any work directories that are being used by this tool.ToolManager
getManager()
Get the manager for this tool.abstract javax.swing.JMenuBar
getMenuBar()
Get the menu bar for a tool.java.lang.String
getShortTitle()
Get a short title for the tool.java.lang.String
getTitle()
Get the title string for the tool.ToolDialog[]
getToolDialogs()
Get an array containing the set of ToolDialogs owned by this tool.void
removeObserver(Tool.Observer o)
Remove a previously registered observer so that it will no longer be notified of changes to a tool.protected abstract void
restore(java.util.Map<java.lang.String,java.lang.String> m)
Restore information about a tool from a map, and configure the tool according this information.protected abstract void
save(java.util.Map<java.lang.String,java.lang.String> m)
Save information about a tool in a map, so that the tool can be restored in a later invocation of JT Harness.protected void
setHelp(java.awt.Component comp, java.lang.String helpID)
Set the helpID for a specific component.protected void
setHelp(java.lang.String helpID)
Set the helpID for this component.protected void
setHelpOnButton(java.awt.Component comp, java.lang.String helpID)
Set a button to be a Help button and to invoke the help view set to a specific helpID.protected void
setI18NTitle(java.lang.String key)
Set the title string for the tool.protected void
setI18NTitle(java.lang.String key, java.lang.Object arg)
Set the title string for the tool.protected void
setI18NTitle(java.lang.String key, java.lang.Object... args)
Set the title string for the tool.void
setShortTitle(java.lang.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 Detail
-
uif
protected final UIFactory uif
The UI factory used to create GUI components.
-
-
Constructor Detail
-
Tool
protected Tool(ToolManager m, java.lang.String uiKey)
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
protected Tool(ToolManager m, java.lang.String uiKey, java.lang.String helpID)
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 Detail
-
addObserver
public void addObserver(Tool.Observer o)
Add an observer to be notified of changes to a tool.- Parameters:
o
- the observer to be added- See Also:
removeObserver(com.sun.javatest.tool.Tool.Observer)
-
removeObserver
public void removeObserver(Tool.Observer o)
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:
addObserver(com.sun.javatest.tool.Tool.Observer)
-
getMenuBar
public abstract javax.swing.JMenuBar 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
protected void setI18NTitle(java.lang.String key)
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:
getTitle()
-
setI18NTitle
protected void setI18NTitle(java.lang.String key, java.lang.Object arg)
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:
I18NResourceBundle
,getTitle()
-
setI18NTitle
protected void setI18NTitle(java.lang.String key, java.lang.Object... args)
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:
I18NResourceBundle
,getTitle()
-
getTitle
public java.lang.String getTitle()
Get the title string for the tool.- Returns:
- the title string for the tool
- See Also:
setI18NTitle(String)
,setI18NTitle(String, Object)
,setI18NTitle(String, Object[])
-
getShortTitle
public java.lang.String getShortTitle()
Get a short title for the tool.- Returns:
- the short title string for the tool
- See Also:
setShortTitle(java.lang.String)
-
setShortTitle
public void setShortTitle(java.lang.String newShortTitle)
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:
getShortTitle()
-
getLoadedTestSuites
public TestSuite[] 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
public WorkDirectory[] 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
public ToolManager getManager()
Get the manager for this tool.- Returns:
- the manager for this tool
-
getDesktop
public Desktop 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
protected abstract void save(java.util.Map<java.lang.String,java.lang.String> m)
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
protected abstract void restore(java.util.Map<java.lang.String,java.lang.String> m)
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
protected java.lang.String[] 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
protected void setHelp(java.lang.String helpID)
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
protected void setHelp(java.awt.Component comp, java.lang.String helpID)
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
protected void setHelpOnButton(java.awt.Component comp, java.lang.String helpID)
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
public ToolDialog[] 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
-
-