org.concord.collisions.ui
Class GUIPanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--org.concord.collisions.ui.GUIPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, CCSimulator, DomainPersistentElement, DomainView, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, StepListener

public class GUIPanel
extends javax.swing.JPanel
implements java.awt.event.ActionListener, StepListener, CCSimulator, DomainView, java.beans.PropertyChangeListener

GUI front end for JPartWorld

Author:
Dmitry Markman
See Also:
Serialized Form

Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected  java.lang.Object activity
           
protected  int arrowsVelDragMode
           
protected  int atomsDragMode
           
protected  boolean constrainDragInside
           
protected  int daemonsDragMode
           
static java.text.DecimalFormat df
           
static int DRAG_ARROW_VEL_NONE
           
static int DRAG_ARROW_VEL_ONLYX
           
static int DRAG_ARROW_VEL_ONLYY
           
static int DRAG_ARROW_VEL_XY
           
static int DRAG_MODE_DAEMON
           
static int DRAG_MODE_FORCE
           
static int DRAG_MODE_FORCEMAGNITUDE
           
static int DRAG_MODE_NONE
           
static int DRAG_MODE_NORMAL
           
static int DRAG_MODE_ONLYVX
           
static int DRAG_MODE_ONLYVY
           
static int DRAG_MODE_ROTATE
           
static int DRAG_MODE_VEL
           
protected  boolean editable
           
protected  boolean elementsSelectable
           
protected  int forcesDragMode
           
protected  boolean tracePossible
           
protected  int wallsDragMode
           
static int WATCH_MODE_CROSS
           
static int WATCH_MODE_LEFT_BOTTOM
           
static int WATCH_MODE_LEFT_TOP
           
static int WATCH_MODE_RIGHT_BOTTOM
           
static int WATCH_MODE_RIGHT_TOP
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface org.concord.shared.simulation.CCSimulator
SIM_RESET_STATE, SIM_RUN_STATE, SIM_STOP_STATE, SIM_UNDEF_STATE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GUIPanel()
          GUIPanel constructor creates instance of GUIPanel
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Deprecated.  
 void addCollisionsListener(CollisionsListener l)
           
 void addEditableProperty(java.lang.String className, java.lang.String propName)
           
 void addEditableProperty(java.lang.String className, java.lang.String propName, java.lang.String propLabel)
           
 void addElement(JWorldElement element)
          add element into the panel
 void addPassiveElement(PassiveElement pe)
          add passive element(Line, Icon, Rectangle, Text) into the panel
 JWall[] buildBox(float x0, float y0, float boxWidth, float boxHeight, float thickness)
          build square box: 4 walls
 JWall[] buildBox(float x0, float y0, float boxWidth, float boxHeight, float thickness, float tLeft, float tRight, float tTop, float tBottom)
          build square box: 4 walls
 void clearAll()
          remove all elements from the panel
 void clearBackgroundIcon()
           
 void clearGrid()
           
 void clearOriginElement()
           
 void closeEverything()
           
 void continueSteps()
          continue simulation
 DomainView create(java.lang.String viewSpecification)
           
 void createPopupMenu(JWorldElement element)
           
 void createPopupMenu(PassiveElement element)
           
protected  void createWorld()
           
protected  void createWorld(float calcDT, float drawDT)
           
 void doOneStep()
          make only one simulation's step
static void drawDashedStraightLine(java.awt.Graphics g, int x1, int y1, int x2, int y2, int delta, int skipPoint)
          used for drawing velocity projections
 void drawStaticPart(java.awt.Graphics g)
           
 JAtom findAtom(float x, float y)
           
 JDaemon findDaemon(float x, float y)
           
 CCDraggable findDaemonDraggable(float x, float y)
           
