Package com.tietoenator.trip.jxp.ccl

# Class TdbKernelWindow

java.lang.Object
com.tietoenator.trip.jxp.session.TdbSessionObject
com.tietoenator.trip.jxp.TdbMessageProvider
com.tietoenator.trip.jxp.ccl.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.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TdbKernelWindow(TdbSession session)`
  Constructor, doesn't create a server buffer
  `TdbKernelWindow(TdbSession session, TdbKernelWindowType type)`
  Constructor, creates a new kernel window buffer on the server with dimensions 20x80
  `TdbKernelWindow(TdbSession session, TdbKernelWindowType type, int rows, int cols)`
  Constructor, creates a new kernel window buffer on the server.

- ## Method Summary

  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
  `String`
  `getLineBreak()`
  Get the current string used to render line breaks.
  `TdbKernelWindowType`
  `getType()`
  Retrieve the type of the window
  `String`
  `getTypeName()`
  Retrieve the XML name of the window
  `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
  `List<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(String lf)`
  Get the current string used to render line breaks.
  `String`
  `toFormattedString(String before, String after, String linebreak)`
  Create a formatted string from the buffer's current contents.
  `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 com.tietoenator.trip.jxp.TdbMessageProvider

  `codeList, getLastCode, getLastMessage, hasMessages, messageList, resetMessages`

  ### Methods inherited from class com.tietoenator.trip.jxp.session.TdbSessionObject

  `cancel, getSession, isCancelable, setCancelable`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### 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 Details

  - ### getTypeName

    public 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 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(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 List<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 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 String toFormattedString(String before, String after, 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 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 `Object`
    Returns:
      A simple string reflecting the window's content