Skip to content

Instantly share code, notes, and snippets.

@kevindoran
kevindoran / exampleSolrDoc.xml
Created February 5, 2013 01:34
Example Solr document
<doc>
<field name="auction_id">54432834</field>
<field name="title">Dell M2012 24" IPS Monitor</field>
<field name="category">monitors</field>
<field name="current_bid">279.95</field>
<field name="end_date">2013-01-06T09:26:04.18Z</field>
<field name="feature">IPS</field>
<field name="feature">Swivel</field>
</doc>
@kevindoran
kevindoran / solr.xml
Created February 5, 2013 01:27
solr core config
<!-- persistent="true" allows the web interface to make lasting changes to Solr. -->
<solr persistent="true" sharedlib="lib">
<cores adminpath="/admin/cores" host="${host:}" hostcontext="${hostContext:}" hostport="${jetty.port:}" zkclienttimeout="${zkClientTimeout:15000}">
<core default="true" instancedir="auctions" name="auctions">
</core></cores>
</solr>
@kevindoran
kevindoran / Category.java
Created February 1, 2013 04:06
Category class for dynamic menu
public class Category {
private String name;
public Category() {
name = "" + Math.random();
}
public List<Category> getChildCategories() {
List<Category> childCategories = new ArrayList<>();
for(int i=0; i<20; i++) {
@kevindoran
kevindoran / RandomMenu2.java
Created February 1, 2013 02:57
Random menu back bean- primefaces version.
@ManagedBean
@ViewScoped
public class RandomMenu2 {
private MenuModel<Category> menuModel;
private Category currentCategory = new Category();
public RandomMenu2() {
menuModel = new MenuModel<>();
menuModel.setContents(currentCategory.getChildCategories());
@kevindoran
kevindoran / primefacesMenu.xhtml
Created February 1, 2013 02:42
Primefaces dynamic menu test
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Primefaces Dynamic Menu Test</title>
</h:head>
<h:body>
<h3>Primefaces Dynamic Menu Test</h3>
<h:form>
<p:menu model="#{randomMenu2.menuModel}" />
@kevindoran
kevindoran / MenuTable.java
Created February 1, 2013 01:06
MenuTable back bean
public class MenuTable<T> {
public List<Row<T>> rows;
private List<Subscriber<T>> subscribers = new ArrayList<>();
private int noOfColumns;
public MenuTable(int noOfColumns) {
this.noOfColumns = noOfColumns;
}
public void setContents(Collection<T> objects) {
@kevindoran
kevindoran / MenuTable.xhtml
Created February 1, 2013 01:03
Menu Table JSF Composite Component
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:cc="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<cc:interface>
<cc:attribute name="model" type="nz.co.kevindoran.jsfmenutable.MenuTable"/>
<cc:attribute name="updateID" />
</cc:interface>
@kevindoran
kevindoran / randomMenu.java
Last active December 12, 2015 01:08
Random menu back bean for JSF menu table
import nz.co.kevindoran.jsfmenutable.MenuTable;
import nz.co.kevindoran.jsfmenutable.Subscriber;
@ManagedBean
@ViewScoped
public class RandomMenu {
private MenuTable<Category> menuTable;
private static final int columnCount = 4;
private Category currentCategory = new Category();
@kevindoran
kevindoran / menuTable.xhtml
Last active December 12, 2015 01:08
XHTML file for JSF Menu Table
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:mt="http://nz.co.kevindoran/jsf-menu">
<h:head>
<title>Menu Table Test</title>
</h:head>
<h:body>
<h:form>
<h2>JSF Menu Table Test</h2>
Current category: #{randomMenu.currentCategory}
<dependencies>
<dependency>
<groupId>nz.co.kevindoran</groupId>
<artifactId>google-charts-jsf</artifactId>
<version>1.0-SNAPSHOT</version>
<type>jar</type>
</dependency>
</dependencies>