org.opensourcephysics.tools
Class Launcher

java.lang.Object
  extended by org.opensourcephysics.tools.Launcher
Direct Known Subclasses:
LaunchBuilder

public class Launcher
extends java.lang.Object

This provides a GUI for launching osp applications and xml files.

Author:
Douglas Brown

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

defaultIcon

protected static final javax.swing.Icon defaultIcon

defaultFileName

protected static java.lang.String defaultFileName

resourcesPath

protected static java.lang.String resourcesPath

classPath

protected static java.lang.String classPath

tabSetBasePath

protected static java.lang.String tabSetBasePath

version

protected static java.lang.String version

releaseDate

protected static java.lang.String releaseDate

chooser

protected static javax.swing.JFileChooser chooser

xmlFileFilter

protected static javax.swing.filechooser.FileFilter xmlFileFilter

xsetFileFilter

protected static javax.swing.filechooser.FileFilter xsetFileFilter

launcherFileFilter

protected static javax.swing.filechooser.FileFilter launcherFileFilter

wInit

protected static int wInit

hInit

protected static int hInit

splashDialog

protected static javax.swing.JDialog splashDialog

creditsLabel

protected static javax.swing.JLabel creditsLabel

splashTitleLabel

protected static javax.swing.JLabel splashTitleLabel

splashPathLabel

protected static javax.swing.JLabel splashPathLabel

splashTimer

protected static javax.swing.Timer splashTimer

baseMenuFontSize

protected static float baseMenuFontSize

launchIcon

protected static javax.swing.Icon launchIcon

launchedIcon

protected static javax.swing.Icon launchedIcon

singletonIcon

protected static javax.swing.Icon singletonIcon

whiteFolderIcon

protected static javax.swing.Icon whiteFolderIcon

redFileIcon

protected static javax.swing.Icon redFileIcon

greenFileIcon

protected static javax.swing.Icon greenFileIcon

magentaFileIcon

protected static javax.swing.Icon magentaFileIcon

yellowFileIcon

protected static javax.swing.Icon yellowFileIcon

whiteFileIcon

protected static javax.swing.Icon whiteFileIcon

noFileIcon

protected static javax.swing.Icon noFileIcon

ghostFileIcon

protected static javax.swing.Icon ghostFileIcon

redFolderIcon

protected static javax.swing.Icon redFolderIcon

greenFolderIcon

protected static javax.swing.Icon greenFolderIcon

yellowFolderIcon

protected static javax.swing.Icon yellowFolderIcon

linkIcon

protected static javax.swing.Icon linkIcon

htmlIcon

protected static javax.swing.Icon htmlIcon

launchEmptyIcon

protected static javax.swing.Icon launchEmptyIcon

ejsIcon

protected static javax.swing.Icon ejsIcon

singleAppMode

public static boolean singleAppMode

singletonMode

public static boolean singletonMode

frameFinder

protected static javax.swing.Timer frameFinder

existingFrames

protected static java.util.ArrayList<java.awt.Frame> existingFrames

extractExtensions

protected static java.lang.String[] extractExtensions

activeNode

public static LaunchNode activeNode

xmlInspector

protected javax.swing.JDialog xmlInspector

tableInspector

protected javax.swing.JDialog tableInspector

divider

protected int divider

frame

public javax.swing.JFrame frame

contentPane

protected javax.swing.JPanel contentPane

tabbedPane

protected javax.swing.JTabbedPane tabbedPane

postEdits

protected boolean postEdits

navigationVisible

protected boolean navigationVisible

navbar

protected javax.swing.JToolBar navbar

navOpenIcon

protected javax.swing.Icon navOpenIcon

navClosedIcon

protected javax.swing.Icon navClosedIcon

navButton

protected javax.swing.JButton navButton

backButton

protected javax.swing.JButton backButton

forwardButton

protected javax.swing.JButton forwardButton

navSpacer

protected java.awt.Component navSpacer

navbarAddOns

protected java.awt.Component[] navbarAddOns

singleAppItem

protected javax.swing.JMenuItem singleAppItem

selectedNode

protected LaunchNode selectedNode

previousNode

protected LaunchNode previousNode

tabSetName

protected java.lang.String tabSetName

textPane

protected javax.swing.JTextPane textPane

textScroller

protected javax.swing.JScrollPane textScroller

showText

protected boolean showText

htmlTabList

protected java.util.ArrayList<Launcher.HTMLPane> htmlTabList

fileMenu

