actionListeners
Class AxisDisplaySettingsActionListener

java.lang.Object
  extended by actionListeners.AxisDisplaySettingsActionListener
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, javax.swing.event.ChangeListener

public class AxisDisplaySettingsActionListener
extends java.lang.Object
implements java.awt.event.ActionListener, javax.swing.event.ChangeListener

ActionListener that is used for the controls on the AxisDisplaySettingsPanel.

Remembers changes made by the user and applies them when the user confirms by pressing ok on the dialog.

When the Axis that is currently being edited changes the user is asked whether he wants to save the changes to the current Axis. This is a workaround to avoid having to store each setting along with the information for which Axis it was made. Ideally all settings should be memorized and applied when the user closes the dialog with the Ok button.


Field Summary
private  boolean autoFitAxis
          Specifies whether Axes should be autofitted.
private  java.awt.Color axisColor
          The axis color.
private  java.awt.Color axisLabelColor
          The axis label color.
private  Chart chart
          The chart for which the settings are edited.
private  Axis currentAxis
          The Axis currently being edited.
private  javax.swing.JDialog dialog
          The display settings dialog.
private  boolean invertAxis
          Specifies whether the Axis is inverted.
private  boolean invertFilter
          Specifies whether the Filters are inverted.
private  AxisDisplaySettingsPanel panel
          The panel on which the display settings controls are located.
(package private) static boolean printLog
          Flag to enable debug message printing for this class.
private  boolean spinnerValueChanged
          Remembers when the spinner value was modified.
private  java.awt.Color ticLabelColor
          The tic label color.
 
Constructor Summary
AxisDisplaySettingsActionListener(javax.swing.JDialog dialog, AxisDisplaySettingsPanel panel, Chart chart)
          Instantiates a new axis display settings action listener for a specific Chart.
AxisDisplaySettingsActionListener(Main mainWindow, javax.swing.JDialog dialog, AxisDisplaySettingsPanel panel)
          Instantiates a new axis display settings action listener for editing the default settings.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void applySettings(Axis axis)
          Apply settings.
 java.awt.Color getAxisColor()
          Gets the axis color.
 java.awt.Color getAxisLabelColor()
          Gets the axis label color.
 Axis getCurrentAxis()
          Gets the axis that is currently being edited.
 java.awt.Color getTicLabelColor()
          Gets the tic label color.
 boolean isAutoFitAxis()
          Checks if Axis is autofitted.
 boolean isInvertAxis()
          Checks if is Axis is inverted.
 boolean isInvertFilter()
          Checks if filters are inverted.
private  boolean isSettingsChanged()
          Checks if is settings changed.
private  void log(java.lang.String message)
          Prints debug information to stdout when printLog is set to true.
private  void readSettings()
          Read settings from Axis to initialise the settings in the memory.
 void setCurrentAxis(Axis currentAxis)
          Sets the current axis.
 void stateChanged(javax.swing.event.ChangeEvent e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

printLog

static final boolean printLog
Flag to enable debug message printing for this class.

See Also:
Constant Field Values

dialog

private javax.swing.JDialog dialog
The display settings dialog.


axisColor

private java.awt.Color axisColor
The axis color.

See Also:
Axis.getAxisColor()

axisLabelColor

private java.awt.Color axisLabelColor
The axis label color.

See Also:
Axis.getAxisLabelFontColor()

ticLabelColor

private java.awt.Color ticLabelColor
The tic label color.

See Also:
Axis.getTicLabelFontSize()

invertFilter

private boolean invertFilter
Specifies whether the Filters are inverted.

See Also:
Filter, Axis.isFilterInverted()

invertAxis

private boolean invertAxis
Specifies whether the Axis is inverted.

See Also:
Axis.isAxisInverted()

autoFitAxis

private boolean autoFitAxis
Specifies whether Axes should be autofitted.

See Also:
Axis

panel

private AxisDisplaySettingsPanel panel
The panel on which the display settings controls are located.

See Also:
Axis.isAutoFit()

chart

private Chart chart
The chart for which the settings are edited.

Only applies if constructor AxisDisplaySettingsActionListener(JDialog, AxisDisplaySettingsPanel, Chart) was used.


currentAxis

private Axis currentAxis
The Axis currently being edited. Only applies if constructor AxisDisplaySettingsActionListener(JDialog, AxisDisplaySettingsPanel, Chart) was used.


spinnerValueChanged

private boolean spinnerValueChanged
Remembers when the spinner value was modified.

This is needed to decide whether settings were modified and require a save operation when the user closes the dialog or changes the Axis to be edited.

Constructor Detail

AxisDisplaySettingsActionListener

public AxisDisplaySettingsActionListener(Main mainWindow,
                                         javax.swing.JDialog dialog,
                                         AxisDisplaySettingsPanel panel)
Instantiates a new axis display settings action listener for editing the default settings.

Parameters:
mainWindow - the main window
dialog - the dialog
panel - the panel

AxisDisplaySettingsActionListener

public AxisDisplaySettingsActionListener(javax.swing.JDialog dialog,
                                         AxisDisplaySettingsPanel panel,
                                         Chart chart)
Instantiates a new axis display settings action listener for a specific Chart.

Parameters:
dialog - the dialog
panel - the panel
chart - the chart
Method Detail

readSettings

private void readSettings()
Read settings from Axis to initialise the settings in the memory.


stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Specified by:
stateChanged in interface javax.swing.event.ChangeListener

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

log

private void log(java.lang.String message)
Prints debug information to stdout when printLog is set to true.

Parameters:
message - the message

getAxisColor

public java.awt.Color getAxisColor()
Gets the axis color.

Returns:
the axis color

getAxisLabelColor

public java.awt.Color getAxisLabelColor()
Gets the axis label color.

Returns:
the axis label color

isInvertFilter

public boolean isInvertFilter()
Checks if filters are inverted.

Returns:
true, if filters are inverted.

getTicLabelColor

public java.awt.Color getTicLabelColor()
Gets the tic label color.

Returns:
the tic label color

getCurrentAxis

public Axis getCurrentAxis()
Gets the axis that is currently being edited.

Returns:
the axis that is currently being edited.

setCurrentAxis

public void setCurrentAxis(Axis currentAxis)
Sets the current axis.

Parameters:
currentAxis - the new current axis

applySettings

public void applySettings(Axis axis)
Apply settings.

Parameters:
axis - the axis

isSettingsChanged

private boolean isSettingsChanged()
Checks if is settings changed.

Returns:
true, if is settings changed

isInvertAxis

public boolean isInvertAxis()
Checks if is Axis is inverted.

Returns:
true, if is Axis is inverted.

isAutoFitAxis

public boolean isAutoFitAxis()
Checks if Axis is autofitted.

Returns:
true, if Axis is autofitted