Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.edit.views
Class ISeriesEditorPromptViewer

java.lang.Object
  extended by Viewer
      extended by com.ibm.etools.iseries.edit.views.ISeriesEditorPromptViewer
All Implemented Interfaces:
IISeriesEditorConstantsPrompt, IISeriesEditorPromptChangeListener

public class ISeriesEditorPromptViewer
extends Viewer
implements IISeriesEditorConstantsPrompt, IISeriesEditorPromptChangeListener

This class displays the content of the prompt view. The content is defined in an XML file, and is made up of one or more pages. One page is displayed at at time.


Nested Class Summary
 class ISeriesEditorPromptViewer.Debouncer
          This class debounces change notifications from the DDS model and refreshes the editor.
 
Field Summary
protected  Action _actionDisableSyntaxChecking
           
protected  Action _actionDisableView
           
protected  Action _actionInsertMode
           
protected  IISeriesEditorPromptAdapter _adapter
           
protected  ISeriesEditorSyntaxError[] _aSyntaxErrors
           
protected  boolean _bApplyOrRevertPressed
           
protected  Button _buttonApply
           
protected  Button _buttonRevert
           
protected  ISeriesEditorPromptChangeEvent _changeEventPending
           
protected  ISeriesEditorPromptChangeEvent _changeEventProcessed
           
protected  ISeriesEditorPromptChangeEvent _changeEventReceived
           
protected  Combo _comboPromptType
           
protected  Composite _compositeClient
           
protected  Composite _compositeFields
           
protected  Composite _compositeParent
           
protected  Composite _compositePrompt
           
protected  Control _controlLastFocus
           
protected  ISeriesEditorPromptViewer.Debouncer _debouncer
           
protected  Font _font
           
protected  int _iElementNumber
           
protected  int _iIndexPageCurrent
           
protected  Label _labelFormatLine
           
protected  Label _labelLine
           
protected  List _listSyntaxErrors
           
protected  Object _objaInput
           
protected  ISeriesEditorPromptGroup _pageGroupCurrent
           
protected  Rectangle _rectBounds
           
protected  String _strElementCurrent
           
protected static String _strEmpty
           
protected  StringBuffer _stringBuffer
           
protected  String _strPromptId
           
protected  IISeriesEditorSyntaxChecker _syntaxChecker
           
protected  ISeriesEditorViewport _viewport
           
static String copyright
           
 
Fields inherited from interface com.ibm.etools.iseries.edit.IISeriesEditorConstantsPrompt
ALIGNMENT_BOTH, ALIGNMENT_LEFT, ALIGNMENT_NONE, ALIGNMENT_RIGHT
 
Constructor Summary
ISeriesEditorPromptViewer(Composite compositeParent, IISeriesEditorPromptAdapter adapter, Action actionCreateNewLine, Action actionDisableView, Action actionDisableSyntaxChecking)
          Constructor.
 
Method Summary
protected  void clearFields()
          Sets the text field values to an empty string.
protected  Control createControl(Composite compositeParent)
          Create the controls for this view.
protected  void createField(Composite compositeParent, ISeriesEditorPromptFieldData data, int iMaxLineLength)
          Creates a composite with a label and either a combo box, or text field under it.
protected  void createPromptComposite()
          Creates the composite with a child composite for the fields and one for the format line and current line.
protected  void doCopy()
          Perform copy action for currently selected text or combo box field.
protected  void doPaste()
          Perform copy action for currently selected text or combo box field.
protected  void ensureVisible(Composite composite)
          Ensures that the field that the user has tabbed to is within the visible part of the client area.
 void fieldChanged()
          Called whenever a field changes its value.
 void focusGained(FocusEvent event)
          Emulates replace mode behaviour for a text field by selecting one character when the text field gains focus.
 void focusLost(FocusEvent event)
           
 Control getControl()
          Method declared on Viewer.
protected  String getFieldHelpID(Control control)
          Returns the help identifier string for the field widget.
protected  Font getFont()
          Returns the editor's current font.
 Object getInput()
          Method declared on Viewer.
protected  String getLineFromFieldValues()
          Reconstitutes a line to be placed into the editor from the individual fields.
 ISelection getSelection()
          Method declared on Viewer.
 void helpRequested(HelpEvent hEvent)
          The F1 key has been pressed on a control inside this view.
 void keyPressed(KeyEvent kEvent)
          Does nothing.
 void keyReleased(KeyEvent kEvent)
          For text fields, when the caret moves because of a key press, ensure that the caret and characters around it are visible by scrolling the viewport.
 void keyTraversed(TraverseEvent event)
          Handles traversal between controls via the Tab and Backtab keys.
 void modifyText(ModifyEvent mEvent)
          Called whenever a text field has been modified.
