jsynoptic.builtin
Class HistoryTextShape

java.lang.Object
  extended by simtools.shapes.AbstractShape
      extended by jsynoptic.builtin.HistoryTextShape
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable, java.lang.Cloneable, ContextualActionProvider, DataSourceConsumer, Linkable, EndNotificationListener, Resizable, NamedProperties

public class HistoryTextShape
extends AbstractShape
implements Resizable, ContextualActionProvider, Linkable, EndNotificationListener, DataSourceConsumer

Author:
zxpletran007
See Also:
Serialized Form

Nested Class Summary
static class HistoryTextShape.HistoryTextShapePropertiesNames
           
 
Nested classes/interfaces inherited from class simtools.shapes.AbstractShape
AbstractShape.AbstractShapePropertiesNames
 
Field Summary
protected  java.util.ArrayList cells
          The array cells are of type HistoryTextShape
protected  java.lang.String link
          Linkable shape
static java.util.ResourceBundle resources
           
 
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
HistoryTextShape(int histSize, int width, int cellHeight)
           
HistoryTextShape(int ox, int oy, int histSize, int width, int cellHeight)
          Build an History shape with the given history size (number of time values to retain).
 
Method Summary
 boolean addDataSource(DataSource d)
           
 boolean canAddDataSource(DataSource d)
           
 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  AbstractShape cloneShape()
          Performs a copy of the shape This method has to be overriden to deal with concrete shapes
 JPropertiesPanel createPanel()
           
protected  TextShape createTextShape(java.lang.String name, int width, int height)
          By overwriting this method, it is possible to create different kind of text cells
 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.
 java.util.ArrayList getCells()
           
 java.lang.String getLink()
           
 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
 void notificationEnd(java.lang.Object referer)
          This callback is called after all notifications were processed.
protected  void positionCells()
          This function supposes dimensions are correct, it will not check that Also, it does not notify changes.
protected  void propagate()
          Propagate cells color and text values.
 void resize(int dx, int dy)
          Resize the component
 void setAnchor(int ox, int oy)
           
 void setCells(java.util.ArrayList cellProperties)
          - Set first cell properties - Propagate static attributes to other cells
protected  void setCellsTextValues()
           
 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
 
Methods inherited from class simtools.shapes.AbstractShape
addListener, contains, contains, contains, contains, getAnchor, getBounds, getBounds2D, getInnerProperties, getMax, getMaxTranslated, getMin, getPathIterator, getPathIterator, intersects, intersects, 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

resources

public static java.util.ResourceBundle resources

cells

protected java.util.ArrayList cells
The array cells are of type HistoryTextShape


link

protected java.lang.String link
Linkable shape

Constructor Detail

HistoryTextShape

public HistoryTextShape(int ox,
                        int oy,
                        int histSize,
                        int width,
                        int cellHeight)
Build an History shape with the given history size (number of time values to retain). The width argument is the array width, the height one is the height of one cell.

Parameters:
histSize - The number of time values to retain
width - The array width @ param height The height of one cell in the array

HistoryTextShape

public HistoryTextShape(int histSize,
                        int width,
                        int cellHeight)
Parameters:
histSize -
width -
cellHeight -
Method Detail

getLink

public java.lang.String getLink()
Specified by:
getLink in interface Linkable

setLink

public void setLink(java.lang.String link)
Specified by:
setLink in interface Linkable

getCells

public java.util.ArrayList getCells()
Returns:
Returns the cells.

translate

public void translate(int dx,
                      int dy)
Description copied from class: AbstractShape
Translates the shape

Overrides:
translate in class AbstractShape

setAnchor

public void setAnchor(int ox,
                      int oy)
Overrides:
setAnchor in class AbstractShape

draw

public void draw(java.awt.Graphics2D g)
Description copied from class: AbstractShape
Draws the shape

Specified by:
draw in class AbstractShape
Parameters:
g - the graphics context

addDataSource

public boolean addDataSource(DataSource d)
Specified by:
addDataSource in interface DataSourceConsumer
Parameters:
d - the data source to be added
Returns:
true if operation succeeds

