com.ibm.as400.vaccess
Class DataQueueDocument
- java.lang.Object
-
- com.ibm.as400.vaccess.DataQueueDocument
-
- All Implemented Interfaces:
- java.io.Serializable, javax.swing.text.Document
Deprecated.Use Java Swing instead, along with the classes in package com.ibm.as400.access
public class DataQueueDocument extends java.lang.Object implements javax.swing.text.Document, java.io.Serializable
The DataQueueDocument class represents an underlying model for text components, where the text is entries from a data queue on a system.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 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 ();- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description DataQueueDocument()
Deprecated.Constructs a DataQueueDocument object.DataQueueDocument(AS400 system, java.lang.String path)
Deprecated.Constructs a DataQueueDocument object.
-
Method Summary
Methods 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.
-
-
-
Constructor Detail
-
DataQueueDocument
public DataQueueDocument()
Deprecated.Constructs a DataQueueDocument object.
-
DataQueueDocument
public DataQueueDocument(AS400 system, java.lang.String path)
Deprecated.Constructs a DataQueueDocument object.- Parameters:
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.
-
-
Method Detail
-
addDataQueueListener
public void addDataQueueListener(DataQueueListener listener)
Deprecated.Adds a listener to be notified when a data queue event occurs.- Parameters:
listener
- The listener.
-
addDocumentListener
public void addDocumentListener(javax.swing.event.DocumentListener listener)
Deprecated.Adds a listener to be notified when a document event occurs.- Specified by:
addDocumentListener
in interfacejavax.swing.text.Document
- Parameters:
listener
- The listener.
-
addErrorListener
public void addErrorListener(ErrorListener listener)
Deprecated.Adds a listener to be notified when an error occurs.- Parameters:
listener
- The listener.
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Deprecated.Adds a listener to be notified when the value of any bound property changes.- Parameters:
listener
- The listener.
-
addUndoableEditListener
public void addUndoableEditListener(javax.swing.event.UndoableEditListener listener)
Deprecated.Adds an undoable edit listener to be notified when undoable edits are made to the document.- Specified by:
addUndoableEditListener
in interfacejavax.swing.text.Document
- Parameters:
listener
- The listener.
-
addVetoableChangeListener
public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Deprecated.Adds a listener to be notified when the value of any constrained property changes.- Parameters:
listener
- The listener.
-
addWorkingListener
public void addWorkingListener(WorkingListener listener)
Deprecated.Adds a listener to be notified when work starts and stops on potentially long-running operations.- Parameters:
listener
- The listener.
-
createPosition
public javax.swing.text.Position createPosition(int offset) throws javax.swing.text.BadLocationException
Deprecated.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.- Specified by:
createPosition
in interfacejavax.swing.text.Document
- Parameters:
offset
- The offset from the start of the document.- Returns:
- The position.
- Throws:
javax.swing.text.BadLocationException
- If the given offset does not represent a valid location in the document.
-
getDefaultRootElement
public 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.- Specified by:
getDefaultRootElement
in interfacejavax.swing.text.Document
- Returns:
- The root element.
-
getEndPosition
public javax.swing.text.Position getEndPosition()
Deprecated.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.- Specified by:
getEndPosition
in interfacejavax.swing.text.Document
- Returns:
- The end position.
-
getLength
public int getLength()
Deprecated.Returns the length of the document.- Specified by:
getLength
in interfacejavax.swing.text.Document
- Returns:
- The length of the document in characters.
-
getPath
public java.lang.String getPath()
Deprecated.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 java.lang.Object getProperty(java.lang.Object key)
Deprecated.Returns a property value associated with the document.- Specified by:
getProperty
in interfacejavax.swing.text.Document
- Parameters:
key
- The property key.- Returns:
- The property value.
-
getRootElements
public javax.swing.text.Element[] getRootElements()
Deprecated.Returns the root elements.- Specified by:
getRootElements
in interfacejavax.swing.text.Document
- Returns:
- The root elements.
-
getStartPosition
public javax.swing.text.Position getStartPosition()
Deprecated.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.- Specified by:
getStartPosition
in interfacejavax.swing.text.Document
- Returns:
- The start position.
-
getSystem
public AS400 getSystem()
Deprecated.Returns the system on which the data queue resides.- Returns:
- The system on which the data queue resides.
-
getText
public java.lang.String getText(int offset, int length) throws javax.swing.text.BadLocationException
Deprecated.Returns the text contained within the specified portion of the document.- Specified by:
getText
in interfacejavax.swing.text.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:
javax.swing.text.BadLocationException
- If the given offset and length does not represent a valid range in the document.
-
getText
public void getText(int offset, int length, javax.swing.text.Segment text) throws javax.swing.text.BadLocationException
Deprecated.Stores the text contained within the specified portion of the document in a segment.- Specified by:
getText
in interfacejavax.swing.text.Document
- 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:
javax.swing.text.BadLocationException
- If the given offset and length does not represent a valid range in the document.
-
insertString
public void insertString(int offset, java.lang.String text, javax.swing.text.AttributeSet attributes) throws javax.swing.text.BadLocationException
Deprecated.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.- Specified by:
insertString
in interfacejavax.swing.text.Document
- 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:
javax.swing.text.BadLocationException
- If the given offset does not represent a valid position in the document.
-
peek
public 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. 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)
Deprecated.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 void putProperty(java.lang.Object key, java.lang.Object value)
Deprecated.Sets a property value associated with the document.- Specified by:
putProperty
in interfacejavax.swing.text.Document
- Parameters:
key
- The property key.value
- The property value.
-
read
public 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. 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)
Deprecated.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 void remove(int offset, int length) throws javax.swing.text.BadLocationException
Deprecated.Removes text from the document.- Specified by:
remove
in interfacejavax.swing.text.Document
- Parameters:
offset
- The offset into the document representing the desired start of the text.length
- The length of the text.- Throws:
javax.swing.text.BadLocationException
- If the given offset and length does not represent a valid range in the document.
-
removeDataQueueListener
public void removeDataQueueListener(DataQueueListener listener)
Deprecated.Removes a data queue listener.- Parameters:
listener
- The listener.
-
removeDocumentListener
public void removeDocumentListener(javax.swing.event.DocumentListener listener)
Deprecated.Removes a document listener.- Specified by:
removeDocumentListener
in interfacejavax.swing.text.Document
- Parameters:
listener
- The listener.
-
removeErrorListener
public void removeErrorListener(ErrorListener listener)
Deprecated.Removes an error listener.- Parameters:
listener
- The listener.
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Deprecated.Removes a property change listener.- Parameters:
listener
- The listener.
-
removeUndoableEditListener
public void removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
Deprecated.Removes an undoable edit listener.- Specified by:
removeUndoableEditListener
in interfacejavax.swing.text.Document
- Parameters:
listener
- The listener.
-
removeVetoableChangeListener
public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Deprecated.Removes a vetoable change listener.- Parameters:
listener
- The listener.
-
removeWorkingListener
public void removeWorkingListener(WorkingListener listener)
Deprecated.Removes a working listener.- Parameters:
listener
- The listener.
-
render
public void render(java.lang.Runnable runnable)
Deprecated.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.- Specified by:
render
in interfacejavax.swing.text.Document
- Parameters:
runnable
- The runnable.
-
setPath
public void setPath(java.lang.String path) throws java.beans.PropertyVetoException
Deprecated.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:
java.beans.PropertyVetoException
- If the change is vetoed.
-
setSystem
public void setSystem(AS400 system) throws java.beans.PropertyVetoException
Deprecated.Sets the system on which the data queue resides.- Parameters:
system
- The system on which the data queue resides.- Throws:
java.beans.PropertyVetoException
- If the change is vetoed.
-
write
public void write()
Deprecated.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.
-
-