|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimtools.shapes.AbstractShape
jsynoptic.builtin.Abstract1DShape
public abstract class Abstract1DShape
Base class for Lines and the 2D shapes (Polygons and Ellipses)
Nested Class Summary | |
---|---|
static class |
Abstract1DShape.Abstract1DShapePropertiesNames
|
Nested classes/interfaces inherited from class simtools.shapes.AbstractShape |
---|
AbstractShape.AbstractShapePropertiesNames |
Field Summary | |
---|---|
protected boolean |
allowResize
|
protected java.awt.geom.Rectangle2D.Double |
bounds2D
|
protected EndNotificationListener |
delegateEndNotificationListener
|
protected boolean |
dirty
|
protected boolean |
dirtyDrawColor
|
protected java.awt.Rectangle |
dirtyRectangle
|
protected java.awt.Color |
drawColor
|
protected java.awt.Color |
drawDynamicColor
|
protected ColorMapper |
drawMapper
|
protected long |
drawMapperIndex
|
protected DataSource |
drawMapperSource
|
protected boolean |
fixedRatio
|
protected java.lang.String |
link
|
static int |
MIN_SIZE
|
protected double |
ratio
|
static MenuResourceBundle |
resources
|
protected java.awt.Stroke |
stroke
|
protected StrokeParameters |
strokeParams
|
protected AffineTransformData |
transform
|
Fields inherited from class simtools.shapes.AbstractShape |
---|
_h, _ox, _oy, _propertyNames, _w, _x, _y, ANTI_ALIASING, currentDialogBox, FONT_NAMES, listeners, REFRESH_PERIOD |
Fields inherited from interface jsynoptic.base.ContextualActionProvider |
---|
EDITOR_CONTEXT, MOUSE_OUT_CONTEXT, MOUSE_OVER_CONTEXT, MOUSE_PRESSED_CONTEXT, SHAPELIST_CONTEXT, SOURCELIST_CONTEXT |
Constructor Summary | |
---|---|
Abstract1DShape(int ox,
int oy,
int width,
int height)
|
Method Summary | |
---|---|
boolean |
canDoAction(double x,
double y,
java.lang.Object o,
java.lang.String action,
int context)
Returns true if, and only if, it is possible to do the action right now |
protected boolean |
canResize()
Allow resize: it is possible to forbid shape resizing even the allow resize property has been set to true by user. |
protected AbstractShape |
cloneShape()
Performs a copy of the shape This method has to be overriden to deal with concrete shapes |
boolean |
contains(double x,
double y)
|
boolean |
contains(double x,
double y,
double w,
double h)
|
boolean |
contains(java.awt.geom.Point2D p)
|
boolean |
contains(java.awt.geom.Rectangle2D r)
|
JPropertiesPanel |
createPanel()
|
JPropertiesPanel |
createPanel(java.lang.String name)
|
void |
DataSourceIndexRangeChanged(DataSource ds,
long startIndex,
long lastIndex)
Called when the range of valid index changed |
void |
DataSourceInfoChanged(DataSource ds,
DataInfo newInfo)
Called when the information about the data source changed |
void |
DataSourceOrderChanged(DataSource ds,
int newOrder)
If defined, called when the order of the source changed. |
void |
DataSourceReplaced(DataSource oldData,
DataSource newData)
Called when a data source is replaced by another one |
void |
DataSourceValueChanged(DataSource ds,
long minIndex,
long maxIndex)
Called when at least a value changed in the data source. |
void |
DataSourceValueRangeChanged(DataSource ds)
Called when the range of possible values changed, if defined. |
boolean |
doAction(double x,
double y,
java.lang.Object o,
java.lang.String action,
javax.swing.undo.CompoundEdit undoableEdit)
Do one of the actions previously declared by getAction. |
boolean |
doCollectiveAction(DiagramSelection sel,
double x,
double y,
java.lang.Object o,
java.lang.String action,
javax.swing.undo.CompoundEdit undoableEdit)
Do one of the collective actions previously declared by getCollectiveActions. |
void |
draw(java.awt.Graphics2D g)
Draws the shape |
protected void |
drawHook(java.awt.Graphics2D g,
boolean shapeDrawn)
For subclasses, called before restoring original graphics properties, after the delegate shape is drawn if shapeDrawn is true, or after saving the current context, before the delegate shape is drawn if shapeDrawn is false |
java.lang.String[] |
getActions(double x,
double y,
java.lang.Object o,
int context)
Return list of possible actions the contect information may be used, or not. |
java.awt.Rectangle |
getBounds()
|
java.awt.geom.Rectangle2D |
getBounds2D()
|
java.util.LinkedHashMap |
getCollectiveActions(DiagramSelection sel,
double x,
double y,
java.lang.Object o,
int context)
Return list of possible collective actions |
EndNotificationListener |
getDelegateEndNotificationListener()
This is useful if this shape belongs to an array of multiple text shapes, in which cas it is better to register the delegate si is is notified only once at each notification end Note1 : take care of read Objects too Note2 : don't forget to use this shape default handler if necessary |
protected abstract java.awt.Shape |
getDelegateShape()
|
java.awt.Color |
getDrawColor()
|
int |
getDx(int dx)
|
int |
getDy(int dy)
|
java.lang.String |
getLink()
|
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform at)
|
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform at,
double flatness)
|
java.lang.String[] |
getPropertyNames()
Get the list of property names |
java.lang.Object |
getPropertyValue(java.lang.String name)
Get the value of the property named name |
boolean |
intersects(double x,
double y,
double w,
double h)
|
boolean |
intersects(java.awt.geom.Rectangle2D r)
|
void |
notificationEnd(java.lang.Object referer)
This callback is called after all notifications were processed. |
void |
resize(int dx,
int dy)
Resize the component |
void |
setAnchor(int ox,
int oy)
|
void |
setDelegateEndNotificationListener(EndNotificationListener denl)
This is useful if this shape belongs to an array of multiple text shapes, in which cas it is better to register the delegate if is is notified only once at each notification end Note1 : take care of read Objects too Note2 : don't forget to use this shape default handler if necessary |
void |
setLink(java.lang.String link)
|
void |
setPropertyValue(java.lang.String name,
java.lang.Object value)
Assigns value to the property named name |
void |
translate(int dx,
int dy)
Translates the shape |
protected void |
updateBounds()
|
void |
updateTransform()
The transformation input paramters have changed it has to be updated according to transformation reference frame coordinates. |
Methods inherited from class simtools.shapes.AbstractShape |
---|
addListener, getAnchor, getInnerProperties, getMax, getMaxTranslated, getMin, notifyChange, notifyChange, refresh, removeListener, setAnchor, setProperties, wipeOff |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static MenuResourceBundle resources
public static int MIN_SIZE
protected java.awt.Color drawColor
protected transient java.awt.Color drawDynamicColor
protected ColorMapper drawMapper
protected transient DataSource drawMapperSource
protected transient long drawMapperIndex
protected boolean allowResize
protected boolean fixedRatio
protected double ratio
protected java.lang.String link
protected transient boolean dirtyDrawColor
protected transient boolean dirty
protected transient java.awt.Rectangle dirtyRectangle
protected transient java.awt.Stroke stroke
protected StrokeParameters strokeParams
protected AffineTransformData transform
protected transient java.awt.geom.Rectangle2D.Double bounds2D
protected transient EndNotificationListener delegateEndNotificationListener
Constructor Detail |
---|
public Abstract1DShape(int ox, int oy, int width, int height)
Method Detail |
---|
public java.lang.String getLink()
getLink
in interface Linkable
public void setLink(java.lang.String link)
setLink
in interface Linkable
public void setAnchor(int ox, int oy)
setAnchor
in class AbstractShape
public void translate(int dx, int dy)
AbstractShape
translate
in class AbstractShape
public void updateTransform()
AffineTransformData.Listener
updateTransform
in interface AffineTransformData.Listener
protected void updateBounds()
protected AbstractShape cloneShape()
cloneShape
in class AbstractShape
protected abstract java.awt.Shape getDelegateShape()
public boolean contains(double x, double y)
contains
in interface java.awt.Shape
contains
in class AbstractShape
public boolean contains(double x, double y, double w, double h)
contains
in interface java.awt.Shape
contains
in class AbstractShape
public boolean contains(java.awt.geom.Point2D p)
contains
in interface java.awt.Shape
contains
in class AbstractShape
public boolean contains(java.awt.geom.Rectangle2D r)
contains
in interface java.awt.Shape
contains
in class AbstractShape
public boolean intersects(double x, double y, double w, double h)
intersects
in interface java.awt.Shape
intersects
in class AbstractShape
public boolean intersects(java.awt.geom.Rectangle2D r)
intersects
in interface java.awt.Shape
intersects
in class AbstractShape
public java.awt.Rectangle getBounds()
getBounds
in interface java.awt.Shape
getBounds
in class AbstractShape
public java.awt.geom.Rectangle2D getBounds2D()
getBounds2D
in interface java.awt.Shape
getBounds2D
in class AbstractShape
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
getPathIterator
in interface java.awt.Shape
getPathIterator
in class AbstractShape
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at, double flatness)
getPathIterator
in interface java.awt.Shape
getPathIterator
in class AbstractShape
protected void drawHook(java.awt.Graphics2D g, boolean shapeDrawn)
public void draw(java.awt.Graphics2D g)
AbstractShape
draw
in class AbstractShape
g
- the graphics contextpublic java.lang.String[] getActions(double x, double y, java.lang.Object o, int context)
ContextualActionProvider
getActions
in interface ContextualActionProvider
x
- Coordinate, mouse position in the same unit as contains(x,y)y
- Coordinate, mouse position in the same unit as contains(x,y)o
- Object the actions should work on. Possibly null => default or all actionscontext
- one of the context defined in the ContextualActionProvider class
public java.util.LinkedHashMap getCollectiveActions(DiagramSelection sel, double x, double y, java.lang.Object o, int context)
SelectionContextualActionProvider
getCollectiveActions
in interface SelectionContextualActionProvider
sel
- the current selectionx
- Coordinate, mouse position in the same unit as contains(x,y)y
- Coordinate, mouse position in the same unit as contains(x,y)o
- Object the collective actions should work on. Possibly null => default or all actionscontext
- one of the context defined in the ContextualActionProvider class
public boolean doCollectiveAction(DiagramSelection sel, double x, double y, java.lang.Object o, java.lang.String action, javax.swing.undo.CompoundEdit undoableEdit)
SelectionContextualActionProvider
doCollectiveAction
in interface SelectionContextualActionProvider
sel
- sel the current selectionx
- Coordinate, for example mouse positiony
- Coordinate, for example mouse positiono
- Object the action should work on.action
- action An action returned by a previous getCollectiveActions call with the same x, y, o parametersundoableEdit
- undoableEdit The current compound edit for undo/redo operation.
If the action is undoable, the required edits shall be added to this current compound edit.
public boolean doAction(double x, double y, java.lang.Object o, java.lang.String action, javax.swing.undo.CompoundEdit undoableEdit)
ContextualActionProvider
doAction
in interface ContextualActionProvider
x
- Coordinate, for example mouse positiony
- Coordinate, for example mouse positiono
- Object the action should work on.action
- An action returned by a previous getActions call with the same x, y, o parameters
It may be null, in which case the default action is requested for this x,y,o.undoableEdit
- current edit for undo/redo operation
If not null, this action is undoable.
public boolean canDoAction(double x, double y, java.lang.Object o, java.lang.String action, int context)
ContextualActionProvider
canDoAction
in interface ContextualActionProvider
x
- Coordinate, for example mouse positiony
- Coordinate, for example mouse positiono
- Object the action should work on.action
- An action returned by a previous getActions call with the same x, y, o parameters
It may be null, in which case the default action is requested for this x,y,o.context
- one of the context defined in the ContextualActionProvider class
public JPropertiesPanel createPanel()
public JPropertiesPanel createPanel(java.lang.String name)
public java.awt.Color getDrawColor()
public EndNotificationListener getDelegateEndNotificationListener()
public void setDelegateEndNotificationListener(EndNotificationListener denl)
delegateEndNotificationListener
- The delegateEndNotificationListener to set.public void notificationEnd(java.lang.Object referer)
EndNotificationListener
notificationEnd
in interface EndNotificationListener
public void DataSourceIndexRangeChanged(DataSource ds, long startIndex, long lastIndex)
DataSourceListener
DataSourceIndexRangeChanged
in interface DataSourceListener
ds
- The data source that changedstartIndex
- The new start IndexlastIndex
- The new last indexpublic void DataSourceInfoChanged(DataSource ds, DataInfo newInfo)
DataSourceListener
DataSourceInfoChanged
in interface DataSourceListener
ds
- The data source that changedpublic void DataSourceOrderChanged(DataSource ds, int newOrder)
DataSourceListener
DataSourceOrderChanged
in interface DataSourceListener
ds
- The data source that changedpublic void DataSourceValueChanged(DataSource ds, long minIndex, long maxIndex)
DataSourceListener
DataSourceValueChanged
in interface DataSourceListener
ds
- The data source that changedminIndex
- Lower bound of the range where values changedmaxIndex
- Higher bound of the range where values changedpublic void DataSourceReplaced(DataSource oldData, DataSource newData)
DataSourceListener
DataSourceReplaced
in interface DataSourceListener
public void DataSourceValueRangeChanged(DataSource ds)
DataSourceListener
DataSourceValueRangeChanged
in interface DataSourceListener
ds
- The data source that changedprotected boolean canResize()
public void resize(int dx, int dy)
Resizable
resize
in interface Resizable
dx
- value on x axisdy
- value on y axispublic int getDx(int dx)
public int getDy(int dy)
public void setPropertyValue(java.lang.String name, java.lang.Object value)
AbstractShape
value
to the property named name
setPropertyValue
in interface NamedProperties
setPropertyValue
in class AbstractShape
name
- the name of the property to getvalue
- its new valueAbstractShape.setPropertyValue(String, Object)
public java.lang.String[] getPropertyNames()
NamedProperties
getPropertyNames
in interface NamedProperties
getPropertyNames
in class AbstractShape
public java.lang.Object getPropertyValue(java.lang.String name)
AbstractShape
name
getPropertyValue
in interface NamedProperties
getPropertyValue
in class AbstractShape
name
- the name of the property to get
AbstractShape.getPropertyValue(String)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |