org.opensourcephysics.displayejs
Class GroupDrawable

java.lang.Object
  extended by org.opensourcephysics.displayejs.Group
      extended by org.opensourcephysics.displayejs.GroupDrawable
All Implemented Interfaces:
Drawable, Interactive, Measurable, Drawable3D, InteractionSource, Measurable3D
Direct Known Subclasses:
PoligonsAndTexts, Tank

public class GroupDrawable
extends Group
implements Interactive, Drawable3D, Measurable3D, InteractionSource


Constructor Summary
GroupDrawable()
           
 
Method Summary
 void add(InteractiveElement element)
          Adds an element to the group
 void addListener(InteractionListener _listener)
          Adds the specified interaction listener to receive interaction events to any of its targets from this source
 void draw(DrawingPanel3D _panel, java.awt.Graphics2D _g2, int _index)
          Draws a given Object3D (indicated by its index).
 void draw(DrawingPanel _panel, java.awt.Graphics _g)
          Draws a representation of an object in a drawing panel.
 void drawQuickly(DrawingPanel3D _panel, java.awt.Graphics2D _g2)
          Sketches the drawable
 Interactive findInteractive(DrawingPanel _panel, int _xpix, int _ypix)
           
 Object3D[] getObjects3D(DrawingPanel3D _panel)
          Returns an array of Objects3D to (sort according to its distance and) draw.
 double getXMax()
          Gets the maximum x needed to draw this object.
 double getXMin()
          Gets the minimum x needed to draw this object.
 double getYMax()
          Gets the maximum y needed to draw this object.
 double getYMin()
          Gets the minimum y needed to draw this object.
 double getZMax()
          Gets the maximum z needed to draw this object.
 double getZMin()
          Gets the minimum z needed to draw this object.
 void invokeActions(InteractionEvent _event)
          Invokes actions on all listeners with the prescribed event
 boolean isEnabled()
          Whether any of the targets of this source is enabled
 boolean isEnabled(int _target)
          Whether a particular target of this source is enabled
 boolean isMeasured()
          Determines if information is available to set min/max values.
 void needsToProject(DrawingPanel _panel)
          Tells the drawable that it should reproject its points because this panel has changed its projection parameters.
 void remove(InteractiveElement element)
          removes an element from the group
 void removeAll()
           
 void removeAllListeners()
          Removes all the interaction listeners
 void removeListener(InteractionListener _listener)
          Removes the specified interaction listener
 void setEnabled(boolean _enabled)
          Enables all the targets of this source
 void setEnabled(int _target, boolean _enabled)
          Enables a particular target of this source
 
Methods inherited from class org.opensourcephysics.displayejs.Group
getSizeX, getSizeY, getSizeZ, getX, getY, getZ, isVisible, reportChange, setSizeX, setSizeXY, setSizeXYZ, setSizeY, setSizeZ, setVisible, setX, setXY, setXYZ, setY, setZ
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opensourcephysics.display.Interactive
getX, getY, setX, setXY, setY
 

Constructor Detail

GroupDrawable

public GroupDrawable()
Method Detail

add

public void add(InteractiveElement element)
Adds an element to the group

Parameters:
_element - the InteractiveElement to be added

remove

public void remove(InteractiveElement element)
removes an element from the group

Parameters:
_element - the InteractiveElement to be removed

removeAll

public void removeAll()

setEnabled

public void setEnabled(boolean _enabled)
Description copied from interface: InteractionSource
Enables all the targets of this source

Specified by:
setEnabled in interface Interactive
Specified by:
setEnabled in interface InteractionSource

isEnabled

public boolean isEnabled()
Description copied from interface: InteractionSource
Whether any of the targets of this source is enabled

Specified by:
isEnabled in interface Interactive
Specified by:
isEnabled in interface InteractionSource

setEnabled

public void setEnabled(int _target,
                       boolean _enabled)
Description copied from interface: InteractionSource
Enables a particular target of this source

Specified by:
setEnabled in interface InteractionSource

isEnabled

public boolean isEnabled(int _target)
Description copied from interface: InteractionSource
Whether a particular target of this source is enabled

Specified by:
isEnabled in interface InteractionSource

findInteractive

public Interactive findInteractive(DrawingPanel _panel,
                                   int _xpix,
                                   int _ypix)
Specified by:
findInteractive in interface Interactive

needsToProject

public void needsToProject(DrawingPanel _panel)
Description copied from interface: Drawable3D
Tells the drawable that it should reproject its points because this panel has changed its projection parameters.

Specified by:
needsToProject in interface Drawable3D
Parameters:
_panel - the DrawingPanel that has changed or null if the drawable should update its projection in all possible panels

getObjects3D

public Object3D[] getObjects3D(DrawingPanel3D _panel)
Description copied from interface: Drawable3D
Returns an array of Objects3D to (sort according to its distance and) draw.

Specified by:
getObjects3D in interface Drawable3D

draw

public void draw(DrawingPanel3D _panel,
                 java.awt.Graphics2D _g2,
                 int _index)
Description copied from interface: Drawable3D
Draws a given Object3D (indicated by its index).

Specified by:
draw in interface Drawable3D

drawQuickly

public void drawQuickly(DrawingPanel3D _panel,
                        java.awt.Graphics2D _g2)
Description copied from interface: Drawable3D
Sketches the drawable

Specified by:
drawQuickly in interface Drawable3D

draw

public void draw(DrawingPanel _panel,
                 java.awt.Graphics _g)
Description copied from interface: Drawable
Draws a representation of an object in a drawing panel.

Specified by:
draw in interface Drawable

isMeasured

public boolean isMeasured()
Description copied from interface: Measurable
Determines if information is available to set min/max values. Objects that store data should return false if data is null.

Specified by:
isMeasured in interface Measurable
Returns:
true if min/max values are valid

getXMin

public double getXMin()
Description copied from interface: Measurable
Gets the minimum x needed to draw this object.

Specified by:
getXMin in interface Measurable
Returns:
minimum

getXMax

public double getXMax()
Description copied from interface: Measurable
Gets the maximum x needed to draw this object.

Specified by:
getXMax in interface Measurable
Returns:
maximum

getYMin

public double getYMin()
Description copied from interface: Measurable
Gets the minimum y needed to draw this object.

Specified by:
getYMin in interface Measurable
Returns:
minimum

getYMax

public double getYMax()
Description copied from interface: Measurable
Gets the maximum y needed to draw this object.

Specified by:
getYMax in interface Measurable
Returns:
minimum

getZMin

public double getZMin()
Description copied from interface: Measurable3D
Gets the minimum z needed to draw this object.

Specified by:
getZMin in interface Measurable3D
Returns:
minimum

getZMax

public double getZMax()
Description copied from interface: Measurable3D
Gets the maximum z needed to draw this object.

Specified by:
getZMax in interface Measurable3D
Returns:
maximum

addListener

public void addListener(InteractionListener _listener)
Description copied from interface: InteractionSource
Adds the specified interaction listener to receive interaction events to any of its targets from this source

Specified by:
addListener in interface InteractionSource
See Also:
InteractionListener

removeListener

public void removeListener(InteractionListener _listener)
Description copied from interface: InteractionSource
Removes the specified interaction listener

Specified by:
removeListener in interface InteractionSource
See Also:
InteractionListener

removeAllListeners

public void removeAllListeners()
Description copied from interface: InteractionSource
Removes all the interaction listeners

Specified by:
removeAllListeners in interface InteractionSource

invokeActions

public void invokeActions(InteractionEvent _event)
Description copied from interface: InteractionSource
Invokes actions on all listeners with the prescribed event

Specified by:
invokeActions in interface InteractionSource
See Also:
InteractionEvent