static java.awt.Frame findNearestFrame(java.awt.Component c)
           
 PassiveElement findPassiveElement(float x, float y)
           
 int getArrowsVelDragMode()
           
 int getAtomsDragMode()
          getting drag mode for the atoms
 java.awt.Point getClosestPointInside(java.awt.Point p)
           
 int getDaemonsDragMode()
          determine drag mode for the daemons
 boolean getEditable()
           
 DomainEngine getEngine()
           
 int getForcesDragMode()
          determine drag mode for the forces
 PassiveGrid getGrid()
           
 java.awt.Image getGUIPanelOffscreen()
           
 java.awt.Image getGUIPanelStaticImage()
           
 CCCoordinateTuner getPanelToWorldCoordinateTuner()
           
protected  float getPanelXfromWorldX(float worldX)
          Converts x coordinate from world coordinate system to GUIPanel coordinate system
protected  float getPanelYfromWorldY(float worldY)
          Converts y coordinate from world coordinate system to GUIPanel coordinate system
 java.awt.Image getPartOffImage(int x, int y, int w, int h)
           
 int getSelectedElemDragMode()
           
 JWorldElement getSelectedElement()
           
 int getSimulationState()
           
 java.util.Vector getViewActions()
           
 java.util.Vector getViewEvents()
           
 java.util.Vector getViewMethods()
           
 int getWallsDragMode()
          determine drag mode for the daemons
 JWorldElement getWatchableElement()
           
 int getWatchMode()
           
 JPartWorld getWorldModel()
           
 CCCoordinateTuner getWorldToPanelCoordinateTuner()
           
protected  float getWorldXfromPanelX(float panelX)
          Converts x coordinate from GUIPanel coordinate system to world coordinate system
