iSeries Remote Systems
v6.0.0

com.ibm.etools.iseries.editor.language.model
Class DdsModelLpexAdapter

java.lang.Object
  extended bycom.ibm.etools.iseries.editor.language.model.DdsModelLpexAdapter
All Implemented Interfaces:
IDdsLanguageModel, com.ibm.etools.systems.editor.ISystemTextEditorAdapterContributor

public class DdsModelLpexAdapter
extends Object
implements IDdsLanguageModel, com.ibm.etools.systems.editor.ISystemTextEditorAdapterContributor

This class manages a DdsModel for a particular LpexTextEditor. It keeps the contents of the editor and model in synch and manages the broadcasting of selection events.


Nested Class Summary
 class DdsModelLpexAdapter.LpexFileReader
           
 class DdsModelLpexAdapter.LpexSourceFile
          This class enables the DDS parser to parse the contents of an Lpex editor
 class DdsModelLpexAdapter.ParseDdsModelJob
          Asynchronously reparse the DDS file and refresh the outline view This job belongs to the family of jobs that parse the DDS model for this editor.
 class DdsModelLpexAdapter.ParseJobScheduler
          This class schedules jobs to parse the model from the editor's contents in the background.
 class DdsModelLpexAdapter.ResequenceJob
          Asynchronously resequence the sequence numbers in the DDS model based on the Lpex editor contents This job belongs to the family of jobs that parse the DDS model for this editor.
 
Field Summary
 
Fields inherited from interface com.ibm.etools.systems.editor.ISystemTextEditorAdapterContributor
Copyright
 
Constructor Summary
DdsModelLpexAdapter(com.ibm.lpex.alef.LpexTextEditor editor)
          Constructor if you do not have the connection and CCSID already computed.
DdsModelLpexAdapter(com.ibm.lpex.alef.LpexTextEditor editor, int iCCSID, ISeriesConnection connection)
          Constructor used from an ISeriesEditorParser that already has computed the necessary parameters
 
Method Summary
 void clearModel()
          Clear the model and notify all views
 String convertToAS400Layout(String text)
          Convert given text to the ordering scheme of the iSeries
 String convertToJavaLayout(String text)
          Convert given text to the ordering scheme of the Java
 Object getAdapter(com.ibm.lpex.alef.LpexTextEditor editor, Class classRequired)
          Adapter factory for creating DDS language model objects
 com.ibm.as400.access.AS400BidiTransform getBidiTransform()
          Get the JTOpen transform that is able transform between the BIDI representation on the iSeries and the representation in a Java String.
 IDdsParserAdapter getDdsCursorListener()
          Return the singleton cursor listener that implements IDdsAdaptable.
 com.ibm.etools.iseries.dds.dom.DdsModel getDdsModel()
          Retrieve DDS model corresponding to the source in the editor.
 DdsModelLpexAdapter.ParseJobScheduler getParseJobScheduler()
           
 void handleFileRename()
          From the editor find the file that is currently being edited Set the current DDS type based on its extension
 boolean incrementallyUpdateModel(int iElement, boolean inserted, boolean willBeReparsed)
          Update the model with the changed/inserted line If we could not do this return true
 boolean isDdsModelParsed()
          Has the DDS Model been parsed yet?
 com.ibm.etools.iseries.dds.dom.DdsModel parseDdsModel()
          Parse the model
 void refreshModel()
          Refresh the model based on the changed source in Lpex.
 void refreshModel(int sequenceUpdateRangeBottom, int sequenceUpdateRangeTop)
          Refresh the model based on the changed source in Lpex.
 void reserveSequenceNumbers(int elementFirst, int changedLineCount)
          If inserting a number of lines make sure that the sequence numbers in the LineContainer in the model has room to insert them.
 void setEditor(com.ibm.lpex.alef.LpexTextEditor editor)
          Set the view for the first time May need to set up listeners Computes the DDS type
 void setIFile(IFile file)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DdsModelLpexAdapter

public DdsModelLpexAdapter(com.ibm.lpex.alef.LpexTextEditor editor,
                           int iCCSID,
                           ISeriesConnection connection)
Constructor used from an ISeriesEditorParser that already has computed the necessary parameters


DdsModelLpexAdapter

public DdsModelLpexAdapter(com.ibm.lpex.alef.LpexTextEditor editor)
Constructor if you do not have the connection and CCSID already computed.

