All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.vaccess.DataQueueDocument

java.lang.Object
   |
   +----com.ibm.as400.vaccess.DataQueueDocument

public class DataQueueDocument
extends Object
implements Document, Serializable
The DataQueueDocument class represents an underlying model for text components, where the text is entries from a data queue on an AS/400.

Use this class in conjuction with any JTextComponent or any other component that works with the Document interface.

Most errors are reported as ErrorEvents rather than throwing exceptions. Users should listen for ErrorEvents in order to diagnose and recover from error conditions.

DataQueueDocument objects generate the following events:

The following example creates a document which contains the next entry in a data queue on an AS/400. It then presents the document in a JTextField object.

// Set up the document and the JTextField.
AS400 system = new AS400 ("MySystem", "Userid", "Password");
DataQueueDocument document = new DataQueueDocument (system, "/QSYS.LIB/MYLIB.LIB/MYDATAQ.DTAQ");
JTextField textField = new JTextField (document, "", 50);

// Add the JTextField to a frame. JFrame frame = new JFrame ("My Window"); frame.getContentPane().add(JTable.createScrollPaneForTable(textField));
// Read the next entry from the data queue. document.read ();


Constructor Index

 o DataQueueDocument()
Constructs a DataQueueDocument object.
 o DataQueueDocument(AS400, String)
Constructs a DataQueueDocument object.

Method Index

 o addDataQueueListener(DataQueueListener)
Adds a listener to be notified when a data queue event occurs.
 o addDocumentListener(DocumentListener)
Adds a listener to be notified when a document event occurs.
 o addErrorListener(ErrorListener)
Adds a listener to be notified when an error occurs.
 o addPropertyChangeListener(PropertyChangeListener)
Adds a listener to be notified when the value of any bound property changes.
 o addUndoableEditListener(UndoableEditListener)
Adds an undoable edit listener to be notified when undoable edits are made to the document.
 o addVetoableChangeListener(VetoableChangeListener)
Adds a listener to be notified when the value of any constrained property changes.
 o addWorkingListener(WorkingListener)
Adds a listener to be notified when work starts and stops on potentially long-running operations.
 o createPosition(int)
Returns a position that will track changes as the document is altered.
 o getDefaultRootElement()
Returns the root element that views should be based upon unless some other mechanism for assigning views to element structures is provided.
 o getEndPosition()
Returns a position that represents the end of the document.
 o getLength()
Returns the length of the document.
 o getPath()
Returns the fully qualified integrated file system path name of the data queue.
 o getProperty(Object)
Returns a property value associated with the document.
 o getRootElements()
Returns the root elements.
 o getStartPosition()
Returns a position that represents the start of the document.
 o getSystem()
Returns the system on which the data queue resides.
 o getText(int, int)
Returns the text contained within the specified portion of the document.
 o getText(int, int, Segment)
Stores the text contained within the specified portion of the document in a segment.
 o insertString(int, String, AttributeSet)
Inserts text into the document.
 o peek()
Reads an entry from the data queue without removing it from the queue, and stores the text of the entry in the document.
 o peek(int)
Reads an entry from the data queue without removing it from the queue, and stores the text of the entry in the document.
 o putProperty(Object, Object)
Sets a property value associated with the document.
 o read()
Reads an entry from the data queue and removes it from the queue, and stores the text of the entry in the document.
 o read(int)
Reads an entry from the data queue and removes it from the queue, and stores the text of the entry in the document.
 o remove(int, int)
Removes text from the document.
 o removeDataQueueListener(DataQueueListener)
Removes a data queue listener.
 o removeDocumentListener(DocumentListener)
Removes a document listener.
 o removeErrorListener(ErrorListener)
Removes an error listener.
 o removePropertyChangeListener(PropertyChangeListener)
Removes a property change listener.
 o removeUndoableEditListener(UndoableEditListener)
Removes an undoable edit listener.
 o removeVetoableChangeListener(VetoableChangeListener)
Removes a vetoable change listener.
 o removeWorkingListener(WorkingListener)
Removes a working listener.
 o render(Runnable)
Renders the document.
 o setPath(String)
