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