protected javax.swing.JMenu fileMenu

displayMenu

protected javax.swing.JMenu displayMenu

helpMenu

protected javax.swing.JMenu helpMenu

openItem

protected javax.swing.JMenuItem openItem

openFromJarMenu

protected javax.swing.JMenu openFromJarMenu

closeTabItem

protected javax.swing.JMenuItem closeTabItem

closeAllItem

protected javax.swing.JMenuItem closeAllItem

editItem

protected javax.swing.JMenuItem editItem

exitItem

protected javax.swing.JMenuItem exitItem

inspectItem

protected javax.swing.JMenuItem inspectItem

hideItem

protected javax.swing.JMenuItem hideItem

backItem

protected javax.swing.JMenuItem backItem

languageMenu

protected javax.swing.JMenu languageMenu

sizeUpItem

protected javax.swing.JMenuItem sizeUpItem

sizeDownItem

protected javax.swing.JMenuItem sizeDownItem

lookFeelMenu

protected javax.swing.JMenu lookFeelMenu

specificLFGroup

protected javax.swing.ButtonGroup specificLFGroup

genericLFGroup

protected javax.swing.ButtonGroup genericLFGroup

javaLFItem

protected javax.swing.JMenuItem javaLFItem

systemLFItem

protected javax.swing.JMenuItem systemLFItem

defaultLFItem

protected javax.swing.JMenuItem defaultLFItem

lookFeelItem

protected javax.swing.JMenuItem lookFeelItem

logItem

protected javax.swing.JMenuItem logItem

aboutItem

protected javax.swing.JMenuItem aboutItem

authorInfoItem

protected javax.swing.JMenuItem authorInfoItem

diagnosticMenu

protected javax.swing.JMenu diagnosticMenu

languageItems

protected javax.swing.JMenuItem[] languageItems

classChooser

protected LaunchClassChooser classChooser

popup

protected javax.swing.JPopupMenu popup

openPaths

protected java.util.Set<java.lang.String> openPaths

spawner

protected Launcher spawner

previewing

protected boolean previewing

editorEnabled

protected boolean editorEnabled

changedFiles

protected java.util.Set<java.lang.String> changedFiles

tabListener

protected java.awt.event.MouseListener tabListener

newNodeSelected

protected boolean newNodeSelected

selfContained

protected boolean selfContained

jarBasePath

protected java.lang.String jarBasePath

title

protected java.lang.String title

tabs

protected java.util.ArrayList<java.awt.Component> tabs

undoManager

protected LauncherUndo undoManager

undoSupport

protected javax.swing.undo.UndoableEditSupport undoSupport

password

protected java.lang.String password

pwRequiredToLoad

protected boolean pwRequiredToLoad

linkListener

protected javax.swing.event.HyperlinkListener linkListener

saveState

protected boolean saveState

lookAndFeel

protected java.lang.String lookAndFeel
Constructor Detail

Launcher

public Launcher()
Constructs a bare Launcher with a splash screen.


Launcher

public Launcher(boolean splash)
Constructs a bare Launcher with or without a splash screen.

Parameters:
splash - true to show the splash screen

Launcher

public Launcher(java.lang.String fileName)
Constructs a Launcher and opens the specified xml file.

Parameters:
fileName - the name of the xml file

Launcher

public Launcher(java.lang.String fileName,
                boolean splash)
Constructs a Launcher and opens the specified xml file.

Parameters:
fileName - the name of the xml file
splash - true to show the splash screen
Method Detail

getContentPane

public java.awt.Container getContentPane()
Gets the content pane.

Returns:
the content pane

getSize

public java.awt.Dimension getSize()
Gets the size.

Returns:
the size Dimension object

setSize

public void setSize(java.awt.Dimension dim)
Sets the size.

Parameters:
dim - the size Dimension

getDivider

public int getDivider()
Gets the divider location.

Returns:
the divider location

setDivider

public void setDivider(int loc)
Sets the divider location.

Parameters:
loc - the divider location

isVisible

public boolean isVisible()
Reports visibility of the Launcher frame.

Returns:
true if visible

setVisible

public void setVisible(boolean visible)
Sets the visibility of the Launcher frame.

Parameters:
visible - true to show the frame

setNavigationVisible

public void setNavigationVisible(boolean vis)
Sets navigation button visibility

Parameters:
vis - true to show navigation buttons

clearHistory

public void clearHistory()
Clears the navigation history.


setEditorEnabled

