| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opensourcephysics.tools.Launcher
public class Launcher
This provides a GUI for launching osp applications and xml files.
| Nested Class Summary | |
|---|---|
 class | 
Launcher.HTMLPane
A class for displaying html pages in a scrolled textPane.  | 
 class | 
Launcher.LaunchSet
A class to save and load a set of launch tabs and Launcher static fields.  | 
| Field Summary | |
|---|---|
protected  javax.swing.JMenuItem | 
aboutItem
 | 
static LaunchNode | 
activeNode
 | 
protected  javax.swing.JMenuItem | 
authorInfoItem
 | 
protected  javax.swing.JButton | 
backButton
 | 
protected  javax.swing.JMenuItem | 
backItem
 | 
protected static float | 
baseMenuFontSize
 | 
protected  java.util.Set<java.lang.String> | 
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 javax.swing.JLabel | 
creditsLabel
 | 
protected static java.lang.String | 
defaultFileName
 | 
protected static javax.swing.Icon | 
defaultIcon
 | 
protected  javax.swing.JMenuItem | 
defaultLFItem
 | 
protected  javax.swing.JMenu | 
diagnosticMenu
 | 
protected  javax.swing.JMenu | 
displayMenu
 | 
protected  int | 
divider
 | 
protected  javax.swing.JMenuItem | 
editItem
 | 
protected  boolean | 
editorEnabled
 | 
protected static javax.swing.Icon | 
ejsIcon
 | 
protected static java.util.ArrayList<java.awt.Frame> | 
existingFrames
 | 
protected  javax.swing.JMenuItem | 
exitItem
 | 
protected static java.lang.String[] | 
extractExtensions
 | 
protected  javax.swing.JMenu | 
fileMenu
 | 
protected  javax.swing.JButton | 
forwardButton
 | 
 javax.swing.JFrame | 
frame
 | 
protected static javax.swing.Timer | 
frameFinder
 | 
protected  javax.swing.ButtonGroup | 
genericLFGroup
 | 
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  java.util.ArrayList<Launcher.HTMLPane> | 
htmlTabList
 | 
protected  javax.swing.JMenuItem | 
inspectItem
 | 
protected  java.lang.String | 
jarBasePath
 | 
protected  javax.swing.JMenuItem | 
javaLFItem
 | 
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.event.HyperlinkListener | 
linkListener
 | 
protected  javax.swing.JMenuItem | 
logItem
 | 
protected  java.lang.String | 
lookAndFeel
 | 
protected  javax.swing.JMenuItem | 
lookFeelItem
 | 
protected  javax.swing.JMenu | 
lookFeelMenu
 | 
protected static javax.swing.Icon | 
magentaFileIcon
 | 
protected  javax.swing.JToolBar | 
navbar
 | 
protected  java.awt.Component[] | 
navbarAddOns
 | 
protected  javax.swing.JButton | 
navButton
 | 
protected  javax.swing.Icon | 
navClosedIcon
 | 
protected  boolean | 
navigationVisible
 | 
protected  javax.swing.Icon | 
navOpenIcon
 | 
protected  java.awt.Component | 
navSpacer
 | 
protected  boolean | 
newNodeSelected
 | 
protected static javax.swing.Icon | 
noFileIcon
 | 
protected  javax.swing.JMenu | 
openFromJarMenu
 | 
protected  javax.swing.JMenuItem | 
openItem
 | 
protected  java.util.Set<java.lang.String> | 
openPaths
 | 
protected  java.lang.String | 
password
 | 
protected  javax.swing.JPopupMenu | 
popup
 | 
protected  boolean | 
postEdits
 | 
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  boolean | 
saveState
 | 
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  javax.swing.ButtonGroup | 
specificLFGroup
 | 
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.JMenuItem | 
systemLFItem
 | 
protected  javax.swing.JTabbedPane | 
tabbedPane
 | 
protected  javax.swing.JDialog | 
tableInspector
 | 
protected  java.awt.event.MouseListener | 
tabListener
 | 
protected  java.util.ArrayList<java.awt.Component> | 
tabs
 | 
protected static java.lang.String | 
tabSetBasePath
 | 
protected  java.lang.String | 
tabSetName
 | 
protected  javax.swing.JTextPane | 
textPane
 | 
protected  javax.swing.JScrollPane | 
textScroller
 | 
protected  java.lang.String | 
title
 | 
protected  LauncherUndo | 
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  javax.swing.JDialog | 
xmlInspector
 | 
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.  | 
 void | 
