fr.esrf.tangoatk.widget.util.jdraw
Class JDGroup

java.lang.Object
  extended by fr.esrf.tangoatk.widget.util.jdraw.JDObject
      extended by fr.esrf.tangoatk.widget.util.jdraw.JDRectangular
          extended by fr.esrf.tangoatk.widget.util.jdraw.JDGroup

public class JDGroup
extends JDRectangular

JDraw Group graphic object. A group can contains all JDObject including group. If the group is scaled, all object within this group will also be scaled.

Here is an exmaple of few group :

JDGroup examples


Field Summary
 
Fields inherited from class fr.esrf.tangoatk.widget.util.jdraw.JDObject
FILL_STYLE_DOT_PATTERN_1, FILL_STYLE_DOT_PATTERN_2, FILL_STYLE_DOT_PATTERN_3, FILL_STYLE_GRADIENT, FILL_STYLE_LARGE_CROSS_HATCH, FILL_STYLE_LARGE_LEFT_HATCH, FILL_STYLE_LARGE_RIGHT_HATCH, FILL_STYLE_NONE, FILL_STYLE_SMALL_CROSS_HATCH, FILL_STYLE_SMALL_LEFT_HATCH, FILL_STYLE_SMALL_RIGHT_HATCH, FILL_STYLE_SOLID, LINE_STYLE_DASH, LINE_STYLE_DASH_DOT, LINE_STYLE_DOT, LINE_STYLE_LONG_DASH, LINE_STYLE_SOLID, VALUE_CHANGE_ON_XDRAG_LEFT, VALUE_CHANGE_ON_XDRAG_RIGHT, VALUE_CHANGE_ON_YDRAG_BOTTOM, VALUE_CHANGE_ON_YDRAG_TOP, VALUE_INC_ON_CLICK, VALUE_INC_ON_PRESSRELEASE
 
Constructor Summary
JDGroup(java.lang.String objectName, java.util.Vector o)
          Construct a group.
 
Method Summary
 JDObject copy(int x, int y)
          Returns a copy of this object at the specified location.
 void generateJavaClass(java.io.FileWriter f)
          Generates a Java class capable to paint this object using only java awt functions.
 JDObject getChildAt(int idx)
          Returns the child at the specifed position.
 java.util.Vector getChildren()
          Returns a Vector containing all children of this group.
 int getChildrenNumber()
          Returns the number of child of this group.
 void getObjectsByName(java.util.Vector result, java.lang.String name, boolean recurseGroup)
          Returns all objects having the given name.
 boolean isInsideObject(int x, int y)
          Determines whether the specified point is inside this object.
 boolean isProgrammed()
          Determines whether this object has a programmed behavior.
 void moveSummit(int id, double x, double y)
          Moves the specifed summit to the specified position.
 void paint(JDrawEditor parent, java.awt.Graphics g)
          Paints this object.
 void restoreTransform()
          Restore original shape previously backuped by saveTransform
 void rotate90(double x, double y)
          Rotate the object by 90deg.
 void saveTransform()
          Backup the shape.
 void setAntiAlias(boolean alias)
          Sets the anti aliasing for all objects of this group
 void setBackground(java.awt.Color c)
          Sets the background of this group, Apply it on all children.
 void setChildrenList(java.util.Vector o)
          Sets the children of this group.
 void setFillStyle(int s)
          Sets the fill style of this group, Apply it on all children.
 void setForeground(java.awt.Color c)
          Sets the foreground of this group, Apply it on all children.
 void setInitValue(int v)
          Sets the init value of this object.
 void setInverseShadow(boolean b)
          Sets the inverse shadow of this group, Apply it on all children.
 void setLineStyle(int s)
          Sets the line style of this group, Apply it on all children.
 void setLineWidth(int w)
          Sets the line width of this group, Apply it on all children.
 void setMaxValue(int v)
          Sets the max value of this object.
 void setMinValue(int v)
          Sets the minimum value of this object.
 void setShadow(boolean b)
          Sets the shadow of this group, Apply it on all children.
 void setShadowWidth(int w)
          Sets the shadow width of this group, Apply it on all children.
 void setVisible(boolean b)
          Shows or hides this object, Apply it on all children.
 