public void setEditorEnabled(boolean enabled)
Sets the editorEnabled property.

Parameters:
enabled - true to enable editing from within Launcher

setHyperlinksEnabled

public void setHyperlinksEnabled(boolean enabled)
Sets the hyperlinksEnabled property for all nodes.

Parameters:
enabled - true to enable hyperlinks in html pages

setHyperlinksEnabled

public void setHyperlinksEnabled(LaunchNode node,
                                 boolean enabled)
Sets the hyperlinksEnabled property for a specified node.

Parameters:
enabled - true to enable hyperlinks in node's html pages

getSelectedTab

public LaunchPanel getSelectedTab()
Gets the LaunchPanel in the selected tab. May return null.

Returns:
the LaunchPanel

setSelectedTab

public LaunchPanel setSelectedTab(java.lang.String path)
Sets the selected tab by name and returns its LaunchPanel, or null if tab not found.

Parameters:
path - a path that starts with the name of the tab's root node
Returns:
the LaunchPanel containing the root

setSelectedTab

public LaunchPanel setSelectedTab(LaunchPanel tab)
Sets the selected tab and returns its LaunchPanel, or null if tab not found.

Parameters:
tab - the tab to select
Returns:
the LaunchPanel containing the root

getSelectedNode

public LaunchNode getSelectedNode()
Gets the selected launch node. May return null.

Returns:
the selected launch node

setSelectedNode

public LaunchNode setSelectedNode(java.lang.String path)
Sets the selected node by path and returns the node, or null if node not found. Path is node names separated by / or \

Parameters:
path - the path of the node
Returns:
the LaunchNode

setSelectedNode

public LaunchNode setSelectedNode(java.lang.String path,
                                  int pageNumber)
Sets the selected node by path and returns the node, or null if node not found. Path is node names separated by / or \

Parameters:
path - the path of the node
pageNumber - the html page number
Returns:
the LaunchNode

setSelectedNode

public 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. Path is node names separated by / or \

Parameters:
path - the path of the node
pageNumber - the html page number
Returns:
the LaunchNode

setSelectedNodeByKey

public LaunchNode setSelectedNodeByKey(java.lang.String keywords,
                                       int pageNumber)
Sets the selected node by path and returns the node, or null if node not found. Path is node names separated by / or \

Parameters:
keywords - the keywords of the node
pageNumber - the html page to dosplay
Returns:
the LaunchNode

getRootNode

public LaunchNode getRootNode()
Gets the root node of the selected launch tree. May return null.

Returns:
the root node

getTabCount

public int getTabCount()
Gets the current number of tabs (LaunchPanels)

Returns:
the tab count

getTab

public LaunchPanel getTab(int i)
Gets the launch panel at the specified tab index. May return null.

Parameters:
i - the tab index
Returns:
the launch panel

getHTMLTab

public Launcher.HTMLPane getHTMLTab(int i)
Gets the html tab at the specified index.

Parameters:
i - the tab index
Returns:
the html tab

open

public java.lang.String open(java.lang.String[] args)
Opens an xml document and selects a tab and/or node specified by name. args[0] may be a relative path, absolute path, or self-contained xml string. args[1] may be a tab name and/or node path.

Parameters:
args - the arguments
Returns:
the absolute path, or null if failed or currently open

open

public 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). Name may be a relative path, absolute path, or self-contained xml string.

Parameters:
name - the name
Returns:
the absolute path, or null if failed or currently open

setNavbarRightEndComponents

public void setNavbarRightEndComponents(java.awt.Component[] comps)
Sets the components to be displayed at the right end of the navigation bar.

Parameters:
comps - the components

addTab

protected boolean addTab(LaunchNode root)
Creates a LaunchPanel with the specified root and adds it to a new tab.

Parameters:
root - the root node
Returns:
true if tab was added

showButtonView

protected void showButtonView(LaunchNode node)
Displays a button view of the specified node.

Parameters:
node - the node

showTabbedPaneView

protected void showTabbedPaneView()
Displays the standard tabbed pane view.


open

protected java.lang.String open()
Opens an xml file selected with a chooser.

Returns:
the name of the opened file

removeSelectedTab

protected boolean removeSelectedTab()
Removes the selected tab.

Returns:
true if the tab was removed

removeAllTabs

protected boolean removeAllTabs()
Removes all tabs.

Returns:
true if all tabs were removed

refreshStringResources

protected void refreshStringResources()
Refreshes string resources.


