shady.common.ui
Class UI

java.lang.Object
  extended by shady.common.ui.UI
Direct Known Subclasses:
MultiUI, SimUI

public abstract class UI
extends java.lang.Object

Shady UI.

Copyright (C) 2006 Marsette A. Vona, III

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Author:
Marsette (Marty) A. Vona, III, Peter Osagie

Field Summary
protected  AccountingDisplay accountingDisplay
          The asynchronous accounting display system.
protected  java.lang.String[] arg
          The command line arguments, null if applet.
static java.awt.Color[] BARREL_COLOR
          Color of shady barrel.
static vona.color.ColorScheme BARREL_COLOR_SCHEME
          The barrel color scheme.
protected  javax.swing.Box box
          The Box that holds everything.
protected  ControlsDisplay controlsDisplay
          The sim controls.
private static java.lang.String cvsid
           
static java.lang.String DEFAULT_APPNAME
          The default name of the application.
static double[] DEFAULT_BARREL_ANGLE
          Barrel angles in default pose (degrees).
static int DEFAULT_CONNECTED_BARREL
          Which gripper is connected in default pose.
static double[] DEFAULT_GRIPPER_STATE
          Gripper states in default pose.
static boolean DEFAULT_INVERT_CONNECTION_SENSE
          Inverte connection sense of default pose.
static java.lang.String DEFAULT_JS_PROMPT
          The default JScheme prompt.
static double DEFAULT_PATHFINDER_SEARCH_RADIUS_COEFFICIENT
          Default pathfinder search radius coefficient.
static int DEFAULT_SEGMENT
          Environment segment index connected in default pose.
static java.lang.String DEFAULT_STARTUP_MESSAGE
          The default startup message.
static double DEFAULT_WHERE
          Environment segment where connected in default pose.
protected  Environment environment
          The environment.
protected  javax.swing.JFrame frame
          Our frame, iff run as an application.
protected  GraphicsDisplay graphicsDisplay
          The asynchronous graphics rendering system.
static java.lang.String INITIAL_FORMS_MESSAGE
          Message to inform user we're running initial forms.
protected  jscheme.JScheme js
          The JScheme interpreter.
static java.lang.String JS_COMMON_EXTRA
          The name of the scheme bindings for the common extra stuff.
static java.lang.String JS_INIT_FILENAME
          The name of initialization script.
static java.lang.String JS_PATHFINDER
          The name of the pathfinder scheme.
protected  Pathfinder pathfinder
          The pathfinder reference, if any.
protected  PoseDisplay poseDisplay
          The asynchronous pose display system.
protected  java.lang.Thread replThread
          The thread running the REPL for js, if any.
protected  ShadyCommonAPI shady
          The mechanism.
static java.lang.String SHADY_JS_COMMON_API
          The name of the scheme bindings for the common api.
protected  StateDisplay stateDisplay
          The asynchronous state display system.
protected  Sunalg sunalg
          The sunalg reference, if any.
static java.lang.String UNSIGNED_APPLET_MSG
          A message to tell the user when we have a security exception.
 
Constructor Summary
UI()
          Covers UI(String[]), no args.
UI(Environment environment, ShadyCommonAPI shady, java.lang.String[] arg)
          Create a new UI.
UI(java.lang.String[] arg)
          Covers UI(Environment, ShadyCommonAPI, String[]), always makeDefaultShady(shady.common.Environment) and makeDefaultEnvironment().
 
Method Summary
 void addAnnotation(java.lang.String name, java.awt.Shape shape)
          Covers GraphicsDisplay.addAnnotation(String, Shape) iff we have a graphics display.
 void addAnnotation(java.lang.String name, java.awt.Shape shape, java.awt.Color color)
          Covers GraphicsDisplay.addAnnotation(String, Shape, Color) iff we have a graphics display.
 void addAnnotation(java.lang.String name, java.awt.Shape shape, java.awt.Color color, float lineWidth)
          Covers GraphicsDisplay.addAnnotation(String, Shape, Color, float) iff we have a graphics display.
 void addHotSpot(HotSpot hotSpot)
          Covers GraphicsDisplay.addHotSpot(HotSpot) iff we have a graphics display.
 void clearAnnotations()
          Covers GraphicsDisplay.clearAnnotations() iff we have a graphics display.
 void clearHotSpots()
          Covers GraphicsDisplay.clearHotSpots() iff we have a graphics display.
 void flashHotSpots()
          Covers GraphicsDisplay.flashHotSpots() iff we have a graphics display.
 void flashHotSpots(double duration)
          Covers GraphicsDisplay.flashHotSpots(double) iff we have a graphics display.
 void flashHotSpots(double duration, java.awt.Color color)
          Covers GraphicsDisplay.flashHotSpots(double, Color) iff we have a graphics display.
 void flashHotSpots(double duration, java.awt.Color color, double radius)
          Covers GraphicsDisplay.flashHotSpots(double, Color, double) iff we have a graphics display.
 java.lang.String getAppletInitialForms()
          Initial scheme forms to eval at end of init in applet context.