Methods inherited from class fr.esrf.tangoatk.widget.util.jdraw.JDObject
addExtension, addMouseListener, addValueListener, centerOrigin, clearMouseListener, clearValueListener, getBackground, getBackgroundMapper, getBoundRect, getExtendedParam, getExtendedParam, getExtendedParamDesc, getExtendedParamIndex, getExtendedParamName, getExtendedParamNumber, getFillStyle, getForeground, getForegroundMapper, getHTranslationMapper, getInitValue, getInvertShadowMapper, getLineStyle, getLineWidth, getMaxValue, getMinValue, getName, getOrigin, getShadowWidth, getSummit, getSummitNumber, getValue, getValueChangeMode, getVisibilityMapper, getVTranslationMapper, hasBackgroundMapper, hasExtendedParam, hasForegroundMapper, hasHTranslationMapper, hasInverseShadow, hasInvertShadowMapper, hasShadow, hasVisibilityMapper, hasVTranslationMapper, isAntiAliased, isFixedExtendedParam, isInteractive, isVisible, moveSummitH, moveSummitV, preRefresh, refresh, removeExtension, removeMouseListener, removeValueListener, scale, scaleTranslate, setBackgroundMapper, setExtendedParam, setExtendedParam, setExtensionList, setForegroundMapper, setGradientFillParam, setHTranslationMapper, setInteractive, setInvertShadowMapper, setName, setOrigin, setValue, setValueChangeMode, setVisibilityMapper, setVTranslationMapper, toString, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JDGroup

public JDGroup(java.lang.String objectName,
               java.util.Vector o)
Construct a group.

Parameters:
objectName - Group name.
o - Vector of JDObject to be grouped.
Method Detail

copy

public JDObject copy(int x,
                     int y)
Description copied from class: JDObject
Returns a copy of this object at the specified location.

Specified by:
copy in class JDObject
Parameters:
x - Horizontal position of the copied object (pixel)
y - Vertical Position of the copied object (pixel)
Returns:
The copy of this object.

paint

public void paint(JDrawEditor parent,
                  java.awt.Graphics g)
Description copied from class: JDObject
Paints this object.

Overrides:
paint in class JDRectangular
Parameters:
parent - JdrawEditor parent (Can be null except for JDSwingObject)
g - the specified Graphics window

isInsideObject

public boolean isInsideObject(int x,
                              int y)
Description copied from class: JDObject
Determines whether the specified point is inside this object.

Overrides:
isInsideObject in class JDObject
Parameters:
x - X coordinate (pixel)
y - Y coordinate (pixel)

restoreTransform

public void restoreTransform()
Description copied from class: JDObject
Restore original shape previously backuped by saveTransform

Overrides:
restoreTransform in class JDObject
See Also:
JDObject.saveTransform()

saveTransform

public void saveTransform()
Description copied from class: JDObject
Backup the shape. This can be usefull when making scaling animation, after multiple scale the rounding may result in deformed shape. To avoid this you can use saveTransform() and restoreTransform(). Note: This is done once when JDrawEditor.loadFile() is called().

Overrides:
saveTransform in class JDObject
See Also:
JDObject.restoreTransform()

rotate90

public void rotate90(double x,
                     double y)
Description copied from class: JDObject
Rotate the object by 90deg. A call to refresh() is needed after transformation.

Overrides:
rotate90 in class JDRectangular
Parameters:
x - Rotation center horizontal pos
y - Rotation center vertical pos
See Also:
JDObject.refresh()

moveSummit

public void moveSummit(int id,
                       double x,
                       double y)
Description copied from class: JDObject
Moves the specifed summit to the specified position. When using moveSummit() to animate objects, A call to refresh() of this object may be needed.

Overrides:
moveSummit in class JDRectangular
Parameters:
id - Summit index
x - Absolute X position
y - Absolute Y position
See Also:
JDObject.refresh()

setBackground

public void setBackground(java.awt.Color c)
Sets the background of this group, Apply it on all children.

Overrides:
setBackground in class JDObject
Parameters:
c - Background color.
See Also:
JDObject.setBackground(java.awt.Color)

setForeground

public void setForeground(java.awt.Color c)
Sets the foreground of this group, Apply it on all children.

Overrides:
setForeground in class JDObject
Parameters:
c - Foreground color.
See Also:
JDObject.setForeground(java.awt.Color)

setFillStyle

public void setFillStyle(int s)
Sets the fill style of this group, Apply it on all children.

