com.ibm.as400.vaccess

Class IFSTextFileDocument

  • java.lang.Object
    • com.ibm.as400.vaccess.IFSTextFileDocument
  • All Implemented Interfaces:
    java.io.Serializable, javax.swing.text.Document, javax.swing.text.StyledDocument

    Deprecated. 
    Use Java Swing instead, along with the classes in package com.ibm.as400.access

    public class IFSTextFileDocument
    extends java.lang.Object
    implements javax.swing.text.StyledDocument, java.io.Serializable
    The IFSTextFileDocument class implements an underlying model for text components, where the text is the contents of a text file located in the integrated file system. You must explicitly call load() to load the information from the 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.

    IFSTextFileDocument objects generate the following events:

    • DocumentEvent
    • ErrorEvent
    • FileEvent
    • PropertyChangeEvent
    • UndoableEditEvent
    • WorkingEvent

    The following example creates a document which contains the contents of a text file in the integrated file system of a system. It then presents the document in a JTextArea object.

    // Set up the document and the JTextArea.
    AS400 system = new AS400 ("MySystem", "Userid", "Password");
    IFSTextFileDocument document = new IFSTextFileDocument (system, "/myFile");
    JTextArea textArea = new JTextArea (document);
    
    // Add the JTextArea to a frame. JFrame frame = new JFrame ("My Window"); frame.getContentPane().add(new JScrollPane(textArea));
    // Load the information from the system. document.load ();
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from interface javax.swing.text.Document

        StreamDescriptionProperty, TitleProperty
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      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 addFileListener(FileListener listener)
      Deprecated. 
      Adds a listener to be notified when a file event occurs.
      void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
      Deprecated. 
      Adds a listener to be notified when the value of any bound property changes.
      javax.swing.text.Style addStyle(java.lang.String name, javax.swing.text.Style parent)
      Deprecated. 
      Adds a style into the logical style hierarchy.
      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 change as the document is altered.
      java.awt.Color getBackground(javax.swing.text.AttributeSet attributes)
      Deprecated. 
      Returns the background color based on a set of attributes.
      javax.swing.text.Element getCharacterElement(int offset)
      Deprecated. 
      Returns the element that represents the character that is at a given offset within the document.
      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.
      java.awt.Font getFont(javax.swing.text.AttributeSet attributes)
      Deprecated. 
      Returns the font based on a set of attributes.
      java.awt.Color getForeground(javax.swing.text.AttributeSet attributes)
      Deprecated. 
      Returns the foreground color based on a set of attributes.
      int getLength()
      Deprecated. 
      Returns the length of the document.
      javax.swing.text.Style getLogicalStyle(int offset)
      Deprecated. 
      Returns the logical style for a given offset within the document.
      javax.swing.text.Element getParagraphElement(int offset)
      Deprecated. 
      Returns the element that represents the paragraph that encloses a given offset within the document.
      java.lang.String getPath()
      Deprecated. 
      The path name of the file.
      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.
      javax.swing.text.Style getStyle(java.lang.String name)
      Deprecated. 
      Returns a named style.
      AS400 getSystem()
      Deprecated. 
      Returns the system on which the file 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.
      boolean isModified()
      Deprecated. 
      Indicates if the document has been modified since it was last read or written.
      void load()
      Deprecated. 
      Loads the contents of the document from the file on the system.
      void putProperty(java.lang.Object key, java.lang.Object value)
      Deprecated. 
      Sets a property value associated with the document.
      void remove(int offset, int length)
      Deprecated. 
      Removes text from the document.
      void removeDocumentListener(javax.swing.event.DocumentListener listener)
      Deprecated. 
      Removes a document listener.
      void removeErrorListener(ErrorListener listener)
      Deprecated. 
      Removes an error listener.
      void removeFileListener(FileListener listener)
      Deprecated. 
      Removes a file listener.
      void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
      Deprecated. 
      Removes a property change listener.
      void removeStyle(java.lang.String name)
      Deprecated. 
      Removes a style from the logical style hierarchy.
      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 save()
      Deprecated. 
      Saves the contents of the document to the file on the system.
      void setCharacterAttributes(int offset, int length, javax.swing.text.AttributeSet attributes, boolean replace)
      Deprecated. 
      Sets the element attributes used for the given range of existing content in the document.
      void setLogicalStyle(int offset, javax.swing.text.Style style)
      Deprecated. 
      Sets the logical style for a given offset within the document.
      void setParagraphAttributes(int offset, int length, javax.swing.text.AttributeSet attributes, boolean replace)
      Deprecated. 
      Sets the element attributes used for the paragraphs enclosing the given range of existing content in the document.
      void setPath(java.lang.String path)
      Deprecated. 
      Sets the path name of the file.
      void setSystem(AS400 system)
      Deprecated. 
      Sets the system on which the file resides.
      java.lang.String toString()
      Deprecated. 
      Returns the string representation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • IFSTextFileDocument

        public IFSTextFileDocument()
        Deprecated. 
        Constructs a IFSTextFileDocument object.
      • IFSTextFileDocument

        public IFSTextFileDocument(IFSFile file)
        Deprecated. 
        Constructs a IFSTextFileDocument object.
        Parameters:
        file - The file.
      • IFSTextFileDocument

        public IFSTextFileDocument(AS400 system,
                           java.lang.String path)
        Deprecated. 
        Constructs a IFSTextFileDocument object.
        Parameters:
        system - The system on which the file resides.
        path - The fully qualified path name of the file that this object represents.
    >
    • Method Detail

      • 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 interface javax.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.
      • addFileListener

        public void addFileListener(FileListener listener)
        Deprecated. 
        Adds a listener to be notified when a file event 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.
      • addStyle

        public javax.swing.text.Style addStyle(java.lang.String name,
                                      javax.swing.text.Style parent)
        Deprecated. 
        Adds a style into the logical style hierarchy.
        Specified by:
        addStyle in interface javax.swing.text.StyledDocument
        Parameters:
        name - The name of the style.
        parent - The parent style.
        Returns:
        The style.
      • 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 interface javax.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 change as the document is altered. If the relative position is null, then the start of the document will be used.
        Specified by:
        createPosition in interface javax.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.
      • getBackground

        public java.awt.Color getBackground(javax.swing.text.AttributeSet attributes)
        Deprecated. 
        Returns the background color based on a set of attributes.
        Specified by:
        getBackground in interface javax.swing.text.StyledDocument
        Parameters:
        attributes - The attributes.
        Returns:
        The background color.
      • getCharacterElement

        public javax.swing.text.Element getCharacterElement(int offset)
        Deprecated. 
        Returns the element that represents the character that is at a given offset within the document.
        Specified by:
        getCharacterElement in interface javax.swing.text.StyledDocument
        Parameters:
        offset - The offset to the character.
        Returns:
        The element.
      • 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 interface javax.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 interface javax.swing.text.Document
        Returns:
        The end position of the document.
      • getFont

        public java.awt.Font getFont(javax.swing.text.AttributeSet attributes)
        Deprecated. 
        Returns the font based on a set of attributes.
        Specified by:
        getFont in interface javax.swing.text.StyledDocument
        Parameters:
        attributes - The attributes.
        Returns:
        The font.
      • getForeground

        public java.awt.Color getForeground(javax.swing.text.AttributeSet attributes)
        Deprecated. 
        Returns the foreground color based on a set of attributes.
        Specified by:
        getForeground in interface javax.swing.text.StyledDocument
        Parameters:
        attributes - The attributes.
        Returns:
        The foreground color.
      • getLength

        public int getLength()
        Deprecated. 
        Returns the length of the document.
        Specified by:
        getLength in interface javax.swing.text.Document
        Returns:
        The length of the document in characters.
      • getLogicalStyle

        public javax.swing.text.Style getLogicalStyle(int offset)
        Deprecated. 
        Returns the logical style for a given offset within the document.
        Specified by:
        getLogicalStyle in interface javax.swing.text.StyledDocument
        Parameters:
        offset - The offset within the document.
        Returns:
        The logical style at the specified offset.
      • getParagraphElement

        public javax.swing.text.Element getParagraphElement(int offset)
        Deprecated. 
        Returns the element that represents the paragraph that encloses a given offset within the document.
        Specified by:
        getParagraphElement in interface javax.swing.text.StyledDocument
        Parameters:
        offset - The offset within the document.
        Returns:
        The element that represents the paragraph.
      • getPath

        public java.lang.String getPath()
        Deprecated. 
        The path name of the file.
        Returns:
        The path name of the file, or "" if the path has not been set.
      • getProperty

        public java.lang.Object getProperty(java.lang.Object key)
        Deprecated. 
        Returns a property value associated with the document.
        Specified by:
        getProperty in interface javax.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 interface javax.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 interface javax.swing.text.Document
        Returns:
        The start position of the document.
      • getStyle

        public javax.swing.text.Style getStyle(java.lang.String name)
        Deprecated. 
        Returns a named style.
        Specified by:
        getStyle in interface javax.swing.text.StyledDocument
        Parameters:
        name - The name of the style.
        Returns:
        The style.
      • getSystem

        public AS400 getSystem()
        Deprecated. 
        Returns the system on which the file resides.
        Returns:
        The system, or null if the system has not been set.
      • 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 interface javax.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 interface javax.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 interface javax.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.
      • isModified

        public boolean isModified()
        Deprecated. 
        Indicates if the document has been modified since it was last read or written.
        Returns:
        true if the document has been modified; false otherwise.
      • load

        public void load()
        Deprecated. 
        Loads the contents of the document from the file on the system.
      • 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 interface javax.swing.text.Document
        Parameters:
        key - The property key.
        value - The property value.
      • remove

        public void remove(int offset,
                  int length)
                    throws javax.swing.text.BadLocationException
        Deprecated. 
        Removes text from the document.
        Specified by:
        remove in interface javax.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.
      • removeDocumentListener

        public void removeDocumentListener(javax.swing.event.DocumentListener listener)
        Deprecated. 
        Removes a document listener.
        Specified by:
        removeDocumentListener in interface javax.swing.text.Document
        Parameters:
        listener - The listener.
      • removeErrorListener

        public void removeErrorListener(ErrorListener listener)
        Deprecated. 
        Removes an error listener.
        Parameters:
        listener - The listener.
      • removeFileListener

        public void removeFileListener(FileListener listener)
        Deprecated. 
        Removes a file listener.
        Parameters:
        listener - The listener.
      • removePropertyChangeListener

        public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
        Deprecated. 
        Removes a property change listener.
        Parameters:
        listener - The listener.
      • removeStyle

        public void removeStyle(java.lang.String name)
        Deprecated. 
        Removes a style from the logical style hierarchy.
        Specified by:
        removeStyle in interface javax.swing.text.StyledDocument
        Parameters:
        name - The name of the style.
      • removeUndoableEditListener

        public void removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
        Deprecated. 
        Removes an undoable edit listener.
        Specified by:
        removeUndoableEditListener in interface javax.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 interface javax.swing.text.Document
        Parameters:
        runnable - The runnable.
      • save

        public void save()
        Deprecated. 
        Saves the contents of the document to the file on the system. This will creates the file if it does not already exist.
      • setCharacterAttributes

        public void setCharacterAttributes(int offset,
                                  int length,
                                  javax.swing.text.AttributeSet attributes,
                                  boolean replace)
        Deprecated. 
        Sets the element attributes used for the given range of existing content in the document.
        Specified by:
        setCharacterAttributes in interface javax.swing.text.StyledDocument
        Parameters:
        offset - The offset to the start of the change.
        length - The length of the change.
        attributes - The attributes.
        replace - Indicates whether or not the previous attributes should be cleared before the new attributes are set. If true, true to replace the previous attributes with these attributes; false to merge them.
      • setLogicalStyle

        public void setLogicalStyle(int offset,
                           javax.swing.text.Style style)
        Deprecated. 
        Sets the logical style for a given offset within the document.
        Specified by:
        setLogicalStyle in interface javax.swing.text.StyledDocument
        Parameters:
        offset - The offset within the document.
        style - The logical style.
      • setParagraphAttributes

        public void setParagraphAttributes(int offset,
                                  int length,
                                  javax.swing.text.AttributeSet attributes,
                                  boolean replace)
        Deprecated. 
        Sets the element attributes used for the paragraphs enclosing the given range of existing content in the document.
        Specified by:
        setParagraphAttributes in interface javax.swing.text.StyledDocument
        Parameters:
        offset - The offset to the start of the change.
        length - The length of the change.
        attributes - The attributes.
        replace - Indicates whether or not the previous attributes should be cleared before the new attributes are set. If true, this will replace the previous attributes entirely. If false, the new attributes will be merged with the previous attributes.
      • setPath

        public void setPath(java.lang.String path)
                     throws java.beans.PropertyVetoException
        Deprecated. 
        Sets the path name of the file.
        Parameters:
        path - The path name of the file.
        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 file resides.
        Parameters:
        system - The system on which the file resides.
        Throws:
        java.beans.PropertyVetoException - If the change is vetoed.
      • toString

        public java.lang.String toString()
        Deprecated. 
        Returns the string representation. This is the name of the file.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string representation of the file name.