protected  void processChangeEvent(ISeriesEditorPromptChangeEvent event)
          Called by the refresh timer after debouncing change events.
 void promptChange(ISeriesEditorPromptChangeEvent event)
          Method declared on IISeriesEditorPromptChangeListener.
 void propertyChange(PropertyChangeEvent event)
          Called when any of the toolbar items are toggled.
 void refresh()
          Refreshes this viewer completely, getting new contents for the input from the content provider.
 void setEnabled(boolean bEnabled)
          Enables / disables the view.
protected  boolean setFieldValuesFromLine(String strLine)
          Sets the line of text.
protected  void setFocusToFieldFromPosition(int iPosition, int iLength)
           
protected  void setFocusToFirstField()
          Sets the focus to the first field.
 void setInput(Object newInput)
          The PropertySheetViewer implementation of this method declared on Viewer method sets the objects for which the viewer is currently showing properties.
protected  void setLineLabelText(String strText)
          Windows takes an ampersand/letter with an underscored letter.
protected  void setPromptType(String strPromptId)
          Sets the prompt page to be displayed.
 void setSelection(ISelection selection, boolean reveal)
          Method declared on Viewer.
protected  void showBlankPage()
          Displays a blank prompt page
protected  boolean showPage(String strPageId)
          Displays the page with the given name.
protected  boolean showPromptTypes()
          Populates the drop down combo with the list of specification types.
protected  void showSyntaxErrorMessages(int iElementNumber)
          Do syntax checking if disable syntax checking toolbar button is disabled
 void terminate()
          Called by the page book view when the page is being disposed.
 void widgetDefaultSelected(SelectionEvent sEvent)
          Does nothing.
 void widgetSelected(SelectionEvent sEvent)
          Called when combo box selection occurs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyright

public static final String copyright
See Also:
Constant Field Values

_strEmpty

protected static String _strEmpty

_actionDisableSyntaxChecking

protected Action _actionDisableSyntaxChecking

_actionDisableView

protected Action _actionDisableView

_actionInsertMode

protected Action _actionInsertMode

_buttonApply

protected Button _buttonApply

_buttonRevert

protected Button _buttonRevert

_comboPromptType

protected Combo _comboPromptType

_controlLastFocus

protected Control _controlLastFocus

_compositeClient

protected Composite _compositeClient

_compositeFields

protected Composite _compositeFields

_compositeParent

protected Composite _compositeParent

_compositePrompt

protected Composite _compositePrompt

_debouncer

protected ISeriesEditorPromptViewer.Debouncer _debouncer

_font

protected Font _font

_adapter

protected IISeriesEditorPromptAdapter _adapter

_syntaxChecker

protected IISeriesEditorSyntaxChecker _syntaxChecker

_changeEventProcessed

protected ISeriesEditorPromptChangeEvent _changeEventProcessed

_changeEventPending

protected ISeriesEditorPromptChangeEvent _changeEventPending

_changeEventReceived

protected ISeriesEditorPromptChangeEvent _changeEventReceived

_pageGroupCurrent

protected ISeriesEditorPromptGroup _pageGroupCurrent

_aSyntaxErrors

protected ISeriesEditorSyntaxError[] _aSyntaxErrors

_viewport

protected ISeriesEditorViewport _viewport

_labelFormatLine

protected Label _labelFormatLine

_labelLine

protected Label _labelLine

_listSyntaxErrors

protected List _listSyntaxErrors

_objaInput

protected Object _objaInput

_rectBounds

protected Rectangle _rectBounds

_strElementCurrent

protected String _strElementCurrent

_strPromptId

protected String _strPromptId

_stringBuffer

protected StringBuffer _stringBuffer

_iIndexPageCurrent

protected int _iIndexPageCurrent

_iElementNumber

protected int _iElementNumber

_bApplyOrRevertPressed

protected boolean _bApplyOrRevertPressed
Constructor Detail

ISeriesEditorPromptViewer

public ISeriesEditorPromptViewer(Composite compositeParent,
                                 IISeriesEditorPromptAdapter adapter,
                                 Action actionCreateNewLine,
                                 Action actionDisableView,
                                 Action actionDisableSyntaxChecking)
Constructor.

Method Detail

clearFields

protected void clearFields()
Sets the text field values to an empty string.


createControl

protected Control createControl(Composite compositeParent)
Create the controls for this view.


createField

protected void createField(Composite compositeParent,
                           ISeriesEditorPromptFieldData data,
                           int iMaxLineLength)
Creates a composite with a label and either a combo box, or text field under it. The widgets are center aligned. If the string array is not null and its length is greater than zero, then a combo box is created. Otherwise, a text field is created. The widget of the text field is based upon the character length.


createPromptComposite

protected void createPromptComposite()
Creates the composite with a child composite for the fields and one for the format line and current line.


