Venice 0.751beta

nz.org.venice.chart.graph
Class CustomGraphUI

java.lang.Object
  extended bynz.org.venice.chart.graph.CustomGraphUI
All Implemented Interfaces:
GraphUI

public class CustomGraphUI
extends java.lang.Object
implements GraphUI

The custom graph user interface.

Author:
Andrew Leppard
See Also:
CustomGraph

Constructor Summary
CustomGraphUI(java.util.HashMap settings, Graphable source, EODQuoteBundle quoteBundle, Symbol symbol)
          Create a new Custom user interface with the initial settings.
 
Method Summary
 java.lang.String checkSettings()
          Check the current settings displayed in the user interface.
 java.lang.String checkSettings(java.util.HashMap settings)
          Check previously set settings.
static Graphable createCustom(Expression indicator, Graphable source, EODQuoteBundle quoteBundle, Symbol symbol)
          Create a new custom graph based on the given graph source and quote bundle.
static java.lang.String getIndicatorText(java.util.HashMap settings)
          Return the custom indicator expression text.
 javax.swing.JPanel getPanel()
          Return the user interface.
 java.util.HashMap getSettings()
          Return the current settings displayed in the user interface.
static boolean isPrimary(java.util.HashMap settings)
          Return whether the graph should appear in the primary graph or not.
 void setSettings(java.util.HashMap settings)
          Display the given settings in the user interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomGraphUI

public CustomGraphUI(java.util.HashMap settings,
                     Graphable source,
                     EODQuoteBundle quoteBundle,
                     Symbol symbol)
Create a new Custom user interface with the initial settings.

Parameters:
settings - the initial settings
Method Detail

checkSettings

public java.lang.String checkSettings()
Description copied from interface: GraphUI
Check the current settings displayed in the user interface. Return an error message if the settings are invalid.

Specified by:
checkSettings in interface GraphUI
Returns:
the error message or null if the settings are valid

checkSettings

public java.lang.String checkSettings(java.util.HashMap settings)
Description copied from interface: GraphUI
Check previously set settings. Return an error message if the settings are invalid.

Specified by:
checkSettings in interface GraphUI
Parameters:
settings - Previously saved settings
Returns:
the error message or null if the settings are valid

getSettings

public java.util.HashMap getSettings()
Description copied from interface: GraphUI
Return the current settings displayed in the user interface.

Specified by:
getSettings in interface GraphUI
Returns:
current settings

setSettings

public void setSettings(java.util.HashMap settings)
Description copied from interface: GraphUI
Display the given settings in the user interface.

Specified by:
setSettings in interface GraphUI
Parameters:
settings - the new settings

getPanel

public javax.swing.JPanel getPanel()
Description copied from interface: GraphUI
Return the user interface.

Specified by:
getPanel in interface GraphUI
Returns:
the user interface

getIndicatorText

public static java.lang.String getIndicatorText(java.util.HashMap settings)
Return the custom indicator expression text.

Parameters:
settings - the settings
Returns:
a text representation of the indicator expression

createCustom

public static Graphable createCustom(Expression indicator,
                                     Graphable source,
                                     EODQuoteBundle quoteBundle,
                                     Symbol symbol)
                              throws EvaluationException
Create a new custom graph based on the given graph source and quote bundle. Usually the function to create a graph is not located in the user interface section, but rather with the core graph code. This case is an exception since the user interface needs to generate the graph to verify that the custom indicator expression is valid.

Parameters:
indicator - the custom indicator expression
source - the source containing the dates to work with
symbol - the symbol to apply the expression
quoteBundle - the quote bundle containing the quotes
Returns:
the custom graph
Throws:
EvaluationException - if there was an error evaluating the expression

isPrimary

public static boolean isPrimary(java.util.HashMap settings)
Return whether the graph should appear in the primary graph or not. Every chart has two kinds of graphs - a primary and a secondary. All primary graphs are drawed together (in the top graph). All secondary graphs are drawn individually (below the top graph).

Parameters:
settings - the settings
Returns:
true if the graph is primary; false otherwise

Venice 0.751beta