JSF usage in Sakai

What this is - I got a list of all the JSF tags that I could see in use or as placeholders. This includes the sakai (sakai) core (f), and the HTML (h), as well as some odds and ends.

Working from a profound ignorance of how they actually work, but with a fairly clear idea of what a useful toolkit should do I tried to find out the following:

  1. Are they doing the right thing?
  2. Are we using them right?
  3. How close does the rendering match the requirements when we do use them right?
  4. What else do we need in the toolkit?

So what follows is a little discursive. I have tried to include, for each tag, examples in use, what the tag attributes of significance for the rendering should be for best results, as well as for the simple tags (such as the HTML series) how to use them according to the style guide

The f: (core) tags are a bit of a black box, so not much to say, the h: (html) tags present some difficulties that I try to point out, but the main issue here is the usage. The sakai: tags need revamping or maybe I need a better understanding of that particular library.

Examining all the different UI practives in the new JSF based tools I am struck by the wide variability in how the JSF gets used, what JSF gets used, what the rendered markup looks like, the degree of compliance to the declared doctype and accessibility standards.

This is a long list, but probably better than my first atempt to understand this

What is needed in my view is:

  1. Regularize usage for consistency - with specific reference to usage of the JSF tags. This needs to be a good and useful doc and is probably the first things that needs to be done.
  2. Update the existing sakai:xxx tags to reflect changes in UI that have taken place in the last year
  3. Hydrate the existing sakai:xxx placeholders (or help me find them if I just could not locate them and thought they are placeholders in consequence!)
  4. Create new sakai:xxx tags that are needed
  5. Address the h:xxx tags that are wrong for our needs. Not sure how to go about this.
  6. Address the issue of different user agents other than web browsers
Sakai tags
sakai: | f: | h: | ?: | UI Element List

sakai:AlphaIndex

Not sure where used, looks like Samigo makes use of it in

<h:panelGroup rendered="#{totalScores.anonymous eq 'false'}"> <f:verbatim><span class="abc"></f:verbatim> <samigo:alphaIndex initials="#{totalScores.agentInitials}" /> <f:verbatim></span></f:verbatim> </h:panelGroup>

In which case the tag is not complete - witness the <f:verbatim> part.

The Rendering needed

sakai:AnchorReference

sakai:Applet

sakai:ButtonBarItem

See below tag

sakai:ButtonBar

See extended examples.

The Rendering needed

sakai:Courier

sakai:DataLine

From: sam\webapp\jsf\author\item\itemHeadings.jsp

<samigo:dataLine rendered="#{itemauthor.target == 'questionpool'}" value="#{questionpool.currentPool.parentPoolsArray}" var="parent" separator=" > " first="0" rows="100" >

sakai:Debug

sakai:DocProperties

Could not find any examples. Is this supposed to render header info?

sakai:DocSection

Could not find any examples. The section of a document needs to be the content between one header and the next header (or subheader)

sakai:DocSectionTitle

Could not find any examples. The section title needs to a header or subheader

The Rendering needed

sakai:DynaTable

Could not find any examples.

The Rendering needed

sakai:FlatList

No direct examples. Some workarounds:

From: metaobj\tool\src\webapp\WEB-INF\jsp\editPermissions.jsp

<table class="chefFlatListViewTable" cellspacing="0" summary ="" border="0">

From: scheduler\scheduler-tool\src\webapp\scheduler\main.jsp

<h:dataTable value="#{schedulerTool.schedulerManager.globalTriggerListener.triggerEvents}" var="event" styleClass="chefFlatListViewTable">

Both of these point at a css class that would be well to deprecate in favor of new ones

The Rendering needed

sakai:FlowState

Used - no impact on rendering.

sakai:GroupBox

No examples found - what was it designed to do? Looks like a fieldset.

sakai:HideDivision

sakai:InputColor

sakai:InputDate

sakai:InputFileUpload

No examples of it in use - although a lot of tools are doing uploads, each it's own way.

The Rendering needed

sakai:InputRichText

sakai:InstructionMessage

The Rendering needed

sakai:Messages

From: preferences\preferences\src\webapp\prefs\noti.jsp

<sakai:messages />

From: presentation\tool\src\webapp\presentation\join.jsp

<sakai:messages />

