Class Tool

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
ExecTool

public abstract class Tool extends JPanel
A base class for tools to appear on the JT Harness desktop.
See Also:
  • Field Details

    • uif

      protected final UIFactory uif
      The UI factory used to create GUI components.
  • Constructor Details

    • Tool

      protected Tool(ToolManager m, 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 tool
      uiKey - the component name for this tool
    • Tool

      protected Tool(ToolManager m, String uiKey, String helpID)
      Create a tool object.
      Parameters:
      m - the manager for this tool
      uiKey - the component name for this tool
      helpID - the help ID for context-sensitive help for this tool
  • Method Details

    • 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

      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:
    • getMenuBar

      public abstract 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(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:
    • setI18NTitle

      protected void setI18NTitle(String key, 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 bundle
      arg - item for substitution into string from resource bundle
      See Also:
    • setI18NTitle

      protected void setI18NTitle(String key, 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 bundle
      args - items for substitution into string from resource bundle
      See Also:
    • getTitle

      public String getTitle()
      Get the title string for the tool.
      Returns:
      the title string for the tool
      See Also:
    • getShortTitle

      public String getShortTitle()
      Get a short title for the tool.
      Returns:
      the short title string for the tool
      See Also:
    • setShortTitle

      public void setShortTitle(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:
    • 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(Map<String,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 method public 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(Map<String,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 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(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(Component comp, 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 question
      helpID - the ID for the help to be displayed
    • setHelpOnButton

      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.
      Parameters:
      comp - the button to be made into a help button
      helpID - 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