ensureVisible

protected void ensureVisible(Composite composite)
Ensures that the field that the user has tabbed to is within the visible part of the client area.


fieldChanged

public void fieldChanged()
Called whenever a field changes its value. In replace mode, the line reconstitued from the field widgets is compared to the original line. If the line is the same, the apply and cancel buttons are disabled. Otherwise the buttons are enabled. Nothing is done in insert mode.


focusGained

public void focusGained(FocusEvent event)
Emulates replace mode behaviour for a text field by selecting one character when the text field gains focus.


focusLost

public void focusLost(FocusEvent event)

getControl

public Control getControl()
Method declared on Viewer. Returns the primary control associated with this viewer.


getFieldHelpID

protected String getFieldHelpID(Control control)
Returns the help identifier string for the field widget. For drop down combos,


getFont

protected Font getFont()
Returns the editor's current font.


getInput

public Object getInput()
Method declared on Viewer.


getLineFromFieldValues

protected String getLineFromFieldValues()
Reconstitutes a line to be placed into the editor from the individual fields.


getSelection

public ISelection getSelection()
Method declared on Viewer.


helpRequested

public void helpRequested(HelpEvent hEvent)
The F1 key has been pressed on a control inside this view.


keyPressed

public void keyPressed(KeyEvent kEvent)
Does nothing.


keyReleased

public void keyReleased(KeyEvent kEvent)
For text fields, when the caret moves because of a key press, ensure that the caret and characters around it are visible by scrolling the viewport.


keyTraversed

public void keyTraversed(TraverseEvent event)
Handles traversal between controls via the Tab and Backtab keys. 6.0.1 ES - removed since it violates accessiblity


modifyText

public void modifyText(ModifyEvent mEvent)
Called whenever a text field has been modified.


promptChange

public void promptChange(ISeriesEditorPromptChangeEvent event)
Method declared on IISeriesEditorPromptChangeListener. The user has moved the cursor to a new line. The event contains the prompt page identifier, the line number, and the line text. The prompt view displays the prompt page, and sets the field content to the text in the line.

Specified by:
promptChange in interface IISeriesEditorPromptChangeListener

processChangeEvent

protected void processChangeEvent(ISeriesEditorPromptChangeEvent event)
Called by the refresh timer after debouncing change events.


propertyChange

public void propertyChange(PropertyChangeEvent event)
Called when any of the toolbar items are toggled.


refresh

public void refresh()
Refreshes this viewer completely, getting new contents for the input from the content provider.


setEnabled

public void setEnabled(boolean bEnabled)
Enables / disables the view. This is called from the disable view action.


setFieldValuesFromLine

protected boolean setFieldValuesFromLine(String strLine)
Sets the line of text. The field values are set with the content of the line.


setFocusToFieldFromPosition

protected void setFocusToFieldFromPosition(int iPosition,
                                           int iLength)

setFocusToFirstField

protected void setFocusToFirstField()
Sets the focus to the first field.


setInput

public void setInput(Object newInput)
The PropertySheetViewer implementation of this method declared on Viewer method sets the objects for which the viewer is currently showing properties.

The input must be an Object[] or null.

Parameters:
input - the input of this viewer, or null if none

setLineLabelText

protected void setLineLabelText(String strText)
Windows takes an ampersand/letter with an underscored letter. This method Replaces ampersand characters with a double ampersand so that underscores do not appear in the label.


setPromptType

protected void setPromptType(String strPromptId)
Sets the prompt page to be displayed. The page is displayed.


setSelection

public void setSelection(ISelection selection,
                         boolean reveal)
Method declared on Viewer. Does nothing.


showBlankPage

protected void showBlankPage()
Displays a blank prompt page


showPage

protected boolean showPage(String strPageId)
Displays the page with the given name. An XML page element is searched for using the given name. The page's field widgets are created and displayed.


showPromptTypes

protected boolean showPromptTypes()
Populates the drop down combo with the list of specification types.


showSyntaxErrorMessages

protected void showSyntaxErrorMessages(int iElementNumber)
Do syntax checking if disable syntax checking toolbar button is disabled


terminate

public void terminate()
Called by the page book view when the page is being disposed. The prompt change listeners are removed from the adapter.


widgetDefaultSelected

public void widgetDefaultSelected(SelectionEvent sEvent)
Does nothing.


widgetSelected

public void widgetSelected(SelectionEvent sEvent)
Called when combo box selection occurs.


doCopy

protected void doCopy()
Perform copy action for currently selected text or combo box field.

Since:
WDSc 5.1.2

doPaste

protected void doPaste()
Perform copy action for currently selected text or combo box field.

Since:
WDSc 5.1.2

Rational Developer for Power Systems Software
V7.6

Copyright © 2011 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.