com.rapidminer.gui.new_plotter.templates.style
Class DefaultPlotterStyleProvider

java.lang.Object
  extended by java.util.Observable
      extended by com.rapidminer.gui.new_plotter.templates.style.PlotterStyleProvider
          extended by com.rapidminer.gui.new_plotter.templates.style.DefaultPlotterStyleProvider

public class DefaultPlotterStyleProvider
extends PlotterStyleProvider

The default PlotterStyleProvider. Lets the user choose a font for the axes, title and legend, and lets him choose a color scheme for the plot.

Author:
Marco Boeck

Field Summary
static int FONT_SIZE_DEFAULT
          the font size for the font buttons
 
Fields inherited from class com.rapidminer.gui.new_plotter.templates.style.PlotterStyleProvider
STYLE_ELEMENT
 
Constructor Summary
DefaultPlotterStyleProvider()
          Creates a new DefaultPlotterStyleProvider.
 
Method Summary
 void addColorScheme(ColorScheme colorScheme)
          Appends the given ColorScheme to the list of available ColorSchemes.
 void addColorScheme(ColorScheme colorScheme, int index)
          Adds the given ColorScheme to the list of available ColorSchemes at the specified index.
 void copySettingsFromPlotterStyleProvider(PlotterStyleProvider provider)
          Uses all settings from the given PlotterStyleProvider to overwrite his own settings.
 org.w3c.dom.Element createXML(org.w3c.dom.Document document)
          Creates an Element which contains all PlotterStyleProvider settings.
 java.awt.Font getAxesFont()
          Returns the Font which the user chose for the axes.
 ColorScheme getColorScheme()
          Returns a ColorScheme instance which will be used to color the plot(s).
 java.util.List<ColorScheme> getColorSchemes()
          Returns the list of available ColorSchemes.
 ColorScheme.ColorRGB getFrameBackgroundColor()
          Returns the ColorScheme.ColorRGB of the background frame of the chart.
 java.awt.Font getLegendFont()
          Returns the Font which the user chose for the legend.
 ColorScheme.ColorRGB getPlotBackgroundColor()
          Returns the ColorScheme.ColorRGB of the plot background.
 int getSelectedColorSchemeIndex()
          Returns the index of the currently selected ColorScheme.
 javax.swing.JPanel getStyleProviderPanel()
          Return the JPanel where the user can change the color/font settings.
 java.awt.Font getTitleFont()
          Returns the Font which the user chose for the title.
 java.lang.String getTitleText()
          Returns the String which the user chose as the chart title.
 boolean isShowLegend()
          Returns true when the legend should be shown; false otherwise.
 void loadFromXML(org.w3c.dom.Element styleElement)
          Loads all PlotterStyleProvider settings from the given Element.
 void removeColorScheme(ColorScheme colorScheme)
          Removes the given ColorScheme.
 void removeColorScheme(int index)
          Removes the given ColorScheme with the given index.
 void setAxesFont(java.awt.Font axesFont)
          Sets the axes Font.
 void setFrameBackgroundColor(ColorScheme.ColorRGB frameBackgroundColor)
          Sets the ColorScheme.ColorRGB for the frame background around the chart.
 void setLegendFont(java.awt.Font legendFont)
          Sets the legend Font.
 void setPlotBackgroundColor(ColorScheme.ColorRGB plotBackgroundColor)
          Sets the ColorScheme.ColorRGB for the chart background.
 void setSelectedColorScheme(ColorScheme colorScheme)
          Sets the selected ColorScheme.
 void setSelectedColorSchemeIndex(int index)
          Set the index of the currently selected ColorScheme.
 void setShowLegend(boolean showLegend)
          Set whether the legend should be shown or not.
 void setTitleFont(java.awt.Font titleFont)
          Sets the title Font.
 void setTitleText(java.lang.String title)
          Set the chart title.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FONT_SIZE_DEFAULT

public static final int FONT_SIZE_DEFAULT
the font size for the font buttons

See Also:
Constant Field Values
Constructor Detail

DefaultPlotterStyleProvider

public DefaultPlotterStyleProvider()
Creates a new DefaultPlotterStyleProvider.

Method Detail

getStyleProviderPanel

public javax.swing.JPanel getStyleProviderPanel()
Description copied from class: PlotterStyleProvider
Return the JPanel where the user can change the color/font settings.

Specified by:
getStyleProviderPanel in class PlotterStyleProvider
Returns:

getTitleText

public java.lang.String getTitleText()
Description copied from class: PlotterStyleProvider
Returns the String which the user chose as the chart title.

Specified by:
getTitleText in class PlotterStyleProvider
Returns:

isShowLegend

public boolean isShowLegend()
Description copied from class: PlotterStyleProvider
Returns true when the legend should be shown; false otherwise.

Specified by:
isShowLegend in class PlotterStyleProvider
Returns:

setTitleText

public void setTitleText(java.lang.String title)
Set the chart title.

Parameters:
title -

setShowLegend

public void setShowLegend(boolean showLegend)
Set whether the legend should be shown or not.

Parameters:
showLegend - if true, shows the legend; otherwise hides it

getAxesFont

public java.awt.Font getAxesFont()
Description copied from class: PlotterStyleProvider
Returns the Font which the user chose for the axes.

Specified by:
getAxesFont in class PlotterStyleProvider
Returns:

setAxesFont

public void setAxesFont(java.awt.Font axesFont)
Sets the axes Font.

Parameters:
axesFont -

getLegendFont

public java.awt.Font getLegendFont()
Description copied from class: PlotterStyleProvider
Returns the Font which the user chose for the legend.

Specified by:
getLegendFont in class PlotterStyleProvider
Returns:

setLegendFont

public void setLegendFont(java.awt.Font legendFont)
Sets the legend Font.

Parameters:
legendFont -

getTitleFont

public java.awt.Font getTitleFont()
Description copied from class: PlotterStyleProvider
Returns the Font which the user chose for the title.

Specified by:
getTitleFont in class PlotterStyleProvider
Returns:

setTitleFont

public void setTitleFont(java.awt.Font titleFont)
Sets the title Font.

Parameters:
titleFont -

setFrameBackgroundColor

public void setFrameBackgroundColor(ColorScheme.ColorRGB frameBackgroundColor)
Sets the ColorScheme.ColorRGB for the frame background around the chart.

Parameters:
frameBackgroundColor -

setPlotBackgroundColor

public void setPlotBackgroundColor(ColorScheme.ColorRGB plotBackgroundColor)
Sets the ColorScheme.ColorRGB for the chart background.

Parameters:
plotBackgroundColor -

getFrameBackgroundColor

public ColorScheme.ColorRGB getFrameBackgroundColor()
Description copied from class: PlotterStyleProvider
Returns the ColorScheme.ColorRGB of the background frame of the chart.

Specified by:
getFrameBackgroundColor in class PlotterStyleProvider
Returns:

getPlotBackgroundColor

public ColorScheme.ColorRGB getPlotBackgroundColor()
Description copied from class: PlotterStyleProvider
Returns the ColorScheme.ColorRGB of the plot background.

Specified by:
getPlotBackgroundColor in class PlotterStyleProvider
Returns:

setSelectedColorSchemeIndex

public void setSelectedColorSchemeIndex(int index)
Set the index of the currently selected ColorScheme.

Parameters:
index -

setSelectedColorScheme

public void setSelectedColorScheme(ColorScheme colorScheme)
Sets the selected ColorScheme. If the given ColorScheme is not in the current list of schemes, it will be appended at the end.

Parameters:
colorScheme - the newly selected ColorScheme

getSelectedColorSchemeIndex

public int getSelectedColorSchemeIndex()
Returns the index of the currently selected ColorScheme.

Returns:

getColorSchemes

public java.util.List<ColorScheme> getColorSchemes()
Returns the list of available ColorSchemes. Notice that this list is a copy so direct modification of the DefaultPlotterStyleProvider is not possible.

Returns:

addColorScheme

public void addColorScheme(ColorScheme colorScheme)
Appends the given ColorScheme to the list of available ColorSchemes. Duplicates are not allowed and will result in an IllegalArgumentException.

Parameters:
colorScheme -

addColorScheme

public void addColorScheme(ColorScheme colorScheme,
                           int index)
Adds the given ColorScheme to the list of available ColorSchemes at the specified index. Note that inserting before the default ColorSchemes is not supported and will result in an IllegalArgumentException. Duplicates are not allowed and will result in an IllegalArgumentException.

Parameters:
colorScheme -

removeColorScheme

public void removeColorScheme(int index)
Removes the given ColorScheme with the given index. Will throw an IllegalArgumentException if trying to remove a default ColorScheme.

Parameters:
index -

removeColorScheme

public void removeColorScheme(ColorScheme colorScheme)
Removes the given ColorScheme. Will throw an IllegalArgumentException if trying to remove a default ColorScheme.

Parameters:
colorScheme -

getColorScheme

public ColorScheme getColorScheme()
Description copied from class: PlotterStyleProvider
Returns a ColorScheme instance which will be used to color the plot(s). Each plot will use one of the colors in the order provided, if more plots than colors exist, it will start from the beginning.

Specified by:
getColorScheme in class PlotterStyleProvider
Returns:

createXML

public org.w3c.dom.Element createXML(org.w3c.dom.Document document)
Description copied from class: PlotterStyleProvider
Creates an Element which contains all PlotterStyleProvider settings.

Specified by:
createXML in class PlotterStyleProvider
Parameters:
document - the Document where the Element will be written to
Returns:
the styleElement Element

loadFromXML

public void loadFromXML(org.w3c.dom.Element styleElement)
Description copied from class: PlotterStyleProvider
Loads all PlotterStyleProvider settings from the given Element.

Specified by:
loadFromXML in class PlotterStyleProvider
Parameters:
styleElement - the Element where all settings are loaded from

copySettingsFromPlotterStyleProvider

public void copySettingsFromPlotterStyleProvider(PlotterStyleProvider provider)
Description copied from class: PlotterStyleProvider
Uses all settings from the given PlotterStyleProvider to overwrite his own settings. Does not overwrite the title text.

Specified by:
copySettingsFromPlotterStyleProvider in class PlotterStyleProvider


Copyright © 2001-2009 by Rapid-I