Sets the fully qualified integrated file system path name of the data queue.
 o setSystem(AS400)
Sets the AS/400 system on which the data queue resides.
 o write()
Writes the contents of the document to the data queue.The entry replaces the current content.

Constructors

 o DataQueueDocument
 public DataQueueDocument()
Constructs a DataQueueDocument object.

 o DataQueueDocument
 public DataQueueDocument(AS400 system,
                          String path)
Constructs a DataQueueDocument object.

Parameters:
system - The AS/400 on which the data queue resides.
path - The fully qualified integrated file system path name of the data queue. The path must be in the format of /QSYS.LIB/libname.LIB/dataQueue.DTAQ. The library and queue name must each be 10 characters or less.

Methods

 o addDataQueueListener
 public void addDataQueueListener(DataQueueListener listener)
Adds a listener to be notified when a data queue event occurs.

Parameters:
listener - The listener.
 o addDocumentListener
 public void addDocumentListener(DocumentListener listener)
Adds a listener to be notified when a document event occurs.

Parameters:
listener - The listener.
 o addErrorListener
 public void addErrorListener(ErrorListener listener)
Adds a listener to be notified when an error occurs.

Parameters:
listener - The listener.
 o addPropertyChangeListener
 public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener to be notified when the value of any bound property changes.

Parameters:
listener - The listener.
 o addUndoableEditListener
 public void addUndoableEditListener(UndoableEditListener listener)
Adds an undoable edit listener to be notified when undoable edits are made to the document.

Parameters:
listener - The listener.
 o addVetoableChangeListener
 public void addVetoableChangeListener(VetoableChangeListener listener)
Adds a listener to be notified when the value of any constrained property changes.

Parameters:
listener - The listener.
 o addWorkingListener
 public void addWorkingListener(WorkingListener listener)
Adds a listener to be notified when work starts and stops on potentially long-running operations.

Parameters:
listener - The listener.
 o createPosition
 public synchronized Position createPosition(int offset) throws BadLocationException
Returns a position that will track changes as the document is altered. If the relative position is null, then the start of the document will be used.

Parameters:
offset - The offset from the start of the document.
Returns:
The position.
Throws: BadLocationException
If the given offset does not represent a valid location in the document.
 o getDefaultRootElement
 public synchronized Element getDefaultRootElement()
Returns the root element that views should be based upon unless some other mechanism for assigning views to element structures is provided.

Returns:
The root element.
 o getEndPosition
 public synchronized Position getEndPosition()
Returns a position that represents the end of the document. The position returned can be counted on to track change and stay located at the end of the document.

Returns:
The end position.
 o getLength
 public synchronized int getLength()
Returns the length of the document.

Returns:
The length of the document in characters.
 o getPath
 public String getPath()
Returns the fully qualified integrated file system path name of the data queue.

Returns:
The fully qualified integrated file system path name of the data queue.
 o getProperty
 public synchronized Object getProperty(Object key)
Returns a property value associated with the document.

Parameters:
key - The property key.
Returns:
The property value.
 o getRootElements
 public synchronized Element[] getRootElements()
Returns the root elements.

Returns:
The root elements.
 o getStartPosition
 public synchronized Position getStartPosition()
Returns a position that represents the start of the document. The position returned can be counted on to track change and stay located at the beginning of the document.

Returns:
The start position.
 o getSystem
 public AS400 getSystem()
Returns the system on which the data queue resides.

Returns:
The system on which the data queue resides.
 o getText
 public synchronized String getText(int offset,
                                    int length) throws BadLocationException
Returns the text contained within the specified portion of the document.

Parameters:
offset - The offset into the document representing the desired start of the text.
length - The length of the text.
Returns:
The text.
Throws: BadLocationException
If the given offset and length does not represent a valid range in the document.
 o getText
 public synchronized void getText(int offset,
                                  int length,
                                  Segment text) throws BadLocationException
Stores the text contained within the specified portion of the document in a segment.

Parameters:
offset - The offset into the document representing the desired start of the text.
length - The length of the text.
text - The segment in which to store the text.
Throws: BadLocationException
If the given offset and length does not represent a valid range in the document.
 o insertString
 public synchronized void insertString(int offset,
                                       String text,
                                       AttributeSet attributes) throws BadLocationException
