com.dukascopy.api
Interface IChartObject

All Known Subinterfaces:
IAndrewsPitchforkChartObject, IChannelChartObject, IChartDependentChartObject, ICyclesChartObject, IDecoratedChartObject, IEllipseChartObject, IFiboArcChartObject, IFiboExpansionChartObject, IFiboFanChartObject, IFiboRetracementChartObject, IFiboTimeZonesChartObject, IFillableChartObject, IGannAnglesChartObject, IGannGridChartObject, IHorizontalLineChartObject, ILabelChartObject, ILeveledChartObject, ILongLineChartObject, IOhlcChartObject, IOrderLineChartObject, IPatternWidgetChartObject, IPercentChartObject, IPolyLineChartObject, IPriceMarkerChartObject, IRayLineChartObject, IRectangleChartObject, IScreenLabelChartObject, IShortLineChartObject, ISignalDownChartObject, ISignalUpChartObject, ITextChartObject, ITimeMarkerChartObject, ITriangleChartObject, IVerticalLineChartObject, IVerticalRetracementChartObject, IWidgetChartObject

public interface IChartObject

Represents graphical object on the chart


Nested Class Summary
static class IChartObject.ATTR_BOOLEAN
          Deprecated.  
static class IChartObject.ATTR_COLOR
          Deprecated.  
static class IChartObject.ATTR_DOUBLE
          Deprecated.  
static class IChartObject.ATTR_INT
          Deprecated.  
static class IChartObject.ATTR_LONG
          Deprecated.  
static class IChartObject.ATTR_TEXT
          Deprecated.  
 
Field Summary
static java.lang.String PROPERTY_FONT
          String constant to be used in PropertyChangeListener.
static java.lang.String PROPERTY_FOREGROUND_ALPHA
          String constant to be used in PropertyChangeListener.
static java.lang.String PROPERTY_FOREGROUND_COLOR
          String constant to be used in PropertyChangeListener.
static java.lang.String PROPERTY_POINT_PRICE
          String constant to be used in PropertyChangeListener.
static java.lang.String PROPERTY_POINT_TIME
          String constant to be used in PropertyChangeListener.
static java.lang.String PROPERTY_STICKY
          String constant to be used in PropertyChangeListener.
static java.lang.String PROPERTY_STROKE
          String constant to be used in PropertyChangeListener.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list.
 boolean getAttrBoolean(IChartObject.ATTR_BOOLEAN field)
          Deprecated.  
 java.awt.Color getAttrColor(IChartObject.ATTR_COLOR field)
          Deprecated.  
 double getAttrDouble(IChartObject.ATTR_DOUBLE field)
          Deprecated.  
 int getAttrInt(IChartObject.ATTR_INT field)
          Deprecated.  
 long getAttrLong(IChartObject.ATTR_LONG field)
          Deprecated.  
 java.lang.String getAttrText(IChartObject.ATTR_TEXT field)
          Deprecated.  
 java.awt.Color getColor()
          Returns color of the object
 java.lang.String getKey()
           
 float getLineWidth()
          Returns stroke width
 float getOpacity()
          Returns opacity alpha of the object
 int getPointsCount()
           
 double getPrice(int pointIndex)
           
 java.beans.PropertyChangeListener[] getPropertyChangeListeners()
          Returns an array of all the PropertyChangeListeners added to this ChartObject with addPropertyChangeListener().
 java.awt.Stroke getStroke()
          Returns stroke that is used for object rendering
 java.lang.String getText()
          Returns object's text
 int getTextTruncation()
          Returns object text's maximum displayable character count.
 long getTime(int pointIndex)
           
 IChart.Type getType()
          Returns type of the graphical object
 boolean isLabelEnabled()
          If false then text value is never shown on chart for this drawing, if true - the label can be added/updated for this drawing object
 boolean isLocked()
          Returns chart object lock state.
 boolean isMenuEnabled()
          If false then the menu is never shown on chart for this drawing, if true - menu will be shown on right button click
 boolean isSticky()
          If true then drawing will adjust itself to closest high/low value for candle under cursor
 boolean isVisibleInWorkspaceTree()
          Returns chart object whether is visible or hidden in Workspace Tree.
 void move(long time, double price)
          Moves first point of the object to the new position dragging whole object with all other points.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list.
 void setAttrBoolean(IChartObject.ATTR_BOOLEAN field, boolean value)
          Deprecated.  
 void setAttrColor(IChartObject.ATTR_COLOR field, java.awt.Color value)
          Deprecated.  
 void setAttrDouble(IChartObject.ATTR_DOUBLE field, double value)
          Deprecated.  
 void setAttrInt(IChartObject.ATTR_INT field, int value)
          Deprecated.  
 void setAttrLong(IChartObject.ATTR_LONG field, long value)
          Deprecated.  
 void setAttrText(IChartObject.ATTR_TEXT field, java.lang.String value)
          Deprecated.  
 void setChartObjectListener(ChartObjectListener listener)
          Adds listener to receive events about user changes on the object.
 void setColor(java.awt.Color color)
          Sets color of the object
 void setLineStyle(int lineStyle)
          Sets stroke style
 void setLineWidth(float width)
          Sets stroke width
 void setLocked(boolean locked)
          Sets chart object lock state.
 void setMenuEnabled(boolean menuEnabled)
           
 void setOpacity(float alpha)
          Sets alpha of the object
 void setSticky(boolean sticky)
          Controls drawing stickiness.
 void setStroke(java.awt.Stroke stroke)
          Sets stroke for object rendering
 void setText(java.lang.String text)
          Sets text to show with the object.
 void setText(java.lang.String text, java.awt.Font font)
          Sets text to show with the object.
 void setText(java.lang.String text, java.awt.Font font, int horizontalAlignment)
          Sets text to show with the object.
 void setText(java.lang.String text, int horizontalAlignment)
          Sets text to show with the object.
 void setTextTruncation(int charCount)
          Sets object text's maximum displayable character count.
 void setTooltip(java.lang.String tooltip)
          Sets popup tooltip which shows when mouse over the figure.
 void setVisibleInWorkspaceTree(boolean visible)
          Make chart object visible or hidden in Workspace Tree.
 