protected  java.lang.String getApplicationInitialForms()
          Initial scheme forms to eval at end of init in application context.
protected  java.lang.String getAppname()
          Get the application name.
 javax.swing.Box getBox()
          Get the UI Box.
 double getCenterX()
          Covers GraphicsDisplay.getCenterX() iff we have a graphics display.
 double getCenterY()
          Covers GraphicsDisplay.getCenterY() iff we have a graphics display.
 Point.Cartesian getClickPointCartesian()
          Covers GraphicsDisplay.getClickPointCartesian() iff we have a graphics display, else returns null.
protected  double getDefaultBarrelAngle(int barrel, Environment environment)
          Get the default barrel angle in makeDefaultPose(shady.common.Environment).
protected  int getDefaultConnectedBarrel(Environment environment)
          Get the default connected barrel in makeDefaultPose(shady.common.Environment).
protected  double getDefaultGripperState(int barrel, Environment environment)
          Get the default gripper state in makeDefaultPose(shady.common.Environment).
protected  boolean getDefaultInvertConnectionSense(Environment environment)
          Get whether to invert the connection sense in makeDefaultPose(shady.common.Environment).
protected  int getDefaultSegment(Environment environment)
          Get the default segment index in makeDefaultPose(shady.common.Environment).
protected  double getDefaultWhere(Environment environment)
          Get the default connection point where in makeDefaultPose(shady.common.Environment).
 double getGraphicsFPS()
          Covers Display.getFPS() iff we have a graphics display.
 int getGraphicsHeight()
          Get the height of the graphics display, if any.
 int getGraphicsWidth()
          Get the width of the graphics display, if any.
 jscheme.JScheme getJScheme()
          Get the JScheme interpreter, if any.
 java.lang.String getJSchemePrompt()
          Get the JScheme interpreter prompt to use.
protected  double getPathfinderSearchRadiusCoeff()
          Get the search radius coefficient to use in makePathfinder(shady.common.ShadyCommonAPI, shady.common.Environment, shady.common.ui.GraphicsDisplay).
 java.lang.String getStartupMessage()
          Get the message to display before the first prompt in the JScheme interpreter.
 java.lang.String getStartupMessage(boolean hasInitialForms)
          Appends a note about running initial forms to getStartupMessage(), iff necessary.
 double getZoom()
          Covers GraphicsDisplay.getScale() iff we have a graphics display.
 boolean isFlashOngoing()
          Covers GraphicsDisplay.isFlashOngoing() iff we have a graphics display.
 void isGraphicsPaused()
          Covers Display.isPaused() iff we have a graphics display.
 boolean isTesserOngoing()
          Covers GraphicsDisplay.isTesserOngoing() iff we have a graphics display.
 boolean loadJSchemeFile(java.lang.String filename)
          Load a script from file.
protected  boolean loadJSchemeFileFromResource(java.lang.Class clazz, java.lang.String resourceName)
          Load a scheme file into js from a resource for clazz.
protected  void loadJSchemeFiles()
          Load initial JScheme files iff js is not null
 void mainImpl(java.lang.String[] argv)
          Default application init.
protected  AccountingDisplay makeAccountingDisplay(ShadyCommonAPI shady)
          Make the accounting display.
protected  ControlsDisplay makeControlsDisplay(ShadyCommonAPI shady)
          Make the controls display.
protected  Environment makeDefaultEnvironment()
          Make a default environment to use if none is specified to the constructor.
protected  ShadyPose makeDefaultPose(Environment environment)
          Make the default pose in environment.
protected abstract  ShadyCommonAPI makeDefaultShady(Environment environment)
          Make a default shady to use if none is specified to the constructor.
protected  GraphicsDisplay makeGraphicsDisplay(ShadyCommonAPI shady, Environment environment)
          Make the graphics display.
protected  jscheme.JScheme makeJScheme(ShadyCommonAPI shady, Environment environment)
          Make the JScheme interpreter.
protected  Pathfinder makePathfinder(ShadyCommonAPI shady, Environment environment, GraphicsDisplay graphicsDisplay)
          Make the Pathfinder.
protected  PoseDisplay makePoseDisplay(ShadyCommonAPI shady, GraphicsDisplay graphicsDisplay)
          Make the pose display.
protected  StateDisplay makeStateDisplay(ShadyCommonAPI shady)
          Make the state display.
protected  Sunalg makeSunalg()
          Make the Sunalg.
protected  boolean noGUI()
          Check whether to disable the GUI.
