public class DataQueueDocument
extends java.lang.Object
implements javax.swing.text.Document, java.io.Serializable
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 a system. 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(new JScrollPane(textField));
// Read the next entry from the data queue. document.read ();
Constructor and Description |
---|
DataQueueDocument()
Deprecated.
Constructs a DataQueueDocument object.
|
DataQueueDocument(AS400 system,
java.lang.String path)
Deprecated.
Constructs a DataQueueDocument object.
|
Modifier and Type | Method and Description |
---|---|
void |
addDataQueueListener(DataQueueListener listener)
Deprecated.
Adds a listener to be notified when a data queue event occurs.
|
void |
addDocumentListener(javax.swing.event.DocumentListener listener)
Deprecated.
Adds a listener to be notified when a document event occurs.
|
void |
addErrorListener(ErrorListener listener)
Deprecated.
Adds a listener to be notified when an error occurs.
|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Deprecated.
Adds a listener to be notified when the value of any
bound property changes.
|
void |
addUndoableEditListener(javax.swing.event.UndoableEditListener listener)
Deprecated.
Adds an undoable edit listener to be notified when undoable
edits are made to the document.
|
void |
addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Deprecated.
Adds a listener to be notified when the value of any
constrained property changes.
|
void |
addWorkingListener(WorkingListener listener)
Deprecated.
Adds a listener to be notified when work starts and stops
on potentially long-running operations.
|
javax.swing.text.Position |
createPosition(int offset)
Deprecated.
Returns a position that will track changes as the document is altered.
|
javax.swing.text.Element |
getDefaultRootElement()
Deprecated.
Returns the root element that views should be based upon
unless some other mechanism for assigning views to element
structures is provided.
|
javax.swing.text.Position |
getEndPosition()
Deprecated.
Returns a position that represents the end of the document.
|
int |
getLength()
Deprecated.
Returns the length of the document.
|
java.lang.String |
getPath()
Deprecated.
Returns the fully qualified integrated file system path name of the data queue.
|
java.lang.Object |
getProperty(java.lang.Object key)
Deprecated.
Returns a property value associated with the document.
|
javax.swing.text.Element[] |
getRootElements()
Deprecated.
Returns the root elements.
|
javax.swing.text.Position |
getStartPosition()
Deprecated.
Returns a position that represents the start of the document.
|
AS400 |
getSystem()
Deprecated.
Returns the system on which the data queue resides.
|
java.lang.String |
getText(int offset,
int length)
Deprecated.
Returns the text contained within the specified portion of
the document.
|
void |
getText(int offset,
int length,
javax.swing.text.Segment text)
Deprecated.
Stores the text contained within the specified portion of
the document in a segment.
|
void |
insertString(int offset,
java.lang.String text,
javax.swing.text.AttributeSet attributes)
Deprecated.
Inserts text into the document.
|
void |
peek()
Deprecated.
Reads an entry from the data queue without removing it from the queue,
and stores the text of the entry in the document.
|
void |
peek(int wait)
Deprecated.
Reads an entry from the data queue without removing it from the queue,
and stores the text of the entry in the document.
|
void |
putProperty(java.lang.Object key,
java.lang.Object value)
Deprecated.
Sets a property value associated with the document.
|
void |
read()
Deprecated.
Reads an entry from the data queue and removes it from the queue,
and stores the text of the entry in the document.
|
void |
read(int wait)
Deprecated.
Reads an entry from the data queue and removes it from the queue,
and stores the text of the entry in the document.
|
void |
remove(int offset,
int length)
Deprecated.
Removes text from the document.
|
void |
removeDataQueueListener(DataQueueListener listener)
Deprecated.
Removes a data queue listener.
|
void |
removeDocumentListener(javax.swing.event.DocumentListener listener)
Deprecated.
Removes a document listener.
|
void |
removeErrorListener(ErrorListener listener)
Deprecated.
Removes an error listener.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Deprecated.
Removes a property change listener.
|
void |
removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
Deprecated.
Removes an undoable edit listener.
|
void |
removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Deprecated.
Removes a vetoable change listener.
|
void |
removeWorkingListener(WorkingListener listener)
Deprecated.
Removes a working listener.
|
void |
render(java.lang.Runnable runnable)
Deprecated.
Renders the document.
|
void |
setPath(java.lang.String path)
Deprecated.
Sets the fully qualified integrated file system path name of the data queue.
|
void |
setSystem(AS400 system)
Deprecated.
Sets the system on which the data queue resides.
|
void |
write()
Deprecated.
Writes the contents of the document to the data queue.The entry replaces the current content.
|
public DataQueueDocument()
public DataQueueDocument(AS400 system, java.lang.String path)
system
- The system 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.public void addDataQueueListener(DataQueueListener listener)
listener
- The listener.public void addDocumentListener(javax.swing.event.DocumentListener listener)
addDocumentListener
in interface javax.swing.text.Document
listener
- The listener.public void addErrorListener(ErrorListener listener)
listener
- The listener.public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The listener.public void addUndoableEditListener(javax.swing.event.UndoableEditListener listener)
addUndoableEditListener
in interface javax.swing.text.Document
listener
- The listener.public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
listener
- The listener.public void addWorkingListener(WorkingListener listener)
listener
- The listener.public javax.swing.text.Position createPosition(int offset) throws javax.swing.text.BadLocationException
createPosition
in interface javax.swing.text.Document
offset
- The offset from the start of the document.javax.swing.text.BadLocationException
- If the given offset does not
represent a valid location in the
document.public javax.swing.text.Element getDefaultRootElement()
getDefaultRootElement
in interface javax.swing.text.Document
public javax.swing.text.Position getEndPosition()
getEndPosition
in interface javax.swing.text.Document
public int getLength()
getLength
in interface javax.swing.text.Document
public java.lang.String getPath()
public java.lang.Object getProperty(java.lang.Object key)
getProperty
in interface javax.swing.text.Document
key
- The property key.public javax.swing.text.Element[] getRootElements()
getRootElements
in interface javax.swing.text.Document
public javax.swing.text.Position getStartPosition()
getStartPosition
in interface javax.swing.text.Document
public AS400 getSystem()
public java.lang.String getText(int offset, int length) throws javax.swing.text.BadLocationException
getText
in interface javax.swing.text.Document
offset
- The offset into the document representing
the desired start of the text.length
- The length of the text.javax.swing.text.BadLocationException
- If the given offset and length does
not represent a valid range in the
document.public void getText(int offset, int length, javax.swing.text.Segment text) throws javax.swing.text.BadLocationException
getText
in interface javax.swing.text.Document
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.javax.swing.text.BadLocationException
- If the given offset and length does
not represent a valid range in the
document.public void insertString(int offset, java.lang.String text, javax.swing.text.AttributeSet attributes) throws javax.swing.text.BadLocationException
insertString
in interface javax.swing.text.Document
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.javax.swing.text.BadLocationException
- If the given offset does not
represent a valid position in the
document.public void peek()
public void peek(int wait)
wait
- The number of seconds to wait if the queue contains no
entries. -1 means to wait until an entry is available.public void putProperty(java.lang.Object key, java.lang.Object value)
putProperty
in interface javax.swing.text.Document
key
- The property key.value
- The property value.public void read()
public void read(int wait)
wait
- The number of seconds to wait if the queue contains no
entries. -1 means to wait until an entry is available.public void remove(int offset, int length) throws javax.swing.text.BadLocationException
remove
in interface javax.swing.text.Document
offset
- The offset into the document representing
the desired start of the text.length
- The length of the text.javax.swing.text.BadLocationException
- If the given offset and length does
not represent a valid range in the
document.public void removeDataQueueListener(DataQueueListener listener)
listener
- The listener.public void removeDocumentListener(javax.swing.event.DocumentListener listener)
removeDocumentListener
in interface javax.swing.text.Document
listener
- The listener.public void removeErrorListener(ErrorListener listener)
listener
- The listener.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The listener.public void removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
removeUndoableEditListener
in interface javax.swing.text.Document
listener
- The listener.public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
listener
- The listener.public void removeWorkingListener(WorkingListener listener)
listener
- The listener.public void render(java.lang.Runnable runnable)
render
in interface javax.swing.text.Document
runnable
- The runnable.public void setPath(java.lang.String path) throws java.beans.PropertyVetoException
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.java.beans.PropertyVetoException
- If the change is vetoed.public void setSystem(AS400 system) throws java.beans.PropertyVetoException
system
- The system on which the data queue resides.java.beans.PropertyVetoException
- If the change is vetoed.public void write()