protected  float getWorldYfromPanelY(float panelY)
          Converts y coordinate from GUIPanel coordinate system to world coordinate system
 void hideCM()
          hide Center of Mass point
 boolean isConstrainDragInside()
           
 boolean isDoAACollisions()
           
 boolean isDoAWCollisions()
           
 boolean isElementInside(JWorldElement elem)
           
 boolean isElementSelected(JWorldElement elem)
           
 boolean isElementsSelectable()
           
 boolean isFocusTraversable()
          Returns the value of a flag that indicates whether this component can be traversed using Tab or Shift-Tab keyboard focus traversal.
 boolean isPassiveElementInside(PassiveElement elem)
           
 boolean isPointInside(float x, float y)
           
 boolean isRunning()
          isRunning
 boolean isTracePossible()
           
 void nextStep()
          nextStep shouldn't be called directly calculates next simulation's step
 void paintComponent(java.awt.Graphics g)
          shouldn't be called directly
 void propertyChange(java.beans.PropertyChangeEvent evt)
           
 void redraw()
          redraw GUIPanel content, actually calls super class repaint method
 void release(DomainView view)
           
 void removeAllAtomsFromArea(int xa, int ya, int wa, int ha)
           
 void removeAtom(JAtom atom)
          remove the given atom from the panel
 void removeAtom(java.lang.String name)
          remove the atom with given name from the panel
 void removeCollisionsListener(CollisionsListener l)
           
 void removeDaemon(JDaemon daemon)
          remove the given daemon from the panel
 void removeDaemon(java.lang.String name)
          remove the daemon of the given name from the panel
 void removeEditableProperty(java.lang.String className, java.lang.String propName)
           
 void removeElement(JWorldElement element)
          remove the element from the panel
 void removePassiveElement(PassiveElement pe)
          add passive element(Line, Icon, Rectangle, Text) into the panel
 void removePassiveElements()
          remove all passive elements from the panel
 void removeRigidBox(JRigidBox box)
          remove the given box from the panel
 void removeRigidBox(java.lang.String name)
          remove the box of the given name from the panel
 void removeWall(JWall wall)
          remove the given wall from the panel
 void removeWall(java.lang.String name)
          remove the wall with given name from the panel
 void reset()
          reset simulation
 void resetStaticImage()
          clear all possible elements from static part of GUIPanel usually that clears all traces;
 void restore(java.io.InputStream input)
           
 void restore(java.io.Reader reader)
           
 void save(java.io.OutputStream output)
           
 void save(java.io.Writer writer)
           
 org.w3c.dom.Element serializeAsElement(org.w3c.dom.Document document)
           
 void setActivity(java.lang.Object activity)
           
 void setArrowsVelDragMode(int arrowsVelDragMode)
           
 void setAtomsDragMode(int atomsDragMode)
          setting drag mode for the atoms
 void setBackground(java.awt.Color col)
           
 void setBackgroundIcon(java.lang.String url)
           
 void setBackgroundIcon(java.lang.String url, int x, int y)
           
 void setBackgroundQTIcon(java.lang.String url)
           
 void setBackgroundQTIcon(java.lang.String url, int x, int y)
           
 void setConstrainDragInside(boolean b)
           
 void setDaemonsDragMode(int daemonDragMode)
          setting drag mode for the daemons
 void setDoAACollisions(boolean doCollisions)
           
 void setDoAWCollisions(boolean doCollisions)
           
 void setEditable(boolean editable)
           
 void setEditableProperty(java.lang.String className, java.lang.String propName, boolean display)
           
 void setElementsSelectable(boolean b)
           
 void setElemsPropertiesPanel(PropertyPanel pan)
           
 void setForcesDragMode(int forceDragMode)
          setting drag mode for the forces
 void setGrid()
           
 void setGrid(int x, int y, int width, int height)
           
 void setNeedScreenResolution(float needScreenResolution)
           
 void setNeedScreenResolution(float newValue, java.awt.Component c)
           
 void setOriginElement(CCMassive originElement)
           
 void setPropertiesPanel(PropertyPanel pan)
           
 void setPropertyForAlElementsInRect(java.lang.String property, int type, float x, float y, float w, float h, java.lang.Object val)
           
 void setSelectedElemDragMode(int d)
           
 void setSelectedElement(JWorldElement elem)
           
 void setSize(int width, int height)
          Resizes this component so that it has width width and height.
 void setSnapToGrid(boolean atom, boolean velocity)
           
 void setSnapToGrid(boolean atom, boolean velocity, int scaleX, int scaleY)
           
 void setTracePossible(boolean tracePossible)
          set GUIPanel trace property
 void setTransformParam(float xtransform, float ytransform)
           
 void setWallsDragMode(int wallDragMode)
          setting drag mode for the walls
 void setWatchableElement(JWorldElement watchableElement)
           
 void setWatchMode(int wm)
           
 void setWorld(JPartWorld newWorld)
           
 void setWorldAperture(float waperture, float haperture)
           
 void setWorldOrigin(float xorigin, float yorigin)
           
 void showCM()
          show Center of Mass point Center of Mass will be represented as point
 void showCM(boolean showCMCross)
          show Center of Mass point
 void start()
          start simulation
 void stepFinished(StepEvent evt)
           
 void stop()
          stop simulation
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tracePossible

protected boolean tracePossible

DRAG_MODE_NORMAL

public static final int DRAG_MODE_NORMAL

DRAG_MODE_VEL

public static final int DRAG_MODE_VEL

DRAG_MODE_ONLYVX

public static final int DRAG_MODE_ONLYVX

DRAG_MODE_ONLYVY

public static final int DRAG_MODE_ONLYVY

DRAG_MODE_NONE

public static final int DRAG_MODE_NONE

DRAG_MODE_DAEMON

public static final int DRAG_MODE_DAEMON

DRAG_MODE_FORCE

public static final int DRAG_MODE_FORCE

DRAG_MODE_FORCEMAGNITUDE

public static final int DRAG_MODE_FORCEMAGNITUDE

DRAG_MODE_ROTATE

public static final int DRAG_MODE_ROTATE

atomsDragMode

protected int atomsDragMode

DRAG_ARROW_VEL_NONE

public static final int DRAG_ARROW_VEL_NONE

DRAG_ARROW_VEL_ONLYX

public static final int DRAG_ARROW_VEL_ONLYX

