Class LaunchBuilder

java.lang.Object
org.opensourcephysics.tools.Launcher
org.opensourcephysics.tools.LaunchBuilder

public class LaunchBuilder extends Launcher
This provides a GUI for building LaunchNode and LaunchSet xml files.
Version:
1.2
Author:
Douglas Brown
  • Constructor Details

    • LaunchBuilder

      public LaunchBuilder()
      No-arg constructor.
    • LaunchBuilder

      public LaunchBuilder(String fileName)
      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

      public LaunchBuilder(String fileName, boolean splash)
      Constructs a builder and loads the specified file with or without splash.
      Parameters:
      fileName - the file name
      splash - true to show the splash screen
  • Method Details

    • main

      public static void main(String[] args)
      Main entry point when used as application.
      Parameters:
      args - args[0] may be an xml file name
    • save

      public String save(LaunchNode node, String fileName)
      Saves a node to the specified file.
      Parameters:
      node - the node
      fileName - the desired name of the file
      Returns:
      the name of the saved file, or null if not saved
    • saveAs

      public String saveAs(LaunchNode node)
      Saves a node to an xml file selected with a chooser.
      Parameters:
      node - the node
      Returns:
      the name of the file
    • saveOwnedNodes

      protected boolean saveOwnedNodes(LaunchNode node)
      Saves the owned nodes of the specified node.
      Parameters:
      node - the node
      Returns:
      true unless cancelled by user
    • saveTabSetAs

      protected String saveTabSetAs()
      Saves a tabset to a file selected with a chooser.
      Returns:
      the absolute path of the tabset file
    • saveTabSet

      public String 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

      protected void refreshNode(LaunchNode node)
      Refreshes the specified node with data from the input fields.
      Parameters:
      node - the node to refresh
    • addTab

      public boolean addTab(LaunchNode root)
      Creates a LaunchPanel with the specified root and adds it to a new tab.
      Overrides:
      addTab in class Launcher
      Parameters:
      root - the root node
      Returns:
      true if tab successfully added
    • removeSelectedTab

      public boolean removeSelectedTab()
      Removes the selected tab. Overrides Launcher method.
      Overrides:
      removeSelectedTab in class Launcher
      Returns:
      true if the tab was removed
    • saveChanges

      protected boolean saveChanges(LaunchPanel tab)
      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 class Launcher
      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 class Launcher
    • refreshGUI

      protected void refreshGUI()
      Refreshes the GUI.
      Overrides:
      refreshGUI in class Launcher
    • createGUI

      protected void createGUI(boolean splash)
      Creates the GUI.
      Overrides:
      createGUI in class Launcher
      Parameters:
      splash - true to show the splash screen
    • 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 class Launcher
      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

      public void addChildToSelectedNode(LaunchNode child)
      Adds a child node to the selected node.
      Parameters:
      child - the child node to add
    • refreshClones

      protected void refreshClones(LaunchNode node)
      Replaces clones of a specified node with new clones.
      Parameters:
      node - the current version of the node to clone
    • replaceClones

      protected void replaceClones(LaunchNode node, Map<LaunchPanel,LaunchNode> clones)
      Replaces nodes with clones of the specified node.
      Parameters:
      node - the current version of the node to clone
      clones - the current clones to replace
    • getClones

      protected Map<LaunchPanel,LaunchNode> getClones(LaunchNode node)
      Returns clones containing a specified node in a tab-to-node map.
      Parameters:
      node - the node
      Returns:
      the tab-to-node map
    • getJARChooser

      protected static JFileChooser getJARChooser()
      Gets a file chooser for selecting jar files.
      Returns:
      the jar chooser
    • getHTMLChooser

      public static JFileChooser getHTMLChooser()
      Gets a file chooser for selecting html files.
      Returns:
      the html chooser
    • getPDFChooser

      public static JFileChooser getPDFChooser()
      Gets a file chooser for selecting pdf files.
      Returns:
      the pdf chooser
    • getFileChooser

      protected static JFileChooser getFileChooser()
      Gets a file chooser.
      Returns:
      the file chooser
    • getHTMLFilter

      public static FileFilter getHTMLFilter()
      Gets a file filter for selecting HTML files.
      Returns:
      the html file filter
    • getPDFFilter

      public static FileFilter getPDFFilter()
      Gets a file filter for selecting PDF files.
      Returns:
      the pdf file filter
    • handleMousePressed

      protected void handleMousePressed(MouseEvent e, LaunchPanel tab)
      Handles a mouse pressed event.
      Overrides:
      handleMousePressed in class Launcher
      Parameters:
      e - the mouse event
      tab - the launch panel triggering the event
    • exit

      protected void exit()
      Overrides Launcher exit method.
      Overrides:
      exit in class Launcher
    • isTabSetWritable

      protected boolean isTabSetWritable()
      Returns true if tabset is writable.
      Returns:
      true if writable
    • isNodeWritable

      protected boolean isNodeWritable(LaunchNode node)
      Returns true if node is writable.
      Parameters:
      node - the node
      Returns:
      true if writable