protected  void packBox()
          Pack all the non-null displays into box.
 void pauseGraphics()
          Covers GraphicsDisplay.pause() iff we have a graphics display.
 boolean removeAnnotation(java.lang.String name)
          Covers GraphicsDisplay.removeAnnotation(String) iff we have a graphics display.
 boolean removeHotSpot(HotSpot hotSpot)
          Covers GraphicsDisplay.removeHotSpot(HotSpot) iff we have a graphics display.
 boolean resetWorldToView()
          Covers GraphicsDisplay.resetWorldToView() iff we have a graphics display.
 boolean resetWorldToView(boolean shrink, double extra, double duration)
          Covers GraphicsDisplay.resetWorldToView(boolean, double, double) iff we have a graphics display.
 boolean resetWorldToView(double extra)
          Covers GraphicsDisplay.resetWorldToView(double) iff we have a graphics display.
 void resetWorldToView(double cx, double cy)
          Covers GraphicsDisplay.resetWorldToView(double, double) iff we have a graphics display.
 void resetWorldToView(double cx, double cy, double scale)
          Covers GraphicsDisplay.resetWorldToView(double, double, double) iff we have a graphics display.
 void setArrowLineWidth(float arrowLineWidth)
          Covers GraphicsDisplay.setArrowLineWidth(float) iff we have a graphics display.
 void setBoneLineWidth(float boneLineWidth)
          Covers GraphicsDisplay.setBoneLineWidth(float) iff we have a graphics display.
 void setClickPointCartesian(double x, double y)
          Covers GraphicsDisplay.setClickPointCartesian(double, double) iff we have a graphics display.
 void setDefaultFrameFormat(java.lang.String format)
          Calls ControlsDisplay.setDefaultFrameFormat(String) if we have a controls display.
 void setDrawBarrelArrows(boolean drawBarrelArrows)
          Covers GraphicsDisplay.setDrawBarrelArrows(boolean) iff we have a graphics display.
 void setDrawBodyArrow(boolean drawBodyArrow)
          Covers GraphicsDisplay.setDrawBodyArrow(boolean) iff we have a graphics display.
 void setDrawCCLineBody(boolean drawCCLineBody)
          Covers GraphicsDisplay.setDrawCCLineBody(boolean) iff we have a graphics display.
 void setDrawLineBody(boolean drawLineBody)
          Covers GraphicsDisplay.setDrawLineBody(boolean) iff we have a graphics display.
 void setDrawPaddles(boolean drawPaddles)
          Covers GraphicsDisplay.setDrawPaddles(boolean) iff we have a graphics display.
 void setDrawShade(boolean drawShade)
          Covers GraphicsDisplay.setDrawShade(boolean) iff we have a graphics display.
 void setEnableToolTip(boolean enable)
          Covers GraphicsDisplay.setEnableToolTip(boolean) iff we have a graphics display.
 void setEnvironmentLineWidth(float environmentLineWidth)
          Covers GraphicsDisplay.setEnvironmentLineWidth(float) iff we have a graphics display.
 void setGraphicsFPS(double fps)
          Covers Display.setFPS(double) iff we have a graphics display.
 void setGraphicsSize(int width, int height)
          Sets the graphics display size in pixels iff we have a graphics display.
protected  void setJSGlobals(jscheme.JScheme js)
          Bind global JScheme values.
 void setPaddleLineWidth(float paddleLineWidth)
          Covers GraphicsDisplay.setPaddleLineWidth(float) iff we have a graphics display.
 void setRelativeLineWidth(float relativeLineWidth)
          Covers GraphicsDisplay.setRelativeLineWidth(float) iff we have a graphics display.
 void setRenderFastest(boolean renderFastest)
          Covers GraphicsDisplay.setRenderFastest(boolean) iff we have a graphics display.
 void setUseFaultColor(boolean useFaultColor)
          Covers GraphicsDisplay.setUseFaultColor(boolean) iff we have a graphics display.
 void setVerboseGraphicsPerformance(boolean verbosePerformance)
          Covers GraphicsDisplay.setVerbosePerformance(boolean) iff we have a graphics display.
 void sleep(double seconds)
          Sleep given seconds in wall-clock time.
 void startSavingFrames()
          Calls ControlsDisplay.startSavingFrames() if we have a controls display.
 void startSavingFrames(java.io.File dir, java.lang.String format, java.lang.String prefix, int numFrameDigits, int nextFrameNumber, double framesPerSecond)
          Calls ControlsDisplay.startSavingFrames(File, String, String, int, int, double) if we have a controls display.
 void startSavingFrames(java.lang.String dir, java.lang.String format, java.lang.String prefix, int numFrameDigits, int nextFrameNumber, double framesPerSecond)
          Covers startSavingFrames(File, String, String, int, int, double).
 void stopSavingFrames()
          Calls ControlsDisplay.stopSavingFrames() if we have a controls display.
 boolean tesserTo(double cx, double cy, double scale, double duration)
          Covers GraphicsDisplay.tesserTo(double, double, double, double) iff we have a graphics display.
 void unPauseGraphics(boolean forceUpdate)
          Covers Display.unPause(boolean) iff we have a graphics display.
 void unsetGraphicsSize()
          Un-set any specific graphics size, iff we have a graphics display.
 java.lang.Exception writeToFile(java.io.File file, java.lang.String format, boolean showErrorDialog)
          Calls GraphicsDisplay.writeToFile(File, String, boolean) iff we have a graphics display.
 java.lang.Exception writeToFile(java.lang.String file, java.lang.String format)
          Calls GraphicsDisplay.writeToFile(File, String) iff we have a graphics display.
 java.lang.Exception writeToFile(java.lang.String file, java.lang.String format, boolean showErrorDialog)
          Covers writeToFile(File, String, boolean).
 void zoomWorldToView(double scale)
          Covers GraphicsDisplay.zoomWorldToView(double) iff we have a graphics display.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cvsid

