Class EjsTool

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

public class EjsTool extends Object
Utility classes to work with Ejs at a high level
Version:
1.0
Author:
Francisco Esquembre (http://fem.um.es)
  • Field Details

  • Constructor Details

    • EjsTool

      public EjsTool()
  • Method Details

    • setLocale

      public static void setLocale(Locale locale)
    • getString

      public static String getString(String key)
    • hasEjsModel

      public static boolean hasEjsModel(Class<?> _ejsClass)
      Whether a class provides an Ejs model.
      Parameters:
      _ejsClass - Class
      Returns:
      boolean
    • getEjsAppletDimension

      public static Dimension getEjsAppletDimension(Class<?> _ejsClass)
      Returns the preferred dimension for the simulation's main window.
      Parameters:
      _ejsClass - Class
      Returns:
      boolean
    • runEjs

      public static boolean runEjs(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
    • runEjs

      public static boolean runEjs(Class<?> _ejsClass, String _password)
      Runs the Ejs model corresponding to the given class providing a given password The model and resources required will be extracted using the ResourceLoader utility.
      Parameters:
      _ejsClass - Class
      _password - String
      Returns:
      boolean true if successful
    • saveInformation

      public static void saveInformation(String _home, 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(String _binDirectoryPath, String _sourceDirectoryPath, 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
      _sourceDirectoryPath - String The source directory path
      _release - String The EJS release version
    • getPath

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

      public static List<Object> ejsConfirmList(Component _target, Dimension _size, String _message, String _title, List<?> _list)
    • ejsConfirmList

      public static List<Object> ejsConfirmList(Component _target, Dimension _size, String _message, String _title, List<?> _list, 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