[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/dirMenu ...
Christian Bauer
christian at hibernate.org
Fri Aug 17 09:00:24 EDT 2007
User: cbauer
Date: 07/08/17 09:00:24
Added: examples/wiki/src/main/org/jboss/seam/wiki/plugin/dirMenu
DirMenu.java DirMenuPreferences.java
Log:
Major refactoring of core data schema and some new features
Revision Changes Path
1.1 date: 2007/08/17 13:00:24; author: cbauer; state: Exp;jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/dirMenu/DirMenu.java
Index: DirMenu.java
===================================================================
/*
* JBoss, Home of Professional Open Source
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.seam.wiki.plugin.dirMenu;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Observer;
import org.jboss.seam.wiki.core.model.Directory;
import org.jboss.seam.wiki.core.model.Node;
import org.jboss.seam.wiki.core.dao.NodeDAO;
import org.jboss.seam.wiki.core.nestedset.NestedSetNodeWrapper;
import org.jboss.seam.ScopeType;
import java.io.Serializable;
/**
* Menu tree, base is the current directory.
*
* @author Christian Bauer
*/
@Name("dirMenu")
@Scope(ScopeType.PAGE)
public class DirMenu implements Serializable {
@In
Directory currentDirectory;
@In
NodeDAO nodeDAO;
@In
DirMenuPreferences dirMenuPreferences;
NestedSetNodeWrapper<Node> root;
public NestedSetNodeWrapper<Node> getRoot() {
if (root == null) {
refreshRoot();
}
return root;
}
@Observer("Preferences.dirMenuPreferences")
public void refreshRoot() {
root = nodeDAO.findMenuItems(currentDirectory, dirMenuPreferences.getMenuDepth(), dirMenuPreferences.getMenuLevels(), false);
}
}
1.1 date: 2007/08/17 13:00:24; author: cbauer; state: Exp;jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/dirMenu/DirMenuPreferences.java
Index: DirMenuPreferences.java
===================================================================
/*
* JBoss, Home of Professional Open Source
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.seam.wiki.plugin.dirMenu;
import org.hibernate.validator.NotNull;
import org.hibernate.validator.Range;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Observer;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.wiki.preferences.Preference;
import org.jboss.seam.wiki.preferences.PreferenceSupport;
import org.jboss.seam.wiki.preferences.PreferenceVisibility;
import java.io.Serializable;
@Name("dirMenuPreferences")
@AutoCreate
@Scope(ScopeType.CONVERSATION)
@Preference(description = "Plugin: Directory Menu", visibility = PreferenceVisibility.INSTANCE)
public class DirMenuPreferences extends PreferenceSupport implements Serializable {
public String getCurrentUserVariable() { return "currentUser"; }
public String getCurrentInstanceVariable() { return "currentDocument"; }
@Observer("PreferenceEditor.refresh.dirMenuPreferences")
public void refreshProperties() { super.refreshProperties(); }
@Preference(description = "01. Flatten display of menu tree to levels", visibility = PreferenceVisibility.INSTANCE)
@Range(min = 1l, max = 100l)
@NotNull
private Long menuLevels;
@Preference(description = "02. Maximum depth of menu tree nodes", visibility = PreferenceVisibility.INSTANCE)
@Range(min = 1l, max = 100l)
@NotNull
private Long menuDepth;
public Long getMenuLevels() {
return menuLevels;
}
public Long getMenuDepth() {
return menuDepth;
}
}
More information about the jboss-cvs-commits
mailing list