private static final java.lang.String cvsid
See Also:
Constant Field Values

DEFAULT_BARREL_ANGLE

public static final double[] DEFAULT_BARREL_ANGLE

Barrel angles in default pose (degrees).


DEFAULT_GRIPPER_STATE

public static final double[] DEFAULT_GRIPPER_STATE

Gripper states in default pose.


DEFAULT_CONNECTED_BARREL

public static final int DEFAULT_CONNECTED_BARREL

Which gripper is connected in default pose.

See Also:
Constant Field Values

DEFAULT_SEGMENT

public static final int DEFAULT_SEGMENT

Environment segment index connected in default pose.

See Also:
Constant Field Values

DEFAULT_WHERE

public static final double DEFAULT_WHERE

Environment segment where connected in default pose.

See Also:
Constant Field Values

DEFAULT_INVERT_CONNECTION_SENSE

public static final boolean DEFAULT_INVERT_CONNECTION_SENSE

Inverte connection sense of default pose.

See Also:
Constant Field Values

DEFAULT_PATHFINDER_SEARCH_RADIUS_COEFFICIENT

public static final double DEFAULT_PATHFINDER_SEARCH_RADIUS_COEFFICIENT

Default pathfinder search radius coefficient.

See Also:
Constant Field Values

DEFAULT_APPNAME

public static final java.lang.String DEFAULT_APPNAME

The default name of the application.

See Also:
Constant Field Values

BARREL_COLOR_SCHEME

public static final vona.color.ColorScheme BARREL_COLOR_SCHEME

The barrel color scheme.


BARREL_COLOR

public static final java.awt.Color[] BARREL_COLOR

Color of shady barrel.


SHADY_JS_COMMON_API

public static final java.lang.String SHADY_JS_COMMON_API

The name of the scheme bindings for the common api.

See Also:
Constant Field Values

JS_COMMON_EXTRA

public static final java.lang.String JS_COMMON_EXTRA

The name of the scheme bindings for the common extra stuff.

See Also:
Constant Field Values

JS_PATHFINDER

public static final java.lang.String JS_PATHFINDER

The name of the pathfinder scheme.

See Also:
Constant Field Values

JS_INIT_FILENAME

public static final java.lang.String JS_INIT_FILENAME

The name of initialization script.

See Also:
Constant Field Values

DEFAULT_JS_PROMPT

public static final java.lang.String DEFAULT_JS_PROMPT

The default JScheme prompt.

See Also:
Constant Field Values

DEFAULT_STARTUP_MESSAGE

public static final java.lang.String DEFAULT_STARTUP_MESSAGE

The default startup message.

See Also:
Constant Field Values

INITIAL_FORMS_MESSAGE

public static final java.lang.String INITIAL_FORMS_MESSAGE

Message to inform user we're running initial forms.

See Also:
Constant Field Values

UNSIGNED_APPLET_MSG

public static final java.lang.String UNSIGNED_APPLET_MSG

A message to tell the user when we have a security exception.

See Also:
Constant Field Values

shady

protected ShadyCommonAPI shady

The mechanism.


environment

protected Environment environment

The environment.


stateDisplay

protected StateDisplay stateDisplay

The asynchronous state display system.


poseDisplay

protected PoseDisplay poseDisplay

The asynchronous pose display system.


graphicsDisplay

protected GraphicsDisplay graphicsDisplay

The asynchronous graphics rendering system.


controlsDisplay

protected ControlsDisplay controlsDisplay

The sim controls.


accountingDisplay

protected AccountingDisplay accountingDisplay

The asynchronous accounting display system.


box

protected javax.swing.Box box

The Box that holds everything.


frame

protected javax.swing.JFrame frame

Our frame, iff run as an application.


js

protected jscheme.JScheme js

The JScheme interpreter.


replThread

protected java.lang.Thread replThread

The thread running the REPL for js, if any.


pathfinder

