jacquard 1.12.0 by The Web Engineering Factory and Toolworks

uk.co.weft.htform
Class Auxiliary

java.lang.Object
  extended byuk.co.weft.htform.Auxiliary
Direct Known Subclasses:
OneFieldAuxiliary

public class Auxiliary
extends java.lang.Object

Auxiliary table information in a Form. An auxilliary shows data from records in related tables at the 'downhill' end of one-to-many links. If not told otherwise, Auxiliary expects that primary keys will have the same name as the table they are in and that foreign keys have the same name as the table they are keys for. It also assumes that the table will have a field called 'Description' containing a string description of the record.

Version:
$Revision: 1.32.4.4 $ This revision: $Author: simon $
Author:
Simon Brooke

Field Summary
 java.lang.String actionLabel
          The text the user sees on the action link
protected  java.lang.String addLinkText
          the caption to use as the link text for the add link
 boolean canAdd
          true if users can add new records of this type
protected  java.lang.String childKey
          the name of the primary key field in that table
protected  java.lang.String description
          the name of the field in that table that contains user-readable identifying information
protected  java.lang.String parent
          the name of the foreign key field within the table which relates to my parent record
protected  java.lang.String parentKey
          the name of the variable in my context which holds the key of the parent record
protected  java.lang.String query
          the query to prepare.
protected  java.lang.String table
          the name of the table which I watch
 
Constructor Summary
Auxiliary(java.lang.String tableName, java.lang.String parentName)
          At minimum I must know my table and my parent.
Auxiliary(java.lang.String tableName, java.lang.String keyField, java.lang.String parentName, java.lang.String actionURL)
          The action URL is a URL which points to a form allowing a single row from the auxiliary information to be edited.
Auxiliary(java.lang.String tableName, java.lang.String keyField, java.lang.String parentName, java.lang.String actionURL, java.lang.String secTitle)
          The section title is a user-friendly title to show above the auxilliary table
Auxiliary(java.lang.String tableName, java.lang.String keyField, java.lang.String parentName, java.lang.String parentId, java.lang.String actionURL, java.lang.String secTitle, java.lang.String descField)
          Specify everything needed to create a navigable auxiliary
Auxiliary(java.lang.String tableName, java.lang.String keyField, java.lang.String parentName, java.lang.String parentId, java.lang.String actionURL, java.lang.String secTitle, java.lang.String descField, java.lang.String addLinkText)
          Specify everything needed to create a navigable auxiliary
 
Method Summary
protected  void doInternalLayout(Context context, javax.servlet.ServletOutputStream out, java.lang.Integer parId, java.lang.String parStr, java.sql.Connection c)
          Lay me out on the output stream of the current context.
 Node generate(Document doc, Context context)
          generate a DOM Node representing this Auxiliary.
 java.lang.String getAddLinkText()
           
 java.lang.String getInternalTarget()
           
 java.lang.String getShouldLayoutMagicToken()
           
 java.lang.String getTitle()
           
protected  void layout(Context context)
          check whether I should be laid out in the current context and if so call doInternalLayout to do the actual layout
protected  void layoutCanAdd(Context context, java.lang.String parStr)
          Lay out my 'can add' link.
 void setAddLinkText(java.lang.String addLinkText)
           
 boolean shouldLayout(Context context)
          should we lay out this auxiliary in this context?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

actionLabel

public java.lang.String actionLabel
The text the user sees on the action link


canAdd

public boolean canAdd
true if users can add new records of this type


addLinkText

protected java.lang.String addLinkText
the caption to use as the link text for the add link


childKey

protected java.lang.String childKey
the name of the primary key field in that table


description

protected java.lang.String description
the name of the field in that table that contains user-readable identifying information


parent

protected java.lang.String parent
the name of the foreign key field within the table which relates to my parent record


parentKey

protected java.lang.String parentKey
the name of the variable in my context which holds the key of the parent record


query

protected java.lang.String query
the query to prepare. Got to do it this way because of a nasty initialisation problem...


table

protected java.lang.String table
the name of the table which I watch

Constructor Detail

Auxiliary

public Auxiliary(java.lang.String tableName,
                 java.lang.String parentName)
At minimum I must know my table and my parent.

Parameters:
tableName - the table this auxilliary displays
parentName - the name of the field in that table which is a foreign key onto the table which the containing form edits

Auxiliary

public Auxiliary(java.lang.String tableName,
                 java.lang.String keyField,
                 java.lang.String parentName,
                 java.lang.String actionURL)
The action URL is a URL which points to a form allowing a single row from the auxiliary information to be edited. If present, each row in the auxilliary will have an 'edit' button.

Parameters:
tableName - the table this auxilliary displays
parentName - the name of the field in that table which is a foreign key onto the table which the containing form edits
actionURL - the URL to follow when a row is selected;
keyField - the column in the table which contains the value to be appended to the URL

Auxiliary

public Auxiliary(java.lang.String tableName,
                 java.lang.String keyField,
                 java.lang.String parentName,
                 java.lang.String actionURL,
                 java.lang.String secTitle)
The section title is a user-friendly title to show above the auxilliary table

Parameters:
tableName - the table this auxilliary displays
parentName - the name of the field in that table which is a foreign key onto the table which the containing form edits
actionURL - the URL to follow when a row is selected;
keyField - the column in the table which contains the value to be appended to the URL
secTitle - the title (headline) for this auxiliary

Auxiliary

public Auxiliary(java.lang.String tableName,
                 java.lang.String keyField,
                 java.lang.String parentName,
                 java.lang.String parentId,
                 java.lang.String actionURL,
                 java.lang.String secTitle,
                 java.lang.String descField)
Specify everything needed to create a navigable auxiliary

Parameters:
tableName - the name of the auxiliary table
keyField - the name of the primary key field in the auxiliary table
parentName - the name of the field in the auxiliary table which is foreign key onto the parent table
parentId - the name in the passed context which holds the value the foreign key should match
actionURL - the URL to call when an item in the auxiliary is clicked
secTitle - the title of this auxiliary
descField - the field which contains user-friendly identifying information in the auxiliary table

Auxiliary

public Auxiliary(java.lang.String tableName,
                 java.lang.String keyField,
                 java.lang.String parentName,
                 java.lang.String parentId,
                 java.lang.String actionURL,
                 java.lang.String secTitle,
                 java.lang.String descField,
                 java.lang.String addLinkText)
Specify everything needed to create a navigable auxiliary

Parameters:
tableName - the name of the auxiliary table
keyField - the name of the primary key field in the auxiliary table
parentName - the name of the field in the auxiliary table which is foreign key onto the parent table
parentId - the name in the passed context which holds the value the foreign key should match
actionURL - the URL to call when an item in the auxiliary is clicked
secTitle - the title of this auxiliary
descField - the field which contains user-friendly identifying information in the auxiliary table
addLinkText - the text to use for the add link
Method Detail

getInternalTarget

public java.lang.String getInternalTarget()
Returns:
the internal navigation target to use for this auxiliary.

getShouldLayoutMagicToken

public java.lang.String getShouldLayoutMagicToken()
Returns:
a token on which a Boolean value for whether I should layout this auxiliary can be cached in the context

getTitle

public java.lang.String getTitle()
Returns:
Returns the title.

generate

public Node generate(Document doc,
                     Context context)
              throws java.lang.Exception
generate a DOM Node representing this Auxiliary.

Parameters:
doc - the document in which this auxilliary lives
context - the context in which this auxiliary is to be created
Throws:
java.lang.Exception

shouldLayout

public boolean shouldLayout(Context context)
should we lay out this auxiliary in this context?

Parameters:
context - the context
Returns:
true if the auxiliary should be shown, else false

doInternalLayout

protected void doInternalLayout(Context context,
                                javax.servlet.ServletOutputStream out,
                                java.lang.Integer parId,
                                java.lang.String parStr,
                                java.sql.Connection c)
                         throws java.lang.Exception
Lay me out on the output stream of the current context.

Parameters:
context - the context
out - the output stream implied by the context
parId - the parent key field value as an integer
parStr - the parent key field value as a string
c - a database connection
Throws:
javax.servlet.ServletException - unlikely
java.io.IOException - if can't write to output stream
DataStoreException - unlikely
java.sql.SQLException - if database throws an error.
java.lang.Exception

layout

protected void layout(Context context)
               throws javax.servlet.ServletException,
                      java.io.IOException,
                      DataStoreException
check whether I should be laid out in the current context and if so call doInternalLayout to do the actual layout

Parameters:
context - the context.
Throws:
javax.servlet.ServletException
java.io.IOException
DataStoreException

layoutCanAdd

protected void layoutCanAdd(Context context,
                            java.lang.String parStr)
                     throws java.lang.Exception
Lay out my 'can add' link.

Parameters:
context - the context
parStr - the parent key field value as a string
Throws:
java.io.IOException - if can't write to output stream
java.lang.Exception

getAddLinkText

public java.lang.String getAddLinkText()
Returns:
the addLinkText

setAddLinkText

public void setAddLinkText(java.lang.String addLinkText)
Parameters:
addLinkText - the addLinkText to set

jacquard 1.12.0 by The Web Engineering Factory and Toolworks