Overrides:
setFillStyle in class JDObject
Parameters:
s - Fill style.
See Also:
JDObject.setFillStyle(int)

setLineStyle

public void setLineStyle(int s)
Sets the line style of this group, Apply it on all children.

Overrides:
setLineStyle in class JDObject
Parameters:
s - Line style.
See Also:
JDObject.setLineStyle(int)

setAntiAlias

public void setAntiAlias(boolean alias)
Sets the anti aliasing for all objects of this group

Overrides:
setAntiAlias in class JDObject
Parameters:
alias - Anti alias
See Also:
JDObject.setAntiAlias(boolean)

setLineWidth

public void setLineWidth(int w)
Sets the line width of this group, Apply it on all children.

Overrides:
setLineWidth in class JDObject
Parameters:
w - Line width.
See Also:
JDObject.setLineWidth(int)

setShadow

public void setShadow(boolean b)
Sets the shadow of this group, Apply it on all children.

Overrides:
setShadow in class JDObject
Parameters:
b - Shadow flag.
See Also:
JDObject.setShadow(boolean)

setVisible

public void setVisible(boolean b)
Shows or hides this object, Apply it on all children.

Overrides:
setVisible in class JDObject
Parameters:
b - True to show, false otherwise.

setInverseShadow

public void setInverseShadow(boolean b)
Sets the inverse shadow of this group, Apply it on all children.

Overrides:
setInverseShadow in class JDObject
Parameters:
b - Invert shadow flag.
See Also:
JDObject.setInverseShadow(boolean)

setShadowWidth

public void setShadowWidth(int w)
Sets the shadow width of this group, Apply it on all children.

Overrides:
setShadowWidth in class JDObject
Parameters:
w - Shadow width.
See Also:
JDObject.setShadowWidth(int)

setMinValue

public void setMinValue(int v)
Description copied from class: JDObject
Sets the minimum value of this object.

Overrides:
setMinValue in class JDObject
Parameters:
v - Min value
See Also:
JDObject.setInitValue(int), JDObject.setMaxValue(int), JDObject.setValue(int)

setMaxValue

public void setMaxValue(int v)
Description copied from class: JDObject
Sets the max value of this object.

Overrides:
setMaxValue in class JDObject
Parameters:
v - Max value
See Also:
JDObject.setInitValue(int), JDObject.setMinValue(int), JDObject.setValue(int)

setInitValue

public void setInitValue(int v)
Description copied from class: JDObject
Sets the init value of this object.

Overrides:
setInitValue in class JDObject
Parameters:
v - Initial value object.
See Also:
JDObject.setMaxValue(int), JDObject.setMinValue(int), JDObject.setValue(int)

getObjectsByName

public void getObjectsByName(java.util.Vector result,
                             java.lang.String name,
                             boolean recurseGroup)
Description copied from class: JDObject
Returns all objects having the given name.

Overrides:
getObjectsByName in class JDObject
Parameters:
result - Result vector (must be constructed by the caller)
name - JDObject name (Case sensitive)
recurseGroup - true to perform a deep search whithin group, false otherwise.
See Also:
JDrawEditor.getObjectsByName(java.lang.String, boolean)

isProgrammed

public boolean isProgrammed()
Description copied from class: JDObject
Determines whether this object has a programmed behavior. If this object is a JDGroup, the function return true if at least one of grouped JDObject is programmed.

Overrides:
isProgrammed in class JDObject
See Also:
JDObject.setValue(int)

getChildAt

public JDObject getChildAt(int idx)
Returns the child at the specifed position.

Parameters:
idx - Child index

getChildrenNumber

public int getChildrenNumber()
Returns the number of child of this group.


setChildrenList

public void setChildrenList(java.util.Vector o)
Sets the children of this group.

Parameters:
o - Vector of JDObject to be grouped.

getChildren

public java.util.Vector getChildren()
Returns a Vector containing all children of this group.


generateJavaClass

public void generateJavaClass(java.io.FileWriter f)
                       throws java.io.IOException
Generates a Java class capable to paint this object using only java awt functions. It supports only Line and Polyline (or shape that can be converted to polyline) and not all functionality of the JDObject are suppported. Nevertheless, the code keeps the vectorial sizing behavior. Note: All objects named 'body' will have their background color overrided by the color passed to the generated paint() function.

Parameters:
f - file to be saved
Throws:
java.io.IOException