protected Pathfinder pathfinder

The pathfinder reference, if any.


sunalg

protected Sunalg sunalg

The sunalg reference, if any.


arg

protected java.lang.String[] arg

The command line arguments, null if applet.

Constructor Detail

UI

public UI(Environment environment,
          ShadyCommonAPI shady,
          java.lang.String[] arg)
   throws java.lang.Exception

Create a new UI.

Everything is init from the various make*() methods.

Parameters:
environment - the mechanism's environment, if null then makeDefaultEnvironment()
shady - the mechanism with which to interact, if null then makeDefaultShady(shady.common.Environment), if still null then inhibit loadJSchemeFiles() and packBox(), it's a signal that a superclass constructor may still need to do things
arg - the arguments that were passed to main, null if applet
Throws:
java.lang.Exception

UI

public UI(java.lang.String[] arg)
   throws java.lang.Exception

Covers UI(Environment, ShadyCommonAPI, String[]), always makeDefaultShady(shady.common.Environment) and makeDefaultEnvironment().

Throws:
java.lang.Exception

UI

public UI()
   throws java.lang.Exception

Covers UI(String[]), no args.

Throws:
java.lang.Exception
Method Detail

packBox

protected void packBox()

Pack all the non-null displays into box.


getApplicationInitialForms

protected java.lang.String getApplicationInitialForms()

Initial scheme forms to eval at end of init in application context.

Default impl returns null (no forms).

Returns:
Initial scheme forms to eval at end of init in application context

getAppletInitialForms

public java.lang.String getAppletInitialForms()

Initial scheme forms to eval at end of init in applet context.

Default impl returns null (no forms).

Returns:
Initial scheme forms to eval at end of init in applet context

getBox

public javax.swing.Box getBox()

Get the UI Box.

Returns:
the UI Box

getJScheme

public jscheme.JScheme getJScheme()

Get the JScheme interpreter, if any.

Returns:
the JScheme interpreter, if any

makeDefaultShady

protected abstract ShadyCommonAPI makeDefaultShady(Environment environment)
                                            throws java.lang.Exception

Make a default shady to use if none is specified to the constructor.

Parameters:
environment - the Environment, null if none
Returns:
a default shady to use if none is specified to the constructor
Throws:
java.lang.Exception

makeDefaultEnvironment

protected Environment makeDefaultEnvironment()

Make a default environment to use if none is specified to the constructor.

Default impl returns null.

Returns:
a default environment to use if none is specified to the constructor

makeDefaultPose

protected ShadyPose makeDefaultPose(Environment environment)

Make the default pose in environment.

Uses the various getDefault*() hooks.

Parameters:
environment - the Environment, null if none

getDefaultBarrelAngle

protected double getDefaultBarrelAngle(int barrel,
                                       Environment environment)

Get the default barrel angle in makeDefaultPose(shady.common.Environment).

Parameters:
barrel - the barrel
environment - the environment
Returns:
the default gripper state in makeDefaultPose(shady.common.Environment)

getDefaultGripperState

protected double getDefaultGripperState(int barrel,
                                        Environment environment)

Get the default gripper state in makeDefaultPose(shady.common.Environment).

Parameters:
barrel - the barrel
environment - the environment
Returns:
the default gripper state in makeDefaultPose(shady.common.Environment)

getDefaultConnectedBarrel

protected int getDefaultConnectedBarrel(Environment environment)

Get the default connected barrel in makeDefaultPose(shady.common.Environment).

Parameters:
environment - the environment
Returns:
the default connected barrel in makeDefaultPose(shady.common.Environment)

getDefaultSegment

protected int getDefaultSegment(Environment environment)

Get the default segment index in makeDefaultPose(shady.common.Environment).

Parameters:
environment - the environment
Returns:
the default segment index in makeDefaultPose(shady.common.Environment)

getDefaultWhere

protected double getDefaultWhere(Environment environment)

Get the default connection point where in makeDefaultPose(shady.common.Environment).

Parameters:
environment - the environment
Returns:
the default connection point where in makeDefaultPose(shady.common.Environment)

getDefaultInvertConnectionSense

protected boolean getDefaultInvertConnectionSense(Environment environment)

Get whether to invert the connection sense in makeDefaultPose(shady.common.Environment).

Parameters:
environment - the environment
Returns:
whether to invert the connection sense in makeDefaultPose(shady.common.Environment)

makeStateDisplay

protected StateDisplay makeStateDisplay(ShadyCommonAPI shady)

Make the state display.

This is a hook so subclasses can use a specialized display or disable it.

Default impl returns a new StateDisplay.

Parameters:
shady - the shady to display
Returns:
the display, null for none

makeGraphicsDisplay

protected GraphicsDisplay makeGraphicsDisplay(ShadyCommonAPI shady,
                                              Environment environment)

Make the graphics display.

