First of all, you'd need SASS to compile CSS, proceed to SASS Installation before beginning if you do not have SASS available in your command line.
Demo project has an integrated jetty plugin so running the sample is easy as building the css first followed by the mvn jetty:run command.
sass --update src/main/webapp/resources:src/main/webapp/resources --no-source-map mvn jetty:run
Navigate to http://localhost:8095/ultima to view the demos which is exactly same as the live version.
Ultima provides a main template.xhtml and additional topbar, menu and footer fragments for the base layout. These xhtml files must be placed under WEB-INF folder and client pages should reference the template.xhtml as their template. Provided empty-page.xhtml is a sample content page using the main template.xhtml that defines "content" as the main ui:define placeholder.
Other required resources are the css, js and images that are located inside resources/ultima-layout folder, simply copy the ultima-layout folder to your %WEB-APP-FOLDER%/resources folder so that final path would be %WEB-APP-FOLDER%/resources/ultima-layout/. Please refer to demo app or maven project of the demo app as the reference.
Ultima comes in two sizes, default is closer to the material design specification with bigger fonts and paddings whereas the alternative compact size shrinks the dimensions of the UI elements. To activate the compact mode add "layout-compact" style class to the h:body element at template.xhtml.
Ultima provides 12 PrimeFaces themes out of the box, setup of a theme simple as defining primefaces.THEME context parameter in web.xml such as "ultima-indigo". Full list of available themes are;
A custom theme can be developed by the following steps.
Here are the variables required to create a theme, you may need to change the last line according to the relative path of the sass folder in your application.
$primaryColor: #009688; $primaryDarkColor: #00695C; $primaryLightColor: #80CBC4; $accentColor: #CDDC39; $accentDarkColor: #9E9D24; $accentLightColor: #E6EE9C; $accentTextColor: #212121; @import '../sass/theme/_theme';
An example sass command to compile the css would be;
sass src/main/webapp/resources/primefaces-ultima-myown/theme.scss:src/main/webapp/resources/primefaces-ultima-myown/theme.css --no-source-map
Watch mode is handy to avoid compiling everytime when a change is made, instead use the following command so that sass generates the file whenever you make a customization. This builds all css files whenever a change is made to any scss file.
sass --watch src/main/webapp/resources:src/main/webapp/resources --no-source-map
Same can also be applied to layout itself;
Here are the variables required to create a layout, you may need to change the last line according to the relative path of the sass folder in your application.
$primaryColor: #03A9F4; $primaryDarkColor: #0277BD; $primaryLightColor: #81D4FA; $accentColor: #FFC107; $accentDarkColor: #FF8F00; $accentLightColor: #FFE082; $accentTextColor: #212121; $darkMenuBgColor: #424242; $darkMenuHoverColor: #676767; @import '/../sass/layout/_layout';
Check out the video tutorial that follows the steps above to create the dark-blue theme and layout
For both cases, several .scss files such as _layout.scss, _theme.scss or _variables.scss has to be present relative to your scss files, these are available inside the sass folder in the distribution.
In case you'd like to customize the structure not just the colors, the _variables.scss is where the structural variables (e.g. font size, paddings) for the layout are defined.
$textColor: #212121; $textSecondaryColor: #757575; /* Material Mode */ $fontSize: 16px; $lineHeight: 24px; $headerFontSize: 16px; $headerPadding: 10px 16px; $contentFontSize: 16px; $contentPadding: 10px 16px; $inputHeaderFontSize: 16px; $inputHeaderPadding: 10px 16px; $inputFontSize: 16px; $buttonFontSize: 16px; $inputOptionFontSize: 16px; $inputOptionPadding: 10px 14px; $iconFontSize: 24px; /* Compact Mode */ $c-fontSize: 14px; $c-lineHeight: 18px; $c-headerFontSize: 14px; $c-headerPadding: 8px 14px; $c-contentFontSize: 14px; $c-contentPadding: 8px 14px; $c-iconFontSize: 20px; $c-buttonFontSize: 14px; $c-inputFontSize: 14px; $c-inputHeaderFontSize: 14px; $c-inputHeaderPadding: 6px 10px; $c-inputOptionFontSize: 14px; $c-inputOptionPadding: 6px 10px; $c-dtPadding: 6px 10px; /* Common */ $hoverBgColor: #e8e8e8; $hoverTextColor: #000000; $dividerColor: #bdbdbd; $dividerLightColor: #cacaca; $grayBgColor: #757575;
Menu is a regular JSF component that supports PrimeFaces MenuModel API allowing both declarative and programmatic approaches. State is saved via a cookie and to remove it define a widgetVar to the menu and call PF('yourwidgetvar').clearMenuState(). To use the menu add the primefaces-ultima-{version}.jar to your classpath and import the http://primefaces.org/ultima namespace.
xmlns:pu="http://primefaces.org/ultima"> <pu:menu> </pu:menu>
Menu has 3 modes, static, overlay and horizontal. Layout wrapper element in template.xhtml is used to define which mode to use by adding specific classes. List below indicates the style classes for each mode.
For example to create a horizontal menu, the div element should be in following form;
<div class="layout-wrapper menu-layout-static menu-layout-horizontal"> <ui:include src="./topbar.xhtml" /> <ui:include src="./menu.xhtml" /> <div class="layout-main"> <ui:insert name="content"/> <ui:include src="./footer.xhtml" /> </div> </div>
It is also possible to leave the choice to the user by keeping the preference at a bean and usign an EL expression to bind it so that user can switch between modes. Sample application has an example implementation of such use case.
<div class="layout-wrapper menu-layout-static"> </div>
To add badge to submenu items;
<p:submenu id="themes" label="Themes" icon=""> <f:attribute name="badge" value="5" /> ... </p:submenu>
There are two possible locations for the user profile menu, first version is inline located inside the main menu and second option is the topbar menu. For inline mode, profile content should be placed above the <pu:menu />component and for inline mode content goes in topbar-items list. The sample demo application provides examples for both cases and even takes it to the next step by making it dynamic with an EL expression.
Layout can be used in RTL orientation as well by adding "layout-rtl" to the "layout-wrapper" div in template.xhtml.
Ultima provides various helper features such as material iconset compatible with PrimeFaces components and helper classes. Visit Utils page for details.
Various elements display a ripple element on mousedown event, if you prefer to remove this effect, simply remove the ripple.js and ripple.css files from template.xhtml.
Ultima uses new PrimeFaces Grid CSS (ui-g-*) throughout the samples, we strongly suggest using Grid CSS as your layout framework as it is well tested and supported by PrimeFaces. Grid CSS is automatically included on newer versions however if your PrimeFaces version is older than 5.3.14, add the provided grid.css file under /ultima-layout/css/ folder to your template manually.
2.1.0 to 2.1.1
2.0.2 to 2.1.0
2.0.1 to 2.0.2
2.0.0 to 2.0.1
1.1.6 to 2.0.0
1.1.5 to 1.1.6
1.1.4 to 1.1.5
1.1.3 to 1.1.4
1.1.2 to 1.1.3
1.1.1 to 1.1.2
1.1.0 to 1.1.1
1.0.8 to 1.0.9
1.0.7 to 1.0.8
1.0.6 to 1.0.7
1.0.5 to 1.0.6
1.0.4 to 1.0.5
1.0.3 to 1.0.4
1.0.2 to 1.0.3
1.0.1 to 1.0.2
1.0 to 1.0.1