DRAG_ARROW_VEL_ONLYY

public static final int DRAG_ARROW_VEL_ONLYY

DRAG_ARROW_VEL_XY

public static final int DRAG_ARROW_VEL_XY

arrowsVelDragMode

protected int arrowsVelDragMode

daemonsDragMode

protected int daemonsDragMode

forcesDragMode

protected int forcesDragMode

wallsDragMode

protected int wallsDragMode

editable

protected boolean editable

constrainDragInside

protected boolean constrainDragInside

elementsSelectable

protected boolean elementsSelectable

df

public static java.text.DecimalFormat df

WATCH_MODE_LEFT_TOP

public static final int WATCH_MODE_LEFT_TOP

WATCH_MODE_LEFT_BOTTOM

public static final int WATCH_MODE_LEFT_BOTTOM

WATCH_MODE_RIGHT_TOP

public static final int WATCH_MODE_RIGHT_TOP

WATCH_MODE_RIGHT_BOTTOM

public static final int WATCH_MODE_RIGHT_BOTTOM

WATCH_MODE_CROSS

public static final int WATCH_MODE_CROSS

activity

protected java.lang.Object activity
Constructor Detail

GUIPanel

public GUIPanel()
GUIPanel constructor creates instance of GUIPanel
Method Detail

getPanelToWorldCoordinateTuner

public CCCoordinateTuner getPanelToWorldCoordinateTuner()

getWorldToPanelCoordinateTuner

public CCCoordinateTuner getWorldToPanelCoordinateTuner()

getGUIPanelOffscreen

public java.awt.Image getGUIPanelOffscreen()

getGUIPanelStaticImage

public java.awt.Image getGUIPanelStaticImage()

getEditable

public boolean getEditable()

setEditable

public void setEditable(boolean editable)

setSize

public void setSize(int width,
                    int height)
Resizes this component so that it has width width and height.
Overrides:
setSize in class java.awt.Component
Parameters:
width - The new width of this component in pixels.
height - The new height of this component in pixels.
See Also:
#java.awt.Component#setSize

isFocusTraversable

public boolean isFocusTraversable()
Returns the value of a flag that indicates whether this component can be traversed using Tab or Shift-Tab keyboard focus traversal. If this method returns "false", this component may still request the keyboard focus using requestFocus(), but it will not automatically be assigned focus during tab traversal.
Overrides:
isFocusTraversable in class javax.swing.JComponent
Returns:
true if this component is focus-traverable; false otherwise.
See Also:
#java.awt.Component#isFocusTraversable

findAtom

public JAtom findAtom(float x,
                      float y)

findDaemon

public JDaemon findDaemon(float x,
                          float y)

findDaemonDraggable

public CCDraggable findDaemonDraggable(float x,
                                       float y)

setOriginElement

public void setOriginElement(CCMassive originElement)

clearOriginElement

public void clearOriginElement()

getPanelXfromWorldX

protected float getPanelXfromWorldX(float worldX)
Converts x coordinate from world coordinate system to GUIPanel coordinate system
Parameters:
worldX - The x coordinate (world coordinate)
Returns:
x coordinate in GUIPanel coordinate system

getPanelYfromWorldY

protected float getPanelYfromWorldY(float worldY)
Converts y coordinate from world coordinate system to GUIPanel coordinate system
Parameters:
worldY - The y coordinate (world coordinate)
Returns:
y coordinate in GUIPanel coordinate system

getWorldXfromPanelX

protected float getWorldXfromPanelX(float panelX)
Converts x coordinate from GUIPanel coordinate system to world coordinate system
Parameters:
worldX - The y coordinate (GUIPanel coordinate)
Returns:
x coordinate in GUIPanel coordinate system

getWorldYfromPanelY

protected float getWorldYfromPanelY(float panelY)
Converts y coordinate from GUIPanel coordinate system to world coordinate system
Parameters:
worldY - The y coordinate (GUIPanel coordinate)
Returns:
x coordinate in GUIPanel coordinate system

