Skip to content

Commit

Permalink
added a demo for multi-level dropdown menus
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanrauh committed Jul 11, 2015
1 parent 0dc9087 commit c956013
Show file tree
Hide file tree
Showing 10 changed files with 319 additions and 0 deletions.
8 changes: 8 additions & 0 deletions MultiLevelDropDown/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/target/
rebel.xml
.metadata
.settings
dist
.faces-config.xml.jsfdia
.project
.classpath
9 changes: 9 additions & 0 deletions MultiLevelDropDown/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# BootsFaces-Examples: Multi-level drop-down menus
This demo shows how to use a multi-level <b:dropDown /> in a navbar.

Run this as a Tomcat application. The URL to start typically is http://localhost:8080/MultiLevelDropDown.

Tested on:
<ul>
<li>Tomcat 8.0 / Apache MyFaces 2.2.7</li>
</ul>
78 changes: 78 additions & 0 deletions MultiLevelDropDown/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.beyondjava</groupId>
<artifactId>MultiLevelDropDown</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>MultiLevelDropDown</name>
<url>http://www.beyondjava.net</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>net.bootsfaces</groupId>
<artifactId>bootsfaces</artifactId>
<version>0.8.0-SNAPSHOT</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>ApplicationServer</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.10</version>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>Mojarra</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.10</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.10</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>MyFaces</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>2.2.7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>2.2.7</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package de.beyondjava.bootsfaces.examples;

import java.util.Date;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

@ViewScoped
@ManagedBean
public class Person {

private String firstName;
private String lastName;
private Date birthdate;
public Date getBirthdate() {
return birthdate;
}
public void setBirthdate(Date birthdate) {
this.birthdate = birthdate;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}

}
8 changes: 8 additions & 0 deletions MultiLevelDropDown/src/main/webapp/WEB-INF/faces-config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2">

</faces-config>
22 changes: 22 additions & 0 deletions MultiLevelDropDown/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<context-param>
<param-name>javax.faces.FACELETS_DECORATORS</param-name>
<param-value>
de.beyondjava.angularFaces.core.tagTransformer.AngularTagDecorator
</param-value>
</context-param>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>bootstrap</param-value>
</context-param>
<context-param>
<param-name>BootsFaces_USETHEME</param-name>
<param-value>true</param-value>
</context-param>
<welcome-file-list>
<welcome-file>index.jsf</welcome-file>
</welcome-file-list>
</web-app>
64 changes: 64 additions & 0 deletions MultiLevelDropDown/src/main/webapp/index.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:b="http://bootsfaces.net/ui" xmlns:f="http://java.sun.com/jsf/core">

