uk.co.weft.htform
Class CompositeStylesheetWidget
java.lang.Object
uk.co.weft.htform.ResourceConsumerImpl
uk.co.weft.domutil.NodeGeneratorImpl
uk.co.weft.htform.Widget
uk.co.weft.htform.MenuWidget
uk.co.weft.htform.MultiSelectWidget
uk.co.weft.htform.ShuffleWidget
uk.co.weft.htform.LinkTableWidget
uk.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.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 |
|
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.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 java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
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 widgetprompt - user prompt for this widgethelp - user help for this widgetmaster - the name of the table in the database to which
stylesheets should be linkedmasterKey - 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 widgetprompt - user prompt for this widgethelp - user help for this widgetmaster - the name of the table in the database to which
stylesheets should be linkedmasterKey - the name of the key field in that table
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 contexttabIndex - 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