This is a hook so subclasses can use a specialized display or disable it.

Default impl returns a new GraphicsDisplay.

Parameters:
shady - the shady to display
environment - the environment if any
Returns:
the display, null for none

makePoseDisplay

protected PoseDisplay makePoseDisplay(ShadyCommonAPI shady,
                                      GraphicsDisplay graphicsDisplay)

Make the pose display.

This is a hook so subclasses can use a specialized display or disable it.

Default impl returns a new PoseDisplay.

Parameters:
shady - the shady to display
Returns:
the display, null for none

makeControlsDisplay

protected ControlsDisplay makeControlsDisplay(ShadyCommonAPI shady)

Make the controls display.

This is a hook so subclasses can use a specialized display or disable it.

Default impl returns a new ControlsDisplay.

Parameters:
shady - the shady to display
Returns:
the display, null for none

makeAccountingDisplay

protected AccountingDisplay makeAccountingDisplay(ShadyCommonAPI shady)

Make the accounting display.

This is a hook so subclasses can use a specialized display or disable it.

Default impl returns a new AccountingDisplay.

Parameters:
shady - the shady to display
Returns:
the display, null for none

makePathfinder

protected Pathfinder makePathfinder(ShadyCommonAPI shady,
                                    Environment environment,
                                    GraphicsDisplay graphicsDisplay)

Make the Pathfinder.

This is a hook so subclasses can use a specialized pathfinder or disable it.

Default impl returns a new Pathfinder.

Parameters:
shady - the shady
environment - the Environment, null if none
graphicsDisplay - the GraphicsDisplay, null if none
Returns:
the pathfinder, null for none

makeSunalg

protected Sunalg makeSunalg()

Make the Sunalg.

This is a hook so subclasses can use a specialized sunalg or disable it.

Default impl returns a new Sunalg.


getPathfinderSearchRadiusCoeff

protected double getPathfinderSearchRadiusCoeff()

Get the search radius coefficient to use in makePathfinder(shady.common.ShadyCommonAPI, shady.common.Environment, shady.common.ui.GraphicsDisplay).

Default impl returns DEFAULT_PATHFINDER_SEARCH_RADIUS_COEFFICIENT.

Returns:
the search radius coefficient to use in makePathfinder(shady.common.ShadyCommonAPI, shady.common.Environment, shady.common.ui.GraphicsDisplay)

makeJScheme

protected jscheme.JScheme makeJScheme(ShadyCommonAPI shady,
                                      Environment environment)

Make the JScheme interpreter.

Returns:
the JScheme interpreter, null for none

setJSGlobals

protected void setJSGlobals(jscheme.JScheme js)

Bind global JScheme values.


loadJSchemeFiles

protected void loadJSchemeFiles()

Load initial JScheme files iff js is not null

Default impl loads SHADY_JS_COMMON_API, JS_COMMON_EXTRA, and JS_PATHFINDER.


loadJSchemeFileFromResource

protected boolean loadJSchemeFileFromResource(java.lang.Class clazz,
                                              java.lang.String resourceName)

Load a scheme file into js from a resource for clazz.

Has no effect if js is null.

Parameters:
clazz - the class associated with the resource
resourceName - the name of the resource (i.e. the name of a scheme file in the same package as this class)
Returns:
true iff the file was loaded

loadJSchemeFile

public boolean loadJSchemeFile(java.lang.String filename)

Load a script from file.

Parameters:
filename - the name of the file
Returns:
true iff the file was loaded

mainImpl

public void mainImpl(java.lang.String[] argv)

Default application init.

If this UI has a JScheme interpreter its REPL is run in replThread.


getJSchemePrompt

public java.lang.String getJSchemePrompt()

Get the JScheme interpreter prompt to use.

Default impl returns DEFAULT_JS_PROMPT.

Returns:
the JScheme interpreter prompt to use

getStartupMessage

public java.lang.String getStartupMessage()

Get the message to display before the first prompt in the JScheme interpreter.

Default impl returns DEFAULT_STARTUP_MESSAGE.

Returns:
the message to display before the first prompt in the JScheme interpreter, null for none

getStartupMessage

public java.lang.String getStartupMessage(boolean hasInitialForms)

Appends a note about running initial forms to getStartupMessage(), iff necessary.

Parameters:
hasInitialForms - whether there are initial forms

getAppname

protected java.lang.String getAppname()

Get the application name.

Default impl returns DEFAULT_APPNAME.

Returns:
the application name

sleep

public void sleep(double seconds)

Sleep given seconds in wall-clock time.

Parameters:
seconds - time to sleep

writeToFile

public java.lang.Exception writeToFile(java.lang.String file,
                                       java.lang.String format)

Calls GraphicsDisplay.writeToFile(File, String) iff we have a graphics display.


writeToFile

public java.lang.Exception writeToFile(java.lang.String file,
                                       java.lang.String format,
                                       boolean showErrorDialog)