setWorldOrigin

public void setWorldOrigin(float xorigin,
                           float yorigin)

setTransformParam

public void setTransformParam(float xtransform,
                              float ytransform)

setWorldAperture

public void setWorldAperture(float waperture,
                             float haperture)

findPassiveElement

public PassiveElement findPassiveElement(float x,
                                         float y)

removeElement

public void removeElement(JWorldElement element)
remove the element from the panel
Parameters:
element - the element to be removed

removeAllAtomsFromArea

public void removeAllAtomsFromArea(int xa,
                                   int ya,
                                   int wa,
                                   int ha)

removeAtom

public void removeAtom(java.lang.String name)
remove the atom with given name from the panel
Parameters:
name - name of the atom to be removed
See Also:
JAtom

removeAtom

public void removeAtom(JAtom atom)
remove the given atom from the panel
Parameters:
atom - the atom to be removed
See Also:
JAtom

removeWall

public void removeWall(java.lang.String name)
remove the wall with given name from the panel
Parameters:
name - name of the wall to be removed
See Also:
JWall

removeWall

public void removeWall(JWall wall)
remove the given wall from the panel
Parameters:
wall - the wall to be removed
See Also:
JWall

removeRigidBox

public void removeRigidBox(JRigidBox box)
remove the given box from the panel
Parameters:
box - the box to be removed
See Also:
JRigidBox

removeRigidBox

public void removeRigidBox(java.lang.String name)
remove the box of the given name from the panel
Parameters:
name - name of the box to be removed
See Also:
JRigidBox

removeDaemon

public void removeDaemon(JDaemon daemon)
remove the given daemon from the panel
Parameters:
daemon - the daemon to be removed
See Also:
JDaemon

removeDaemon

public void removeDaemon(java.lang.String name)
remove the daemon of the given name from the panel
Parameters:
name - name of the daemon to be removed
See Also:
JDaemon

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Deprecated.  

ActionListener's method implementation
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - ActionEvent

createWorld

protected void createWorld()

createWorld

protected void createWorld(float calcDT,
                           float drawDT)

setWorld

public void setWorld(JPartWorld newWorld)

getWorldModel

public JPartWorld getWorldModel()
Returns:
instance of JPartWorld class that contains information about
all atoms an walls added to the panel
See Also:
JPartWorld

addElement

public void addElement(JWorldElement element)
                throws java.lang.Exception
add element into the panel
Parameters:
element - element to add
See Also:
JPartWorld.addWorldElement(org.concord.collisions.engine.JWorldElement)

addPassiveElement

public void addPassiveElement(PassiveElement pe)
add passive element(Line, Icon, Rectangle, Text) into the panel
Parameters:
pe - element to add
See Also:
PassiveElement

removePassiveElement

public void removePassiveElement(PassiveElement pe)
add passive element(Line, Icon, Rectangle, Text) into the panel
Parameters:
pe - element to add
See Also:
PassiveElement

removePassiveElements

public void removePassiveElements()
remove all passive elements from the panel
See Also:
PassiveElement

clearAll

public void clearAll()
remove all elements from the panel
See Also:
PassiveElement, org.concord.collisions.engine.world#clearWorld

resetStaticImage

public void resetStaticImage()
clear all possible elements from static part of GUIPanel usually that clears all traces;

getPartOffImage

public java.awt.Image getPartOffImage(int x,
                                      int y,
                                      int w,
                                      int h)

setNeedScreenResolution

public void setNeedScreenResolution(float needScreenResolution)

setNeedScreenResolution

public void setNeedScreenResolution(float newValue,
                                    java.awt.Component c)

drawStaticPart

public void drawStaticPart(java.awt.Graphics g)

setBackground

public void setBackground(java.awt.Color col)
Overrides:
setBackground in class javax.swing.JComponent

paintComponent

public void paintComponent(java.awt.Graphics g)
shouldn't be called directly
Overrides:
paintComponent in class javax.swing.JComponent

redraw

public void redraw()
redraw GUIPanel content, actually calls super class repaint method

reset

public void reset()
reset simulation
Specified by:
reset in interface CCSimulator
See Also:
JPartWorld.reset()

stop

public void stop()
stop simulation
Specified by:
stop in interface CCSimulator
See Also:
JPartWorld.stop()

continueSteps

public void continueSteps()
continue simulation
Specified by:
continueSteps in interface CCSimulator
See Also:
JPartWorld.stop()

doOneStep

public void doOneStep()
make only one simulation's step
Specified by:
doOneStep in interface CCSimulator
See Also:
JPartWorld.doOneStep()

nextStep

public void nextStep()
nextStep shouldn't be called directly calculates next simulation's step
Specified by:
nextStep in interface CCSimulator

isRunning

public boolean isRunning()
isRunning
Specified by:
isRunning in interface CCSimulator
Returns:
true if simulation is running or false if simulation was reset

getSimulationState

public int getSimulationState()
Specified by:
getSimulationState in interface CCSimulator

start

public void start()
start simulation
Specified by:
start in interface CCSimulator
See Also:
JPartWorld.start()

buildBox

public JWall[] buildBox(float x0,
                        float y0,
                        float boxWidth,
                        float boxHeight,
                        float thickness)
build square box: 4 walls
Parameters:
x0 - x coordinate of top left corner of the box
y0 - y coordinate of top left corner of the box
boxWidth - width of the box
boxHeight - height of the box
thickness - thickness of the walls
Returns:
walls array [0] left; [1] right; [2] top; [3] bottom
See Also:
JWall

buildBox

public JWall[] buildBox(float x0,
                        float y0,
                        float boxWidth,
                        float boxHeight,
                        float thickness,
                        float tLeft,
                        float tRight,
                        float tTop,
                        float tBottom)
build square box: 4 walls
Parameters:
x0 - x coordinate of top left corner of the box
y0 - y coordinate of top left corner of the box
boxWidth - width of the box
boxHeight - height of the box
thickness - thickness of the walls
tLeft - temperature of the left wall
tRight - temperature of the right wall
tTop - temperature of the top wall
tBottom - temperature of the bottom wall
Returns:
walls array [0] left; [1] right; [2] top; [3] bottom
See Also:
JWall

setPropertyForAlElementsInRect

public void setPropertyForAlElementsInRect(java.lang.String property,
                                           int type,
                                           float x,
                                           float y,
                                           float w,
                                           float h,
                                           java.lang.Object val)
Parameters:
type - kind of particle could be JPartWorld.TYPE_ATOM or JPartWorld.TYPE_WALL
See Also:
JPartWorld.TYPE_ATOM, JPartWorld.TYPE_WALL, JPartWorld.setPropertyForAtomsInRect(java.lang.String, float, float, float, float, java.lang.Object), JPartWorld.setPropertyForWallsInRect(java.lang.String, float, float, float, float, java.lang.Object)

addCollisionsListener

public void addCollisionsListener(CollisionsListener l)
See Also:
JPartWorld.addCollisionsListener(org.concord.collisions.event.CollisionsListener)

removeCollisionsListener

public void removeCollisionsListener(CollisionsListener l)
See Also:
JPartWorld.removeCollisionsListener(org.concord.collisions.event.CollisionsListener)

setTracePossible

public void setTracePossible(boolean tracePossible)
set GUIPanel trace property
Parameters:
tracePossible - if parameter is true, GUIPanel will support the drawing atom's traces

isTracePossible

public boolean isTracePossible()
Returns:
current value of tracePossible

createPopupMenu

public void createPopupMenu(JWorldElement element)

createPopupMenu

public void createPopupMenu(PassiveElement element)

drawDashedStraightLine

public static void drawDashedStraightLine(java.awt.Graphics g,
                                          int x1,
                                          int y1,
                                          int x2,
                                          int y2,
                                          int delta,
                                          int skipPoint)
