Reminder: you can use value bindings #{foo.bar} wherever on your page,
you do not need to use it exclusively inside a jsf tag.
For instance, you could write:
<img src="${myIcon.path}" />
You would only lose features like conversions and other controls over
your data.
You can also have something like:
<script language="javascript">
function doSomething() {
document.getElementById('#{myFormId}');
...
}
</script>
Sometimes it's just not worth the extra headache :)
Anahide Tchertchian a écrit :
Hi,
Here is an overview of new features, please read carefully if you'd like
to make your life easier when writing xhtml files :)
First the "test" method has been moved to the util taglib, you should
now use:
xmlns:nxu="http://nuxeo.org/nxweb/util"
itemStyleClass="#{nxu:test(webActions.currentTabAction == tab,
'selected', '')}"
Another tag in util called methodResult exposes the result of a method
binding as a request-scope attribute. This allows you to avoid having to
define a method on your action listener to get some rendering info.
This is comparable to f:param or ui:param tags, but using method
bindings instead of value bindings.
example:
<nxu:methodResult name="actions"
value="#{webActions.getActionsList('SUBVIEW_UPPER_LIST')}">
<nxu:dataList var="action"
value="#{actions}">
...
</nxu:dataList>
</nxu:methodResult>
Think of using facelets templating features for other common use cases:
http://www.jsftoolbox.com/documentation/facelets/10-TagReference/index.jsf
Document lists have been refactored so that multi selection is made
easier to define and implement in an action listener. I'll give more
information about it soon.
A document can be rendered as any other object, accessing field values
with a syntax such as "#{document.schema.field}" (for instance:
"#{document.dublincore.title}". Usual converters can be used too.
Take a look at the Nuxeo/web/incl/documents_table.xhtml for examples:
http://svn.nuxeo.org/trac/nuxeo/browser/Nuxeo/trunk/web/incl/documents_table.xhtml
Some functions and tags have been added to the
xmlns:nxd="http://nuxeo.org/nxweb/document" taglib to make it easier to
render a document model for common use cases.
You can now use
- <nxd:docLink title="#{document.dublincore.title} or 'whatever'"
document="#{document}" /> to get a link to a given document model.
All other attributes defined for a commandLink are also accepted (except
value and action).
- "#{nxd:typeInfo(document)}": uses a document adapter to get the
document type information as described in contributions like
ecm-types-contrib.xml.
Example usage:
import org.nuxeo.ecm.core.api.DocumentModel;
import org.nuxeo.ecm.types.adapter.TypeInfo;
TypeInfo typeInfo = document.getAdapter(TypeInfo.class);
if (typeInfo != null) {
iconPath = typeInfo.getIcon();
}
Of course this can be used in any other code than taglib functions.
- "#{nxd:typeLabel(document)" to get the document type label. Common use
case: <h:outputText value="#{messages[nxd:typeLabel(document)}" />
- "#{nxd:iconPath(document)" to get the document icon path (tries to get
the field "icon" in schema "common", and defaults to the document type
icon).
- "#{nxd:titleOrId(document)" to get the document title, and its id if
title is somehow not set (can be very handy if you'd still like to click
on the link to access it).
Also, the commandLink and commandButton methods defined in
xmlns:nxh="http://nuxeo.org/nxweb/html" taglib have been changed so that
they can invoke a method binding which is the result of the given method
binding. Ok, here's an example :)
NXActions items can be configured to hold method bindings as a link like
"${documentAction.createDocument('Domain')}". This information can be
accessed in a page via "${action.getLink()}".
The nxh:commandLink tag will not consider this as a string (default
behaviour of the h:commandLink tag) but will invoke the corresponding
method binding.
So now you can have:
<nxh:commandLink value="#{action.label}" action="${action.getLink()}" />
Anahide Tchertchian a écrit :
Hi,
A new module has been created to handle view related features within
the Nuxeo platform: NXWebPlatform.
It basically defines jsf components, and taglibs we would like to keep
control on so that we can add features there without changing too many
templates using these tags.
Please try to use tags defined in there instead of using some basic
html (h:) and tomahawk (t:) tags.
see:
NXWebPlatform/WEB-INF/nxweb-fn.taglib.xml
NXWebPlatform/WEB-INF/nxweb-html.taglib.xml
NXWebPlatform/WEB-INF/nxweb-util.taglib.xml
fn usage example: (xmlns:nxf="http://nuxeo.org/nxweb/function")
itemStyleClass="#{nxf:test(webActions.currentTabAction == tab,
'selected', '')}"
Feel free to add other useful methods there.
html usage: xmlns:nxh="http://nuxeo.org/nxweb/html"
all basic html tags
util usage: xmlns:nxu="http://nuxeo.org/nxweb/util"
The util taglib holds several tomahawk tags redefinition, feel free to
add there missing ones (unless they're anyway too specific like the
tomahawk tree2 tag).
It holds specific tags to handle file input and output:
<nxu:inputFile value="#{document.file.content}"
filename="#{document.file.filename}" editFileName="true">
<nxu:outputFile value="#{document.file.content}"
filename="#{document.file.filename}" />
It also holds a selectItems tag that gives control on what should be
used for ids and labels.
<nxu:selectItems value="documentList" var="document"
itemValue="#{document.ref}" itemLabel="#{document.dublincore.title}" />
Some features are currently added to handle multi selection within a
table, more info on this later :)
anahide.
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm
--
Anahide Tchertchian, Nuxeo
Mail: [EMAIL PROTECTED] - Tel: +33 (0)1 40 33 79 87
http://www.nuxeo.com - http://www.nuxeo.org
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm