Package org.opensourcephysics.tools
Class LaunchBuilder
java.lang.Object
org.opensourcephysics.tools.Launcher
org.opensourcephysics.tools.LaunchBuilder
This provides a GUI for building LaunchNode and LaunchSet xml files.
- Version:
- 1.2
- Author:
- Douglas Brown
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.opensourcephysics.tools.Launcher
Launcher.HTMLPane, Launcher.LauncherFrame, Launcher.LaunchSet
-
Field Summary
Fields inherited from class org.opensourcephysics.tools.Launcher
aboutItem, authorInfoItem, backButton, backDisabledIcon, backIcon, backItem, baseMenuFontSize, changedFiles, chooser, classChooser, classPath, closeAllItem, closeTabItem, contentPane, creditsLabel, defaultFileName, defaultIcon, defaultLFItem, diagnosticMenu, displayMenu, divider, editItem, editorEnabled, ejsIcon, existingFrames, exitItem, expansions, extractExtensions, fileMenu, forwardButton, forwardDisabledIcon, forwardIcon, frame, frameFinder, genericLFGroup, ghostFileIcon, greenFileIcon, greenFolderIcon, helpMenu, hideItem, hInit, htmlIcon, htmlTabList, inspectItem, jarBasePath, javaLFItem, languageItems, languageMenu, launchedIcon, launchEmptyIcon, launcherFileFilter, launchIcon, linkIcon, linkListener, logItem, lookAndFeel, lookFeelItem, lookFeelMenu, magentaFileIcon, mainLauncher, memoryButton, navbar, navbarAddOns, navButton, navClosedIcon, navigationVisible, navOpenIcon, navSpacer, newNodeSelected, noFileIcon, openFromJarMenu, openItem, openPaths, password, passwordItem, passwords, popup, popupEnabled, postEdits, previewing, previousNode, pwRequiredToLoad, redFileIcon, redFolderIcon, releaseDate, resourcesPath, saveState, selectedNode, selectedPath, selfContained, showText, singleAppItem, singleAppMode, singletonIcon, sizeDownItem, sizeUpItem, spawner, specificLFGroup, splashDialog, splashPathLabel, splashTimer, splashTitleLabel, systemLFItem, tabbedPane, tableInspector, tabListener, tabs, tabSetBasePath, tabSetName, textPane, textScroller, title, undoManager, undoSupport, whiteFileIcon, whiteFolderIcon, wInit, xmlFileFilter, xmlInspector, xsetFileFilter, xsetMemorySize, yellowFileIcon, yellowFolderIcon
-
Constructor Summary
ConstructorsConstructorDescriptionNo-arg constructor.LaunchBuilder
(boolean splash) Constructs a builder with or without a splash screen.LaunchBuilder
(String fileName) Constructs a builder and loads the specified file.LaunchBuilder
(String fileName, boolean splash) Constructs a builder and loads the specified file with or without splash. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChildToSelectedNode
(LaunchNode child) Adds a child node to the selected node.boolean
addTab
(LaunchNode root) Creates a LaunchPanel with the specified root and adds it to a new tab.protected void
Creates the actions.protected void
createGUI
(boolean splash) Creates the GUI.protected void
exit()
Overrides Launcher exit method.protected Map<LaunchPanel,
LaunchNode> getClones
(LaunchNode node) Returns clones containing a specified node in a tab-to-node map.protected static JFileChooser
Gets a file chooser.static JFileChooser
Gets a file chooser for selecting html files.static FileFilter
Gets a file filter for selecting HTML files.protected static JFileChooser
Gets a file chooser for selecting jar files.static JFileChooser
Gets a file chooser for selecting pdf files.static FileFilter
Gets a file filter for selecting PDF files.protected void
handleMousePressed
(MouseEvent e, LaunchPanel tab) Handles a mouse pressed event.protected boolean
isNodeWritable
(LaunchNode node) Returns true if node is writable.protected boolean
Returns true if tabset is writable.static void
Main entry point when used as application.protected void
move
(int newPos) Move selected tab up or down one position.protected void
refreshClones
(LaunchNode node) Replaces clones of a specified node with new clones.protected void
Refreshes the GUI.protected void
refreshNode
(LaunchNode node) Refreshes the specified node with data from the input fields.protected void
Refreshes the selected node.protected void
Refreshes string resources.protected boolean
Removes all tabs and closes the tabset.void
Removes the selected node.void
Removes the selected nodes.boolean
Removes the selected tab.protected void
replaceClones
(LaunchNode node, Map<LaunchPanel, LaunchNode> clones) Replaces nodes with clones of the specified node.save
(LaunchNode node, String fileName) Saves a node to the specified file.protected boolean
Offers to save all changes, if any.saveAs
(LaunchNode node) Saves a node to an xml file selected with a chooser.protected boolean
saveChanges
(LaunchPanel tab) Offers to save changes, if any, to the specified tab.protected boolean
saveOwnedNodes
(LaunchNode node) Saves the owned nodes of the specified node.boolean
saveTabs()
Saves tabs.Saves the current tabset.protected String
Saves a tabset to a file selected with a chooser.void
setFontLevel
(int level) Sets the font level.Methods inherited from class org.opensourcephysics.tools.Launcher
clearHistory, getClassChooser, getContentPane, getDefaultJar, getDisplayName, getDivider, getFileIcon, getHTMLTab, getHTMLTabCount, getModelPane, getNodeAndPage, getOpenPaths, getRootNode, getSelectedNode, getSelectedTab, getSize, getTab, getTabCount, getXMLChooser, getXMLFilter, handleHyperLink, hasEJSModel, isDisplayable, isLaunchable, isLaunchable, isLink, isModel, isVisible, launch, launch, launch, loadIcon, log, open, open, open, refreshMemoryButton, refreshSelectedTab, relaunch, setCanExit, setDivider, setEditorEnabled, setHyperlinksEnabled, setHyperlinksEnabled, setJarsOnly, setLinksEnabled, setLookAndFeel, setNavbarRightEndComponents, setNavigationVisible, setSelectedNode, setSelectedNode, setSelectedNode, setSelectedNodeByKey, setSelectedTab, setSelectedTab, setSize, setVisible, showAboutDialog, showAuthorInformation, showButtonView, showTabbedPaneView, terminateApps, urlExists
-
Constructor Details
-
LaunchBuilder
public LaunchBuilder()No-arg constructor. -
LaunchBuilder
Constructs a builder and loads the specified file.- Parameters:
fileName
- the file name
-
LaunchBuilder
public LaunchBuilder(boolean splash) Constructs a builder with or without a splash screen.- Parameters:
splash
- true to show the splash screen
-
LaunchBuilder
Constructs a builder and loads the specified file with or without splash.- Parameters:
fileName
- the file namesplash
- true to show the splash screen
-
-
Method Details
-
main
Main entry point when used as application.- Parameters:
args
- args[0] may be an xml file name
-
save
Saves a node to the specified file.- Parameters:
node
- the nodefileName
- the desired name of the file- Returns:
- the name of the saved file, or null if not saved
-
saveAs
Saves a node to an xml file selected with a chooser.- Parameters:
node
- the node- Returns:
- the name of the file
-
saveOwnedNodes
Saves the owned nodes of the specified node.- Parameters:
node
- the node- Returns:
- true unless cancelled by user
-
saveTabSetAs
Saves a tabset to a file selected with a chooser.- Returns:
- the absolute path of the tabset file
-
saveTabSet
Saves the current tabset.- Returns:
- the full path to the saved file, or null if not saved
-
saveTabs
public boolean saveTabs()Saves tabs.- Returns:
- true unless cancelled by user
-
refreshSelectedNode
protected void refreshSelectedNode()Refreshes the selected node. -
refreshNode
Refreshes the specified node with data from the input fields.- Parameters:
node
- the node to refresh
-
addTab
Creates a LaunchPanel with the specified root and adds it to a new tab. -
removeSelectedTab
public boolean removeSelectedTab()Removes the selected tab. Overrides Launcher method.- Overrides:
removeSelectedTab
in classLauncher
- Returns:
- true if the tab was removed
-
saveChanges
Offers to save changes, if any, to the specified tab.- Parameters:
tab
- the tab- Returns:
- true unless cancelled by user
-
removeAllTabs
protected boolean removeAllTabs()Removes all tabs and closes the tabset.- Overrides:
removeAllTabs
in classLauncher
- Returns:
- true if all tabs were removed
-
saveAllChanges
protected boolean saveAllChanges()Offers to save all changes, if any.- Returns:
- true unless cancelled by user
-
refreshStringResources
protected void refreshStringResources()Refreshes string resources.- Overrides:
refreshStringResources
in classLauncher
-
refreshGUI
protected void refreshGUI()Refreshes the GUI.- Overrides:
refreshGUI
in classLauncher
-
createGUI
protected void createGUI(boolean splash) Creates the GUI. -
move
protected void move(int newPos) Move selected tab up or down one position.- Parameters:
newPos
-
-
setFontLevel
public void setFontLevel(int level) Sets the font level.- Overrides:
setFontLevel
in classLauncher
- Parameters:
level
- the level
-
createActions
protected void createActions()Creates the actions. -
removeSelectedNode
public void removeSelectedNode()Removes the selected node. -
removeSelectedNodes
public void removeSelectedNodes()Removes the selected nodes. -
addChildToSelectedNode
Adds a child node to the selected node.- Parameters:
child
- the child node to add
-
refreshClones
Replaces clones of a specified node with new clones.- Parameters:
node
- the current version of the node to clone
-
replaceClones
Replaces nodes with clones of the specified node.- Parameters:
node
- the current version of the node to cloneclones
- the current clones to replace
-
getClones
Returns clones containing a specified node in a tab-to-node map.- Parameters:
node
- the node- Returns:
- the tab-to-node map
-
getJARChooser
Gets a file chooser for selecting jar files.- Returns:
- the jar chooser
-
getHTMLChooser
Gets a file chooser for selecting html files.- Returns:
- the html chooser
-
getPDFChooser
Gets a file chooser for selecting pdf files.- Returns:
- the pdf chooser
-
getFileChooser
Gets a file chooser.- Returns:
- the file chooser
-
getHTMLFilter
Gets a file filter for selecting HTML files.- Returns:
- the html file filter
-
getPDFFilter
Gets a file filter for selecting PDF files.- Returns:
- the pdf file filter
-
handleMousePressed
Handles a mouse pressed event.- Overrides:
handleMousePressed
in classLauncher
- Parameters:
e
- the mouse eventtab
- the launch panel triggering the event
-
exit
protected void exit()Overrides Launcher exit method. -
isTabSetWritable
protected boolean isTabSetWritable()Returns true if tabset is writable.- Returns:
- true if writable
-
isNodeWritable
Returns true if node is writable.- Parameters:
node
- the node- Returns:
- true if writable
-