Field Detail

PROPERTY_FOREGROUND_COLOR

static final java.lang.String PROPERTY_FOREGROUND_COLOR
String constant to be used in PropertyChangeListener.

See Also:
Constant Field Values

PROPERTY_FOREGROUND_ALPHA

static final java.lang.String PROPERTY_FOREGROUND_ALPHA
String constant to be used in PropertyChangeListener.

See Also:
Constant Field Values

PROPERTY_STROKE

static final java.lang.String PROPERTY_STROKE
String constant to be used in PropertyChangeListener.

See Also:
Constant Field Values

PROPERTY_FONT

static final java.lang.String PROPERTY_FONT
String constant to be used in PropertyChangeListener.

See Also:
Constant Field Values

PROPERTY_STICKY

static final java.lang.String PROPERTY_STICKY
String constant to be used in PropertyChangeListener.

See Also:
Constant Field Values

PROPERTY_POINT_TIME

static final java.lang.String PROPERTY_POINT_TIME
String constant to be used in PropertyChangeListener. PropertyChangeListener fires IndexedPropertyChangeEvent with index of modified point

See Also:
Constant Field Values

PROPERTY_POINT_PRICE

static final java.lang.String PROPERTY_POINT_PRICE
String constant to be used in PropertyChangeListener. PropertyChangeListener fires IndexedPropertyChangeEvent with index of modified point

See Also:
Constant Field Values
Method Detail

setChartObjectListener

void setChartObjectListener(ChartObjectListener listener)
Adds listener to receive events about user changes on the object. Works only with unlocked objects

Parameters:
listener - listener for events

addPropertyChangeListener

void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. The listener is registered for all properties.

A PropertyChangeEvent will get fired in response to setting a bound property, e.g. setColor, setOpacity, or setStroke. Note that if the current component is inheriting its property from its container, then no event will be fired in response to a change in the inherited property.

Parameters:
listener - The PropertyChangeListener to be added
See Also:
removePropertyChangeListener(java.beans.PropertyChangeListener), getPropertyChangeListeners()

removePropertyChangeListener

void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

Parameters:
listener - the PropertyChangeListener to be removed
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener)

getPropertyChangeListeners