propagate

protected void propagate()
Propagate cells color and text values.


setCellsTextValues

protected void setCellsTextValues()

positionCells

protected void positionCells()
This function supposes dimensions are correct, it will not check that Also, it does not notify changes.


resize

public void resize(int dx,
                   int dy)
Description copied from interface: Resizable
Resize the component

Specified by:
resize in interface Resizable
Parameters:
dx - value on x axis
dy - value on y axis

getActions

public java.lang.String[] getActions(double x,
                                     double y,
                                     java.lang.Object o,
                                     int context)
Description copied from interface: ContextualActionProvider
Return list of possible actions the contect information may be used, or not.

Specified by:
getActions in interface ContextualActionProvider
Parameters:
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 actions
context - one of the context defined in the ContextualActionProvider class
Returns:
The list of possible actions, possibly null or an empty array

doAction

public boolean doAction(double x,
                        double y,
                        java.lang.Object o,
                        java.lang.String action,
                        javax.swing.undo.CompoundEdit undoableEdit)
Description copied from interface: ContextualActionProvider
Do one of the actions previously declared by getAction.

Specified by:
doAction in interface ContextualActionProvider
Parameters:
x - Coordinate, for example mouse position
y - Coordinate, for example mouse position
o - 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.
Returns:
true if the action could be performed

createPanel

public JPropertiesPanel createPanel()

canDoAction

public boolean canDoAction(double x,
                           double y,
                           java.lang.Object o,
                           java.lang.String action,
                           int context)
Description copied from interface: ContextualActionProvider
Returns true if, and only if, it is possible to do the action right now

Specified by:
canDoAction in interface ContextualActionProvider
Parameters:
x - Coordinate, for example mouse position
y - Coordinate, for example mouse position
o - 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
Returns:
true if the action can be performed

createTextShape

protected TextShape createTextShape(java.lang.String name,
                                    int width,
                                    int height)
By overwriting this method, it is possible to create different kind of text cells

Parameters:
name -
width -
height -
Returns:
a text shape belonging to text array

setCells

public void setCells(java.util.ArrayList cellProperties)
- Set first cell properties - Propagate static attributes to other cells

Parameters:
cellProperties -

canAddDataSource

public boolean canAddDataSource(DataSource d)
Specified by:
canAddDataSource in interface DataSourceConsumer
Parameters:
d - the data source to be added
Returns:
true if operation can be be performed

cloneShape

protected AbstractShape cloneShape()
Description copied from class: AbstractShape
Performs a copy of the shape This method has to be overriden to deal with concrete shapes

Overrides:
cloneShape in class AbstractShape
Returns:
a copy of the shape

notificationEnd

public void notificationEnd(java.lang.Object referer)
Description copied from interface: EndNotificationListener
This callback is called after all notifications were processed. The referer object is the one to decide what the end means. For example, it may be a single data source notifying both a range change and a value change. Or it could be a collection notifying all its sources.

Specified by:
notificationEnd in interface EndNotificationListener

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String name)
Description copied from class: AbstractShape
Get the value of the property named name

Specified by:
getPropertyValue in interface NamedProperties
Overrides:
getPropertyValue in class AbstractShape
Parameters:
name - the name of the property to get
Returns:
the property value
See Also:
AbstractShape.getPropertyValue(String)

setPropertyValue

public void setPropertyValue(java.lang.String name,
                             java.lang.Object value)
Description copied from class: AbstractShape
Assigns value to the property named name

Specified by:
setPropertyValue in interface NamedProperties
Overrides:
setPropertyValue in class AbstractShape
Parameters:
name - the name of the property to get
value - its new value
See Also:
AbstractShape.setPropertyValue(String, Object)

getPropertyNames

public java.lang.String[] getPropertyNames()
Description copied from interface: NamedProperties
Get the list of property names

Specified by:
getPropertyNames in interface NamedProperties
Overrides:
getPropertyNames in class AbstractShape