<h:head>
<style>
.nav-tabs>li.active>a, .nav-tabs>li.active>a:hover, .nav-tabs>li.active>a:focus {background-color:#ddd !important; }
</style>
</h:head>
<h:body>
<b:navBar brand="BootsFaces Rocks!" brandHref="/index.jsf" inverse="true"
fixed="true">
<b:navbarLinks>
<b:dropMenu value="Help"
styleClass="navbar-inverse" style="color:#fff"
contentClass="navbar-inverse" contentStyle="color:#fff">
<b:navLink value="About"
styleClass="navbar-inverse" style="color:#fff"
contentClass="navbar-inverse" contentStyle="color:#fff"
onclick="alert('This demo shows how to implement a multi-level drop-down menu.')"></b:navLink>
</b:dropMenu>
</b:navbarLinks>
</b:navBar>

<b:container>
<b:tabView style="dd">
<b:tab title="large">
<div style="height: 10px" />
<ui:include src="large.xhtml" />
</b:tab>
<b:tab title="medium (default)">
<div style="height: 10px" />
<ui:include src="medium.xhtml" />
</b:tab>
<b:tab title="small">
<div style="height: 10px" />
<ui:include src="small.xhtml" />
</b:tab>
</b:tabView>
</b:container>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push([ 'trackPageView' ]);
_paq.push([ 'enableLinkTracking' ]);
(function() {
var u = "//www.atapuerca.de/piwik/";
_paq.push([ 'setTrackerUrl', u + 'piwik.php' ]);
_paq.push([ 'setSiteId', 4 ]);
var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
g.type = 'text/javascript';
g.async = true;
g.defer = true;
g.src = u + 'piwik.js';
s.parentNode.insertBefore(g, s);
})();
</script>
<noscript>
<p>
<img src="//www.atapuerca.de/piwik/piwik.php?idsite=4" style="border: 0;" alt="" />
</p>
</noscript>
<!-- End Piwik Code -->
</h:body>
</html>
33 changes: 33 additions & 0 deletions MultiLevelDropDown/src/main/webapp/large.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<ui:fragment xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:b="http://bootsfaces.net/ui"
xmlns:f="http://java.sun.com/jsf/core">

<b:row>
<b:column col-lg="8">
<b:panel look="primary" title="b:column col-lg='8'">
Eight columns on large desktop screens.<br /> Stacked on screens smaller than 1200 pixels width.
<br />
<br />
</b:panel>
</b:column>
<b:column col-lg="4">
<b:panel look="primary" title="b:column col-lg='4'">
Four columns on large desktop screens. Stacked on screens smaller than 1200 pixels width.
</b:panel>
</b:column>
</b:row>
<b:row>
<b:column col-lg="4">
<b:panel look="primary" title="b:column col-lg='4'">
Four columns on large desktop screens. Stacked on screens smaller than 1200 pixels width.
</b:panel>
</b:column>
<b:column col-lg="8">
<b:panel look="primary" title="b:column col-lg='8'">
Eight columns on large desktop screens. Stacked on screens smaller than 1200 pixels width.
</b:panel>
</b:column>
</b:row>
</ui:fragment>
30 changes: 30 additions & 0 deletions MultiLevelDropDown/src/main/webapp/medium.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<ui:fragment xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:b="http://bootsfaces.net/ui" xmlns:f="http://java.sun.com/jsf/core">

<b:row>
<b:column span="8">
<b:panel look="primary" title="b:column span='8'">
Eight columns on medium screens (e.g. small desktop and notebook screens).<br /> Stacked on screens smaller than 992 pixels width.
<br />
<br />
</b:panel>
</b:column>
<b:column span="4">
<b:panel look="primary" title="b:column span='4'">
Four columns on medium screens (e.g. small desktop and notebook screens). Stacked on screens smaller than 992 pixels width.
</b:panel>
</b:column>
</b:row>
<b:row>
<b:column span="4">
<b:panel look="primary" title="b:column span='4'">
Four columns on medium screens (e.g. small desktop and notebook screens). Stacked on screens smaller than 992 pixels width.
</b:panel>
</b:column>
<b:column span="8">
<b:panel look="primary" title="b:column span='8'">
Eight columns on medium screens (e.g. small desktop and notebook screens). Stacked on screens smaller than 992 pixels width.
</b:panel>
</b:column>
</b:row>
</ui:fragment>
33 changes: 33 additions & 0 deletions MultiLevelDropDown/src/main/webapp/small.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<ui:fragment xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:b="http://bootsfaces.net/ui"
xmlns:f="http://java.sun.com/jsf/core">

<b:row>
<b:column col-sm="8">
<b:panel look="primary" title="b:column col-sm='8'">
Eight columns on small screens (e.g. tablets).<br /> Stacked on screens smaller than 768 pixels width.
<br />
<br />
</b:panel>
</b:column>
<b:column col-sm="4">
<b:panel look="primary" title="b:column col-sm='4'">
Four columns on small screens (e.g. tablets). Stacked on screens smaller than 768 pixels width.
</b:panel>
</b:column>
</b:row>
<b:row>
<b:column col-sm="4">
<b:panel look="primary" title="b:column col-sm='4'">
Four columns on small screens (e.g. tablets). Stacked on screens smaller than 768 pixels width.
</b:panel>
</b:column>
<b:column col-sm="8">
<b:panel look="primary" title="b:column col-sm='8'">
Eight columns on small screens (e.g. tablets). Stacked on screens smaller than 768 pixels width.
</b:panel>
</b:column>
</b:row>
</ui:fragment>

0 comments on commit c956013

Please sign in to comment.