java.beans.PropertyChangeListener[] getPropertyChangeListeners()
Returns an array of all the PropertyChangeListeners added to this ChartObject with addPropertyChangeListener().

Returns:
all of the PropertyChangeListeners added or an empty array if no listeners have been added
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener), removePropertyChangeListener(java.beans.PropertyChangeListener)

setAttrLong

@Deprecated
void setAttrLong(IChartObject.ATTR_LONG field,
                            long value)
Deprecated. 

Assigns value of type long to field

Parameters:
field - chart object field
value - to be assigned

getAttrLong

@Deprecated
long getAttrLong(IChartObject.ATTR_LONG field)
Deprecated. 

Retrieves value of field

Parameters:
field - chart object field
Returns:
value of field

setAttrDouble

@Deprecated
void setAttrDouble(IChartObject.ATTR_DOUBLE field,
                              double value)
Deprecated. 

Assigns value of type double to field

Parameters:
field - chart object field
value - to be assigned

getAttrDouble

@Deprecated
double getAttrDouble(IChartObject.ATTR_DOUBLE field)
Deprecated. 

Retrieves value of field

Parameters:
field - chart object field
Returns:
value of field

setAttrInt

@Deprecated
void setAttrInt(IChartObject.ATTR_INT field,
                           int value)
Deprecated. 

Assigns value of type int to field

Parameters:
field - chart object field
value - to be assigned

getAttrInt

@Deprecated
int getAttrInt(IChartObject.ATTR_INT field)
Deprecated. 

Retrieves value of field

Parameters:
field - chart object field
Returns:
value of field

setAttrBoolean

@Deprecated
void setAttrBoolean(IChartObject.ATTR_BOOLEAN field,
                               boolean value)
Deprecated. 

Assigns value of type boolean to field

Parameters:
field - chart object field
value - to be assigned

getAttrBoolean

@Deprecated
boolean getAttrBoolean(IChartObject.ATTR_BOOLEAN field)
Deprecated. 

Retrieves value of field

Parameters:
field - chart object field
Returns:
value of field

setAttrColor

@Deprecated
void setAttrColor(IChartObject.ATTR_COLOR field,
                             java.awt.Color value)
Deprecated. 

Assigns value of type Color to field

Parameters:
field - chart object field
value - to be assigned

getAttrColor

@Deprecated
java.awt.Color getAttrColor(IChartObject.ATTR_COLOR field)
Deprecated. 

Retrieves value of field

Parameters:
field - chart object field
Returns:
value of field

setAttrText

@Deprecated
void setAttrText(IChartObject.ATTR_TEXT field,
                            java.lang.String value)
Deprecated. 

Assigns value of type String to field

Parameters:
field - chart object field
value - to be assigned

getAttrText

@Deprecated
java.lang.String getAttrText(IChartObject.ATTR_TEXT field)
Deprecated. 

Retrieves value of field

Parameters:
field - chart object field
Returns:
value of field

move

void move(long time,
          double price)
Moves first point of the object to the new position dragging whole object with all other points. Do not initiate chart repaint immediately, use IChart.repaint() method if necessary.

Parameters:
time - new time of the first point
price - new price of the first point

getText

java.lang.String getText()
Returns object's text

Returns:
text

setText

void setText(java.lang.String text)
Sets text to show with the object. Ignored if object doesn't support text

Parameters:
text - text to show

setText

void setText(java.lang.String text,
             java.awt.Font font)
Sets text to show with the object. Ignored if object doesn't support text

Parameters:
text - text to show
font - font to use for text rendering

setText

void setText(java.lang.String text,
             int horizontalAlignment)
Sets text to show with the object. Ignored if object doesn't support text

Parameters:
text - text to show
horizontalAlignment - text horizontal position according to specified time. Available options for horizontalAlignment = {SwingConstants.CENTER, SwingConstants.LEFT, SwingConstants.RIGHT} Default value is SwingConstants.LEFT

setText

void setText(java.lang.String text,
             java.awt.Font font,
             int horizontalAlignment)
Sets text to show with the object. Ignored if object doesn't support text

Parameters:
text - text to show
font - font to use for text rendering
horizontalAlignment - text horizontal position according to specified time. Available options for horizontalAlignment = {SwingConstants.CENTER, SwingConstants.LEFT, SwingConstants.RIGHT} Default value is SwingConstants.LEFT

