SWT LPEX
v3.0.5

com.ibm.lpex.alef.preferences
Class SequenceNumbersPreferencePage

java.lang.Object
  extended byorg.eclipse.jface.dialogs.DialogPage
      extended byorg.eclipse.jface.preference.PreferencePage
          extended byorg.eclipse.jface.preference.FieldEditorPreferencePage
              extended bycom.ibm.lpex.alef.preferences.LpexFieldEditorPreferencePage
                  extended bycom.ibm.lpex.alef.preferences.SequenceNumbersPreferencePage
All Implemented Interfaces:
EventListener, IDialogPage, IMessageProvider, IPreferencePage, IPropertyChangeListener, IWorkbenchPreferencePage

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
           
 
Fields inherited from class org.eclipse.jface.preference.FieldEditorPreferencePage
FLAT, GRID, MARGIN_HEIGHT, MARGIN_WIDTH, VERTICAL_SPACING
 
Fields inherited from interface org.eclipse.jface.dialogs.IMessageProvider
ERROR, INFORMATION, NONE, WARNING
 
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 org.eclipse.jface.preference.FieldEditorPreferencePage
addField, adjustGridLayout, applyFont, dispose, getFieldEditorParent, initialize, setVisible
 
Methods inherited from class org.eclipse.jface.preference.PreferencePage
applyDialogFont, computeSize, createControl, createDescriptionLabel, createNoteComposite, doComputeSize, doGetPreferenceStore, getApplyButton, getContainer, getDefaultsButton, getPreferenceStore, isValid, noDefaultAndApplyButton, okToLeave, performApply, performCancel, performHelp, setContainer, setErrorMessage, setMessage, setPreferenceStore, setSize, setTitle, setValid, toString, updateApplyButton
 
Methods inherited from class org.eclipse.jface.dialogs.DialogPage
convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, getControl, getDescription, getDialogFontName, getErrorMessage, getFont, getImage, getMessage, getMessageType, getShell, getTitle, getToolTipText, initializeDialogUnits, isControlCreated, setButtonLayoutData, setControl, setDescription, setImageDescriptor, setMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.preference.IPreferencePage
computeSize, isValid, okToLeave, performCancel, setContainer, setSize
 
Methods inherited from interface org.eclipse.jface.dialogs.IDialogPage
createControl, dispose, getControl, getDescription, getErrorMessage, getImage, getMessage, getTitle, performHelp, setDescription, setImageDescriptor, setTitle, setVisible
 

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, an LPEX view preference page (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(org.eclipse.swt.widgets.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()

SWT LPEX
v3.0.5

(C) Copyright IBM Corporation 1998, 2005.  All Rights Reserved.