ptolemy.vergil
Class VergilApplication

java.lang.Object
  extended byptolemy.actor.gui.MoMLApplication
      extended byptolemy.vergil.VergilApplication
Direct Known Subclasses:
SingleWindowApplication

public class VergilApplication
extends MoMLApplication

This application opens run control panels for models specified on the command line.

The exact facilities that are available are determined by an optional command line argument that names a directory in ptolemy/configs that contains a configuration.xml file. For example, if we call vergil -ptiny, then we will use ptolemy/configs/ptiny/configuration.xml and ptolemy/configs/ptiny/intro.htm. The default configuration is ptolemy/configs/full/configuration.xml, which is loaded before any other command-line arguments are processed.

This application also takes an optional command line argument pair -conf configurationFile.xml that names a configuration to be read. For example,

   $PTII/bin/vergil -conf ptolemy/configs/ptiny/configuration.xml
   
and
   $PTII/bin/vergil -ptiny
   
are equivalent

If there are no command-line arguments at all, then the configuration file is augmented by the MoML file ptolemy/configs/vergilWelcomeWindow.xml.

Since:
Ptolemy II 1.0
Version:
$Id: VergilApplication.java,v 1.118.2.1 2004/06/18 00:49:25 cxh Exp $
Author:
Edward A. Lee, Steve Neuendorffer, Christopher Hylands
See Also:
ModelFrame, RunTableau, PtExecuteApplication
Accepted Rating:
Red (eal)
Proposed Rating:
Yellow (eal)

Field Summary
protected static java.lang.String[][] _commandOptions
          The command-line options that take arguments.
 
Fields inherited from class ptolemy.actor.gui.MoMLApplication
_basePath, _commandFlags, _commandTemplate, _config, _parser, _test
 
Constructor Summary
VergilApplication(java.lang.String[] args)
          Parse the specified command-line arguments, creating models and frames to interact with them.
VergilApplication(java.lang.String basePath, java.lang.String[] args)
          Parse the specified command-line arguments, creating models and frames to interact with them.
 
Method Summary
protected  Configuration _createDefaultConfiguration()
          Return a default Configuration.
protected  Configuration _createEmptyConfiguration()
          Return a default Configuration to use when there are no command-line arguments, which in this case is given by the default configuration augmented by the MoML file _basePath/vergilWelcomeWindow.xml.
protected  void _parseArgs(java.lang.String[] args)
          Parse the command-line arguments.
protected  java.lang.String _usage()
          Return a string summarizing the command-line arguments.
static void main(java.lang.String[] args)
          Create a new instance of this application, passing it the command-line arguments.
static void openLibrary(Configuration configuration, java.io.File file)
          Open the MoML file at the given location as a new library in the actor library for this application.
 
Methods inherited from class ptolemy.actor.gui.MoMLApplication
_configurationUsage, _parseArg, _readConfiguration, specToURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_commandOptions

protected static java.lang.String[][] _commandOptions
The command-line options that take arguments.

Constructor Detail

VergilApplication

public VergilApplication(java.lang.String[] args)
                  throws java.lang.Exception
Parse the specified command-line arguments, creating models and frames to interact with them. Look for configurations in "ptolemy/configs"

Parameters:
args - The command-line arguments.
Throws:
java.lang.Exception - If command line arguments have problems.

VergilApplication

public VergilApplication(java.lang.String basePath,
                         java.lang.String[] args)
                  throws java.lang.Exception
Parse the specified command-line arguments, creating models and frames to interact with them.

Parameters:
basePath - The basePath to look for configurations in, usually "ptolemy/configs", but other tools might have other configurations in other directories
args - The command-line arguments.
Throws:
java.lang.Exception - If command line arguments have problems.
Method Detail

main

public static void main(java.lang.String[] args)
Create a new instance of this application, passing it the command-line arguments.

Parameters:
args - The command-line arguments.

openLibrary

public static void openLibrary(Configuration configuration,
                               java.io.File file)
                        throws java.lang.Exception
Open the MoML file at the given location as a new library in the actor library for this application.

Throws:
java.lang.Exception

_createDefaultConfiguration

protected Configuration _createDefaultConfiguration()
                                             throws java.lang.Exception
Return a default Configuration. The initial default configuration is the MoML file full/configuration.xml under the _basePath directory, which is usually ptolemy/configs. using different command line arguments can change the value Usually, we also open the user library, which is located in the directory returned by StringUtilities.preferencesDirectory() If the configuration contains a top level Parameter named _hideUserLibrary, then we do not open the user library.

Overrides:
_createDefaultConfiguration in class MoMLApplication
Returns:
A default configuration.
Throws:
java.lang.Exception - If the configuration cannot be opened.

_createEmptyConfiguration

protected Configuration _createEmptyConfiguration()
                                           throws java.lang.Exception
Return a default Configuration to use when there are no command-line arguments, which in this case is given by the default configuration augmented by the MoML file _basePath/vergilWelcomeWindow.xml.

Overrides:
_createEmptyConfiguration in class MoMLApplication
Returns:
A configuration for when there no command-line arguments.
Throws:
java.lang.Exception - If the configuration cannot be opened.

_parseArgs

protected void _parseArgs(java.lang.String[] args)
                   throws java.lang.Exception
Parse the command-line arguments.

Overrides:
_parseArgs in class MoMLApplication
Throws:
java.lang.Exception - If an argument is not understood or triggers an error.

_usage

protected java.lang.String _usage()
Return a string summarizing the command-line arguments.

Overrides:
_usage in class MoMLApplication
Returns:
A usage string.