Covers writeToFile(File, String, boolean).


writeToFile

public java.lang.Exception writeToFile(java.io.File file,
                                       java.lang.String format,
                                       boolean showErrorDialog)

Calls GraphicsDisplay.writeToFile(File, String, boolean) iff we have a graphics display.


setDefaultFrameFormat

public void setDefaultFrameFormat(java.lang.String format)

Calls ControlsDisplay.setDefaultFrameFormat(String) if we have a controls display.


startSavingFrames

public void startSavingFrames(java.lang.String dir,
                              java.lang.String format,
                              java.lang.String prefix,
                              int numFrameDigits,
                              int nextFrameNumber,
                              double framesPerSecond)

Covers startSavingFrames(File, String, String, int, int, double).


startSavingFrames

public void startSavingFrames(java.io.File dir,
                              java.lang.String format,
                              java.lang.String prefix,
                              int numFrameDigits,
                              int nextFrameNumber,
                              double framesPerSecond)

Calls ControlsDisplay.startSavingFrames(File, String, String, int, int, double) if we have a controls display.


startSavingFrames

public void startSavingFrames()

Calls ControlsDisplay.startSavingFrames() if we have a controls display.


stopSavingFrames

public void stopSavingFrames()

Calls ControlsDisplay.stopSavingFrames() if we have a controls display.


addHotSpot

public void addHotSpot(HotSpot hotSpot)

Covers GraphicsDisplay.addHotSpot(HotSpot) iff we have a graphics display.


removeHotSpot

public boolean removeHotSpot(HotSpot hotSpot)

Covers GraphicsDisplay.removeHotSpot(HotSpot) iff we have a graphics display.


clearHotSpots

public void clearHotSpots()

Covers GraphicsDisplay.clearHotSpots() iff we have a graphics display.


flashHotSpots

public void flashHotSpots(double duration,
                          java.awt.Color color,
                          double radius)

Covers GraphicsDisplay.flashHotSpots(double, Color, double) iff we have a graphics display.


flashHotSpots

public void flashHotSpots(double duration,
                          java.awt.Color color)

Covers GraphicsDisplay.flashHotSpots(double, Color) iff we have a graphics display.


flashHotSpots

public void flashHotSpots(double duration)

Covers GraphicsDisplay.flashHotSpots(double) iff we have a graphics display.


flashHotSpots

public void flashHotSpots()

Covers GraphicsDisplay.flashHotSpots() iff we have a graphics display.


isFlashOngoing

public boolean isFlashOngoing()

Covers GraphicsDisplay.isFlashOngoing() iff we have a graphics display.


addAnnotation

public void addAnnotation(java.lang.String name,
                          java.awt.Shape shape,
                          java.awt.Color color,
                          float lineWidth)

Covers GraphicsDisplay.addAnnotation(String, Shape, Color, float) iff we have a graphics display.


addAnnotation

public void addAnnotation(java.lang.String name,
                          java.awt.Shape shape,
                          java.awt.Color color)

Covers GraphicsDisplay.addAnnotation(String, Shape, Color) iff we have a graphics display.


addAnnotation

public void addAnnotation(java.lang.String name,
                          java.awt.Shape shape)

Covers GraphicsDisplay.addAnnotation(String, Shape) iff we have a graphics display.


removeAnnotation

public boolean removeAnnotation(java.lang.String name)

Covers GraphicsDisplay.removeAnnotation(String) iff we have a graphics display.


clearAnnotations

public void clearAnnotations()

Covers GraphicsDisplay.clearAnnotations() iff we have a graphics display.


getClickPointCartesian

public Point.Cartesian getClickPointCartesian()

Covers GraphicsDisplay.getClickPointCartesian() iff we have a graphics display, else returns null.


setClickPointCartesian

public void setClickPointCartesian(double x,
                                   double y)

Covers GraphicsDisplay.setClickPointCartesian(double, double) iff we have a graphics display.


setDrawBodyArrow

public void setDrawBodyArrow(boolean drawBodyArrow)

Covers GraphicsDisplay.setDrawBodyArrow(boolean) iff we have a graphics display.


setDrawBarrelArrows

public void setDrawBarrelArrows(boolean drawBarrelArrows)

Covers GraphicsDisplay.setDrawBarrelArrows(boolean) iff we have a graphics display.


setDrawPaddles

public void setDrawPaddles(boolean drawPaddles)

Covers GraphicsDisplay.setDrawPaddles(boolean) iff we have a graphics display.


setDrawLineBody

public void setDrawLineBody(boolean drawLineBody)

Covers GraphicsDisplay.setDrawLineBody(boolean) iff we have a graphics display.


setDrawCCLineBody

public void setDrawCCLineBody(boolean drawCCLineBody)

Covers GraphicsDisplay.setDrawCCLineBody(boolean) iff we have a graphics display.


