Class BasicTableService

java.lang.Object
wt.templateutil.table.BasicTableService
All Implemented Interfaces:
HTMLTableServiceEventListener

public class BasicTableService extends Object implements HTMLTableServiceEventListener
Deprecated.
Deprecation Notice: This class is still valid for this release, however this serves as advance notice that it will be removed in the future. All user interfaces built using the Windchill HTML Template Processing client architecture will be rewritten using a different framework in an upcoming release.

This Table Service can be used, in general, with any HTMLTable object or subclass of HTMLTable. There are several methods that require an additional interface to be implemented by either the TableModel used by the HTMLTable instance or the HTMLTable instance itself.

The primary purpose of this service is to allow basic manipulation of HTMLTable objects via Windchill Script calls. Some examples of these manipulations are

  • Adding columns
  • Deleting columns
  • Changing the background color of columns
  • Changing the font of the header
  • etc.
Here is a full listing of the actions available through the BasicTableService

  • Add a column to the HTMLTable and the TableModel
  • Remove a column from the view, but not the TableModel
  • Switch the display positions of two columns
  • Add more than one column to the HTMLTable and the TableModel
  • Delete more than one column from the View, but not the TableModel
  • Set attributes to pass on to each cell that is rendered for a column
  • Set attributes to pass on to the Header for a column
  • Set attributes for the HTML Table that is going to be presented
  • Perform a query using a subclass of BaseQueryService and present the results
  • Set the ServiceName of the HTMLTable
  • Set the HTML component to use to render the cells in a given column
  • Set the HTML component to use to generate the Header in a given column
  • Instructs the HTMLTable not to display the Header row
  • Instructs the HTMLTable to generate the Header for a given column from a ResourceBundle

For what methods perform these actions and the syntax for these Windchill script methods, please see the javadoc for the methods.

Supported API: true

Extendable: false

  • Field Details

  • Method Details

    • performAction

      public void performAction(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      Performs the action defined by the value of the key BasicTableService.ACTION in the props parameter.

      If either props == null or there is not a value for BasicTableService.ACTION, an exception is thrown.

      The list of valid actions are

      • ADDCOLUMN - Add a column to the HTMLTable and the TableModel
      • DELETECOLUMN - Remove a column from the view, but not the TableModel
      • MOVECOLUMN - Switch the display positions of two columns
      • ADDCOLUMNS - Add more than one column to the HTMLTable and the TableModel
      • DELETECOLUMNS - Delete more than one column from the View, but not the TableModel
      • SETCOLUMNATTRIBUTES - Set attributes to pass on to each cell that is rendered for a column
      • SETHEADERATTRIBUTES - Set attributes to pass on to the Header for a column
      • SETTABLEATTRIBUTES - Set attributes for the HTML Table that is going to be presented
      • INITQUERYTABLE - Perform a query using a subclass of BaseQueryService and present the results
      • SETSERVICENAME - Set the ServiceName of the HTMLTable
      • SETCELLCOMPONENT - Set the HTML component to use to render the cells in a given column
      • SETHEADERCOMPONENT - Set the HTML component to use to generate the Header in a given column
      • HIDETABLEHEADER - Instructs the HTMLTable not to display the Header row
      • SETHEADERFROMRESOURCE - Instructs the HTMLTable to generate the Header for a given column from a ResourceBundle

      For the requirements/details of the individual methods, please see the javadoc for those methods directly.

      Supported API: true

      Parameters:
      props -
      locale -
      os -
      Throws:
      WTException
    • addColumn

      public void addColumn(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      Adds a new column to the HTMLTable and the underlying TableModel. The visual positioning of the Column can be specified. The HTMLTableColumn class to use can be specified.

      It is required that the underlying TableModel implement the AddColumn interface.

      The basic syntax of the Windchill script call is :

      tableService action=addColumn NAME=<Column Handle or Attribute Name>

      The parameters to that can be passed in are

      • NAME=<Column Handle or Attribute Name>
      • COLUMNNUMBER=<Visual Location of Column> - If not specified, column displayed at end of table
      • COLUMNCLASS=<Fully Qualified classpath of HTMLColumn subclass> - If not spefified, HTMLTableColumn is used

        You can also specify the subclass of the HTMLTableColumn to use when adding the column. The key "COLUMNCLASS" can be used to do this. The value associated to this key must be a fully qualified class path for a subclass of HTMLTableColumn. If you specify this parameter, the column class you specify will be used by the HTMLTableColumnModel to present the cells in that column.

        It could be that the underlying TableModel that implements AddColumn has some additional contraints of its own, so be sure to see the documentation on the addColumn method of underlying TableModel's implementation of the AddColumn interface.

        Supported API: true

      Parameters:
      props -
      locale -
      os -
      Throws:
      WTException
    • deleteColumn

      public void deleteColumn(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      Deletes a the specified column from the "View". That is, the column is removed from HTMLTableColumnModel but not the TableModel. This means that the data column still exists in the TableModel but that the data for that column will not be presented in the HTML page when the table is generated.

      There are not any special requirements on the HTMLTable. If you want to use the NAME to specify the column to delete, your TableModel should implement the ColumnIdentifier interface.

      There are two basic forms the this command

      tableService action=deleteColumn NAME=<Column Handle or Attribute Name>

      or

      tableService action=deleteColumn COLUMNNUMBER=<Visual Location of Column>

      The position passed in is a reference is the display position of the the column, not the modelIndex of the column in the TableModel.

      Supported API: true

      Parameters:
      props -
      locale -
      os -
      Throws:
      WTException
    • moveColumn

      public void moveColumn(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      Exchanges the View position of two columns. The position in the TableModel is not affected. It is the position in the HTMLTableColumnModel that is affected. The result is that the visual presentation of the two columns is switched.

      There are not any special requirements on the HTMLTable or the TableModel.

      The basic form the this command is

      tableService action=moveColumn INITIAL=<Display Postion of column to move> FINAL=<Display Postion of column to switch with>

      The positions to pass in as arguments are the Visual positions of the columns

      Supported API: true

      Parameters:
      props -
      locale -
      os -
      Throws:
      WTException
    • deleteColumns

      public void deleteColumns(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      Deletes a the specified columns from the "View". That is, the columns are removed from HTMLTableColumnModel but not the TableModel. This means that the data columns still exist in the TableModel but that the data for those columns will not be presented in the HTML page when the table is generated.

      There are not any special requirements on the HTMLTable. If you want to use the NAMES to specify the columns to delete, your TableModel should implement the ColumnIdentifier interface.

      There are two basic forms the this command

      tableService action=deleteColumn NAMES=<Comma separated list of Column Handles or Attribute Names>

      or

      tableService action=deleteColumn COLUMNNUMBERS=<Comma separated list of Visual Location of Column>

      The position passed in is a reference is the display position of the the column, not the modelIndex of the column in the TableModel. The order of the of the locations listed will not affect the deletion. It is not require to have ascending or descending numbers.

      Supported API: true

      Parameters:
      props -
      locale -
      os -
      Throws:
      WTException
    • addColumns

      public void addColumns(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      Adds new columns to the HTMLTable and the underlying TableModel. The visual positioning of the Columns can be specified. The HTMLTableColumn class to use can be specified.

      It is required that the underlying TableModel implement the AddColumn interface.

      The basic syntax of the Windchill script call is :

      tableService action=addColumn NAME=<Comma separated list of Column Handles or Attribute Names>

      The parameters to that can be passed in are

      • NAMES=<Comma separated list of Column Handles or Attribute Names>
      • COLUMNCLASS=<Fully Qualified classpath of HTMLColumn subclass> - If not spefified, HTMLTableColumn is used

        You can also specify the subclass of the HTMLTableColumn to use when adding the column. The key "COLUMNCLASS" can be used to do this. The value associated to this key must be a fully qualified class path for a subclass of HTMLTableColumn. If you specify this parameter, the column class you specify will be used by the HTMLTableColumnModel to present the cells in that column. The same column class will be used for all of the columns

        It could be that the underlying TableModel that implements AddColumn has some additional contraints of its own, so be sure to see the documentation on the addColumn method of underlying TableModel's implementation of the AddColumn interface.

        Supported API: true

      Parameters:
      props -
      locale -
      os -
      Throws:
      WTException
    • setColumnAttributes

      public void setColumnAttributes(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      Sets/Overrides the column attributes of the column(s) specified. What visual or other presentation characteristics can be manipulated depend on the HTML component(s) being used to render the cells in the column(s).

      The HTMLTableColumn columnProperties attribute will either be initialized with the name/values pairs passed, if the columnProperties attribute is not not currently set, or will have the new values added to it (Possibly overriding already set values). When the cells in the column represented by the HTMLTableColumn object are rendered, the columnProperties attribute will be passed in to the HTML Component during the init method and the properties will then be available to affect the presentation.

      To specify certain display characteristics be overriden, the name in the name/values pairs of the Windchill script call need to be meaningful to the HTML Components using the name/values pairs (via the columnProperties attribute).

      Supported API: true

      Parameters:
      props -
      locale -
      os -
      Throws:
      WTException
    • setHeaderAttributes

      public void setHeaderAttributes(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      Sets/Overrides the header display attributes of the column(s) specified. What visual or other presentation characteristics can be manipulated depend on the HTML component(s) being used to render the header of the column(s).

      The HTMLTableColumn headerProperties attribute will either be initialized with the name/values pairs passed, if the headerProperties attribute is not not currently set, or will have the new values added to it (Possibly overriding already set values). When the header for the column represented by the HTMLTableColumn object is rendered, the headerProperties attribute will be passed in to the HTML Component rendering the header during the init method and the properties will then be available to affect the presentation.

      To specify certain display characteristics be overriden, the name in the name/values pairs of the Windchill script call need to be meaningful to the HTML Components using the name/values pairs (via the headerProperties attribute).

      Supported API: true

      Parameters:
      props -
      locale -
      os -
      Throws:
      WTException
    • setTableAttributes

      public void setTableAttributes(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      If there are attribute values you want to pass on to the HTML Table (that is, the TABLE tag attributes), use this call.

      Supported API: true
      Parameters:
      props -
      locale -
      os -
      Throws:
      WTException
    • show

      public void show(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      Displays the HTMLTable that is currently using the HTML Table Service.

      If there are 1 or more rows in the TableModel to display, the show method on the HTMLTable that is currently using the HTML Table Service is called.

      If there are not any rows to display in the TableModel, then the if the messageKey and the messageResource fields are set on the TemplateProcessorTableService instance used by the HTML Table Service, this localized message is displayed.

      If there are not any rows in the TableModel and if the messageKey and the messageResource fields are not set, nothing is displayed.

      Supported API: true

      Parameters:
      props -
      locale -
      os -
      Throws:
      WTException
    • initQueryResultsTable

      public void initQueryResultsTable(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      Initializes a WTHtmlTable with a QueryResult, from a subclass of wt.enterprise.tabularresults.BaseQueryService. The RowDataTableModel is used as the TableModel. The call to the BaseQueryService subclass has the current context object passed into it.

      After calling this method, the WTHtmlTable is available to the be customized with Windchill script calls to the HTML Table Service

      After customizing the table, a call to the HTML Table Service "show" will display the table.

      The basic call has the form

      tableService action=initQueryResultsTable QueryName=<Name of BaseQueryService>

      The parameters to that can be used on this Windchill script call are
      • QueryName=<Name of BaseQueryService> - This must be either the fully qualified classpath of a subclass of BaseQueryService or just the name of the class, it the subclass is code generated.
      • NO_RESULTS_MESSAGE_RESOURCE=<Fully qualified class path of ResourceBundle> - Used to get the localized message to present in the case the query has zero results
      • NO_RESULTS_MESSAGE_KEY=<Key for ResourceBundle> - Used as the key in the ResourceBundle specified with the NO_RESULTS_MESSAGE_RESOURCE for the message to present in the case the query returns with zero results



      Supported API: true

      Parameters:
      props -
      locale -
      os -
      Throws:
      WTException
    • getPrintWriter

      public PrintWriter getPrintWriter(OutputStream out, Locale locale)
      Deprecated.
      Calls TemplateOutputStream.getPrintWriter on the OutputStream and Locale passed in.

      Supported API: true
      Parameters:
      out -
      locale -
      Returns:
      PrintWriter
    • getHtmlTable

      public HTMLTable getHtmlTable()
      Deprecated.
      Gets the value of the attribute: htmlTable.

      Supported API: true
      Specified by:
      getHtmlTable in interface HTMLTableServiceEventListener
      Returns:
      HTMLTable
    • setHtmlTable

      public void setHtmlTable(HTMLTable a_HtmlTable)
      Deprecated.
      Sets the value of the attribute: htmlTable.

      Supported API: true
      Specified by:
      setHtmlTable in interface HTMLTableServiceEventListener
      Parameters:
      a_HtmlTable -
    • setServiceName

      public void setServiceName(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      Sets the serviceName attribute of the HTMLTable.

      The HTMLTable attribute, serviceName, is used to define the "Service Name" in wt.properties that the HTMLTable will use to define the default values for the Headers and Cells in the table.

      The default value for the serviceName for HTML components, HTMLTable is an HMTL component, is wt.templateutil.component. So entries of the form

      wt.templateutil.component.<HTML Element Name>.<Attribute Name>=<Value>

      So use a different set of defaults, set the serviceName and you will be able to use entries in wt.properties of the form

      <New serviceName>.<HTML Element Name>.<Attribute Name>=<Value>

      The Syntax of the Windchill script call is

      tableService action=setServiceName SERVICENAME=<New serviceName>

      Supported API: true

      Parameters:
      props -
      locale -
      Throws:
      WTException
    • hideTableHeader

      public void hideTableHeader(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      Sets a flag to either suppress the printing of the Table Headers or request the printing of the table headers. By default, the HMTLTable will print the headers.

      No requirements on the HTMLTable or the TableModel.

      The syntax of the method call is

      tableService action=hideTableHeader DISPLAYHEADERS=<true/false>

      Supported API: true

      Parameters:
      props -
      locale -
      Throws:
      WTException
    • setCellComponent

      public void setCellComponent(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      Sets the HTML componenent to be used to render the cell for the specified columns.

      The TableModel used needs to implement the ColumnIdentifier interface to be able to use this HTML Table Service method.

      There are two basic formats to the command

      tableService action=setCellComponent CELLCOMPONENT=<Fully qualified classpath of HTMLComponent> COLUMNNUMBER=<Comma separated list of display positions>

      or

      tableService action=setCellComponent CELLCOMPONENT=<Fully qualified classpath of HTMLComponent> NAME=<Comma separated list of colunm names/handles>

      You can use the keyword, ALL, for either the COLUMNNUMBER or the NAME to indicate that you want the specified CELLCOMPONENT to be used for all of the Columns currently listed in the HTMLTableColumnModel.

      Supported API: true

      Parameters:
      props -
      locale -
      Throws:
      WTException
    • setHeaderComponent

      public void setHeaderComponent(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      Sets the HTML componenent to be used to render the header for the specified columns.

      The TableModel used needs to implement the ColumnIdentifier interface to be able to use this HTML Table Service method.

      There are two basic formats to the command

      tableService action=setHeaderComponent HEADERCOMPONENT=<Fully qualified classpath of HTMLComponent> COLUMNNUMBER=<Comma separated list of display positions>

      or

      tableService action=setHeaderComponent HEADERCOMPONENT=<Fully qualified classpath of HTMLComponent> NAME=<Comma separated list of colunm names/handles>

      You can use the keyword, ALL, for either the COLUMNNUMBER or the NAME to indicate that you want the specified CELLCOMPONENT to be used for all of the Columns currently listed in the HTMLTableColumnModel.

      Supported API: true

      Parameters:
      props -
      locale -
      Throws:
      WTException
    • setHeaderFromResource

      public void setHeaderFromResource(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      Sets the ResourceBundle and the key to use in the ResourceBundle to generate a localized header.

      The TableModel has to implement the TableHeaderSetter interface to be able to this service method.

      The two formats for the Windchill script call are

      tableService action=setHeaderFromResource RESOURCEBUNDLE=<Fully qualified classpath of ResourceBundle> RESOURCEKEY=<Key in ResourceBundle> COLUMNNAME=<Column handle/name>

      or

      tableService action=setHeaderFromResource RESOURCEBUNDLE=<Fully qualified classpath of ResourceBundle> RESOURCEKEY=<Key in ResourceBundle> POSITION=<display position>



      Supported API: true

      Parameters:
      props -
      locale -
      Throws:
      WTException
    • setHeaderFromTargetClass

      public void setHeaderFromTargetClass(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      Sets the Class to used for introspection for retrieving the localized Display Name of an attribute. The localized Display name is then used for the header. This assumes that the handle of the column is also the name of an attribute on the class that is being selected to perform introspection on.

      The TableModel has to implement the TableHeaderSetter interface to be able to this service method.

      The two formats for the Windchill script call are

      tableService action=setHeaderFromTargetClass TARGETCLASS=<Fully qualified classpath> COLUMNNAME=<Column handle/name>

      or

      tableService action=setHeaderFromTargetClass TARGETCLASS=<Fully qualified classpath> POSITION=<Column handle/name>



      Supported API: true

      Parameters:
      props -
      locale -
      Throws:
      WTException
    • defineActionBar

      public void defineActionBar(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      Configures the Action Row on the PDMLink HTML Table. This script call requires that the HTMLTable instance is an instance (or subclass) of PDMLinkHTMLTable. Otherwise, a ClassCast exception will be thrown.

      Here is the format of the script call

      tableService action=defineActionBar multiSelectActionNavBar=<Name of section in Navigation XML config file> multiSelectActionList=<comma seperated list of link names> actionNavBar=<Name of section in Navigation XML config file> actionList=<comma seperated list of link names> actionListStyleClass=<name of a style class>

      The role of the script elements is as follows

      • multiSelectActionNavBar - Names the section of the Navigation Configuration File that will be used to generate the Multi-select section. If this parameter is omitted, no multi-select section or multi-select column will be generated
      • multiSelectActionList - Used to define a subset of links of the section named by the multiSelectActionNavBar. If this parameter is omitted, all of the links defined in the section will be used.
      • actionNavBar - Names the section of the Navigation Configuration File that will be used to generate the Context Object action section. If this parameter is omitted, no Context Object action section column will be generated
      • actionList - Used to define a subset of links of the section named by the actionNavBar. If this parameter is omitted, all of the links defined in the section will be used.
      • actionListStyleClass - Name of the style class to be used for the context action bar on right side of row. Optional. If this parameter is omitted, "body" will be used.


      Supported API: true
      Parameters:
      props -
      locale -
      Throws:
      WTException
    • enableSorting

      public void enableSorting(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      Enables or Disables the ability to sort on a column of a PDMLinkHTMLTable. If the HTMLTable being used is not an instance of (or subclass of) PDMLinkHTMLTable, a ClassCast exception will be generated. The default setting of the ability to sort the columns of the PDMLinkHTMLTable is true (i.e. enabled).

      There are two formats to this script call

      tableService action=enableSorting isEnabled=<true|false>

      You can also omit the isEnabled parameter with the call

      tableService action=enableSorting

      This second form will result in the sorting being enabled.

      Supported API: true

      Parameters:
      props -
      locale -
      Throws:
      WTException
    • enableColumnCollapse

      public void enableColumnCollapse(Properties props, Locale locale, OutputStream os) throws WTException
      Deprecated.
      Enables or Disables the ability to hide(collapse) columns of a PDMLinkHTMLTable. If the HTMLTable being used is not an instance of (or subclass of) PDMLinkHTMLTable, a ClassCast exception will be generated. The default setting of the ability to hide(collapse) the columns of the PDMLinkHTMLTable is true (i.e. enabled).

      There are two formats to this script call

      tableService action=enableColumnCollapse isEnabled=<true|false>

      You can also omit the isEnabled parameter with the call

      tableService action=enableColumnCollapse

      This second form will result in the hiding(collapsing) of columns being enabled.

      Supported API: true

      Parameters:
      props -
      locale -
      Throws:
      WTException