Class VergilApplication
- java.lang.Object
-
- ptolemy.actor.gui.ConfigurationApplication
-
- ptolemy.actor.gui.MoMLApplication
-
- ptolemy.vergil.VergilApplication
-
- All Implemented Interfaces:
ExecutionListener
- Direct Known Subclasses:
AutomaticSimulation
public class VergilApplication extends MoMLApplication
An application for editing ptolemy models visually.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
-configuration configurationFile.xml
that names a configuration to be read. For example,$PTII/bin/vergil -configuration ptolemy/configs/ptiny/configuration.xml
and$PTII/bin/vergil -ptiny
are equivalentIf there are no command-line arguments at all, then the configuration file is augmented by the MoML file ptolemy/configs/full/welcomeWindow.xml
Note that if the configuration starts with "ptiny", then
RemoveNonPtinyClasses
is used to remove classes such as code generators that might be present in the model but are not part of the Ptiny configuration.- Since:
- Ptolemy II 1.0
- Version:
- $Id$
- Author:
- Edward A. Lee, Steve Neuendorffer, Christopher Hylands, contributor: Chad Berkeley
- See Also:
ModelFrame
,RunTableau
,PtExecuteApplication
- Pt.AcceptedRating:
- Red (eal)
- Pt.ProposedRating:
- Yellow (eal)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.actor.gui.ConfigurationApplication
ConfigurationApplication.IgnoreErrorHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String[][]
_commandOptions
The command-line options that take arguments.-
Fields inherited from class ptolemy.actor.gui.ConfigurationApplication
_basePath, _commandFlagsWithDescriptions, _commandTemplate, _configuration, _exit, _parser, _printPDF, _run, _run20x, _statistics, _test
-
-
Constructor Summary
Constructors Constructor Description 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
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected Configuration
_createDefaultConfiguration()
Return a default Configuration.protected Configuration
_createEmptyConfiguration()
Return a default Configuration to use when there are no command-line arguments.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
errorAndExit(java.lang.String message, java.lang.String[] args, java.lang.Throwable throwable)
Print out an error message and stack trace on stderr and then display a dialog box.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)
Deprecated.-
Methods inherited from class ptolemy.actor.gui.MoMLApplication
_initializeApplication
-
Methods inherited from class ptolemy.actor.gui.ConfigurationApplication
_configurationUsage, _configurationUsage, _openModel, _openModel, _parseArg, _printPDF, _readConfiguration, closeModelWithoutSavingOrExiting, configurationDirectories, configurationDirectoryFullOrFirst, executionError, executionFinished, getActiveCount, managerStateChanged, models, openModel, openModelOrEntity, readConfiguration, runModels, setActiveCount, specToURL, throwArgsException, waitForFinish
-
-
-
-
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 directoriesargs
- The command-line arguments.- Throws:
java.lang.Exception
- If command line arguments have problems.
-
-
Method Detail
-
errorAndExit
public static void errorAndExit(java.lang.String message, java.lang.String[] args, java.lang.Throwable throwable)
Print out an error message and stack trace on stderr and then display a dialog box. This method is used as a fail safe in case there are problems with the configuration We use a Throwable here instead of an Exception because we might get an Error or and Exception. For example, if we are using JNI, then we might get a java.lang.UnsatisfiedLinkError, which is an Error, not and Exception.- Parameters:
message
- The message to be displayedargs
- The arguments to be displayedthrowable
- The Throwable that caused the problem.
-
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
@Deprecated public static void openLibrary(Configuration configuration, java.io.File file) throws java.lang.Exception
Deprecated.Open the MoML file at the given location as a new library in the actor library for this application. An alternate class can be used to build the library if reading the MoML is not desired. The class must extend ptolemy.moml.LibraryBuilder and the _alternateLibraryBuilder property must be set with the 'value' set to the class that extends LibraryBuilder.- Parameters:
configuration
- The configuration where we look for the actor library.file
- The MoML file to open.- Throws:
java.lang.Exception
- If there is a problem opening the configuration, opening the MoML file, or opening the MoML file as a new library.
-
_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 byStringUtilities.preferencesDirectory()
If the configuration contains a top level Parameter named _hideUserLibrary, then we do not open the user library.- Overrides:
_createDefaultConfiguration
in classConfigurationApplication
- 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. If the configuration contains a parameter _applicationBlankPtolemyEffigyAtStartup then we create an empty up an empty PtolemyEffigy.- Overrides:
_createEmptyConfiguration
in classConfigurationApplication
- 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 classConfigurationApplication
- Parameters:
args
- The command-line arguments to be parsed.- 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 classConfigurationApplication
- Returns:
- A usage string.
-
-