<< View previous version | view page history | view next version >>
DeviceStylesheet Component
With each mobile device having distinct looks and feels, all mobility components available with this distribution are styled according to the device upon which they appear. Each of these components was themed, and only the theme for each device is loaded for the application. An iPhone user will only have the iphone css files served for their application as will an Android and Blackberry user.
Usage
There are really two ways to use this component. The main usage is to detect the device being used and to serve only the css pertaining to that device in a single css file. Users of Blackberry, Android, iPhone, iPad and desktop users will be able to connect to the same application yet see the theme that resembles their individual device without any extra effort on the developer's behalf.
Simply place this tag in the head of your template or facelet page.
<html.....xmlns:mobi="http://www.icesoft.com/icefaces/mobile/component">
...
<h:head>
<mobi:deviceStylesheet/>
</h:head>
<h:body>
........
</h:body>
</html>
This component will take care of loading the correct device-detected css. Currently those are iPhone, Android and Blackberry. Default will be iPhone for desktop browsers and iPad.
This tag may also be used to load the various css resources as it does in mobile-showcase application:-
<mobi:deviceStylesheet name="#{themeSwitcher.theme}" />
Since all themes reside in a single library, the library will default to the correct library of
org.icefaces.component.skins
Attributes
This section covers attributes supported for this component in typical use-case format. The most common use-case of this component will be to use it without attributes as a detection mechanism for loading the correct css for each device.
name denotes the jsf resource name of the css resource to be loaded if not using this device to detect the css to be delivered.
library specifies the jsf resource library from where to serve this resource. Default is "org.icefaces.component.skins" if no library is specified
media CSS media type, screen, print. Will default to screen, but developers can develop their own css to include styling for various media types and annotate their css file to contain all css definitions within one file.
TagLib Documentation This section covers attributes involved in the typical use-cases for this component. For reference, the complete taglib documentation for this component is available here. |