com.SoftWoehr.JTOpenContrib.MEU
Class MEUEditBuffer

java.lang.Object
  |
  +--com.SoftWoehr.JTOpenContrib.MEU.MEUEditBuffer

public class MEUEditBuffer
extends java.lang.Object

Handles row editing the rows of unicode text representing the content of the file member being edited.


Constructor Summary
MEUEditBuffer(MEU anMEU, com.ibm.as400.access.AS400 a400, java.lang.String lib, java.lang.String fil, java.lang.String mbr)
          Creates new MEUEditBuffer
 
Method Summary
 boolean appendEmptyRow()
          Append an empty row.
 boolean appendRow(java.lang.String contents)
          Append a row.
 int changeNextOnLine(java.lang.String sought, java.lang.String changed, int rownum, int offset)
          Change next occurence after offset of sought to changed in line rownum.
 void closeSession(boolean writeOut)
          Close one way or another
 boolean copyRowAfter(int fromPos, int precederPos)
          Copy a record after a specific position.
 boolean copyRowBefore(int fromPos, int followerPos)
          Copy a row to before another row
 boolean createMember(java.lang.String description)
           
protected  MEUEditRow getEditRows()
          Return the edit rows associated with this edit buffer
 java.lang.String getFileName()
          Get file name
 java.lang.String getIFSPath()
          Return the IFSPath of the file member we represent
 java.lang.String getLibraryName()
          Get library name
 java.lang.String getMemberName()
          Get member name
 int getNumberOfRows()
          Get number of row records
 int getNumberOfRowsDisplayed()
          Return number of rows in display
 int getNumColumnsInView()
          Fetch number of Columns actually displayed
 int getNumRowsInView()
          Fetch number of rows being displayed in the window view.
 com.ibm.as400.access.RecordFormat getRecordFormat()
          Return the record format or null if it couldn't be gotten.
 java.lang.String getSRCDTAcontents(int rownum)
          Return contents of a specific row
 int getSRCDTAlength()
          Return length of SRCDTA field
 int getTopRowDisplayed()
          Fetch index of top row being displayed, ranges from -1 to number of records.
 boolean insertAllRowsFrom(int rownum, MEUEditBuffer sourceBuff)
          Insert all rows from another buffer into this buffer below current row
 boolean insertEmptyRow(int pos)
          Insert an empty row
 boolean insertRow(int pos, java.lang.String contents)
          Insert a record row (== record in this case) number.
 boolean isDirty()
          Is there a dirty row in the buffer?
 boolean load()
          Load in the file member records to be edited.
 boolean moveRowAfter(int fromPos, int precederPos)
          Move a record after a specific position.
 boolean moveRowBefore(int fromPos, int followerPos)
          Move a record before a specific position.
 java.lang.String recordsToString()
          Return all records as a string
 boolean removeRow(int pos)
          Delete a row.
 boolean replaceAllRowsWith(MEUEditBuffer sourceBuff)
          Empty this buffer, change its format, and replace all rows from source
protected  void resetDirty()
          No row has been inserted/moved/altered/deleted
 void scrollAhead()
          Scroll top of view ahead one page
 java.lang.String scrollBack()
          Scroll back one page
 void scrollTopOfView(int delta)
           
 void scrollTopOfViewAhead()
          Scroll top of view ahead one page
 void scrollTopOfViewBack()
          Scroll top of view ahead one page
 java.lang.String scrollView(int delta)
          Scroll the view forwards (+) or back (-).
 int search(java.lang.String s, int rownum)
          Returns the rownum on which the next occurrence of a string is found.
protected  void setDirty()
          A row has been inserted/moved/altered/deleted
 void setNumRowsInView(int val)
          Safely set the rows-in-view value.
 boolean setRecordFormat()
          Cause the record format to be fetched
 boolean setRecordFormat(MEUEditBuffer srcBuffer)
          Set the record format to match the source edit buffer's format
 void setTopRowDisplayed(int val)
          Safely set the top row value.
 boolean splitJoinRow(int rownum, int offset, int lastrow)
          Split/join a row and its follower
 java.lang.String toDisplayString()
          Return a string representing the current window view of the data
 java.lang.String toString()
          Return a string representation of all rows
 java.lang.String toString(int row)
          Return one row
 java.lang.String toString(int startRow, int postindex)
          Return a string representation of a certain number of rows, starting zero-based at a certain row.
 boolean updateRow(int pos, java.lang.String contents)
          Update a record by row (== record in this case) number.
 boolean write()
          Write out if modified or if forced and set unmodified.
 boolean write(boolean forceWrite)
          Write out if modified and set unmodified.
 void writeLocaltext(java.io.OutputStream o)
          Write out the file member locally to a text stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MEUEditBuffer

public MEUEditBuffer(MEU anMEU,
                     com.ibm.as400.access.AS400 a400,
                     java.lang.String lib,
                     java.lang.String fil,
                     java.lang.String mbr)
Creates new MEUEditBuffer
Parameters:
a400 - The AS400 object representing the server the file to be edited resides on.
rowlen - The length of the data (text) portion of the row.
lib - IFS name of the library in which the file member resides.
fil - IFS name of the file in which the member resides.
mem - Member to be edited.
Method Detail

getLibraryName

public java.lang.String getLibraryName()
Get library name

getFileName

public java.lang.String getFileName()
Get file name

getMemberName

public java.lang.String getMemberName()
Get member name

getEditRows

protected MEUEditRow getEditRows()
Return the edit rows associated with this edit buffer

setDirty

protected void setDirty()
A row has been inserted/moved/altered/deleted