clearHistory()
Clears the navigation history.  | 
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)  | 
 Launcher.HTMLPane | 
getHTMLTab(int i)
Gets the html tab at the specified index.  | 
protected  java.lang.Object[] | 
getNodeAndPage(java.net.URL html)
Gets the node path and page number associated with an html URL.  | 
protected  java.util.Set<java.lang.String> | 
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 panel at the specified tab index.  | 
 int | 
getTabCount()
Gets the current number of tabs (LaunchPanels)  | 
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  boolean | 
hasEJSModel(LaunchNode node)
Determines whether the specified node has an associated EJS model (xml file).  | 
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 asSociated with a launch node.  | 
protected static javax.swing.Icon | 
loadIcon(java.lang.String path)
Loads an icon and substitutes default icon if not found.  | 
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.  | 
 void | 
setEditorEnabled(boolean enabled)
Sets the editorEnabled property.  | 
protected  void | 
setFontLevel(int level)
Sets the font level.  | 
 void | 
setHyperlinksEnabled(boolean enabled)
Sets the hyperlinksEnabled property for all nodes.  | 
 void | 
setHyperlinksEnabled(LaunchNode node,
                     boolean enabled)
Sets the hyperlinksEnabled property for a specified node.  | 
static void | 
setJarsOnly(boolean onlyJars)
Sets the static jarsOnly property.  | 
protected  void | 
setLinksEnabled(javax.swing.JEditorPane textPane,
                boolean enabled)
Enables hyperlinks for the specified JEditorPane.  | 
protected  Launcher | 
setLookAndFeel(java.lang.String lf,
               boolean always)
Sets the look and feel.  | 
 void | 
setNavbarRightEndComponents(java.awt.Component[] comps)
Sets the components to be displayed at the right end of the navigation bar.  | 
 void | 
setNavigationVisible(boolean vis)
Sets navigation button visibility  | 
 LaunchNode | 
setSelectedNode(java.lang.String path)
Sets the selected node by path and returns the node, or null if node not found.  | 
 LaunchNode | 
setSelectedNode(java.lang.String path,
                int pageNumber)
Sets the selected node by path and returns the node, or null if node not found.  | 
 LaunchNode | 
setSelectedNode(java.lang.String path,
                int pageNumber,
                java.net.URL url)
Sets the selected node by path and returns the node, or null if node not found.  | 
 LaunchNode | 
setSelectedNodeByKey(java.lang.String keywords,
                     int pageNumber)
Sets the selected node by path and returns the node, or null if node not found.  | 
 LaunchPanel | 
setSelectedTab(LaunchPanel tab)
Sets the selected tab and returns its LaunchPanel, or null if tab 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 | 
setVisible(boolean visible)
Sets the visibility of the Launcher frame.  | 
protected  void | 
showAboutDialog()
Shows the about dialog.  | 
protected  void | 
showAuthorInformation()
Shows the metadata 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 final javax.swing.Icon defaultIcon
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 creditsLabel
protected static javax.swing.JLabel splashTitleLabel
protected static javax.swing.JLabel splashPathLabel
protected static javax.swing.Timer splashTimer
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
protected static javax.swing.Icon ejsIcon
public static boolean singleAppMode
public static boolean singletonMode
protected static javax.swing.Timer frameFinder
protected static java.util.ArrayList<java.awt.Frame> existingFrames
protected static java.lang.String[] extractExtensions
public static LaunchNode activeNode
protected javax.swing.JDialog xmlInspector
protected javax.swing.JDialog tableInspector
protected int divider
public javax.swing.JFrame frame
protected javax.swing.JPanel contentPane
protected javax.swing.JTabbedPane tabbedPane
protected boolean postEdits
protected boolean navigationVisible
protected javax.swing.JToolBar navbar
protected javax.swing.Icon navOpenIcon
protected javax.swing.Icon navClosedIcon
protected javax.swing.JButton navButton
protected javax.swing.JButton backButton
protected javax.swing.JButton forwardButton
protected java.awt.Component navSpacer
protected java.awt.Component[] navbarAddOns
protected javax.swing.JMenuItem singleAppItem
protected LaunchNode selectedNode
protected LaunchNode previousNode
protected java.lang.String tabSetName
protected javax.swing.JTextPane textPane
protected javax.swing.JScrollPane textScroller
protected boolean showText
protected java.util.ArrayList<Launcher.HTMLPane> htmlTabList
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.JMenu lookFeelMenu
protected javax.swing.ButtonGroup specificLFGroup
protected javax.swing.ButtonGroup genericLFGroup
protected javax.swing.JMenuItem javaLFItem
protected javax.swing.JMenuItem systemLFItem
protected javax.swing.JMenuItem defaultLFItem
protected javax.swing.JMenuItem lookFeelItem
protected javax.swing.JMenuItem logItem
protected javax.swing.JMenuItem aboutItem
protected javax.swing.JMenuItem authorInfoItem
protected javax.swing.JMenu diagnosticMenu
protected javax.swing.JMenuItem[] languageItems
protected LaunchClassChooser classChooser
protected javax.swing.JPopupMenu popup
protected java.util.Set<java.lang.String> openPaths
protected Launcher spawner
protected boolean previewing
protected boolean editorEnabled
protected java.util.Set<java.lang.String> 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<java.awt.Component> tabs
protected LauncherUndo undoManager
protected javax.swing.undo.UndoableEditSupport undoSupport
protected java.lang.String password
protected boolean pwRequiredToLoad
protected javax.swing.event.HyperlinkListener linkListener
protected boolean saveState
protected java.lang.String lookAndFeel
| 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 file
public Launcher(java.lang.String fileName,
                boolean splash)
