Class TdbKernelWindow

  • All Implemented Interfaces:
    com.tietoenator.trip.jxp.internal.utils.DOMSink

    public class TdbKernelWindow
    extends TdbMessageProvider
    implements com.tietoenator.trip.jxp.internal.utils.DOMSink
    Container and manipulation logic for kernel window buffers.
    Kernel window buffers mirror the content of memory on the server, and are used to contain the results of output-generating commands. All such commands use the kernel's output formatter to create the content of the window buffers, and so the content is limited to the capabilities of that output formatter. For richer, more modern results, applications should make use of the data retrieval capabilities in the com.tietoenator.nxp.data.TdbRecord and com.tietoenator.nxp.data.TdbRecordSet classes and then transform the resulting information using XSLT for rich presentation.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clear the local buffer
      void close()
      Close the kernel window, release any associated resources on both client and server.
      int getId()
      Retrieve the ID of the window
      java.lang.String getLineBreak()
      Get the current string used to render line breaks.
      TdbKernelWindowType getType()
      Retrieve the type of the window
      java.lang.String getTypeName()
      Retrieve the XML name of the window
      java.util.List<TdbHitPoint> hits()
      Retrieve any hit points relevant to the current buffer.
      boolean isAtBottom()
      Check if the window is positioned at the "bottom" of the available output
      boolean isAtTop()
      Check if the window is positioned at the "top" of the available output
      boolean isFocused()
      Check if the window contains focus points (Show FOCus output)
      boolean isLinePlanned()
      Retrieve information on the use of line feed for the current data in the window buffer.
      boolean isScrollingWindow()
      Check if the window is using scrolling output or replaced output
      java.util.List<java.lang.String> lines()
      Retrieve the most recent update to the buffer.
      void scrollDown()
      Scroll the buffer "down" a "page" at a time.
      void scrollNext()
      Scroll the buffer "down" so that the next record after the last currently being displayed in the buffer is at the top of the buffer.
      void scrollPrevious()
      Scroll the buffer "up" so that the previous record before the topmost currently being displayed in the buffer is at the top of the buffer.
      void scrollUp()
      Scroll the buffer "up" a "page" at a time.
      void setLineBreak​(java.lang.String lf)
      Get the current string used to render line breaks.
      java.lang.String toFormattedString​(java.lang.String before, java.lang.String after, java.lang.String linebreak)
      Create a formatted string from the buffer's current contents.
      java.lang.String toString()
      Overrides the default to provide the text content of the window buffer, lines delimited with newlines (if the NOLF filter is not used).
      • Methods inherited from class java.lang.Object

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

      • TdbKernelWindow

        public TdbKernelWindow​(TdbSession session,
                               TdbKernelWindowType type,
                               int rows,
                               int cols)
                        throws TdbException
        Constructor, creates a new kernel window buffer on the server.
        Parameters:
        session - Active session
        type - Window type
        rows - Vertical dimension of the buffer to create
        cols - Horizontal dimension of the buffer to create
        Throws:
        TdbException
      • TdbKernelWindow

        public TdbKernelWindow​(TdbSession session,
                               TdbKernelWindowType type)
                        throws TdbException
        Constructor, creates a new kernel window buffer on the server with dimensions 20x80
        Parameters:
        session - Active session
        type - Wndow type
        Throws:
        TdbException
      • TdbKernelWindow

        public TdbKernelWindow​(TdbSession session)
                        throws TdbException
        Constructor, doesn't create a server buffer
        Parameters:
        session - Active session
        Throws:
        TdbException
    • Method Detail

      • getTypeName

        public java.lang.String getTypeName()
        Retrieve the XML name of the window
        Returns:
        The name of the window in TRIPxpi protocol form
      • getType

        public TdbKernelWindowType getType()
        Retrieve the type of the window
        Returns:
        The type of the window
      • getId

        public int getId()
        Retrieve the ID of the window
        Returns:
        The window ID
      • isAtTop

        public boolean isAtTop()
        Check if the window is positioned at the "top" of the available output
        Returns:
        true if the window cannot be further scrolled up
      • isAtBottom

        public boolean isAtBottom()
        Check if the window is positioned at the "bottom" of the available output
        Returns:
        true if the window cannot be further scrolled down
      • isScrollingWindow

        public boolean isScrollingWindow()
        Check if the window is using scrolling output or replaced output
        Returns:
        true if the window is free-scrolling, false if it is paged
      • isFocused

        public boolean isFocused()
        Check if the window contains focus points (Show FOCus output)
        Returns:
        true if the window contains focus points
      • getLineBreak

        public java.lang.String getLineBreak()
        Get the current string used to render line breaks.

        The default is carriage return and linefeed (CRLF)

        This string will be used as linebreak in the toString() method, and in the toFormattedString() methods if null is passed as the line break argument.

        Returns:
        Linebreak string
      • setLineBreak

        public void setLineBreak​(java.lang.String lf)
        Get the current string used to render line breaks.

        The default is carriage return and linefeed (CRLF)

        This string will be used as linebreak in the toString() method, and in the toFormattedString() methods if null is passed as the line break argument.

        Parameters:
        lf - String to use for line breaks
      • lines

        public java.util.List<java.lang.String> lines()
        Retrieve the most recent update to the buffer. This collection of "lines" is overwritten every time there is an operation on the kernel window.
        Returns:
        The collection of kernel buffer "lines"
      • hits

        public java.util.List<TdbHitPoint> hits()
        Retrieve any hit points relevant to the current buffer. This collection of hit points is overwritten every time there is an operation on the kernel window.
        Returns:
        The collection of hit points
      • isLinePlanned

        public boolean isLinePlanned()
        Retrieve information on the use of line feed for the current data in the window buffer.

        This property is true unless the NOLF filter is used in the output format. Applications can check this method to determine how the lines in the window buffer should be delimited.

        Note that for SHOW orders from clusters with mixed output formats where some databases use a NOLF filter and some do not, the linefeed behavior is undefined for window buffers that contain information from more than one database.

        Returns:
        True if lines should be delimited by a line feed or equivalent
      • clear

        public void clear()
        Clear the local buffer
      • scrollDown

        public void scrollDown()
                        throws TdbException
        Scroll the buffer "down" a "page" at a time. Invoking this method causes network I/O.
        Throws:
        TdbException
      • scrollUp

        public void scrollUp()
                      throws TdbException
        Scroll the buffer "up" a "page" at a time. Invoking this method causes network I/O.
        Throws:
        TdbException
      • scrollNext

        public void scrollNext()
                        throws TdbException
        Scroll the buffer "down" so that the next record after the last currently being displayed in the buffer is at the top of the buffer. Invoking this method causes network I/O.
        Throws:
        TdbException
      • scrollPrevious

        public void scrollPrevious()
                            throws TdbException
        Scroll the buffer "up" so that the previous record before the topmost currently being displayed in the buffer is at the top of the buffer. Invoking this method causes network I/O.
        Throws:
        TdbException
      • close

        public void close()
                   throws TdbException
        Close the kernel window, release any associated resources on both client and server. Invoking this method causes network I/O.
        Throws:
        TdbException
      • toFormattedString

        public java.lang.String toFormattedString​(java.lang.String before,
                                                  java.lang.String after,
                                                  java.lang.String linebreak)
                                           throws TdbException
        Create a formatted string from the buffer's current contents. Could be used, for example, to create (very) simple HTML suitable for insertion within a <div>
        Parameters:
        before - String to be inserted before hit terms
        after - String to be inserted after hit terms
        linebreak - String to be inserted to delimit lines within the buffer, or null to use the default linebreak style
        Returns:
        The formatted string
        Throws:
        TdbException
      • toString

        public java.lang.String toString()
        Overrides the default to provide the text content of the window buffer, lines delimited with newlines (if the NOLF filter is not used). Hit points are not marked up.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A simple string reflecting the window's content