LPEX
4.4.0

com.ibm.lpex.alef.preferences
Class SequenceNumbersPreferencePage

java.lang.Object
  extended by FieldEditorPreferencePage
      extended by com.ibm.lpex.alef.preferences.LpexFieldEditorPreferencePage
          extended by com.ibm.lpex.alef.preferences.SequenceNumbersPreferencePage

public class SequenceNumbersPreferencePage
extends LpexFieldEditorPreferencePage

Preference page with sequence-numbers settings for one LPEX view, or default settings for the editor.


Field Summary
protected  com.ibm.lpex.alef.preferences.SequenceNumbersPreferencePage.SeqNumIntegerFieldEditor _numColumnTextField
           
protected  com.ibm.lpex.alef.preferences.SequenceNumbersPreferencePage.SeqNumIntegerFieldEditor _numWidthTextField
           
protected  com.ibm.lpex.alef.preferences.SequenceNumbersPreferencePage.SeqNumIntegerFieldEditor _textColumnTextField
           
protected  com.ibm.lpex.alef.preferences.SequenceNumbersPreferencePage.SeqNumIntegerFieldEditor _textWidthTextField
           
 
Constructor Summary
SequenceNumbersPreferencePage(LpexView lpexView)
          Constructor.
 
Method Summary
protected  void checkState()
          Recomputes the page's error state.
protected  Control createContents(Composite parent)
          Creates and returns the SWT control for the customized body of this preference page.
protected  void createFieldEditors()
          Creates this preference page's field editors.
protected  void performDefaults()
          "Restore Defaults" button pressed.
 boolean performOk()
          "OK" / "Apply" button pressed.
protected  void performReset()
          "Reset" button pressed.
 void propertyChange(PropertyChangeEvent event)
          Validates field-value changes.
protected  boolean validateSequenceNumbers()
          Checks the validity of the sequence-numbers fields.
 
Methods inherited from class com.ibm.lpex.alef.preferences.LpexFieldEditorPreferencePage
contributeButtons, fieldEditorsCreated, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_numColumnTextField

protected com.ibm.lpex.alef.preferences.SequenceNumbersPreferencePage.SeqNumIntegerFieldEditor _numColumnTextField

_numWidthTextField

protected com.ibm.lpex.alef.preferences.SequenceNumbersPreferencePage.SeqNumIntegerFieldEditor _numWidthTextField

_textColumnTextField

protected com.ibm.lpex.alef.preferences.SequenceNumbersPreferencePage.SeqNumIntegerFieldEditor _textColumnTextField

_textWidthTextField

protected com.ibm.lpex.alef.preferences.SequenceNumbersPreferencePage.SeqNumIntegerFieldEditor _textWidthTextField
Constructor Detail

SequenceNumbersPreferencePage

public SequenceNumbersPreferencePage(LpexView lpexView)
Constructor. When the constructor is passed a non-null LpexView, a view-scoped, rather than a global-settings, preference page is created, which handles the sequence-numbers settings for the particular view.

Method Detail

createContents

protected Control createContents(Composite parent)
Creates and returns the SWT control for the customized body of this preference page. Overridden in order to set the context help.


createFieldEditors

protected void createFieldEditors()
Creates this preference page's field editors.

Method fieldEditorsCreated() is called after the fields of this preference page are created and set to their initial values. One or more of the fields may be disabled by a subclass in there, as follows:

 
 _numColumnTextField.setEnabled(false);
 _numWidthTextField.setEnabled(false);
 _textColumnTextField.setEnabled(false); 
 _textWidthTextField.setEnabled(false);
 


performOk

public boolean performOk()
"OK" / "Apply" button pressed. Commits any new updated value, and ensures that the changes are reflected correctly on the LPEX screens.


performDefaults

protected void performDefaults()
"Restore Defaults" button pressed. Sets the values and the dialog fields to the install/default settings, does a checkState() to recalculate page's error state.


performReset

protected void performReset()
"Reset" button pressed. Restores the initial preference page settings.

Overrides:
performReset in class LpexFieldEditorPreferencePage
See Also:
LpexFieldEditorPreferencePage.contributeButtons(Composite)

checkState

protected void checkState()
Recomputes the page's error state. This method calls isValid() for every field and, if all are correct, validateSequenceNumbers().

Called when the preference page is selected, and on any value change in our fields.


propertyChange

public void propertyChange(PropertyChangeEvent event)
Validates field-value changes. The original FieldEditorPreferencePage implementation of this method only calls checkState() when an invalid field becomes valid. As we also want to validate the individual values in their entirety as sequence-numbers settings, we call here checkState() on any field-value change.


validateSequenceNumbers

protected boolean validateSequenceNumbers()
Checks the validity of the sequence-numbers fields. Checks are done for acceptable values (columns > 1, widths < 9), and adjacency of the numeric and text parts.

A subclass may extend this method to perform additional checks, for example:

 
 protected boolean validateSequenceNumbers()
 {
  boolean valid = super.validateSequenceNumbers();
  if (valid)
   {
    valid = myAdditionalChecks();
    if (!valid)
     {
      setErrorMessage("myAdditionalChecks information"); 
     }
   }
  return valid;
 } 

See Also:
checkState()

LPEX
4.4.0

Copyright � 2016 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.