java.lang.Object
org.opensourcephysics.cabrillo.tracker.Tracker

public class Tracker extends Object
This is the default Tracker application.
Author:
Douglas Brown, Wolfgang Christian, Robert M. Hanson
  • Field Details

    • loadTabsInSeparateThread

      public static boolean loadTabsInSeparateThread
    • TRACKER_TEST_URL

      public static String TRACKER_TEST_URL
    • doHoldRepaint

      public static boolean doHoldRepaint
    • allowDataFunctionControls

      public static boolean allowDataFunctionControls
    • allowTableRefresh

      public static boolean allowTableRefresh
    • allowPlotRefresh

      public static boolean allowPlotRefresh
    • allowDataRefresh

      public static boolean allowDataRefresh
    • allowViews

      public static boolean allowViews
    • allowMenuRefresh

      public static boolean allowMenuRefresh
    • allowToolbarRefresh

      public static boolean allowToolbarRefresh
    • timeLogEnabled

      public static boolean timeLogEnabled
    • jsutil

      public static swingjs.api.JSUtilI jsutil
    • TRACKER_ICON

      public static final ImageIcon TRACKER_ICON
      the tracker icon
    • TRACKER_ICON_256

      public static final ImageIcon TRACKER_ICON_256
      a larger tracker icon
  • Constructor Details

    • Tracker

      public Tracker()
      Constructs Tracker with a blank tab and splash.
    • Tracker

      public Tracker(Video video)
      Constructs Tracker with a video.
      Parameters:
      video - the video
  • Method Details

    • getResourceIcon

      public static Icon getResourceIcon(String imageName, boolean resizable)
      Gets an icon from a class resource image.
      Parameters:
      imageName - the name of the image, with no path
      resizable - true to return a ResizableIcon, otherwise returns ImageIcon
    • getLocales

      public static Locale[] getLocales()
    • getClassResource

      public static URL getClassResource(String resource)
      If JavaScript, look in an asset zip file; if not, use Tracker.class.getResource() if not.
      Parameters:
      resource - "resources/...."
      Returns:
      URL (with byte[ ] in _streamData if OSPRuntime.isJS)
    • getTracker

      public static Tracker getTracker(Runnable whenLoaded)
      Gets the shared Tracker for single-VM use.
      Parameters:
      whenLoaded -
      Returns:
      the shared Tracker
    • loadExperimentURL

      public void loadExperimentURL(String path)
      Replace any open tabs with a single tab loaded with the given path. JavaScript only?
      Parameters:
      path -
    • getFrame

      public TFrame getFrame()
      Gets the frame with alias for JavaScript
      Returns:
      the frame
    • getMainFrame

      public OSPFrame getMainFrame()
      OSP API to get the main program frame.
      Returns:
      OSPFrame
    • getMainFrameSize

      public int[] getMainFrameSize()
      OSP API to get the main Tracker frame size.
    • getMainFrameLocation

      public int[] getMainFrameLocation()
      OSP API to get the main Tracker frame location.
    • onWindowClosing

      protected void onWindowClosing()
    • exit

      public static void exit()
    • compareVersions

      public static int compareVersions(String ver1, String ver2)
      Compares version strings.
      Parameters:
      ver1 - version 1
      ver2 - version 2
      Returns:
      0 if equal, 1 if ver1>ver2, -1 if ver1<ver2
    • showAboutTracker

      public static void showAboutTracker()
      Shows the About Tracker dialog.
    • findDataFunctions

      public static Map<String,ArrayList<String[]>> findDataFunctions(String dirPath)
      Finds data functions in all DataBuilder XMLControl files found in a specified directory. This returns a map for which the keys are names of DataBuilder xml files and the values are lists of data functions as String[] {function name, expression, tracktype}
      Parameters:
      dirPath - the directory path
      Returns:
      map of file name to list of data functions
    • createActions

      protected static void createActions()
      Creates the actions.
    • getFullConfig

      protected static Set<String> getFullConfig()
      Gets the full set of configuration properties.
      Returns:
      the full configuration set
    • getDefaultConfig

      protected static Set<String> getDefaultConfig()
      Gets the default set of configuration properties.
      Returns:
      the default configuration set
    • setDefaultConfig

      protected static void setDefaultConfig(Set<String> config)
      Sets the default set of configuration properties.
      Parameters:
      config - a set of configuration properties
    • autoloadDataFunctions

      protected static void autoloadDataFunctions()
    • getDefaultAutoloadSearchPaths

      public static Collection<String> getDefaultAutoloadSearchPaths()
      Gets the default autoload search paths.
      Returns:
      the default search paths
    • getInitialSearchPaths

      protected static Collection<String> getInitialSearchPaths()
      Gets the starting autoload search paths. Search paths may be later modified by the user.
      Returns:
      the search paths
    • setPreferredLocale

      protected static void setPreferredLocale(String localeName)
      Sets the preferred locale.
      Parameters:
      localeName - the name of the locale
    • updateResources

      protected static boolean updateResources()
      Checks and updates video engine resources if needed.
      Returns:
      true if any resources were updated
    • areEqual

      protected static boolean areEqual(Set<?> set1, Set<?> set2)
      Determines if two sets contain the same elements.
      Parameters:
      set1 -
      set2 -
      Returns:
      true if the sets are equal
    • showUpgradeStatus

      protected static void showUpgradeStatus(TrackerPanel trackerPanel)
      Check for upgrades and show a dialog with upgrade info. Also refresh toolbar associated with TrackerPanel, if any.
      Parameters:
      trackerPanel - a TrackerPanel (may be null)
    • loadCurrentVersion

      protected static boolean loadCurrentVersion(boolean ignoreInterval, boolean logToFile, boolean dialogOK)
      Loads the current (latest) Tracker version number and compares it with this version.
      Parameters:
      ignoreInterval - true to load/compare immediately
      logToFile - true to log in to the PHP counter
      dialogOK - true to notify user if newer version available
      Returns:
      true if a newer version is found and user informed
    • loadPreferences

      protected static void loadPreferences()
      Loads preferences from a preferences file, if any.
    • savePreferences

      protected static String savePreferences()
      Saves the current preferences.
      Returns:
      the path to the saved file
    • getZoomInCursor

      protected static Cursor getZoomInCursor()
      Gets the zoomInCursor.
      Returns:
      the cursor
    • isZoomInCursor

      protected static boolean isZoomInCursor(Cursor cursor)
      Determines if a cursor is the zoomInCursor.
      Returns:
      true if the cursor is zoonIn
    • getZoomOutCursor

      protected static Cursor getZoomOutCursor()
      Gets the zoomOutCursor.
      Returns:
      the cursor
    • isZoomOutCursor

      protected static boolean isZoomOutCursor(Cursor cursor)
      Determines if a cursor is the zoomOutCursor.
      Returns:
      true if the cursor is zoomOut
    • main

      public static void main(String[] args)
      Main entry point when used as application.
      Parameters:
      args - array of tracker or video file names
    • logTime

      protected static void logTime(String message)
      Logs the current time (to milliseconds) with a message.
      Parameters:
      message -
    • addRecent

      protected static void addRecent(String filename, boolean atEnd)
      Adds a path to the list of recent files.
      Parameters:
      filename - the absolute path to a recently opened or saved file.
      atEnd - true to add at end of the list
    • setRecentSize

      protected static void setRecentSize(int max)
      Sets the maximum size of the recent files list. Limited to 12 or less.
      Parameters:
      max - the desired maximum size.
    • haveDataFunctions

      public static boolean haveDataFunctions()
    • loadControlStringObjects

      public static void loadControlStringObjects(Class<?> trackType, FunctionPanel panel)
      Parameters:
      trackType -
      panel -
    • loadControlStrings

      public static void loadControlStrings(Runnable reload)
      Parameters:
      reload -
    • loadControls

      public static void loadControls(Class<?> trackType, FunctionPanel panel)
      Parameters:
      trackType -
      panel -
    • askToSetMemory

      public static void askToSetMemory(TFrame frame)
      Ask about preferred memory size for TToolBar
      Parameters:
      frame -
    • checkMemory

      public static int checkMemory(TFrame frame, boolean ignoreLowMemory)
      Check the memory status for TrackerIO and warn the user if needed.
      Parameters:
      frame -
      ignoreLowMemory -
      Returns:
      MEMORY_OK, MEMORY_IGNORE, MEMORY_DONTIGNORE, MEMORY_OUT, MEMORY_INCREASE