getTextTruncation

int getTextTruncation()
Returns object text's maximum displayable character count. Returns -1 if it is unrestricted. If the getText() length exceeds the count, the string on chart gets truncated according to this parameter value and gets postfixed by "...".

For ISignalDownChartObject, ISignalUpChartObject and all IHorizontalLineChartObject implementations the default is 30, for the rest it is -1. The parameter does not apply to ITextChartObject.

Returns:
object text's maximum displayable character count

setTextTruncation

void setTextTruncation(int charCount)
Sets object text's maximum displayable character count. Passing -1 makes it unrestricted. If the getText() length exceeds the count, the string on chart gets truncated according to this parameter value and gets postfixed by "...". The parameter does not apply to ITextChartObject.

Parameters:
charCount -

getColor

java.awt.Color getColor()
Returns color of the object

Returns:
color

setColor

void setColor(java.awt.Color color)
Sets color of the object

Parameters:
color - color to use for object rendering

getOpacity

float getOpacity()
Returns opacity alpha of the object

Returns:
alpha 0-1 (0: transparent; 1: opaque)

setOpacity

void setOpacity(float alpha)
Sets alpha of the object

Parameters:
alpha - values: 0-1 (0: transparent; 1: opaque)

getStroke

java.awt.Stroke getStroke()
Returns stroke that is used for object rendering

Returns:
stroke

setStroke

void setStroke(java.awt.Stroke stroke)
Sets stroke for object rendering

Parameters:
stroke - stroke to use for object rendering

setLineStyle

void setLineStyle(int lineStyle)
Sets stroke style

Parameters:
lineStyle - one of LineStyle constant
See Also:
LineStyle

getLineWidth

float getLineWidth()
Returns stroke width

Returns:
stroke width

setLineWidth

void setLineWidth(float width)
Sets stroke width

Parameters:
width - width of stroke line

getType

IChart.Type getType()
Returns type of the graphical object

Returns:
type of the graphical object

getKey

java.lang.String getKey()
Returns:
unique key of this object

getTime

long getTime(int pointIndex)
Parameters:
pointIndex - which determines which coordinate should be used to obtain time
Returns:
time of the coordinate

getPrice

double getPrice(int pointIndex)
Parameters:
pointIndex - which determines which coordinate should be used to obtain price
Returns:
price of the coordinate

getPointsCount

int getPointsCount()
Returns:
minimal count of points which are used to set this chart object

setSticky

void setSticky(boolean sticky)
Controls drawing stickiness. True by default

Parameters:
sticky - if true then drawing will adjust itself to closest high/low value for candle under cursor

isSticky

boolean isSticky()
If true then drawing will adjust itself to closest high/low value for candle under cursor

Returns:
true when drawing is sticky

isMenuEnabled

boolean isMenuEnabled()
If false then the menu is never shown on chart for this drawing, if true - menu will be shown on right button click

Returns:
true when menu is enabled for the drawing

setMenuEnabled

void setMenuEnabled(boolean menuEnabled)
Parameters:
menuEnabled - which determines show or not show the menu for the drawing

isLabelEnabled

boolean isLabelEnabled()
If false then text value is never shown on chart for this drawing, if true - the label can be added/updated for this drawing object

Returns:
true when label is enabled for the drawing

setTooltip

void setTooltip(java.lang.String tooltip)
Sets popup tooltip which shows when mouse over the figure.


isVisibleInWorkspaceTree

boolean isVisibleInWorkspaceTree()
Returns chart object whether is visible or hidden in Workspace Tree. Default value: true. Note: locked chart objects are not visible in workspace tree

See Also:
isLocked(), setLocked(boolean)

setVisibleInWorkspaceTree

void setVisibleInWorkspaceTree(boolean visible)
Make chart object visible or hidden in Workspace Tree. Default value: true.

Parameters:
visibile -
See Also:
isLocked(), setLocked(boolean)

isLocked

boolean isLocked()
Returns chart object lock state. When chart object is locked it is not visible in workspace tree and is not editable on UI. Default value: false.


setLocked

void setLocked(boolean locked)
Sets chart object lock state. When chart object is locked it is not visible in workspace tree and is not editable on UI. Default value: false.