That seem to render via various adhoc mechanisms like:
preferences\preferences\src\webapp\prefs\prefUpdatedMsg.jsp

<span style="background-color:#FFF8DF; border:1px solid #B8B88A; color:#663300; font-size:x-small;margin:5px 0px 5px 0px; padding:5px 5px 5px 25px;">Message</span>

What is the difference between <sakai:messages /> and <h:messages>?

It would be excelent for <sakai:messages /> to have modes. Then we could do:

Instruction

Information

Success

Warning

sakai:MultiColumn

Just demo examples found

sakai:OutputDate

Just demo examples found

sakai:Pager

From: gradebook\tool\src\webapp_common\inc\filterPaging.jspf
<sakai:pager id="pager" totalItems="#{bean.dataRows}" firstItem="#{bean.firstRow}" pageSize="#{bean.maxDisplayedRows}" textStatus="#{msgs.paging_status_students}" />
Resulting in:
<span class="nav">   <span class="instruction"> Viewing 1 to 1 of 1 students </span>   <br>   <input name="gbForm:pager_first" value="|<" disabled="disabled" type="submit">   <input name="gbForm:pager_prev" value="<" disabled="disabled" type="submit">   <select name="gbForm:pager_pageSize" id="gbForm:pager_pageSize" onchange="javascript:this.form.submit(); return false;">     <option value="5">      Show 5     </option>     <option value="10">      Show 10     </option>      <option selected="selected" value="20">      Show 20     </option>     <option value="50">      Show 50     </option>     <option value="100">      Show 100     </option>     <option value="0">      Show all     </option>    </select>    <input name="gbForm:pager_next" value=">" disabled="disabled" type="submit">    <input name="gbForm:pager_last" value=">|" disabled="disabled" type="submit">    <input name="gbForm:pager_pastItem" value="0" type="hidden"> </span>

Issues:

The wrapper used in gradebook is a table, generated via

<h:panelGrid styleClass="gbContainerNav" columns="2" columnClasses="gbLeftNav,gbRightNav">

Whereas it needs to be a block

The Rendering needed

sakai:PanelEdit

No examples found. Part of original tag list

sakai:PeerRefresh

No examples found.

sakai:Popup

No examples found.

sakai:ProgressBar

No examples found.

sakai:RichTextArea

No examples found. Not even placeholders.

sakai:Script

No examples found. Not even placeholders.

sakai:Stylesheet

No examples found. Not even placeholders.

sakai:TimerBar

No examples found. Not even placeholders.

sakai:ToolBarItem

No examples found. Not even placeholders.

sakai:ToolBarMessage

No examples found. Just placeholders. Was this supposed to be the message displayed instead of the toolbar? If so deprecated, now a header, see header

sakai:Message

Not sure - how does this relate to the other "Message" tags?

sakai:ToolBarSpacer

No examples found. Just placeholders.

sakai:ToolBar

No examples found. Just placeholders.

sakai:ViewContent

No examples found - deprecated? Found use of viewContainer here and there:
From:preferences\preferences\src\webapp\prefs\refresh.jsp

<sakai:view_container title="Preferences">

sakai:View

From: jsf\widgets\src\java\org\sakaiproject\jsf\renderer\ViewRenderer.java
This renders a block:

<div class="portletBody"> content </div>

sakai:ViewTitle

From:
jsf\widgets\src\java\org\sakaiproject\jsf\renderer\ViewTitleRenderer.java
This renders a header:

<h3 class="insColor insBak insBorder">Message</h2>

The class attribute is deprecated.

Core tags
sakai: | f: | h: | ?: | UI Element List

None of these seem to have any rendering consequences - included just in case

f:actionListener

f:attribute

f:convertDateTime

f:convertNumber

f:converter

f:facet

f:loadBundle

f:param

f:selectItem

f:selectItems

f:subview

f:validateDoubleRange

f:validateLength

f:validateLongRange

f:validator

f:valueChangeListener

f:verbatim

f:view

HTML Tags
sakai: | f: | h: | ?: | UI Element List

The idea here is to identify any problems in the rendering that will need to be addressed in usage or via custom tags (to suplement core h:xxx tags)

The attribute table will treat only the ones with rendering consequences - based on the following assumptions about the response

  1. We are putting XHTML Transitional in response for browser user agents, with a high likelyhood that this will be XHTML Strict in the near future
  2. We are committed to WCAG and Section 508
  3. We are commited to separate content and presentation
  4. We will try to produce semantically valid markup - markup that is meaningful
  5. We will follow the style guide whenever possible

h:commandButton

From: gradebook\tool\src\webapp_common\addAssignment.jsp

<p class="act calendarPadding"> <h:commandButton id="saveButton" styleClass="active" value="#{msgs.add_assignment_submit}" action="#{addAssignmentBean.saveNewAssignment}"/> <h:commandButton value="#{msgs.add_assignment_cancel}" action="overview" immediate="true"/> </p>

But is not <sakai:buttonBar /> and <sakai:buttonBarItem /> taking care of this?

See actionbuttons.html for the extended examples

here is a table
commandbutton attributes
Attribute Description
id required
value use bundle
accesskey use only if normal serialization (tab order) does not work in this UI
alt required
dir set in css of parent block - use here to override
lang set in attributes of a parent block and addressed in the css - use here to override
style use only to override standard rendering
styleClass thinking is this is where one overrides the rendering. h:commandButton can be the child of a parent block that contextually defines the rendering of all its children - except for specific children that need to be emphasized somehow.

See actionButtons

tabindex Use only to override default serialization
title required - use bundle

h:commandLink

From: gradebook\tool\src\webapp_common\assignmentDetails.jsp

<h:commandLink action="editAssignment" rendered="#{!assignmentDetailsBean.assignment.externallyMaintained}" accesskey="e" tabindex="7" title="#{msgs.assignment_details_edit}"> <h:outputFormat id="editAssignment" value="#{msgs.assignment_details_edit}" /> <f:param name="assignmentId" value="#{assignmentDetailsBean.assignment.id}"/> </h:commandLink>

Usage

  1. Accesskey "e" - it is a "reserved" key assignation for most browsers.
  2. The tabindex seems odd - the rule is - do not modify the defacto index (how the tree gets serialized), unless there is a particular need for it.
  3. Good use of title - but it could be more informative (rather than repeat the "value" attribute value of the h:outputFormat)

From: presentation\tool\src\webapp\presentation\main.jsp

<h:commandLink action="#{pres.processActionListView}"> <h:outputText value="#{msgs.pt_link_view}"/> </h:commandLink>

Usage

  1. No use of title
  2. Wrapper should be <div class="itemAction">Action link</div>
Attribute Description
id required
accesskey consult chart...
dir set in css of parent block - use here to override
lang set in attributes of a parent block and addressed in the css - use here to override
style use only to override standard rendering
styleClass none if standard rendering is fine, none if specific rendering is inherited (say: all <a> that are in <th>) - use only if overriding all cases
tabindex use only if normal serialization (tab order) does not work in this ui
title required - use bundle, use "[new window]" if so, differentiate this from all other titles in same view

h:dataTable

Frequent use. Some examples.

From:profile\profile-app\src\webapp\profile\searchResults.jsp

<h:dataTable value="#{SearchTool.currentSearchResults}" var="searchResult"> <h:column> <h:commandLink action="#{searchResult.processActionDisplayProfile}"> <h:outputText value=" " /> <h:outputText value="#{searchResult.profile.lastName}" /> <h:outputText value=", " /> <h:outputText value="#{searchResult.profile.firstName}" /> <h:outputText value=" " /> </h:commandLink > </h:column> </h:dataTable>

From:syllabus\syllabus-app\src\webapp\syllabus\main.jsp

<h:dataTable value="#{SyllabusTool.entries}" var="eachEntry"> <h:column> <sakai:panel_edit> <sakai:doc_section> <h:outputText/> </sakai:doc_section> <h:outputText value="#{eachEntry.entry.title}" style="font-size:14px;font-weight:bold"/> <sakai:doc_section> <h:outputText/> </sakai:doc_section> <syllabus:syllabus_htmlShowArea value="#{eachEntry.entry.asset}" /> </sakai:panel_edit> </h:column> </h:dataTable>

From:sakai\sam\target\samigo\jsf\author\authorIndex.jsp

<h:dataTable styleClass="listHier" id="coreAssessments" value="#{author.assessments}" var="coreAssessment"> ........... </h:dataTable>
Attribute Description
bgcolor omit
border set to "0"
cellpadding set to "0"
cellspacing set to "0"
columnClasses open - no class definitions yet
footerClass indeterminate - let the css take care of it via inheritance, unless there is a clear need to make the footer of *this* table be different from the other tables in this same class
frame TODO:not sure what this is meant to accomplish - if the table borders - inherit via css from table class set in the styleClass attribute of dataTable
headerClass Since this applies to all headers of a given table, is of limited utility. Use only if you need to override the inherited header definitions of this particular table's class.
rowClasses Not sure how useful this is. Some possible uses: 1) highlight specific rows? 2) alternate row treatment for readability? In the first case it will look like ",,,,,,,,,,,,highlight,,,,,,,,,,,"; in the second even more exciting
rules indeterminate - let css take care of it via inheritance, unless there is a clear need to make the rules of *this* table be different from the other tables in this same class
summary required
styleClass values for styleClass are (for now):

dynaTable

flatTable

actionTable

dir, lang, style, title, width dir and lang would seem to be best dealt with in the css as well - set to inherit from a parent element in most cases (like the <body />) and override here if needed.
Same for style (use to override). Let width work from the styleClass, unless specifically need override here. title is a bonus.
onXXX events

h:form

Attribute Description
dir set in css of parent block - use here to override
lang set in attributes of a parent block and addressed in the css - use here to override
style use only to override standard rendering
styleClass none if standard rendering is fine, none if specific rendering is - use only if overriding
title optional

h:graphicImage

From: help\help-tool\src\webapp\tableOfContents\main.jsp

<h:graphicImage value="../image/topic.gif"/>

From: sakai\profile\profile-app\src\webapp\profile\main.jsp

<h:graphicImage value="#{ProfileTool.profile.pictureUrl}" height="75" width="75" rendered="#{ProfileTool.displayPictureURL}"/>

From: sam\target\samigo\jsf\author\preview_item\AudioRecording.jsp

<h:graphicImage id="image" alt="#{msg.audio_recording}." url="/images/recordresponse.gif" />

Attribute Description
alt required
dir set in css of parent block - use here to override
height desirable - specially if large - page and layout load better
lang set in attributes of a parent block and addressed in the css - use here to override
longdesc required if image is not iconic and meaning cannot be conveyed in the alt attribute
style use only to override standard rendering
styleclass none if standard rendering is fine (definition of img element)
title desirable
width desirable - page and layout load better

h:inputHidden

No rendering

h:inputSecret

See input text

h:inputText

From:gradebook\tool\target\webapp_dir\sakai-gradebook-tool\assignmentDetails.jsp

<h:inputText id="Score" value="#{scoreRow.score}" size="4" rendered="#{!assignmentDetailsBean.assignment.externallyMaintained}" style="text-align:right;" onkeypress="return submitOnEnter(event, 'gbForm:saveButton');"> <f:convertNumber /> <f:validateDoubleRange minimum="0"/> <f:validator validatorId="org.sakaiproject.gradebook.jsf.validator.ASSIGNMENT_GRADE"/> </h:inputText>

  1. could use title that will differentiate this input from all other inputs in this column
  2. could use an invisible (since this input displayed in a cell on a table) <label /> keyed to the id

From:help\help-tool\src\webapp\question\display.jsp

<h:outputText value="#{msgs.emailAddress}"/> <h:inputText value="#{QuestionTool.emailAddress}" disabled="true" />

  1. h:outputText really should have been an h:outputLabel keyed to the id of the h:inputText
  2. ...for which the h:inputText needs an id
  3. h:inputText also needs a title

Notes

The agreed way to present this element is as part of a label/input pair. See:

inputText

Unless the input happens inside of a dataTable, then see:

actionTable

If required, the rendering should be:

inputTextRequired

On failed validation the rendering should be:

inputTextValidationError

Attribute Description
id Required
accesskey consult chart...
required if required from user...
alt TODO:what possible user agent would need this?
dir set in css of parent block - use here to override
lang set in attributes of a parent block and addressed in the css - use here to override
maxlength depends
onxxx events
size required
style use only to override standard rendering
styleClass none if standard rendering is fine, none if specific rendering is inherited (see wrapper issues below - use only if overriding all cases
tabindex use only if normal serialization (tab order) does not work in this ui
title required - use bundle
- provides hover info - futureproof against next version WCAG

h:inputTextarea

From: help\help-tool\src\webapp\question\display.jsp

<h:outputText value="#{msgs.content}"/> <h:inputTextarea value="#{QuestionTool.content}" cols="45" rows="10" disabled="true" />

  1. h:outputText really should have been an h:outputLabel keyed to the id of the h:inputText
  2. ...for which the h:inputText needs an id
  3. h:inputText also needs a title

From:sakai\sam\target\samigo\jsf\delivery\item\deliverMultipleChoiceSingleCorrect.jsp

<h:outputLabel for="rationale" value="#{msg.rationale}" /> <f:verbatim><br /></f:verbatim> <h:inputTextarea id="rationale" value="#{question.rationale}" rows="5" cols="40" disabled="#{delivery.previewMode eq 'true'}" />

  1. correct use of label/input construct
  2. title on h:inputTextarea would be good

Notes

The agreed way to present this element is as part of a label/input pair. See:

longText

If required, the rendering should be:

longTextRequired

On failed validation the rendering should be:

longTextValidationError

Attribute Description
id required
accesskey consult chart...
cols TODO:determine standard
dir set in css of parent block - use here to override
lang set in attributes of a parent block and addressed in the css - use here to override
onxxx events
rows TODO:determine standard
style use only to override standard rendering
styleClass none if standard rendering is fine, none if specific rendering is inherited (see wrapper issues above - use only if overriding all cases
tabindex use only if normal serialization (tab order) does not work in this ui
title required - use bundle -provides hover info - futureproof against next version WCAG

h:message

From: gradebook\tool\src\webapp_common\assignmentDetails.jsp

<h:column> <h:message for="Score" styleClass="validationEmbedded"/> </h:column>

From:sakai\sam\target\samigo\jsf\author\editPart.jsp

<h:message for="numSelected" styleClass="validate"/>

From:scheduler\scheduler-tool\src\webapp\scheduler\create_job.jsp

<h:inputText id="job_name" value="#{schedulerTool.jobName}" required="true" validator="#{schedulerTool.validateJobName}"/> <h:message for="job_name" styleClass="chefRequiredInline"/>

  1. A lot of variariability
  2. A seen below, do not fully understand how this works, so following recomendations, chunk of salt

The recommendations for messages are as follows (there is no clear 1X1 correspondence to the types given in attributes for h:message) - this needs to be figured out.

Warn

Info

Validation

Success

Instruction

Attribute Description
for TODO:what are the implications of this?
id TODO:needed?
showDetail TODO:what are the implications of this?
showSummary TODO:what are the implications of this?
errorClass TODO:match ERROR with style class
errorStyle Only to override errorClass
fatalClass TODO:match FATAL with style class
fatalStyle Only to override fatalClass
infoClass TODO:match INFO with style class, first glance this should be "infoMessage"
infoStyle Only to override infoClass
style Only to override styleClass
styleClass TODO: generalized styleClass that is overridden by message type styleClasses?
title Can't see the desirability of this
tooltip Can't see the desirability of this
warnClass TODO:match FATAL with style class

h:messages

Same as message above - Do not really understand all the implications - I do think that we should not use the table value for the layout attribute

h:outputFormat

Looks like just a string?

h:outputLabel

See h:inputText above

h:outputLink

See h:commandLink above

h:outputText

Nothing to report

h:panelGrid

See h:dataTable above - avoid use for layout

h:panelGroup

I think I understand this - not much to say

h:selectBooleanCheckbox

From:profile\profile-app\src\webapp\profile\edit.jsp

<h:selectBooleanCheckbox title= "Hide my Personal Information" value="#{ProfileTool.profile.hidePrivateInfo}" /> <h:outputText value="Hide only my Personal Information" style="font-size: 11;" />

  1. String in the title
  2. use of h:outputText, instead of h:outputLabel
  3. use of style attribute
  4. invalid value for "style" attribute

From:syllabus\syllabus-app\src\webapp\syllabus\main_edit.jsp

<h:column rendered="#{! SyllabusTool.displayNoEntryMsg}"> <f:facet name="header"> <h:outputText value="Remove"/> </f:facet> <h:selectBooleanCheckbox value="#{eachEntry.selected}"/> </h:column>

  1. h:selectBooleanCheckbox in a cell - could use h:outputLabel classed to be invisible
  2. string in h:outputText header value

From:gradebook\tool\src\webapp_common\gradeOptions.jsp

<h:selectBooleanCheckbox id="displayAssignmentGrades" value="#{feedbackOptionsBean.localGradebook.assignmentsDisplayed}" onkeypress="return submitOnEnter(event, 'gbForm:saveButton');"/> <h:outputLabel for="displayAssignmentGrades" value="#{msgs.feedback_options_grade_display_assignment_grades}" />

  1. use of h:outputLabel with h:selectBooleanCheckbox :)

The agreed way to present this element is as part of a label/input pair. See:

checkBox

Unless the input happens inside of a dataTable, then see:

actionTable

If required, the rendering should be:

inputCheckRequired

On failed validation the rendering should be:

inputCheckValidationError

Note: above deals with input[type="radio"] but is all the same.

Attribute Description
Id required
accesskey consult chart...
dir set in css of parent block - use here to override
lang set in attributes of a parent block and addressed in the css - use here to override
onxxx events
style use only to override standard rendering
styleClass none if standard rendering is fine, none if specific rendering is inherited (see wrapper issues above - use only if overriding all cases
tabindex use only if normal serialization (tab order) does not work in this ui
title required - use bundle -provides hover info - futureproof against next version WCAG

h:selectManyCheckbox

Note: the rendering of this widget is very problematic - a table, each cell containing a label wrapping an input. Whereas this is all correct, adds unnecessary markup. The label wrapping the input is unconventional but correct as well. Of course - do not need for and id attributes in this case. Or do we? TODO:check if so.

<table> <tr> <td> <label for="jsftags:cars1"> <input name="jsftags:cars1" value="accord" type="checkbox" id="jsftags:cars1"> Honda Accord </label> </td> .............. </tr> </table>

Attribute Description
id required
accesskey consult chart...
border set to 0"
dir set in attributes of a parent block and addressed in the css - use here to override
disabledClass TODO:what would this be other than the default rendering?
enabledClass TODO:what would this be other than the default rendering?
lang set in attributes of a parent block and addressed in the css - use here to override
layout Really really wish the options for this attribute did not result both in tables
onxxx events
style use only to override standard rendering
styleClass TODO:what would this be?
tabindex use only if normal serialization (tab order) does not work in this ui
title required - use bundle -provides hover info - futureproof against next version WCAG

h:selectManyListbox

Same as h:selectOneListbox below, + the many and size options

h:selectManyMenu

Same as h:selectManyListbox? Can't tell the difference in the rendering

h:selectOneListbox

Notes

Seems to be missing the <optgroup /> possibility

The agreed way to present this element is as part of a label/input pair. See:

selectControl

Unless the input happens inside of a dataTable, then see:

actionTable (same treatment as the input[type=text])

If required, the rendering should be:

inputTextRequired (same treatment as the input[type=text])

On failed validation the rendering should be:

inputTextValidationError (same treatment as the input[type=text])

Attribute Description
accesskey consult chart...
dir set in css of parent block - use here to override
lang set in attributes of a parent block and addressed in the css - use here to override
disabledClass TODO:what would this be other than the default rendering?
enabledClass TODO:what would this be other than the default rendering?
onxxxx events
size TODO:not a valid attribute for a single select <select /> - Spec says: "Number of available options to be shown at all times. If not specified, all available options are shown." Spec is confused?
style use only to override standard rendering
styleClass none if standard rendering is fine, none if specific rendering is inherited (see wrapper issues above - use only if overriding all cases
Tabindex use only if normal serialization (tab order) does not work in this ui
Title required - use bundle - provides hover info - futureproof against next version WCAG

h:selectOneMenu

Same as h:selectOneListbox? Can't tell the difference in the rendering

h:selectOneRadio

Same issues as in h:selectBooleanCheckbox above

h:column

Odds and ends
sakai: | f: | h: | ?: | UI Element List

These are things I have found in use

actButtons

globalLinks

hierarchicalTableControl

viewActionTool