used for drawing velocity projections
Parameters:
g - Graphics where line should be drawn
x1 - start point x coordinate
y1 - start point y coordinate
x2 - end point x coordinate
y2 - end point y coordinate
delta - number of pixels to draw
skipPoint - number of pixels to skip

showCM

public void showCM()
show Center of Mass point Center of Mass will be represented as point

showCM

public void showCM(boolean showCMCross)
show Center of Mass point
Parameters:
showCMCross - if true Center of Mass will be represented as cross if false Center of Mass will be represented as point

hideCM

public void hideCM()
hide Center of Mass point

setAtomsDragMode

public void setAtomsDragMode(int atomsDragMode)
setting drag mode for the atoms
Parameters:
desired - drag mode: DRAG_MODE_NORMAL - moving atom DRAG_MODE_VEL - changing atom's velocity

getAtomsDragMode

public int getAtomsDragMode()
getting drag mode for the atoms
Returns:
current drag mode: DRAG_MODE_NORMAL - moving atom DRAG_MODE_VEL - changing atom's velocity

setDaemonsDragMode

public void setDaemonsDragMode(int daemonDragMode)
setting drag mode for the daemons
Parameters:
desired - drag mode: DRAG_MODE_NORMAL - moving daemon DRAG_MODE_VEL - changing daemon's velocity DRAG_MODE_DAEMON - changing daemon's specific thing for example for booster it's the delta velocity for force daemons it's the force for displ daemons it's the arrow length

getDaemonsDragMode

public int getDaemonsDragMode()
determine drag mode for the daemons
Returns:
current drag mode: DRAG_MODE_NORMAL - moving daemon DRAG_MODE_VEL - changing daemon's velocity DRAG_MODE_DAEMON - changing daemon's specific thing for example for booster it's the delta velocity and for force daemons it's the force

setForcesDragMode

public void setForcesDragMode(int forceDragMode)
setting drag mode for the forces
Parameters:
desired - drag mode: DRAG_MODE_NORMAL - snap force to another atom or element DRAG_MODE_FORCE - changing daemon's velocity DRAG_MODE_FORCEMAGNITUDE - changing daemon's velocity

getForcesDragMode

public int getForcesDragMode()
determine drag mode for the forces
Returns:
current drag mode: DRAG_MODE_NORMAL - snap force to another atom or element DRAG_MODE_FORCE - changing daemon's velocity DRAG_MODE_FORCEMAGNITUDE - changing daemon's velocity

setWallsDragMode

public void setWallsDragMode(int wallDragMode)
setting drag mode for the walls
Parameters:
desired - drag mode: DRAG_MODE_NORMAL - moving wall DRAG_MODE_ROTATE - rotate wall around one edge as pivot

getWallsDragMode

public int getWallsDragMode()
determine drag mode for the daemons
Returns:
current drag mode: DRAG_MODE_NORMAL - moving daemon DRAG_MODE_VEL - changing daemon's velocity DRAG_MODE_DAEMON - changing daemon's specific thing for example for booster it's the delta velocity and for force daemons it's the force

setArrowsVelDragMode

public void setArrowsVelDragMode(int arrowsVelDragMode)

getArrowsVelDragMode

public int getArrowsVelDragMode()

setSelectedElemDragMode

public void setSelectedElemDragMode(int d)

getSelectedElemDragMode

public int getSelectedElemDragMode()

isDoAACollisions

public boolean isDoAACollisions()

setDoAACollisions

public void setDoAACollisions(boolean doCollisions)

isDoAWCollisions

public boolean isDoAWCollisions()

setDoAWCollisions

public void setDoAWCollisions(boolean doCollisions)

getWatchableElement

public JWorldElement getWatchableElement()

setWatchableElement

public void setWatchableElement(JWorldElement watchableElement)

getWatchMode

public int getWatchMode()

setWatchMode

