org.opensourcephysics.tools
Class EjsTool

java.lang.Object
  extended by org.opensourcephysics.tools.EjsTool

public class EjsTool
extends java.lang.Object

Utility classes to work with Ejs at a high level

Version:
1.0
Author:
Francisco Esquembre (http://fem.um.es)

Field Summary
static java.lang.String GET_MODEL_METHOD
           
static java.lang.String GET_RESOURCES_METHOD
           
 
Constructor Summary
EjsTool()
           
 
Method Summary
static java.util.List<?> ejsConfirmList(java.awt.Component _target, java.awt.Dimension _size, java.lang.String _message, java.lang.String _title, java.util.List<?> _list)
           
static java.util.List<?> ejsConfirmList(java.awt.Component _target, java.awt.Dimension _size, java.lang.String _message, java.lang.String _title, java.util.List<?> _list, javax.swing.JComponent _bottomComponent)
          This method receives a list of objects which it exposes to the user.
static java.lang.String getPath(java.io.File _file)
          Gets the path of a file in standard form.
static java.lang.String getString(java.lang.String key)
           
static boolean hasEjsModel(java.lang.Class<?> _ejsClass)
          Whether a class provides an Ejs model.
static boolean runEjs(java.lang.Class<?> _ejsClass)
          Runs the Ejs model corresponding to the given class.
static void saveInformation(java.lang.String _home, java.lang.String _release)
          To be used by EJS version 3.47 and earlier only.
static void saveInformation(java.lang.String _binDirectoryPath, java.lang.String _sourceDirectoryPath, java.lang.String _release)
          To be used by EJS version 4.0 and later only.
static void setLocale(java.util.Locale locale)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GET_MODEL_METHOD

public static final java.lang.String GET_MODEL_METHOD
See Also:
Constant Field Values

GET_RESOURCES_METHOD

public static final java.lang.String GET_RESOURCES_METHOD
See Also:
Constant Field Values
Constructor Detail

EjsTool

public EjsTool()
Method Detail

setLocale

public static void setLocale(java.util.Locale locale)

getString

public static java.lang.String getString(java.lang.String key)

hasEjsModel

public static boolean hasEjsModel(java.lang.Class<?> _ejsClass)
Whether a class provides an Ejs model.

Parameters:
_ejsClass - Class
Returns:
boolean

runEjs

public static boolean runEjs(java.lang.Class<?> _ejsClass)
Runs the Ejs model corresponding to the given class. The model and resources required will be extracted using the ResourceLoader utility.

Parameters:
_ejsClass - Class
Returns:
boolean true if successful

saveInformation

public static void saveInformation(java.lang.String _home,
                                   java.lang.String _release)
To be used by EJS version 3.47 and earlier only. It is here to make sure that the information saved matches the information read by runEjs().

Parameters:
_release - String

saveInformation

public static void saveInformation(java.lang.String _binDirectoryPath,
                                   java.lang.String _sourceDirectoryPath,
                                   java.lang.String _release)
To be used by EJS version 4.0 and later only. It is here to make sure that the information saved matches the information read by runEjs().

Parameters:
_binDirectoryPath - String The binary directory from which EJS was launched
_consoleOptionsFilePath - String The location of the console options file
_sourceDirectoryPath - String The source directory path
_release - String The EJS release version

getPath

public static java.lang.String getPath(java.io.File _file)
Gets the path of a file in standard form. If it is a directory, the path ends in "/"


ejsConfirmList

public static java.util.List<?> ejsConfirmList(java.awt.Component _target,
                                               java.awt.Dimension _size,
                                               java.lang.String _message,
                                               java.lang.String _title,
                                               java.util.List<?> _list)

ejsConfirmList

public static java.util.List<?> ejsConfirmList(java.awt.Component _target,
                                               java.awt.Dimension _size,
                                               java.lang.String _message,
                                               java.lang.String _title,
                                               java.util.List<?> _list,
                                               javax.swing.JComponent _bottomComponent)
This method receives a list of objects which it exposes to the user. The user can remove objects from the list and click OK. The class then returns the modified list. If the user clicks cancel it will return null

Parameters:
_target - Component The dialog will be shown relative to this component
_size - Dimension The size of the display dialog
_message - String The message to display
_title - String The title for the display dialog
_list - java.util.List The initial list of objects
_bottomComponent - JComponent and additional component to show at the bottom
Returns:
AbstractList