Method Detail

getAdapter

public Object getAdapter(com.ibm.lpex.alef.LpexTextEditor editor,
                         Class classRequired)
Adapter factory for creating DDS language model objects

Specified by:
getAdapter in interface com.ibm.etools.systems.editor.ISystemTextEditorAdapterContributor
See Also:
ISystemTextEditorAdapterContributor.getAdapter(com.ibm.lpex.alef.LpexTextEditor, java.lang.Class)

getDdsCursorListener

public IDdsParserAdapter getDdsCursorListener()
Return the singleton cursor listener that implements IDdsAdaptable. Lazily create the singleton.

Specified by:
getDdsCursorListener in interface IDdsLanguageModel

setEditor

public void setEditor(com.ibm.lpex.alef.LpexTextEditor editor)
Set the view for the first time May need to set up listeners Computes the DDS type


setIFile

public void setIFile(IFile file)
Parameters:
file - The iFile to set.

handleFileRename

public void handleFileRename()
From the editor find the file that is currently being edited Set the current DDS type based on its extension


getDdsModel

public com.ibm.etools.iseries.dds.dom.DdsModel getDdsModel()
Retrieve DDS model corresponding to the source in the editor. Parse and create model if it does not exist.

Specified by:
getDdsModel in interface IDdsLanguageModel
Returns:

isDdsModelParsed

public boolean isDdsModelParsed()
Has the DDS Model been parsed yet?

Returns:

parseDdsModel

public com.ibm.etools.iseries.dds.dom.DdsModel parseDdsModel()
Parse the model

Returns:

getBidiTransform

public com.ibm.as400.access.AS400BidiTransform getBidiTransform()
Get the JTOpen transform that is able transform between the BIDI representation on the iSeries and the representation in a Java String. Typically on the iSeries the data is in visual order but in Java Strings it is always in logical order. When IFile are downloaded they are transformed to logical. But the parser expects the source in the same order that it was entered on the iSeries.


convertToAS400Layout

public String convertToAS400Layout(String text)
Convert given text to the ordering scheme of the iSeries

Parameters:
text -

convertToJavaLayout

public String convertToJavaLayout(String text)
Convert given text to the ordering scheme of the Java

Parameters:
text -

reserveSequenceNumbers

public void reserveSequenceNumbers(int elementFirst,
                                   int changedLineCount)
If inserting a number of lines make sure that the sequence numbers in the LineContainer in the model has room to insert them. If not increment the sequence number of as many subsequent lines as necessary to accomodate them. By doing this once at the beginning we avoid having to do this for each inserted line, which is an O(n * m/2) operation where n = the number of lines inserted and m = the number of lines in the file.

Specified by:
reserveSequenceNumbers in interface IDdsLanguageModel
Parameters:
elementFirst - - the element number of the first line being inserted
changedLineCount - - the number of lines that will be inserted
See Also:
IDdsLanguageModel.reserveSequenceNumbers(int, int)

incrementallyUpdateModel

public boolean incrementallyUpdateModel(int iElement,
                                        boolean inserted,
                                        boolean willBeReparsed)
Update the model with the changed/inserted line If we could not do this return true

Specified by:
incrementallyUpdateModel in interface IDdsLanguageModel
Parameters:
iElement - - element number of line in Lpex that has been changed or inserted
inserted - - element was inserted if true
willBeReparsed - - the model will be reparsed anyways - if inserting only update the line container but not the fileLevel heirarchy
Returns:
true if the model needs to be refreshed because we could not successfully update the model incrementally

refreshModel

public void refreshModel()
Refresh the model based on the changed source in Lpex.

Specified by:
refreshModel in interface IDdsLanguageModel

refreshModel

public void refreshModel(int sequenceUpdateRangeBottom,
                         int sequenceUpdateRangeTop)
Refresh the model based on the changed source in Lpex. The given range of elements may have to have their sequence numbers fixed up after parsing

Specified by:
refreshModel in interface IDdsLanguageModel
Parameters:
sequenceUpdateRangeBottom - element number of the first line to check for resequencing
sequenceUpdateRangeTop - element number of the last line to check for resequencing

getParseJobScheduler

public DdsModelLpexAdapter.ParseJobScheduler getParseJobScheduler()

clearModel

public void clearModel()
Clear the model and notify all views


iSeries Remote Systems
v6.0.0

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