public void setWatchMode(int wm)

stepFinished

public void stepFinished(StepEvent evt)
Specified by:
stepFinished in interface StepListener

setGrid

public void setGrid()

setGrid

public void setGrid(int x,
                    int y,
                    int width,
                    int height)

getGrid

public PassiveGrid getGrid()

clearGrid

public void clearGrid()

setBackgroundIcon

public void setBackgroundIcon(java.lang.String url)

setBackgroundIcon

public void setBackgroundIcon(java.lang.String url,
                              int x,
                              int y)

setBackgroundQTIcon

public void setBackgroundQTIcon(java.lang.String url)

setBackgroundQTIcon

public void setBackgroundQTIcon(java.lang.String url,
                                int x,
                                int y)

clearBackgroundIcon

public void clearBackgroundIcon()

setSnapToGrid

public void setSnapToGrid(boolean atom,
                          boolean velocity)

setSnapToGrid

public void setSnapToGrid(boolean atom,
                          boolean velocity,
                          int scaleX,
                          int scaleY)

isElementInside

public boolean isElementInside(JWorldElement elem)

isPassiveElementInside

public boolean isPassiveElementInside(PassiveElement elem)

isPointInside

public boolean isPointInside(float x,
                             float y)

getClosestPointInside

public java.awt.Point getClosestPointInside(java.awt.Point p)

findNearestFrame

public static java.awt.Frame findNearestFrame(java.awt.Component c)

setConstrainDragInside

public void setConstrainDragInside(boolean b)

isConstrainDragInside

public boolean isConstrainDragInside()

create

public DomainView create(java.lang.String viewSpecification)
Specified by:
create in interface DomainView

release

public void release(DomainView view)
Specified by:
release in interface DomainView

getViewMethods

public java.util.Vector getViewMethods()
Specified by:
getViewMethods in interface DomainView

getViewEvents

public java.util.Vector getViewEvents()
Specified by:
getViewEvents in interface DomainView

getViewActions

public java.util.Vector getViewActions()
Specified by:
getViewActions in interface DomainView

getEngine

public DomainEngine getEngine()
Specified by:
getEngine in interface DomainView

setActivity

public void setActivity(java.lang.Object activity)
Specified by:
setActivity in interface DomainView

closeEverything

public void closeEverything()
Specified by:
closeEverything in interface DomainView

save

public void save(java.io.Writer writer)
Specified by:
save in interface DomainPersistentElement

restore

public void restore(java.io.Reader reader)
Specified by:
restore in interface DomainPersistentElement

save

public void save(java.io.OutputStream output)
Specified by:
save in interface DomainPersistentElement

restore

public void restore(java.io.InputStream input)
Specified by:
restore in interface DomainPersistentElement

serializeAsElement

public org.w3c.dom.Element serializeAsElement(org.w3c.dom.Document document)
Specified by:
serializeAsElement in interface DomainPersistentElement

setElementsSelectable

public void setElementsSelectable(boolean b)

isElementsSelectable

public boolean isElementsSelectable()

getSelectedElement

public JWorldElement getSelectedElement()

isElementSelected

public boolean isElementSelected(JWorldElement elem)

setSelectedElement

public void setSelectedElement(JWorldElement elem)

setElemsPropertiesPanel

public void setElemsPropertiesPanel(PropertyPanel pan)

setPropertiesPanel

public void setPropertiesPanel(PropertyPanel pan)

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

setEditableProperty

public void setEditableProperty(java.lang.String className,
                                java.lang.String propName,
                                boolean display)

addEditableProperty

public void addEditableProperty(java.lang.String className,
                                java.lang.String propName)

addEditableProperty

public void addEditableProperty(java.lang.String className,
                                java.lang.String propName,
                                java.lang.String propLabel)
                         throws java.lang.IllegalArgumentException

removeEditableProperty

public void removeEditableProperty(java.lang.String className,
                                   java.lang.String propName)
                            throws java.lang.IllegalArgumentException