refreshGUI

protected void refreshGUI()
Refreshes the GUI.


createGUI

protected void createGUI(boolean splash)
Creates the GUI.

Parameters:
splash - true to show the splash screen

setFontLevel

protected void setFontLevel(int level)
Sets the font level.

Parameters:
level - the level

getOpenPaths

protected java.util.Set<java.lang.String> getOpenPaths()
Gets the paths of currently open set and tabs.

Returns:
the open paths

setLookAndFeel

protected Launcher setLookAndFeel(java.lang.String lf,
                                  boolean always)
Sets the look and feel.

Parameters:
lf - OSPRuntime name of look and feel
always - true to set LnF even if already set

showAboutDialog

protected void showAboutDialog()
Shows the about dialog.


showAuthorInformation

protected void showAuthorInformation()
Shows the metadata dialog.


isLink

protected boolean isLink(LaunchNode node)
Determines whether the specified node is a link to another xset, tab or node. To be a link, there must be no launch class but one or more arguments.

Parameters:
node - the launch node to verify
Returns:
true if the node is a link

hasEJSModel

protected boolean hasEJSModel(LaunchNode node)
Determines whether the specified node has an associated EJS model (xml file).

Parameters:
node - the launch node to check
Returns:
true if the node has an EJS model

isLaunchable

protected boolean isLaunchable(LaunchNode node)
Determines whether the specified node is launchable.

Parameters:
node - the launch node to verify
Returns:
true if the node is launchable

setLinksEnabled

protected void setLinksEnabled(javax.swing.JEditorPane textPane,
                               boolean enabled)
Enables hyperlinks for the specified JEditorPane.

Parameters:
textPane - the editor pane
enabled - true to enable hyperlinks

getNodeAndPage

protected java.lang.Object[] getNodeAndPage(java.net.URL html)
Gets the node path and page number associated with an html URL. May return null.

Parameters:
html - the URL
Returns:
[0] String node path, [1] Integer pageNumber

isLaunchable

protected static boolean isLaunchable(java.lang.Class<?> type)
Determines whether the specified class is launchable.

Parameters:
type - the launch class to verify
Returns:
true if the class is launchable

handleMousePressed

protected void handleMousePressed(java.awt.event.MouseEvent e,
                                  LaunchPanel tab)
Handles a mouse pressed event.

Parameters:
e - the mouse event
tab - the launch panel receiving the event

exit

protected void exit()
Exits this application.


terminateApps

protected boolean terminateApps()
Terminates running apps.

Returns:
false if process is cancelled by the user

getFileIcon

protected javax.swing.Icon getFileIcon(LaunchNode node)
Gets an appropriate File icon for a node (must have non-null filename)

Parameters:
node - the launch node
Returns:
the icon

launch

public static void launch(java.lang.Class<?> type)
Launches an application with no arguments.

Parameters:
type - the class to be launched

launch

public static void launch(java.lang.Class<?> type,
                          java.lang.String[] args)
Launches an application with an array of string arguments.

Parameters:
type - the class to be launched
args - the String array of arguments

launch

public static void launch(java.lang.Class<?> type,
                          java.lang.String[] args,
                          LaunchNode node)
Launches an application asSociated with a launch node.

Parameters:
type - the class to be launched
args - the argument array (may be null)
node - the launch node (may be null)

setJarsOnly

public static void setJarsOnly(boolean onlyJars)
Sets the static jarsOnly property.

Parameters:
onlyJars - true to restrict class paths to jar files

main

public static void main(java.lang.String[] args)
Main entry point when used as application.

Parameters:
args - args[0] may be an xml file name

getClassChooser

protected LaunchClassChooser getClassChooser()
Gets a class chooser for selecting launchable classes from jar files.

Returns:
the jar class chooser

getXMLChooser

protected static javax.swing.JFileChooser getXMLChooser()
Gets a file chooser for selecting xml files.

Returns:
the xml chooser

getDisplayName

protected static java.lang.String getDisplayName(java.lang.String fileName)
Gets the display name of the specified file name.

Parameters:
fileName - the file name
Returns:
the bare name without path or extension

getDefaultJar

protected static java.lang.String getDefaultJar()
Gets the name of the jar containing the default launcher xml file, if any.

Returns:
the jar name

loadIcon

protected static javax.swing.Icon loadIcon(java.lang.String path)
Loads an icon and substitutes default icon if not found.

Parameters:
path - the path to the icon image
Returns:
the icon