resetDirty

protected void resetDirty()
No row has been inserted/moved/altered/deleted

isDirty

public boolean isDirty()
Is there a dirty row in the buffer?

getIFSPath

public java.lang.String getIFSPath()
Return the IFSPath of the file member we represent

getNumberOfRows

public int getNumberOfRows()
Get number of row records

getNumberOfRowsDisplayed

public int getNumberOfRowsDisplayed()
Return number of rows in display

toString

public java.lang.String toString()
Return a string representation of all rows
Overrides:
toString in class java.lang.Object
Returns:
The java string representation of the entire file member.

toString

public java.lang.String toString(int startRow,
                                 int postindex)
Return a string representation of a certain number of rows, starting zero-based at a certain row. The postindex is zero-based and is the index of the next row after the last converted. This representation is suitable for MEUTextArea.setText(), that is, it has the extra fields and has linefeeds embedded at the end of all rows but the last.
Parameters:
startRow - The number of the row to start with. This is zero-based.
numRows - How many rows to format as a string. If 0 is the start row and numRows is 25, rows 0 through 24 inclusive will be formatted and returned.
Returns:
A String representation of the requested rows.

toString

public java.lang.String toString(int row)
Return one row

toDisplayString

public java.lang.String toDisplayString()
Return a string representing the current window view of the data

setTopRowDisplayed

public void setTopRowDisplayed(int val)
Safely set the top row value. Used once the file member is open (and read, if necessary).

getTopRowDisplayed

public int getTopRowDisplayed()
Fetch index of top row being displayed, ranges from -1 to number of records.

getSRCDTAlength

public int getSRCDTAlength()
Return length of SRCDTA field

getSRCDTAcontents

public java.lang.String getSRCDTAcontents(int rownum)
Return contents of a specific row

setNumRowsInView

public void setNumRowsInView(int val)
Safely set the rows-in-view value.

getNumRowsInView

public int getNumRowsInView()
Fetch number of rows being displayed in the window view.

getNumColumnsInView

public int getNumColumnsInView()
Fetch number of Columns actually displayed

scrollView

public java.lang.String scrollView(int delta)
Scroll the view forwards (+) or back (-). Controller should have called setTopRowDisplayed and setNumRowsInView before calling this.

scrollTopOfView

public void scrollTopOfView(int delta)

scrollTopOfViewAhead

public void scrollTopOfViewAhead()
Scroll top of view ahead one page

scrollTopOfViewBack

public void scrollTopOfViewBack()
Scroll top of view ahead one page

scrollAhead

public void scrollAhead()
Scroll top of view ahead one page

scrollBack

public java.lang.String scrollBack()
Scroll back one page

load

public boolean load()
Load in the file member records to be edited. return true on success. in any event, reset changed flag

getRecordFormat

public com.ibm.as400.access.RecordFormat getRecordFormat()
Return the record format or null if it couldn't be gotten.

setRecordFormat

public boolean setRecordFormat()
Cause the record format to be fetched

setRecordFormat

public boolean setRecordFormat(MEUEditBuffer srcBuffer)
Set the record format to match the source edit buffer's format

updateRow

public boolean updateRow(int pos,
                         java.lang.String contents)
Update a record by row (== record in this case) number.

insertRow

public boolean insertRow(int pos,
                         java.lang.String contents)
Insert a record row (== record in this case) number.

insertEmptyRow

public boolean insertEmptyRow(int pos)
Insert an empty row

removeRow

public boolean removeRow(int pos)
Delete a row.

appendEmptyRow

public boolean appendEmptyRow()
Append an empty row.

appendRow

public boolean appendRow(java.lang.String contents)
Append a row.

replaceAllRowsWith

public boolean replaceAllRowsWith(MEUEditBuffer sourceBuff)
Empty this buffer, change its format, and replace all rows from source

insertAllRowsFrom

public boolean insertAllRowsFrom(int rownum,
                                 MEUEditBuffer sourceBuff)
Insert all rows from another buffer into this buffer below current row

splitJoinRow

public boolean splitJoinRow(int rownum,
                            int offset,
                            int lastrow)
Split/join a row and its follower

copyRowBefore

public boolean copyRowBefore(int fromPos,
                             int followerPos)
Copy a row to before another row

moveRowBefore

public boolean moveRowBefore(int fromPos,
                             int followerPos)
Move a record before a specific position.

copyRowAfter

public boolean copyRowAfter(int fromPos,
                            int precederPos)
Copy a record after a specific position.

moveRowAfter

public boolean moveRowAfter(int fromPos,
                            int precederPos)
Move a record after a specific position.

write

public boolean write()
Write out if modified or if forced and set unmodified.

write

public boolean write(boolean forceWrite)
Write out if modified and set unmodified.

writeLocaltext

public void writeLocaltext(java.io.OutputStream o)
                    throws java.io.IOException
Write out the file member locally to a text stream

closeSession

public void closeSession(boolean writeOut)
Close one way or another

createMember

public boolean createMember(java.lang.String description)

recordsToString

public java.lang.String recordsToString()
Return all records as a string

search

public int search(java.lang.String s,
                  int rownum)
Returns the rownum on which the next occurrence of a string is found. Caller looks for match on same row where search started (rownum - 1) without invoking this function. This function only used for searching rownum and the following rows.

changeNextOnLine

public int changeNextOnLine(java.lang.String sought,
                            java.lang.String changed,
                            int rownum,
                            int offset)
Change next occurence after offset of sought to changed in line rownum. Return new cursor offset or -1 if no change.