public class Desktop
extends java.lang.Object
Much of the functionality of a desktop is provided by the current view, and because of that, many of the methods here simply call through to the underlying current view object.
DeskView
Modifier and Type | Field and Description |
---|---|
static int |
MDI_STYLE
A constant to indicate the MDI-style desktop:
a single window for the desktop, containing multiple internal windows, one per tool.
|
static int |
SDI_STYLE
A constant to indicate the SDI-style desktop:
multiple top-level windows, one per tool.
|
static int |
TAB_STYLE
A constant to indicate the tabbed-style desktop:
a single window for the desktop, using a tabbed pane for the tools.
|
Constructor and Description |
---|
Desktop()
Create a desktop using a style determined according to the
user's preferences.
|
Desktop(CommandContext ctx)
New desktop, using preferred style and given context.
|
Desktop(int style)
Create a desktop using a specified style.
|
Desktop(int style,
CommandContext ctx) |
Modifier and Type | Method and Description |
---|---|
void |
addDefaultTool()
Add a new default tool to the desktop.
|
Tool |
addDefaultTool(InterviewParameters ip)
Add a new default tool to the desktop.
|
void |
addToFileHistory(java.io.File f,
FileOpener fo)
Add a file and a corresponding file opener to the file history
that appears on the File menu.
|
void |
addTool(Tool t)
Add a new tool to the desktop.
|
void |
checkToolsAndExitIfOK(javax.swing.JFrame parent)
Check all the tools on the desktop to see if they have open state
that should be saved or processes running.
|
boolean |
containsTool(Tool t)
Check if a tool is present on the desktop.
|
java.awt.Container |
createDialog(Tool tool,
java.lang.String uiKey,
java.lang.String title,
javax.swing.JMenuBar menuBar,
java.awt.Container body,
java.awt.Rectangle bounds,
int type)
Create a dialog.
|
void |
dispose()
Dispose of any resources used by this object.
|
java.awt.Component |
getDialogParent()
Get a parent component for a dialog to use.
|
javax.swing.JFrame[] |
getFrames()
Get the top level frames that make up this desktop.
|
javax.help.HelpBroker |
getHelpBroker()
Get the Help Broker used by the Help menu amd context sensitive help.
|
javax.swing.Icon |
getLogo()
Get an icon containing the JT Harness logo.
|
static int |
getPreferredStyle()
Get a value indicating the user's preferred desktop style,
as recorded in the user's preferences.
|
boolean |
getRestoreOnStart()
Check whether or not the desk view should restore saved tools state when the Harness is starting.
|
boolean |
getSaveOnExit()
Check whether or not the desktop will save its state when the VM exits.
|
Tool |
getSelectedTool()
Get the currently selected tool on the desktop.
|
int |
getStyle()
Get a value indicating the current style of the desktop.
|
ToolManager |
getToolManager(java.lang.Class c)
Get the instance of a tool manager for this desktop of a specific class.
|
ToolManager |
getToolManager(java.lang.String className)
Get the instance of a tool manager for this desktop of a specific class.
|
ToolManager[] |
getToolManagers()
Get the set of tool managers associated with this desktop.
|
Tool[] |
getTools()
Get the set of tools currently on the desktop.
|
boolean |
isEmpty()
Check whether the desktop is empty of any tools.
|
boolean |
isFirstTime()
Determine if this is the first time that JT Harness has been run.
|
boolean |
isOKToAutoExit()
Check if it is OK to automatically exit JT Harness.
|
boolean |
isOKToClose(Tool t,
javax.swing.JFrame parent)
Check if it is OK to close a tool.
|
boolean |
isOKToExit(javax.swing.JFrame parent)
Check if it is OK to close all tools and exit the desktop.
|
boolean |
isToolOwnerForDialog(Tool tool,
java.awt.Container dialog)
Check if the tool's parent Window is the owner of a dialog.
|
boolean |
isVisible()
Check if the top level windows of the desktop are visible or not.
|
void |
log(I18NResourceBundle i18n,
java.lang.String key)
Print a text message to the desktop logfile.
|
void |
log(I18NResourceBundle i18n,
java.lang.String key,
java.lang.Object arg)
Print a text message to the desktop logfile.
|
void |
log(I18NResourceBundle i18n,
java.lang.String key,
java.lang.Object[] args)
Print a text message to the desktop logfile.
|
void |
print(java.awt.print.Printable printable) |
void |
printSetup() |
void |
removeTool(Tool t)
Remove a tool from the desktop.
|
void |
restore()
Restore the desktop from information in a saved desktop file.
|
void |
restore(java.io.File file)
Restore the desktop from information in a specified file.
|
void |
restoreHistory() |
void |
save()
Save the current state of the desktop in the user's standard desktop file.
|
void |
save(java.io.File f)
Save the current state of the desktop in a specified desktop file.
|
void |
setFirstTime(boolean b)
Set the flag indicating whether or not this is the first time
that JT Harness has been run.
|
void |
setRestoreOnStart(boolean restoreOnStart)
Specify whether or not the desk view should restore saved tools state when the Harness is starting.
|
void |
setSaveOnExit(boolean b)
Specify whether or not the desktop will save its state when the VM exits.
|
void |
setSelectedTool(Tool t)
Set the currently selected tool on the desktop.
|
void |
setStyle(int style)
Set the current style of the desktop.
|
void |
setVisible(boolean b)
Set whether or not the top level windows of the desktop should be visible.
|
void |
showPreferences(javax.swing.JFrame parent)
Show a Preferences window.
|
public static final int TAB_STYLE
public static final int MDI_STYLE
public static final int SDI_STYLE
public Desktop()
public Desktop(CommandContext ctx)
public Desktop(int style, CommandContext ctx)
public int getStyle()
setStyle(int)
,
MDI_STYLE
,
SDI_STYLE
,
TAB_STYLE
public static int getPreferredStyle()
public void setStyle(int style)
style
- a value indicating the current style of the desktopgetStyle()
,
MDI_STYLE
,
SDI_STYLE
,
TAB_STYLE
public javax.help.HelpBroker getHelpBroker()
public boolean isFirstTime()
public void setFirstTime(boolean b)
b
- true if JT Harness should behave as though this is th
first time JT Harness has been runisFirstTime()
public boolean isEmpty()
public Tool[] getTools()
public void addTool(Tool t)
t
- the tool to be addedremoveTool(com.sun.javatest.tool.Tool)
public void removeTool(Tool t)
t
- the tool to be removedaddTool(com.sun.javatest.tool.Tool)
public Tool getSelectedTool()
setSelectedTool(com.sun.javatest.tool.Tool)
public void setSelectedTool(Tool t)
t
- the the tool to be selected on the desktopgetSelectedTool()
public void addDefaultTool()
removeTool(com.sun.javatest.tool.Tool)
public Tool addDefaultTool(InterviewParameters ip)
ip
- a configuration to be passed to the default tool manager's startTool
methodremoveTool(com.sun.javatest.tool.Tool)
public boolean containsTool(Tool t)
t
- the tool for which to checkpublic ToolManager[] getToolManagers()
public ToolManager getToolManager(java.lang.Class c)
c
- the class of the desired tool manager.public ToolManager getToolManager(java.lang.String className)
className
- the name of the class of the desired tool manager.public javax.swing.JFrame[] getFrames()
public java.awt.Component getDialogParent()
public void addToFileHistory(java.io.File f, FileOpener fo)
f
- The file to be addedfo
- A FileOpener object to be used to open the file if necessarypublic boolean isVisible()
setVisible(boolean)
public void setVisible(boolean b)
b
- If true, the top level windows will be made visible; if false, they
will be hidden.public java.awt.Container createDialog(Tool tool, java.lang.String uiKey, java.lang.String title, javax.swing.JMenuBar menuBar, java.awt.Container body, java.awt.Rectangle bounds, int type)
tool
- the parent tool for the dialoguiKey
- a string which is to be used as the base name for any
resources that may be requiredtitle
- the title for the dialogmenuBar
- the menu bar for the dialogbody
- the body component for the dialogbounds
- the size and position for the dialogpublic boolean isToolOwnerForDialog(Tool tool, java.awt.Container dialog)
tool
- the tool from which to determine the parent Windowdialog
- the dialog to be checkedpublic void checkToolsAndExitIfOK(javax.swing.JFrame parent)
parent
- A parent frame to be used if a confirmation dialog
is necessaryisOKToExit(javax.swing.JFrame)
public boolean isOKToClose(Tool t, javax.swing.JFrame parent)
t
- The tool to be checkedparent
- A parent frame to be used if a confirmation dialog
is necessarypublic boolean isOKToExit(javax.swing.JFrame parent)
parent
- A parent frame to be used if a confirmation dialog
is necessarypublic boolean isOKToAutoExit()
public void save()
public void save(java.io.File f)
f
- the file in which to save the desktoppublic void restore()
public void restore(java.io.File file)
file
- the file from which to load the datapublic void restoreHistory()
public void showPreferences(javax.swing.JFrame parent)
parent
- the parent frame to be used for the preferences dialogpublic javax.swing.Icon getLogo()
public void dispose()
public void log(I18NResourceBundle i18n, java.lang.String key)
i18n
- a resource bundle containing the localized messageskey
- a key into the resource bundle for the required messagepublic void log(I18NResourceBundle i18n, java.lang.String key, java.lang.Object arg)
i18n
- a resource bundle containing the localized messageskey
- a key into the resource bundle for the required messagearg
- An argument to be formatted into the specified message.
If this is a Throwable
, its stack trace
will be included in the log.public void log(I18NResourceBundle i18n, java.lang.String key, java.lang.Object[] args)
i18n
- a resource bundle containing the localized messageskey
- a key into the resource bundle for the required messageargs
- An array of arguments to be formatted into the specified message.
If the first arg is a Throwable
, its stack
trace will be included in the log.public boolean getSaveOnExit()
setSaveOnExit(boolean)
public void setSaveOnExit(boolean b)
b
- true if the desktop should save its state when the VM exits, and false otherwisegetSaveOnExit()
public boolean getRestoreOnStart()
setRestoreOnStart(boolean)
public void setRestoreOnStart(boolean restoreOnStart)
restoreOnStart
- true if the desk will restore its tools when the Harness is starting, and false otherwisegetRestoreOnStart()
public void printSetup()
public void print(java.awt.print.Printable printable)
Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.