|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opensourcephysics.tools.Launcher
This provides a GUI for launching osp applications and xml files.
Nested Class Summary | |
class |
Launcher.LaunchSet
A class to save and load a set of launch tabs and Launcher static fields. |
protected class |
Launcher.LinkEdit
A class to undo/redo a link, open or new tabset action. |
Field Summary | |
protected javax.swing.JMenuItem |
aboutItem
|
static LaunchNode |
activeNode
|
protected javax.swing.JMenuItem |
backItem
|
protected static float |
baseMenuFontSize
|
protected java.util.Set |
changedFiles
|
protected static javax.swing.JFileChooser |
chooser
|
protected LaunchClassChooser |
classChooser
|
protected static java.lang.String |
classPath
|
protected javax.swing.JMenuItem |
closeAllItem
|
protected javax.swing.JMenuItem |
closeTabItem
|
protected javax.swing.JPanel |
contentPane
|
protected static java.lang.String |
defaultFileName
|
protected javax.swing.JMenu |
diagnosticMenu
|
protected javax.swing.JMenu |
displayMenu
|
protected int |
divider
|
protected javax.swing.JMenuItem |
editItem
|
protected boolean |
editorEnabled
|
protected static java.util.ArrayList |
existingFrames
|
protected javax.swing.JMenuItem |
exitItem
|
protected javax.swing.JMenu |
fileMenu
|
javax.swing.JFrame |
frame
|
protected static javax.swing.Timer |
frameFinder
|
protected static javax.swing.Icon |
ghostFileIcon
|
protected static javax.swing.Icon |
greenFileIcon
|
protected static javax.swing.Icon |
greenFolderIcon
|
protected javax.swing.JMenu |
helpMenu
|
protected javax.swing.JMenuItem |
hideItem
|
protected static int |
hInit
|
protected static javax.swing.Icon |
htmlIcon
|
protected javax.swing.JMenuItem |
inspectItem
|
protected javax.swing.JDialog |
inspector
|
protected static boolean |
isWebStart
|
protected java.lang.String |
jarBasePath
|
protected javax.swing.JMenuItem[] |
languageItems
|
protected javax.swing.JMenu |
languageMenu
|
protected static javax.swing.Icon |
launchedIcon
|
protected static javax.swing.Icon |
launchEmptyIcon
|
protected static javax.swing.filechooser.FileFilter |
launcherFileFilter
|
protected static javax.swing.Icon |
launchIcon
|
protected static javax.swing.Icon |
linkIcon
|
protected javax.swing.JMenuItem |
logItem
|
protected javax.swing.JMenuItem |
lookFeelItem
|
protected static javax.swing.Icon |
magentaFileIcon
|
protected boolean |
newNodeSelected
|
protected static javax.swing.Icon |
noFileIcon
|
protected javax.swing.JMenu |
openFromJarMenu
|
protected javax.swing.JMenuItem |
openItem
|
protected java.util.Set |
openPaths
|
protected java.lang.String |
password
|
protected javax.swing.JPopupMenu |
popup
|
protected boolean |
previewing
|
protected LaunchNode |
previousNode
|
protected boolean |
pwRequiredToLoad
|
protected static javax.swing.Icon |
redFileIcon
|
protected static javax.swing.Icon |
redFolderIcon
|
protected static java.lang.String |
releaseDate
|
protected static java.lang.String |
resourcesPath
|
protected LaunchNode |
selectedNode
|
protected boolean |
selfContained
|
protected boolean |
showText
|
protected javax.swing.JMenuItem |
singleAppItem
|
static boolean |
singleAppMode
|
protected static javax.swing.Icon |
singletonIcon
|
static boolean |
singletonMode
|
protected javax.swing.JMenuItem |
sizeDownItem
|
protected javax.swing.JMenuItem |
sizeUpItem
|
protected Launcher |
spawner
|
protected static javax.swing.JDialog |
splashDialog
|
protected static javax.swing.JLabel |
splashPathLabel
|
protected static javax.swing.Timer |
splashTimer
|
protected static javax.swing.JLabel |
splashTitleLabel
|
protected javax.swing.JTabbedPane |
tabbedPane
|
protected java.awt.event.MouseListener |
tabListener
|
protected java.util.ArrayList |
tabs
|
protected static java.lang.String |
tabSetBasePath
|
protected java.lang.String |
tabSetName
|
protected javax.swing.JEditorPane |
textPane
|
protected javax.swing.JScrollPane |
textScroller
|
protected java.lang.String |
title
|
protected Launcher.LinkEdit |
undoEdit
|
protected javax.swing.undo.UndoManager |
undoManager
|
protected javax.swing.undo.UndoableEditSupport |
undoSupport
|
protected static java.lang.String |
version
|
protected static javax.swing.Icon |
whiteFileIcon
|
protected static javax.swing.Icon |
whiteFolderIcon
|
protected static int |
wInit
|
protected static javax.swing.filechooser.FileFilter |
xmlFileFilter
|
protected static javax.swing.filechooser.FileFilter |
xsetFileFilter
|
protected static javax.swing.Icon |
yellowFileIcon
|
protected static javax.swing.Icon |
yellowFolderIcon
|
Constructor Summary | |
Launcher()
Constructs a bare Launcher with a splash screen. |
|
Launcher(boolean splash)
Constructs a bare Launcher with or without a splash screen. |
|
Launcher(java.lang.String fileName)
Constructs a Launcher and opens the specified xml file. |
|
Launcher(java.lang.String fileName,
boolean splash)
Constructs a Launcher and opens the specified xml file. |
Method Summary | |
protected boolean |
addTab(LaunchNode root)
Creates a LaunchPanel with the specified root and adds it to a new tab. |
protected void |
createGUI(boolean splash)
Creates the GUI. |
protected void |
exit()
Exits this application. |
protected LaunchClassChooser |
getClassChooser()
Gets a class chooser for selecting launchable classes from jar files. |
java.awt.Container |
getContentPane()
Gets the content pane. |
protected static java.lang.String |
getDefaultJar()
Gets the name of the jar containing the default launcher xml file, if any. |
protected static java.lang.String |
getDisplayName(java.lang.String fileName)
Gets the display name of the specified file name. |
int |
getDivider()
Gets the divider location. |
protected javax.swing.Icon |
getFileIcon(LaunchNode node)
Gets an appropriate File icon for a node (must have non-null filename) |
protected java.util.Set |
getOpenPaths()
Gets the paths of currently open set and tabs. |
LaunchNode |
getRootNode()
Gets the root node of the selected launch tree. |
LaunchNode |
getSelectedNode()
Gets the selected launch node. |
LaunchPanel |
getSelectedTab()
Gets the LaunchPanel in the selected tab. |
java.awt.Dimension |
getSize()
Gets the size. |
LaunchPanel |
getTab(int i)
Gets the launch tree at the specified tab index. |
protected static javax.swing.JFileChooser |
getXMLChooser()
Gets a file chooser for selecting xml files. |
protected void |
handleMousePressed(java.awt.event.MouseEvent e,
LaunchPanel tab)
Handles a mouse pressed event. |
protected static boolean |
isLaunchable(java.lang.Class type)
Determines whether the specified class is launchable. |
protected boolean |
isLaunchable(LaunchNode node)
Determines whether the specified node is launchable. |
protected boolean |
isLink(LaunchNode node)
Determines whether the specified node is a link to another xset, tab or node. |
boolean |
isVisible()
Reports visibility of the Launcher frame. |
static void |
launch(java.lang.Class type)
Launches an application with no arguments. |
static void |
launch(java.lang.Class type,
java.lang.String[] args)
Launches an application with an array of string arguments. |
static void |
launch(java.lang.Class type,
java.lang.String[] args,
LaunchNode node)
Launches an application asociated with a launch node. |
static void |
main(java.lang.String[] args)
Main entry point when used as application. |
protected java.lang.String |
open()
Opens an xml file selected with a chooser. |
java.lang.String |
open(java.lang.String name)
Opens an xml document specified by name and displays it in a new tab (or selects the tab if already open). |
java.lang.String |
open(java.lang.String[] args)
Opens an xml document and selects a tab and/or node specified by name. |
protected void |
refreshGUI()
Refreshes the GUI. |
protected void |
refreshStringResources()
Refreshes string resources. |
protected boolean |
removeAllTabs()
Removes all tabs. |
protected boolean |
removeSelectedTab()
Removes the selected tab. |
void |
setDivider(int loc)
Sets the divider location. |
protected void |
setFontLevel(int level)
Sets the font level. |
protected void |
setLookAndFeel(boolean defaultLF)
Sets the look and feel. |
LaunchNode |
setSelectedNode(java.lang.String path)
Sets the selected node by path and returns the node, or null if node not found. |
LaunchPanel |
setSelectedTab(java.lang.String path)
Sets the selected tab by name and returns its LaunchPanel, or null if tab not found. |
void |
setSize(java.awt.Dimension dim)
Sets the size. |
void |
setSize(int width,
int height)
Sets the size. |
void |
setVisible(boolean visible)
Sets the visibility of the Launcher frame. |
protected void |
showAboutDialog()
Shows the about dialog. |
protected void |
showButtonView(LaunchNode node)
Displays a button view of the specified node. |
protected void |
showTabbedPaneView()
Displays the standard tabbed pane view. |
protected boolean |
terminateApps()
Terminates running apps. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static java.lang.String defaultFileName
protected static java.lang.String resourcesPath
protected static java.lang.String classPath
protected static java.lang.String tabSetBasePath
protected static java.lang.String version
protected static java.lang.String releaseDate
protected static javax.swing.JFileChooser chooser
protected static javax.swing.filechooser.FileFilter xmlFileFilter
protected static javax.swing.filechooser.FileFilter xsetFileFilter
protected static javax.swing.filechooser.FileFilter launcherFileFilter
protected static int wInit
protected static int hInit
protected static javax.swing.JDialog splashDialog
protected static javax.swing.JLabel splashTitleLabel
protected static javax.swing.JLabel splashPathLabel
protected static javax.swing.Timer splashTimer
protected static boolean isWebStart
protected static float baseMenuFontSize
protected static javax.swing.Icon launchIcon
protected static javax.swing.Icon launchedIcon
protected static javax.swing.Icon singletonIcon
protected static javax.swing.Icon whiteFolderIcon
protected static javax.swing.Icon redFileIcon
protected static javax.swing.Icon greenFileIcon
protected static javax.swing.Icon magentaFileIcon
protected static javax.swing.Icon yellowFileIcon
protected static javax.swing.Icon whiteFileIcon
protected static javax.swing.Icon noFileIcon
protected static javax.swing.Icon ghostFileIcon
protected static javax.swing.Icon redFolderIcon
protected static javax.swing.Icon greenFolderIcon
protected static javax.swing.Icon yellowFolderIcon
protected static javax.swing.Icon linkIcon
protected static javax.swing.Icon htmlIcon
protected static javax.swing.Icon launchEmptyIcon
public static boolean singleAppMode
public static boolean singletonMode
protected static javax.swing.Timer frameFinder
protected static java.util.ArrayList existingFrames
public static LaunchNode activeNode
protected javax.swing.JDialog inspector
protected int divider
public javax.swing.JFrame frame
protected javax.swing.JPanel contentPane
protected javax.swing.JTabbedPane tabbedPane
protected javax.swing.JMenuItem singleAppItem
protected LaunchNode selectedNode
protected LaunchNode previousNode
protected java.lang.String tabSetName
protected javax.swing.JEditorPane textPane
protected javax.swing.JScrollPane textScroller
protected boolean showText
protected javax.swing.JMenu fileMenu
protected javax.swing.JMenu displayMenu
protected javax.swing.JMenu helpMenu
protected javax.swing.JMenuItem openItem
protected javax.swing.JMenu openFromJarMenu
protected javax.swing.JMenuItem closeTabItem
protected javax.swing.JMenuItem closeAllItem
protected javax.swing.JMenuItem editItem
protected javax.swing.JMenuItem exitItem
protected javax.swing.JMenuItem inspectItem
protected javax.swing.JMenuItem hideItem
protected javax.swing.JMenuItem backItem
protected javax.swing.JMenu languageMenu
protected javax.swing.JMenuItem sizeUpItem
protected javax.swing.JMenuItem sizeDownItem
protected javax.swing.JMenuItem lookFeelItem
protected javax.swing.JMenuItem logItem
protected javax.swing.JMenuItem aboutItem
protected javax.swing.JMenu diagnosticMenu
protected javax.swing.JMenuItem[] languageItems
protected LaunchClassChooser classChooser
protected javax.swing.JPopupMenu popup
protected java.util.Set openPaths
protected Launcher spawner
protected boolean previewing
protected boolean editorEnabled
protected java.util.Set changedFiles
protected java.awt.event.MouseListener tabListener
protected boolean newNodeSelected
protected boolean selfContained
protected java.lang.String jarBasePath
protected java.lang.String title
protected java.util.ArrayList tabs
protected javax.swing.undo.UndoManager undoManager
protected javax.swing.undo.UndoableEditSupport undoSupport
protected java.lang.String password
protected boolean pwRequiredToLoad
protected Launcher.LinkEdit undoEdit
Constructor Detail |
public Launcher()
public Launcher(boolean splash)
splash
- true to show the splash screenpublic Launcher(java.lang.String fileName)
fileName
- the name of the xml filepublic Launcher(java.lang.String fileName, boolean splash)
fileName
- the name of the xml filesplash
- true to show the splash screenMethod Detail |
public java.awt.Dimension getSize()
public void setSize(java.awt.Dimension dim)
dim
- the size Dimensionpublic void setSize(int width, int height)
width
- the widthheight
- the heightpublic int getDivider()
public void setDivider(int loc)
loc
- the divider locationpublic boolean isVisible()
public void setVisible(boolean visible)
visible
- true to show the framepublic LaunchPanel getSelectedTab()
public LaunchPanel setSelectedTab(java.lang.String path)
path
- a path that starts with the name of the tab's root node
public LaunchNode getSelectedNode()
public LaunchNode setSelectedNode(java.lang.String path)
path
- the path of the node
public LaunchNode getRootNode()
public LaunchPanel getTab(int i)
i
- the tab index
public java.awt.Container getContentPane()
public java.lang.String open(java.lang.String[] args)
args
- the arguments
public java.lang.String open(java.lang.String name)
name
- the name
protected boolean addTab(LaunchNode root)
root
- the root node
protected void showButtonView(LaunchNode node)
node
- the nodeprotected void showTabbedPaneView()
protected java.lang.String open()
protected boolean removeSelectedTab()
protected boolean removeAllTabs()
protected void refreshStringResources()
protected void refreshGUI()
protected void createGUI(boolean splash)
splash
- true to show the splash screenprotected void setFontLevel(int level)
level
- the levelprotected java.util.Set getOpenPaths()
protected void setLookAndFeel(boolean defaultLF)
defaultLF
- true to use default L&Fprotected void showAboutDialog()
protected boolean isLink(LaunchNode node)
node
- the launch node to verify
true
if the node is a linkprotected boolean isLaunchable(LaunchNode node)
node
- the launch node to verify
true
if the node is launchableprotected static boolean isLaunchable(java.lang.Class type)
type
- the launch class to verify
true
if the class is launchableprotected void handleMousePressed(java.awt.event.MouseEvent e, LaunchPanel tab)
e
- the mouse eventtab
- the launch panel receiving the eventprotected void exit()
protected boolean terminateApps()
protected javax.swing.Icon getFileIcon(LaunchNode node)
node
- the launch node
public static void launch(java.lang.Class type)
type
- the class to be launchedpublic static void launch(java.lang.Class type, java.lang.String[] args)
type
- the class to be launchedargs
- the String array of argumentspublic static void launch(java.lang.Class type, java.lang.String[] args, LaunchNode node)
type
- the class to be launchedargs
- the argument array (may be null)node
- the launch node (may be null)public static void main(java.lang.String[] args)
args
- args[0] may be an xml file nameprotected LaunchClassChooser getClassChooser()
protected static javax.swing.JFileChooser getXMLChooser()
protected static java.lang.String getDisplayName(java.lang.String fileName)
fileName
- the file name
protected static java.lang.String getDefaultJar()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |