mixconfig.panels.MixConfigPanel Class Reference

Inherits javax::swing::JPanel, java::awt::event::ItemListener, java::awt::event::FocusListener, and JAPHelpContext::IHelpContext.

Inherited by mixconfig.panels.AdvancedPanel, mixconfig.panels.CascadePanel, mixconfig.panels.GeneralPanel, mixconfig.panels.LogCrimePanel, mixconfig.panels.MixOnCDPanel, mixconfig.panels.OtherMixPanel, mixconfig.panels.OwnCertificatesPanel, mixconfig.panels.PaymentPanel, mixconfig.panels.TermsAndConditionsPanel, and mixconfig.panels.WizardFinishPanel.

List of all members.

Public Member Functions

abstract Vector< String > check ()
String getPanelName ()
Insets getDefaultInsets ()
final void setName (String a_name)
void itemStateChanged (ItemEvent ie)
void focusGained (FocusEvent e)
void focusLost (FocusEvent e)
void setEnabled (boolean enabled)
void setConfiguration (MixConfiguration a_mixConf) throws IOException
MixConfiguration getConfiguration ()
void load () throws IOException
void save () throws IOException

Static Public Attributes

static final int MAX_COLUMN_LENGTH = 20
static final int MAX_COMBO_BOX_LENGTH = 27
static final int MAX_COORDINATE_FIELD_LENGTH = 7
static final String MSG_WARNING_NO_MIX_CERT = MixConfigPanel.class.getName() + "_warningNoMixCert"
static final String MSG_WARNING_NO_OPERATOR_CERT = MixConfigPanel.class.getName() + "_warningOperatorCert"
static final String MSG_ERROR_BLANK_FIELD = MixConfigPanel.class.getName() + "_errorBlankField"

Protected Member Functions

 MixConfigPanel (String a_name)
abstract void enableComponents ()
GridBagConstraints getInitialConstraints ()
void setAutoSaveEnabled (boolean a_autoSave)
boolean isAutoSaveEnabled ()
void save (IPTextField a_ipTextField)
void save (Container a) throws IOException
void save (JTable table)
void save (CertPanel a) throws IOException
void save (PriceCertPanel a_panel) throws IOException
void save (JTextField a_textfield)
void save (String a_xmlPath, String a_value)
void save (JCheckBox a)
void save (JComboBox a)
void save (JRadioButton a)
void save (ButtonGroup a)
void load (Container a) throws IOException
void load (JTextField a)
void load (JCheckBox a)
void load (JComboBox a)
void load (JRadioButton a)
void load (JTable table)
void load (IPTextField a_ipTextField)
void load (CertPanel a_panel) throws IOException
void load (PriceCertPanel a_panel) throws IOException
boolean isNumber (String str)
Component getComponentByName (String a_name)

Private Attributes

boolean m_autoSave = true
MixConfiguration m_mixConf = null
Insets m_insets

Classes

class  ToggleButtonModel


Detailed Description

This is the abstract superclass of all configuration panels. It saves the data entered by the user to the underlying configuration object, and updates the panels if the configuration changes.
Loading data from the MixConfiguration object into the panel controls happens via the load(..) methods. They should be called only when a new empty configuration is created, or a configuration is loaded from a file. The only public load method is the one that iterates over all controls in the dialog and sets their values to the corresponding data from the configuration object (the corresponding XML keys are found via the getName() method in java.awt.Component).
Saving the controls' values to the configuration object is done via the save() methods. They should be called whenever the user changes the value of a control to keep the panels and the configuration object synchronized. To make this easier, this class implements the ItemListener and FocusListener interfaces. Controls that correspond to a configuration key should add this class to their listeners list; the event handler methods in this class will then take care of the data synchronisation between AWT/Swing components and the configuration object.
Author:
ronin <ronin2@web.de>
Todo:
Find another way to synchronize non-ItemSelectables. The FocusListener is not a safe way.

Constructor & Destructor Documentation

mixconfig.panels.MixConfigPanel.MixConfigPanel ( String  a_name  )  [protected]

Construct a new instance of MixConfigPanel

Parameters:
a_name the initial name of the panel; must be a non-blank String longer than zero

References mixconfig.panels.MixConfigPanel.m_insets, and mixconfig.panels.MixConfigPanel.setName().


Member Function Documentation

abstract void mixconfig.panels.MixConfigPanel.enableComponents (  )  [protected, pure virtual]

abstract Vector<String> mixconfig.panels.MixConfigPanel.check (  )  [pure virtual]

String mixconfig.panels.MixConfigPanel.getPanelName (  ) 

Return the name of the panel assuming all panel classes are named correctly

Returns:
the name of the panel

Referenced by mixconfig.panels.OtherMixPanel.check().

GridBagConstraints mixconfig.panels.MixConfigPanel.getInitialConstraints (  )  [protected]

Insets mixconfig.panels.MixConfigPanel.getDefaultInsets (  ) 

final void mixconfig.panels.MixConfigPanel.setName ( String  a_name  ) 

(Re)sets the name of this panel.

Parameters:
a_name the new name of the panel; must be a non-blank String longer than zero

Referenced by mixconfig.panels.MixConfigPanel.MixConfigPanel().

void mixconfig.panels.MixConfigPanel.itemStateChanged ( ItemEvent  ie  ) 

void mixconfig.panels.MixConfigPanel.focusGained ( FocusEvent  e  ) 

void mixconfig.panels.MixConfigPanel.focusLost ( FocusEvent  e  ) 

void mixconfig.panels.MixConfigPanel.setEnabled ( boolean  enabled  ) 

void mixconfig.panels.MixConfigPanel.setConfiguration ( MixConfiguration  a_mixConf  )  throws IOException

Informs the panel about a new Mix configuration and makes it load the attribute values from the configuration object into the text fields, combo boxes etc.

Parameters:
a_mixConf The new configuration
Exceptions:
IOException If an error occurs while transferring the data

Reimplemented in mixconfig.panels.AdvancedPanel, mixconfig.panels.CascadePanel, mixconfig.panels.GeneralPanel, mixconfig.panels.MixOnCDPanel, mixconfig.panels.NextMixProxyPanel, mixconfig.panels.OwnCertificatesPanel, mixconfig.panels.PaymentPanel, mixconfig.panels.PreviousMixPanel, and mixconfig.panels.TermsAndConditionsPanel.

References mixconfig.panels.MixConfigPanel.load(), and mixconfig.panels.MixConfigPanel.m_mixConf.

Referenced by mixconfig.ConfigFrame.setConfiguration().

MixConfiguration mixconfig.panels.MixConfigPanel.getConfiguration (  ) 

Returns the configuration object currently edited by this panel.

Returns:
The current configuration

References mixconfig.panels.MixConfigPanel.m_mixConf.

Referenced by mixconfig.panels.OwnCertificatesPanel.actionPerformed(), mixconfig.panels.NextMixProxyPanel.actionPerformed(), mixconfig.panels.GeneralPanel.actionPerformed(), mixconfig.panels.TermsAndConditionsPanel.check(), mixconfig.panels.PaymentPanel.check(), mixconfig.panels.OtherMixPanel.check(), mixconfig.panels.NextMixProxyPanel.check(), mixconfig.panels.GeneralPanel.check(), mixconfig.panels.CascadePanel.check(), mixconfig.panels.AdvancedPanel.check(), mixconfig.panels.OwnCertificatesPanel.checkCertificateField(), mixconfig.panels.MixOnCDPanel.checkDHCPEnabled(), mixconfig.panels.NextMixProxyPanel.componentShown(), mixconfig.panels.NextMixProxyPanel.createTableModel(), mixconfig.panels.DataRetentionPanel.DataRetentionPanel(), mixconfig.panels.PreviousMixPanel.enableComponents(), mixconfig.panels.PaymentPanel.enableComponents(), mixconfig.panels.NextMixProxyPanel.enableComponents(), mixconfig.panels.GeneralPanel.enableComponents(), mixconfig.panels.CascadePanel.enableComponents(), mixconfig.panels.AdvancedPanel.enableComponents(), mixconfig.panels.LogCrimePanel.exportCert(), mixconfig.panels.AdvancedPanel.focusGained(), mixconfig.panels.AdvancedPanel.focusLost(), mixconfig.panels.OwnCertificatesPanel.OperatorCertCreationValidator.getExtensions(), mixconfig.panels.OwnCertificatesPanel.OwnCertCreationValidator.getExtensions(), mixconfig.panels.TermsAndConditionsPanel.getInfoServices(), mixconfig.panels.TermsAndConditionsPanel.getPreviewTranslation(), mixconfig.panels.TermsAndConditionsPanel.getServiceOperator(), mixconfig.panels.DataRetentionPanel.importDataRetentionKey(), mixconfig.panels.GeneralPanel.initListenerInterfacesTable(), mixconfig.panels.TermsAndConditionsPanel.initTemplates(), mixconfig.panels.TermsAndConditionsPanel.initTermsAndConditionsSettings(), mixconfig.panels.GeneralPanel.isFirstDynamicMix(), mixconfig.panels.PaymentPanel.isPaymentEnabled(), mixconfig.panels.OwnCertificatesPanel.OperatorCertCreationValidator.isValid(), mixconfig.panels.OwnCertificatesPanel.OwnCertCreationValidator.isValid(), mixconfig.panels.MixOnCDPanel.itemStateChanged(), mixconfig.panels.AdvancedPanel.itemStateChanged(), mixconfig.panels.OwnCertificatesPanel.load(), mixconfig.panels.MixOnCDPanel.load(), mixconfig.panels.LogCrimePanel.load(), mixconfig.panels.GeneralPanel.load(), mixconfig.panels.CascadePanel.load(), mixconfig.panels.AdvancedPanel.load(), mixconfig.panels.MixOnCDPanel.loadPasswords(), mixconfig.panels.NextMixProxyPanel.NextMixProxyPanel(), mixconfig.panels.CascadePanel.recvMixList(), mixconfig.panels.TermsAndConditionsPanel.save(), mixconfig.panels.OwnCertificatesPanel.save(), mixconfig.panels.MixOnCDPanel.save(), mixconfig.panels.LogCrimePanel.save(), mixconfig.panels.GeneralPanel.save(), mixconfig.panels.MixOnCDPanel.savePasswords(), mixconfig.panels.PreviousMixPanel.setConfiguration(), mixconfig.panels.NextMixProxyPanel.setConfiguration(), mixconfig.panels.MixOnCDPanel.setConfiguration(), mixconfig.panels.CascadePanel.setConfiguration(), mixconfig.panels.AdvancedPanel.setDirectoryLoggingValues(), mixconfig.panels.PaymentPanel.stateChanged(), mixconfig.panels.NextMixProxyPanel.stateChanged(), mixconfig.panels.GeneralPanel.stateChanged(), mixconfig.panels.CascadePanel.stateChanged(), mixconfig.panels.AdvancedPanel.stateChanged(), and mixconfig.panels.CascadePanel.MixListTableModel.toXmlElement().

void mixconfig.panels.MixConfigPanel.setAutoSaveEnabled ( boolean  a_autoSave  )  [protected]

Determines whether values changed in the panel should be automatically saved to the configuration object. Normally, all values are written to the configuration as soon as they are entered in the panel. However, it is sometimes necessary to disable this in order to prevent infinite loops.
For example, if the state of a combo box is changed, it casts an java.awt.event.ItemEvent. The containing panel catches the event through its implementation of java.awt.event.ItemListener and saves the changed value to the MixConfiguration object. This triggers a javax.swing.event.ChangeEvent. If the panel catches this event and sets the combo box value accordingly to keep the configuration and the panel synchronized, this will trigger an ItemEvent again, leading to an infinite ping-pong of events.

Parameters:
a_autoSave true to enable auto saving, false to disable it

References mixconfig.panels.MixConfigPanel.m_autoSave.

Referenced by mixconfig.panels.AdvancedPanel.AdvancedPanel(), mixconfig.panels.MixConfigPanel.load(), mixconfig.panels.AdvancedPanel.load(), and mixconfig.panels.PaymentPanel.setConfiguration().

boolean mixconfig.panels.MixConfigPanel.isAutoSaveEnabled (  )  [protected]

void mixconfig.panels.MixConfigPanel.load (  )  throws IOException

Loads the attribute values from the configuration object into the panel's controls. This method iterates through all components of the panel and reads their names using the getName() method. If the name is not null, it retrieves the configuration attribute with the same name and sets the value of the component (text field, combo box etc.) according to the attribute value.

Exceptions:
IOException If loading an attribute from the configuration fails

Reimplemented in mixconfig.panels.AdvancedPanel, mixconfig.panels.GeneralPanel, mixconfig.panels.LogCrimePanel, mixconfig.panels.MixOnCDPanel, mixconfig.panels.NextMixProxyPanel, and mixconfig.panels.TermsAndConditionsPanel.

References mixconfig.panels.MixConfigPanel.setAutoSaveEnabled().

Referenced by mixconfig.panels.MixConfigPanel.load(), mixconfig.wizard.ConfigWizardPanel.load(), mixconfig.ConfigFrame.load(), mixconfig.panels.MixConfigPanel.setConfiguration(), mixconfig.panels.PaymentPanel.stateChanged(), mixconfig.panels.OwnCertificatesPanel.stateChanged(), and mixconfig.panels.CascadePanel.stateChanged().

void mixconfig.panels.MixConfigPanel.save (  )  throws IOException

void mixconfig.panels.MixConfigPanel.save ( IPTextField  a_ipTextField  )  [protected]

Saves the value of the IP address in the IPTextField.

Parameters:
a_ipTextField an IPTextField

Reimplemented in mixconfig.panels.MixOnCDPanel.

References mixconfig.panels.MixConfigPanel.m_mixConf, and mixconfig.MixConfiguration.setValue().

void mixconfig.panels.MixConfigPanel.save ( Container  a  )  throws IOException [protected]

Saves the value of all components in the specified container. The method iterates over all of the container's components and invokes the appropriate save method for them. If the container is an instance of mixconfig.networkpanel.IPTextField, the value of the IPTextField is saved instead.

Parameters:
a A container
Exceptions:
IOException If an error occurs while writing the values to the configuration object

Reimplemented in mixconfig.panels.TermsAndConditionsPanel.

References mixconfig.panels.MixConfigPanel.save().

void mixconfig.panels.MixConfigPanel.save ( JTable  table  )  [protected]

Saves the values of a table to the configuration object. The value is only saved if the component is currently enabled, otherwise, a null value is saved.

Parameters:
a A table

References mixconfig.panels.MixConfigPanel.m_mixConf, and mixconfig.MixConfiguration.setValue().

void mixconfig.panels.MixConfigPanel.save ( CertPanel  a  )  throws IOException [protected]

Saves the values of a certificate panel to the configuration object. The value is only saved if the component is currently enabled, otherwise, the element with the same XML path as the component's name is removed from the XML structure.

Parameters:
a A certificate panel
Exceptions:
IOException If an error occurs while writing the values to the configuration object

References mixconfig.panels.MixConfigPanel.m_mixConf, mixconfig.MixConfiguration.removeNode(), and mixconfig.MixConfiguration.setValue().

void mixconfig.panels.MixConfigPanel.save ( PriceCertPanel  a_panel  )  throws IOException [protected]

Save a price certificate from PriceCertPanel to the configuration

Parameters:
a_panel 
Exceptions:
IOException 

References mixconfig.panels.MixConfigPanel.m_mixConf, mixconfig.MixConfiguration.removeNode(), and mixconfig.MixConfiguration.setValue().

void mixconfig.panels.MixConfigPanel.save ( JTextField  a_textfield  )  [protected]

Save the values of a text field to the configuration object. The value is only saved if the component is currently enabled, otherwise, the element with the same XML path as the component's name is removed from the XML structure.

Parameters:
a A text field

Reimplemented in mixconfig.panels.GeneralPanel.

References mixconfig.panels.MixConfigPanel.m_mixConf, mixconfig.MixConfiguration.removeNode(), and mixconfig.panels.MixConfigPanel.save().

void mixconfig.panels.MixConfigPanel.save ( String  a_xmlPath,
String  a_value 
) [protected]

Saves the value to the specified XML path in the configuration object. If the value is null or empty the path specified is deleted.

Parameters:
a_xmlPath an xml path
a_value a value

References mixconfig.MixConfiguration.getValue(), mixconfig.MixConfiguration.hasAttributes(), mixconfig.panels.MixConfigPanel.m_mixConf, mixconfig.MixConfiguration.removeNode(), and mixconfig.MixConfiguration.setValue().

void mixconfig.panels.MixConfigPanel.save ( JCheckBox  a  )  [protected]

Saves the values of a checkbox to the configuration object. If the component is currently disabled, a value of false is saved no matter what the selected state of the checkbox is.

Parameters:
a A checkbox

Reimplemented in mixconfig.panels.GeneralPanel, and mixconfig.panels.MixOnCDPanel.

References mixconfig.panels.MixConfigPanel.m_mixConf, and mixconfig.MixConfiguration.setValue().

void mixconfig.panels.MixConfigPanel.save ( JComboBox  a  )  [protected]

Saves the values of a combo box to the configuration object. The value is only saved if the component is currently enabled, otherwise, the element with the same XML path as the component's name is removed from the XML structure.

Parameters:
a A combo box

Reimplemented in mixconfig.panels.GeneralPanel, mixconfig.panels.OwnCertificatesPanel, and mixconfig.panels.TermsAndConditionsPanel.

References mixconfig.panels.MixConfigPanel.m_mixConf, mixconfig.MixConfiguration.removeNode(), and mixconfig.MixConfiguration.setValue().

void mixconfig.panels.MixConfigPanel.save ( JRadioButton  a  )  [protected]

Saves the values of a radio button to the configuration object. This method does not save the value directly, but tries to retrieve the radio button's group and invokes the appropriate save method.

Parameters:
a A radio button the encoding is UTF-8. If this encoding is not supported, an exception is thrown.

Reimplemented in mixconfig.panels.OwnCertificatesPanel.

References mixconfig.panels.MixConfigPanel.ToggleButtonModel.getGroup(), and mixconfig.panels.MixConfigPanel.save().

void mixconfig.panels.MixConfigPanel.save ( ButtonGroup  a  )  [protected]

Saves the value of the currently selected button in the specified button group to the configuration object, and removes the values of the unselected buttons in the group. If the component is currently disabled, a null value is saved.

Parameters:
a A button group

void mixconfig.panels.MixConfigPanel.load ( Container  a  )  throws IOException [protected]

Loads the value of all components in the specified container. The method iterates over all of the container's components and invokes the appropriate load method for them. If the container is an instance of mixconfig.networkpanel.IPTextField, the value is loaded only into the IPTextField instead.

Parameters:
a A container
Exceptions:
IOException If an error occurs while writing the values to the configuration object

Reimplemented in mixconfig.panels.TermsAndConditionsPanel.

References mixconfig.panels.MixConfigPanel.load().

void mixconfig.panels.MixConfigPanel.load ( JTextField  a  )  [protected]

Loads the value with the same name as the specified text field from the configuration object and sets its value accordingly.

Parameters:
a A text field

Reimplemented in mixconfig.panels.CascadePanel, and mixconfig.panels.GeneralPanel.

References mixconfig.MixConfiguration.getValue(), and mixconfig.panels.MixConfigPanel.m_mixConf.

void mixconfig.panels.MixConfigPanel.load ( JCheckBox  a  )  [protected]

Loads the value with the same name as the specified checkbox from the configuration object and sets its value accordingly.

Parameters:
a A check box

Reimplemented in mixconfig.panels.GeneralPanel, and mixconfig.panels.MixOnCDPanel.

References mixconfig.MixConfiguration.getValue(), and mixconfig.panels.MixConfigPanel.m_mixConf.

void mixconfig.panels.MixConfigPanel.load ( JComboBox  a  )  [protected]

Loads the value with the same name as the specified combo box from the configuration object and sets its value accordingly. If the value in the configuration is not an int, a value of 0 (zero) is assumed by default.

Parameters:
a A combo box

Reimplemented in mixconfig.panels.GeneralPanel, mixconfig.panels.OwnCertificatesPanel, and mixconfig.panels.TermsAndConditionsPanel.

References mixconfig.MixConfiguration.getValue(), and mixconfig.panels.MixConfigPanel.m_mixConf.

void mixconfig.panels.MixConfigPanel.load ( JRadioButton  a  )  [protected]

Loads the value with the same name as the specified combo box from the configuration object and sets its value accordingly.

Parameters:
a A radio button

Reimplemented in mixconfig.panels.OwnCertificatesPanel.

References mixconfig.MixConfiguration.getValue(), and mixconfig.panels.MixConfigPanel.m_mixConf.

void mixconfig.panels.MixConfigPanel.load ( JTable  table  )  [protected]

void mixconfig.panels.MixConfigPanel.load ( IPTextField  a_ipTextField  )  [protected]

void mixconfig.panels.MixConfigPanel.load ( CertPanel  a_panel  )  throws IOException [protected]

Loads the value with the same name as the specified certificate panel from the configuration object and sets its value accordingly.

Parameters:
a A certificate panel
Exceptions:
IOException If an error occurs while writing the values to the configuration object

References mixconfig.MixConfiguration.getValue(), and mixconfig.panels.MixConfigPanel.m_mixConf.

void mixconfig.panels.MixConfigPanel.load ( PriceCertPanel  a_panel  )  throws IOException [protected]

Load a price certificate from a configuration into a PriceCertPanel

References mixconfig.MixConfiguration.getDocument(), and mixconfig.panels.MixConfigPanel.m_mixConf.

boolean mixconfig.panels.MixConfigPanel.isNumber ( String  str  )  [protected]

Checks whether the specified String value is parseable into an int value.

Parameters:
str A string
Returns:
boolean true if the specified string can be parsed into an int value, false otherwise

Component mixconfig.panels.MixConfigPanel.getComponentByName ( String  a_name  )  [protected]

Returns the component with the specified name.

Parameters:
a_name The name of the desired component
Returns:
The component with the specified name, or null if there is no component with this name in this container


Member Data Documentation

final String mixconfig.panels.MixConfigPanel.MSG_WARNING_NO_MIX_CERT = MixConfigPanel.class.getName() + "_warningNoMixCert" [static]

final String mixconfig.panels.MixConfigPanel.MSG_WARNING_NO_OPERATOR_CERT = MixConfigPanel.class.getName() + "_warningOperatorCert" [static]

final String mixconfig.panels.MixConfigPanel.MSG_ERROR_BLANK_FIELD = MixConfigPanel.class.getName() + "_errorBlankField" [static]


The documentation for this class was generated from the following file:

Generated on Mon Nov 16 23:24:48 2009 for MixConfig by  doxygen 1.5.6