fileName - the name of the xml filesplash - true to show the splash screen| Method Detail | 
|---|
public java.awt.Container getContentPane()
public java.awt.Dimension getSize()
public void setSize(java.awt.Dimension dim)
dim - the size Dimensionpublic int getDivider()
public void setDivider(int loc)
loc - the divider locationpublic boolean isVisible()
public void setVisible(boolean visible)
visible - true to show the framepublic void setNavigationVisible(boolean vis)
vis - true to show navigation buttonspublic void clearHistory()
public void setEditorEnabled(boolean enabled)
enabled - true to enable editing from within Launcherpublic void setHyperlinksEnabled(boolean enabled)
enabled - true to enable hyperlinks in html pages
public void setHyperlinksEnabled(LaunchNode node,
                                 boolean enabled)
enabled - true to enable hyperlinks in node's html pagespublic LaunchPanel getSelectedTab()
public LaunchPanel setSelectedTab(java.lang.String path)
path - a path that starts with the name of the tab's root node
public LaunchPanel setSelectedTab(LaunchPanel tab)
tab - the tab to select
public LaunchNode getSelectedNode()
public LaunchNode setSelectedNode(java.lang.String path)
path - the path of the node
public LaunchNode setSelectedNode(java.lang.String path,
                                  int pageNumber)
path - the path of the nodepageNumber - the html page number
public LaunchNode setSelectedNode(java.lang.String path,
                                  int pageNumber,
                                  java.net.URL url)
path - the path of the nodepageNumber - the html page number
public LaunchNode setSelectedNodeByKey(java.lang.String keywords,
                                       int pageNumber)
keywords - the keywords of the nodepageNumber - the html page to dosplay
public LaunchNode getRootNode()
public int getTabCount()
public LaunchPanel getTab(int i)
i - the tab index
public Launcher.HTMLPane getHTMLTab(int i)
i - the tab index
public java.lang.String open(java.lang.String[] args)
args - the arguments
public java.lang.String open(java.lang.String name)
name - the name
public void setNavbarRightEndComponents(java.awt.Component[] comps)
comps - the componentsprotected 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<java.lang.String> getOpenPaths()
protected Launcher setLookAndFeel(java.lang.String lf,
                                  boolean always)
lf - OSPRuntime name of look and feelalways - true to set LnF even if already setprotected void showAboutDialog()
protected void showAuthorInformation()
protected boolean isLink(LaunchNode node)
node - the launch node to verify
true if the node is a linkprotected boolean hasEJSModel(LaunchNode node)
node - the launch node to check
true if the node has an EJS modelprotected boolean isLaunchable(LaunchNode node)
node - the launch node to verify
true if the node is launchable
protected void setLinksEnabled(javax.swing.JEditorPane textPane,
                               boolean enabled)
textPane - the editor paneenabled - true to enable hyperlinksprotected java.lang.Object[] getNodeAndPage(java.net.URL html)
html - the URL
protected static boolean isLaunchable(java.lang.Class<?> type)
type - the launch class to verify
true if the class is launchable
protected 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 launched
public static void launch(java.lang.Class<?> type,
                          java.lang.String[] args)
type - the class to be launchedargs - the String array of arguments
public 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 setJarsOnly(boolean onlyJars)
onlyJars - true to restrict class paths to jar filespublic 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()
protected static javax.swing.Icon loadIcon(java.lang.String path)
path - the path to the icon image
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||