jacquard 1.12.0 by The Web Engineering Factory and Toolworks

uk.co.weft.htform
Class CompositeStylesheetWidget

java.lang.Object
  extended byuk.co.weft.htform.ResourceConsumerImpl
      extended byuk.co.weft.domutil.NodeGeneratorImpl
          extended byuk.co.weft.htform.Widget
              extended byuk.co.weft.htform.MenuWidget
                  extended byuk.co.weft.htform.MultiSelectWidget
                      extended byuk.co.weft.htform.ShuffleWidget
                          extended byuk.co.weft.htform.LinkTableWidget
                              extended byuk.co.weft.htform.CompositeStylesheetWidget
All Implemented Interfaces:
java.lang.Cloneable, NodeGenerator, ResourceConsumer

public class CompositeStylesheetWidget
extends LinkTableWidget

In setting up customisable content management systems (which, let's face it, is 90% of what we do) it's often useful to allow the users to choose - mix-n-match - CSS stylesheets from a number of previously set up stylesheets. It would be useful if they could get immediate feedback on what they've set up. This is an experimental control to help with this. Only usable in TableWrapperForms.

By default this widget assumes there is a table in the database named 'stylesheet' whose keyfield is named 'stylesheet_id' and which has a filed called 'name'; and that there is another table with the same name as the widget which is a link table between the stylesheet table and the master table for the widget which has an integer column called 'rank'.

To support this functionality you need a servlet served from csssample which can show the stylesheets. A suitable servlet is provided as CompositeStylesheetSample. The version provided generates no body content and is expected to take its content from a head include file. You may want to specialise this and generate some particular content, if the head include solution does not work for you.

Since:
Jacquard 1.9
Version:
$Revision: 1.4.4.3 $ This revision: $Author: simon $
Author:
Simon Brooke
See Also:
CompositeStylesheetSample

Field Summary
protected  java.lang.String keyField
          the name in the context which holds the key value which when passed as arg to sampleURL will collect the correct bundle of stylesheets
protected  java.lang.String sampleURL
          The (possibly relative) URL from which a suitable sample page can be fetched.
 
Fields inherited from class uk.co.weft.htform.ShuffleWidget
doProcessExtension, excludeLabel, includeLabel, preferGracefulDegradeToNetscapeBugs, shuffleScript, unselectedExtension
 
Fields inherited from class uk.co.weft.htform.MultiSelectWidget
eltTag
 
Fields inherited from class uk.co.weft.htform.MenuWidget
defaultSize, unsetLabel, UNSETVALUEMAGICTOKEN
 
Fields inherited from class uk.co.weft.htform.Widget
ACTIONCSSCLASS, akprompt, attrs, CONTEXTATTRIBUTESSUFFIX, cssClass, DANGEROUSCSSCLASS, debug, DEFAULTTOKEN, dflt, form, generateAs, GENERATEASHTML, GENERATEASXFORM, GENERATEASXML, help, HELPTOKEN, immutable, ISIMMUTABLETOKEN, ISMANDATORYTOKEN, mandatory, MANDATORYCSSCLASS, maxVisibleSize, name, NAMETOKEN, OPTIONALCSSCLASS, PREVIOUSVALUESUFFIX, prompt, PROMPTTOKEN, size, SIZETOKEN, type, TYPETOKEN
 
Fields inherited from class uk.co.weft.domutil.NodeGeneratorImpl
namespaceURI
 
Fields inherited from class uk.co.weft.htform.ResourceConsumerImpl
resourceBundleName
 
Fields inherited from interface uk.co.weft.domutil.NodeGenerator
NAMESPACEURIMAGICTOKEN
 
Fields inherited from interface uk.co.weft.htform.ResourceConsumer
RESOURCEBUNDLEMAGICTOKEN
 
Constructor Summary
CompositeStylesheetWidget(java.lang.String name, java.lang.String prompt, java.lang.String help, java.lang.String master, java.lang.String masterKey)
          Creates a new CompositeStylesheetWidget object.
CompositeStylesheetWidget(java.lang.String name, java.lang.String prompt, java.lang.String help, java.lang.String master, java.lang.String cssTable, java.lang.String masterKey, java.lang.String cssKey)
          Creates a new CompositeStylesheetWidget object.
 
Method Summary
 void layout(Context context, int tabIndex)
          lay me out and my associated prompt and help text on this output stream in this context.
 java.lang.String scriptRequest(Context context)
          ShuffleWidgets positively need JavaScript scripts to support them!
 
Methods inherited from class uk.co.weft.htform.LinkTableWidget
getOptions, getTabPlaces, onloadRequest, postProcess, preProcess
 
Methods inherited from class uk.co.weft.htform.ShuffleWidget
getWidth, layoutSelectedWidget, layoutSelectedWidget, layoutShuffleButton, layoutShuffleButton, layoutUnselectedWidget, layoutUnselectedWidget
 
Methods inherited from class uk.co.weft.htform.MultiSelectWidget
getHeight, layoutValue
 
Methods inherited from class uk.co.weft.htform.MenuWidget
addOption, clone, generateInnerHTML, generateValue, setDebug
 
Methods inherited from class uk.co.weft.htform.Widget
generate, generateAttributes, generateAttributes, generateHTML, generateHTMLPrompt, generateXML, getContextAttribute, getCssClass, getHelp, getName, getPrompt, getType, init, layout, layout, layout, layoutAttribute, layoutAttributes, makeReady, maybeLayout, maybeLayout, onloadRequest, scriptRequest, setAttribute, setContextAttribute, setCssClass, setDefault, setHelp, setImmutable, setMandatory, setMandatory, setName, setPrompt, setSize, setType
 
Methods inherited from class uk.co.weft.domutil.NodeGeneratorImpl
getNamespaceURI, setNamespaceURI
 
Methods inherited from class uk.co.weft.htform.ResourceConsumerImpl
getContextOrResource, getResource, getResourceOrContext, getResourceString, grs, grs
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uk.co.weft.domutil.NodeGenerator
generate, getName, getNamespaceURI, init, setDebug
 

Field Detail

keyField

protected java.lang.String keyField
the name in the context which holds the key value which when passed as arg to sampleURL will collect the correct bundle of stylesheets


sampleURL

protected java.lang.String sampleURL
The (possibly relative) URL from which a suitable sample page can be fetched. The agent on the other end needs to know about two variables: 'stylesheets', being a comma separated list of stylesheet IDs, and keyField

Constructor Detail

CompositeStylesheetWidget

public CompositeStylesheetWidget(java.lang.String name,
                                 java.lang.String prompt,
                                 java.lang.String help,
                                 java.lang.String master,
                                 java.lang.String masterKey)
Creates a new CompositeStylesheetWidget object.

Parameters:
name - the name of this widget
prompt - user prompt for this widget
help - user help for this widget
master - the name of the table in the database to which stylesheets should be linked
masterKey - the name of the key field in that table

CompositeStylesheetWidget

public CompositeStylesheetWidget(java.lang.String name,
                                 java.lang.String prompt,
                                 java.lang.String help,
                                 java.lang.String master,
                                 java.lang.String cssTable,
                                 java.lang.String masterKey,
                                 java.lang.String cssKey)
Creates a new CompositeStylesheetWidget object.

Parameters:
name - the name of this widget
prompt - user prompt for this widget
help - user help for this widget
master - the name of the table in the database to which stylesheets should be linked
masterKey - the name of the key field in that table
Method Detail

layout

public void layout(Context context,
                   int tabIndex)
            throws DataFormatException,
                   javax.servlet.ServletException,
                   java.io.IOException
lay me out and my associated prompt and help text on this output stream in this context.

Overrides:
layout in class LinkTableWidget
Parameters:
context - the service context
tabIndex - the tabindex to use, ot the tab index of my first sub-widget if I have more than one
Throws:
DataStoreException - I don't, but things which specialise me may
javax.servlet.ServletException - I don't, but things which specialise me may
java.io.IOException - if can't write to the output stream
DataFormatException

scriptRequest

public java.lang.String scriptRequest(Context context)
                               throws java.lang.Exception
ShuffleWidgets positively need JavaScript scripts to support them!

Overrides:
scriptRequest in class ShuffleWidget
Throws:
java.lang.Exception

jacquard 1.12.0 by The Web Engineering Factory and Toolworks