Inserts text into the document. A position marks a location in the document between items. If the attributes that have been defined exactly match the current attributes defined at the position, the element representing the content at that position will simply be expanded. If the attributes defined are different, a new content element will be created that matches the attributes.

Parameters:
offset - The offset into the document representing the insertion position.
text - The text.
attributes - The attributes to associate with the inserted content, or null if there are no attributes.
Throws: BadLocationException
If the given offset does not represent a valid position in the document.
 o peek
 public void peek()
Reads an entry from the data queue without removing it from the queue, and stores the text of the entry in the document. The entry replaces the current content. This method will not wait for entries if none are on the queue. System and path must be set prior to calling this method.

 o peek
 public void peek(int wait)
Reads an entry from the data queue without removing it from the queue, and stores the text of the entry in the document. The entry replaces the current content. System and path must be set prior to calling this method.

Parameters:
wait - The number of seconds to wait if the queue contains no entries. -1 means to wait until an entry is available.
 o putProperty
 public synchronized void putProperty(Object key,
                                      Object value)
Sets a property value associated with the document.

Parameters:
key - The property key.
value - The property value.
 o read
 public void read()
Reads an entry from the data queue and removes it from the queue, and stores the text of the entry in the document. The entry replaces the current content. This method will not wait for entries if none are on the queue. System and path must be set prior to calling this method.

 o read
 public void read(int wait)
Reads an entry from the data queue and removes it from the queue, and stores the text of the entry in the document. The entry replaces the current content. System and path must be set prior to calling this method.

Parameters:
wait - The number of seconds to wait if the queue contains no entries. -1 means to wait until an entry is available.
 o remove
 public synchronized void remove(int offset,
                                 int length) throws BadLocationException
Removes text from the document.

Parameters:
offset - The offset into the document representing the desired start of the text.
length - The length of the text.
Throws: BadLocationException
If the given offset and length does not represent a valid range in the document.
 o removeDataQueueListener
 public void removeDataQueueListener(DataQueueListener listener)
Removes a data queue listener.

Parameters:
listener - The listener.
 o removeDocumentListener
 public void removeDocumentListener(DocumentListener listener)
Removes a document listener.

Parameters:
listener - The listener.
 o removeErrorListener
 public void removeErrorListener(ErrorListener listener)
Removes an error listener.

Parameters:
listener - The listener.
 o removePropertyChangeListener
 public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a property change listener.

Parameters:
listener - The listener.
 o removeUndoableEditListener
 public void removeUndoableEditListener(UndoableEditListener listener)
Removes an undoable edit listener.

Parameters:
listener - The listener.
 o removeVetoableChangeListener
 public void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a vetoable change listener.

Parameters:
listener - The listener.
 o removeWorkingListener
 public void removeWorkingListener(WorkingListener listener)
Removes a working listener.

Parameters:
listener - The listener.
 o render
 public void render(Runnable runnable)
Renders the document. This allows the model to be safely rendered in the presence of currency, if the model supports being updated asynchronously. The given runnable will be executed in a way that allows it to safely read the model with no changes while the runnable is being executed. The runnable itself may not make any mutations.

Parameters:
runnable - The runnable.
 o setPath
 public void setPath(String path) throws PropertyVetoException
Sets the fully qualified integrated file system path name of the data queue.

Parameters:
path - The fully qualified integrated file system path name of the data queue. The path must be in the format of /QSYS.LIB/libname.LIB/dataQueue.DTAQ. The library and queue name must each be 10 characters or less.
Throws: PropertyVetoException
If the change is vetoed.
 o setSystem
 public void setSystem(AS400 system) throws PropertyVetoException
Sets the AS/400 system on which the data queue resides.

Parameters:
system - The AS/400 system on which the data queue resides.
Throws: PropertyVetoException
If the change is vetoed.
 o write
 public void write()
Writes the contents of the document to the data queue.The entry replaces the current content. System and path must be set prior to calling this method.


All Packages  Class Hierarchy  This Package  Previous  Next  Index