|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimtools.shapes.AbstractShape
jsynoptic.builtin.AutomatonShape
public class AutomatonShape
A 2D automaton, driven by a data source. It consists in a grid which cells have configurable background and label. Actions are associated to data source values or ranges. They are processed dynamically when data arrives.
Nested Class Summary | |
---|---|
static class |
AutomatonShape.Cell
|
class |
AutomatonShape.PropertiesPanel
A JPanel do display and change the properties of the SimpleShape |
Nested classes/interfaces inherited from class simtools.shapes.AbstractShape |
---|
AbstractShape.AbstractShapePropertiesNames |
Field Summary | |
---|---|
protected int |
activeX
|
protected int |
activeY
|
protected boolean |
allowResize
|
protected AutomatonShape.Cell[][] |
cells
|
protected boolean |
dirtyState
|
protected boolean |
fixedRatio
|
protected long |
index
|
protected java.lang.String |
link
|
protected AutomatonActionMapper |
mapper
|
static int |
MIN_CELL_HEIGHT
|
static int |
MIN_CELL_WIDTH
|
protected double |
ratio
|
protected static int |
referenceBaseline
|
protected static java.awt.Font |
referenceFont
|
protected static int |
referenceHeight
Reference font and dimensions used to compute sizes when resizing |
protected static int |
referenceWidth
|
static java.util.ResourceBundle |
resources
|
protected DataSource |
source
|
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 | |
---|---|
AutomatonShape(int ox,
int oy)
|
|
AutomatonShape(int ox,
int oy,
int nx,
int ny)
|
|
AutomatonShape(int ox,
int oy,
int nx,
int ny,
int width,
int height)
|
Method Summary | |
---|---|
void |
applyRules()
Apply the automaton rules on the active cell |
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 |
AutomatonShape.PropertiesPanel |
createPanel()
|
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. |
void |
draw(java.awt.Graphics2D g)
Draws the shape |
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. |
static java.awt.Font |
getFontToFitText(java.lang.String text,
int width,
int height)
Utility method that returns a Font object, as would be used to draw the text according to widht and height May return null if the desired operation results in no visible text. |
java.lang.String |
getLink()
|
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 |
setLink(java.lang.String link)
|
Methods inherited from class simtools.shapes.AbstractShape |
---|
addListener, cloneShape, contains, contains, contains, contains, getAnchor, getBounds, getBounds2D, getInnerProperties, getMax, getMaxTranslated, getMin, getPathIterator, getPathIterator, getPropertyNames, getPropertyValue, intersects, intersects, notifyChange, notifyChange, refresh, removeListener, setAnchor, setAnchor, setProperties, setPropertyValue, translate, wipeOff |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.util.ResourceBundle resources
public static int MIN_CELL_WIDTH
public static int MIN_CELL_HEIGHT
protected AutomatonActionMapper mapper
protected transient DataSource source
protected transient long index
protected boolean allowResize
protected boolean fixedRatio
protected double ratio
protected int activeX
protected int activeY
protected static int referenceHeight
protected static int referenceWidth
protected static int referenceBaseline
protected static java.awt.Font referenceFont
protected java.lang.String link
protected AutomatonShape.Cell[][] cells
protected transient boolean dirtyState
Constructor Detail |
---|
public AutomatonShape(int ox, int oy)
public AutomatonShape(int ox, int oy, int nx, int ny)
public AutomatonShape(int ox, int oy, int nx, int ny, 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 draw(java.awt.Graphics2D g)
AbstractShape
draw
in class AbstractShape
g
- the graphics contextpublic static java.awt.Font getFontToFitText(java.lang.String text, int width, int height)
public 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 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 AutomatonShape.PropertiesPanel createPanel()
public void applyRules()
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 DataSourceValueRangeChanged(DataSource ds)
DataSourceListener
DataSourceValueRangeChanged
in interface DataSourceListener
ds
- The data source that changedpublic void DataSourceReplaced(DataSource oldData, DataSource newData)
DataSourceListener
DataSourceReplaced
in interface DataSourceListener
public void notificationEnd(java.lang.Object referer)
EndNotificationListener
notificationEnd
in interface EndNotificationListener
public void resize(int dx, int dy)
Resizable
resize
in interface Resizable
dx
- value on x axisdy
- value on y axis
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |