myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Myfaces Wiki] Update of "MyFacesComponents" by Jan Dockx
Date Sat, 27 Aug 2005 23:07:59 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The following page has been changed by Jan Dockx:
http://wiki.apache.org/myfaces/MyFacesComponents

------------------------------------------------------------------------------
  
  
  ==== enabledOnUserRole ====
- If the current user has one of the roles listed in the attribute {{{enabledOnUserRole}}},
the {{{enabled}}} attribute is used to decide whether or not to render the component ''enabled''.
If the current user does not have one of the roles listed in the attribute {{{enabledOnUserRole}}},
the the component is rendered ''disabled''.
+ If the current user has one of the roles listed in the attribute {{{enabledOnUserRole}}},
the {{{disabled}}} attribute is used to decide whether or not to render the component ''enabled''.
If the current user does not have one of the roles listed in the attribute {{{enabledOnUserRole}}},
the the component is rendered ''disabled''.
  
+ Note the reversal of logic from the standard {{{disabled}}} attribute to the extended ''
'''not''' disabled on user role'' {{{enabledOnUserRole}}} attribute.
+ 
+ 
+ === Display Value Only ===
+ Consider you are creating a page where users can inspect data and change it. You might want
to implement different states of the page, one where users can only see the data, and not
change it (let's call it ''view mode'' {{{DISPLAY}}}), and another where users can also modify
the data (let's call it ''view mode'' {{{EDIT}}}). In view mode {{{EDIT}}}, you obviously
need HTML input tags, to have the browser show editable fields. For a clean user interface,
you don't want editable fields in view mode {{{DISPLAY}}}.
+ 
+ On solution to make the difference, apart from creating 2 separate .jsp(x) pages, is to
disable the fields in view mode {{{DISPLAY}}}:
+ {{{
+   <h:inputText ... disabled="#{myHandler.viewMode == 'DISPLAY'}" ...>
+ }}}
+ 
+ With the extended standard components of Tomahawk, it is also possible to render the value
of the fields just as text, whithout the field. This is controlled by the boolean {{{displayValueOnly}}}
attribute. If the value of this attribute evaluates to {{{true}}}, no HTML input tags are
rendered, but the component behaves like the standard {{{<h:outputText>}}} component.
If the value of this attribute evaluates to {{{false}}}, HTML input tags are rendered, and
the component behaves like the equivalent standard input component.
+ 
+ When the component is rendered a value only, you still want to control it's representation.
For that, the attribute {{{displayValueOnlyStyle}}} and {{{displayValueOnlyStyleClass}}} are
at your disposal. The css style or resp. style class mentioned as values for these attributes
are applied to a HTML span tag around the displayed text.
  
  == Advanced Additional Components ==
  

Mime
View raw message