setDrawShade

public void setDrawShade(boolean drawShade)

Covers GraphicsDisplay.setDrawShade(boolean) iff we have a graphics display.


setUseFaultColor

public void setUseFaultColor(boolean useFaultColor)

Covers GraphicsDisplay.setUseFaultColor(boolean) iff we have a graphics display.


setRenderFastest

public void setRenderFastest(boolean renderFastest)

Covers GraphicsDisplay.setRenderFastest(boolean) iff we have a graphics display.


setVerboseGraphicsPerformance

public void setVerboseGraphicsPerformance(boolean verbosePerformance)

Covers GraphicsDisplay.setVerbosePerformance(boolean) iff we have a graphics display.


setEnvironmentLineWidth

public void setEnvironmentLineWidth(float environmentLineWidth)

Covers GraphicsDisplay.setEnvironmentLineWidth(float) iff we have a graphics display.


setBoneLineWidth

public void setBoneLineWidth(float boneLineWidth)

Covers GraphicsDisplay.setBoneLineWidth(float) iff we have a graphics display.


setArrowLineWidth

public void setArrowLineWidth(float arrowLineWidth)

Covers GraphicsDisplay.setArrowLineWidth(float) iff we have a graphics display.


setPaddleLineWidth

public void setPaddleLineWidth(float paddleLineWidth)

Covers GraphicsDisplay.setPaddleLineWidth(float) iff we have a graphics display.


setRelativeLineWidth

public void setRelativeLineWidth(float relativeLineWidth)

Covers GraphicsDisplay.setRelativeLineWidth(float) iff we have a graphics display.


setEnableToolTip

public void setEnableToolTip(boolean enable)

Covers GraphicsDisplay.setEnableToolTip(boolean) iff we have a graphics display.


setGraphicsFPS

public void setGraphicsFPS(double fps)

Covers Display.setFPS(double) iff we have a graphics display.


getGraphicsFPS

public double getGraphicsFPS()

Covers Display.getFPS() iff we have a graphics display.


pauseGraphics

public void pauseGraphics()

Covers GraphicsDisplay.pause() iff we have a graphics display.


unPauseGraphics

public void unPauseGraphics(boolean forceUpdate)

Covers Display.unPause(boolean) iff we have a graphics display.


isGraphicsPaused

public void isGraphicsPaused()

Covers Display.isPaused() iff we have a graphics display.


resetWorldToView

public void resetWorldToView(double cx,
                             double cy,
                             double scale)

Covers GraphicsDisplay.resetWorldToView(double, double, double) iff we have a graphics display.


resetWorldToView

public void resetWorldToView(double cx,
                             double cy)

Covers GraphicsDisplay.resetWorldToView(double, double) iff we have a graphics display.


resetWorldToView

public boolean resetWorldToView(double extra)

Covers GraphicsDisplay.resetWorldToView(double) iff we have a graphics display.


resetWorldToView

public boolean resetWorldToView()

Covers GraphicsDisplay.resetWorldToView() iff we have a graphics display.


resetWorldToView

public boolean resetWorldToView(boolean shrink,
                                double extra,
                                double duration)

Covers GraphicsDisplay.resetWorldToView(boolean, double, double) iff we have a graphics display.


zoomWorldToView

public void zoomWorldToView(double scale)

Covers GraphicsDisplay.zoomWorldToView(double) iff we have a graphics display.


getZoom

public double getZoom()

Covers GraphicsDisplay.getScale() iff we have a graphics display.


getCenterX

public double getCenterX()

Covers GraphicsDisplay.getCenterX() iff we have a graphics display.


getCenterY

public double getCenterY()

Covers GraphicsDisplay.getCenterY() iff we have a graphics display.


tesserTo

public boolean tesserTo(double cx,
                        double cy,
                        double scale,
                        double duration)

Covers GraphicsDisplay.tesserTo(double, double, double, double) iff we have a graphics display.


isTesserOngoing

public boolean isTesserOngoing()

Covers GraphicsDisplay.isTesserOngoing() iff we have a graphics display.


setGraphicsSize

public void setGraphicsSize(int width,
                            int height)

Sets the graphics display size in pixels iff we have a graphics display.

Parameters:
width - the display width in pixels
height - the display height in pixels

unsetGraphicsSize

public void unsetGraphicsSize()

Un-set any specific graphics size, iff we have a graphics display.


getGraphicsWidth

public int getGraphicsWidth()

Get the width of the graphics display, if any.

Returns:
the width of the graphics display, if any

getGraphicsHeight

public int getGraphicsHeight()

Get the height of the graphics display, if any.

Returns:
the height of the graphics display, if any

noGUI

protected boolean noGUI()

Check whether to disable the GUI.

Looks for the presence of a command line arg "noGUI".

Returns:
true if to run without GUI