JBoss Rich Faces SVN: r1927 - in trunk: framework/api/src/main/java/org/richfaces/model and 6 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-07-30 10:03:21 -0400 (Mon, 30 Jul 2007)
New Revision: 1927
Added:
trunk/framework/api/src/main/java/org/richfaces/model/LastAwareArrayDataModel.java
trunk/framework/api/src/main/java/org/richfaces/model/LastAwareDataModel.java
trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModelProvider.java
trunk/framework/api/src/main/java/org/richfaces/model/TreeComponentModel.java
trunk/framework/api/src/main/java/org/richfaces/model/TreeComponentModelListener.java
Modified:
trunk/extensions/portlet/
trunk/framework/api/src/main/java/org/richfaces/model/ListRowKey.java
trunk/samples/ajaxPortlet/
trunk/ui/tree/src/main/config/component/treeNode.xml
trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
trunk/ui/tree/src/main/java/org/richfaces/component/UITreeNode.java
trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeDataModelEventNavigator.java
trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js
trunk/ui/tree/src/main/templates/htmlTree.jspx
Log:
- TreeModel API
- Tree component fixes & updates
Property changes on: trunk/extensions/portlet
___________________________________________________________________
Name: svn:ignore
- target
+ target
.classpath
.project
.settings
Added: trunk/framework/api/src/main/java/org/richfaces/model/LastAwareArrayDataModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/LastAwareArrayDataModel.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/model/LastAwareArrayDataModel.java 2007-07-30 14:03:21 UTC (rev 1927)
@@ -0,0 +1,118 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import java.io.IOException;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.model.Range;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 26.07.2007
+ *
+ */
+public class LastAwareArrayDataModel extends ExtendedDataModel implements LastAwareDataModel {
+
+ private Object[] wrappedData;
+ private Integer rowKey;
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.model.ExtendedDataModel#getRowKey()
+ */
+ public Object getRowKey() {
+ return rowKey;
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.model.ExtendedDataModel#setRowKey(java.lang.Object)
+ */
+ public void setRowKey(Object key) {
+ this.rowKey = (Integer) key;
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.model.ExtendedDataModel#walk(javax.faces.context.FacesContext, org.ajax4jsf.model.DataVisitor, org.ajax4jsf.model.Range, java.lang.Object)
+ */
+ public void walk(FacesContext context, DataVisitor visitor, Range range,
+ Object argument) throws IOException {
+ if (wrappedData != null) {
+ for (int i = 0; i < wrappedData.length; i++) {
+ Integer key = new Integer(i);
+
+ visitor.process(context, key, argument);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#getRowCount()
+ */
+ public int getRowCount() {
+ return wrappedData != null ? wrappedData.length : 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#getRowData()
+ */
+ public Object getRowData() {
+ if (wrappedData == null) {
+ return null;
+ }
+
+ return wrappedData[rowKey.intValue()];
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#getRowIndex()
+ */
+ public int getRowIndex() {
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#getWrappedData()
+ */
+ public Object getWrappedData() {
+ return wrappedData;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#isRowAvailable()
+ */
+ public boolean isRowAvailable() {
+ return wrappedData != null && wrappedData.length < rowKey.intValue();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#setRowIndex(int)
+ */
+ public void setRowIndex(int rowIndex) {
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#setWrappedData(java.lang.Object)
+ */
+ public void setWrappedData(Object data) {
+ this.wrappedData = (Object[]) data;
+ }
+
+ public boolean isLast() {
+ return wrappedData != null && wrappedData.length == rowKey.intValue() + 1;
+ }
+
+ public LastAwareArrayDataModel(Object[] wrappedData) {
+ super();
+ setWrappedData(wrappedData);
+ }
+
+ public boolean isEmpty() {
+ return wrappedData == null || wrappedData.length == 0;
+ }
+}
Added: trunk/framework/api/src/main/java/org/richfaces/model/LastAwareDataModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/LastAwareDataModel.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/model/LastAwareDataModel.java 2007-07-30 14:03:21 UTC (rev 1927)
@@ -0,0 +1,16 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 26.07.2007
+ *
+ */
+public interface LastAwareDataModel {
+ public boolean isLast();
+
+ public boolean isEmpty();
+}
Modified: trunk/framework/api/src/main/java/org/richfaces/model/ListRowKey.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/ListRowKey.java 2007-07-30 14:02:57 UTC (rev 1926)
+++ trunk/framework/api/src/main/java/org/richfaces/model/ListRowKey.java 2007-07-30 14:03:21 UTC (rev 1927)
@@ -57,7 +57,11 @@
*/
protected ListRowKey(ListRowKey parentRowKey) {
super();
- this.path = (ArrayList) parentRowKey.path.clone();
+ if (parentRowKey != null) {
+ this.path = (ArrayList) parentRowKey.path.clone();
+ } else {
+ this.path = new ArrayList();
+ }
}
/**
@@ -175,6 +179,10 @@
return path.listIterator(fromIndex);
}
+ public ListRowKey getSubKey(int fromIndex) {
+ return new ListRowKey(path.subList(fromIndex, path.size()));
+ }
+
public boolean isSubKey(TreeRowKey rowKey) {
if (rowKey instanceof ListRowKey) {
ListRowKey listRowKey = (ListRowKey) rowKey;
@@ -233,4 +241,8 @@
length++;
return length;
}
+
+ public Object get(int i) {
+ return path.get(i);
+ }
}
Added: trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java 2007-07-30 14:03:21 UTC (rev 1927)
@@ -0,0 +1,387 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.model.Range;
+
+/**
+ * @author Nick Belaevski mailto:nbelaevski@exadel.com created 25.07.2007
+ *
+ */
+public class StackingTreeModel extends AbstractTreeDataModel implements TreeComponentModel {
+
+ private String id;
+
+ private String modelId;
+ private Object modelKey;
+
+ protected StackingTreeModel stackingTreeModel;
+
+ // private ExtendedDataModel dataModel;
+ protected StackingTreeModel parent;
+ private Map models = new LinkedHashMap();
+
+ private List treeComponentModelListeners = new ArrayList();
+
+ public ExtendedDataModel getDataModel() {
+ return null;
+ }
+
+ public StackingTreeModel(String id) {
+ super();
+ this.id = id;
+ }
+
+ public void leaveModel() {
+ if (stackingTreeModel != null && stackingTreeModel != this) {
+ stackingTreeModel.leaveModel();
+ }
+ stackingTreeModel = null;
+ modelId = null;
+ modelKey = null;
+ }
+
+ public void setupModel(Object object) {
+
+ }
+
+ public void setParent(StackingTreeModel parent) {
+ this.parent = parent;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.model.AbstractTreeDataModel#getTreeNode()
+ */
+ public TreeNode getTreeNode() {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.model.AbstractTreeDataModel#isLeaf()
+ */
+ public boolean isLeaf() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ protected void doWalk(FacesContext context, DataVisitor dataVisitor,
+ Range range, Object rowKey, Object argument,
+ boolean last) throws IOException {
+ final ListRowKey argumentKey = (ListRowKey) rowKey;
+
+ if (argument != null) {
+ Argument2 a = (Argument2) argument;
+
+ Object localRowKey = a.localKey;
+ ExtendedDataModel dataModel = a.dataModel;
+ if (dataModel == null) {
+ dataModel = getDataModel();
+ }
+ dataModel.setRowKey(localRowKey);
+ setupModel(dataModel.getRowData());
+ System.out.println(dataModel.getRowData() + (last ? " * " : "") + " - " + argumentKey);
+
+ processElement(context, dataVisitor, argument, argumentKey, last);
+ }
+
+ ShiftingDataVisitor shiftingDataVisitor = new ShiftingDataVisitor(
+ new Visitor1(dataVisitor));
+ Iterator iterator = StackingTreeModel.this.getModels().entrySet().iterator();
+ while (iterator.hasNext()) {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ StackingTreeModel model = (StackingTreeModel) entry.getValue();
+ doSpecialWalk(context, shiftingDataVisitor, range, argumentKey, last, model);
+ }
+
+ shiftingDataVisitor.end(context);
+ }
+
+ public Map getModels() {
+ return models;
+ }
+
+ public void walk(FacesContext context, DataVisitor dataVisitor,
+ Range range, Object rowKey, Object argument,
+ boolean last) throws IOException {
+
+ if (rowKey != null) {
+ ListRowKey listRowKey = (ListRowKey) rowKey;
+ if (listRowKey != null) {
+ int depth = listRowKey.depth();
+ StackingTreeModel stackingTreeModel = this;
+ for (int i = 0; i < depth; i++) {
+ Key key = (Key) listRowKey.get(i);
+ if (key.modelId != null) {
+ stackingTreeModel = (StackingTreeModel) stackingTreeModel.getModels().get(key.modelId);
+
+ this.stackingTreeModel = stackingTreeModel;
+ this.modelId = key.modelId;
+
+ if (i == depth - 1) {
+ Argument2 argument2 = new Argument2();
+ argument2.localKey = key.modelKey;
+ //argument2.dataModel = stackingTreeModel;
+ stackingTreeModel.doWalk(context, dataVisitor, range, listRowKey, argument2,
+ last);
+ } else {
+ stackingTreeModel.setLocalRowKey(key.modelKey);
+ }
+ }
+ }
+ }
+ } else {
+ doWalk(context, dataVisitor, range, rowKey, argument, last);
+ }
+ }
+
+ private void doSpecialWalk(FacesContext context,
+ ShiftingDataVisitor dataVisitor, Range range,
+ ListRowKey rowKey, boolean last, StackingTreeModel stackingTreeModel) throws IOException {
+
+ Argument argument2 = new Argument();
+ argument2.listRowKey = rowKey;
+ // setup current model
+ argument2.model = stackingTreeModel;
+ argument2.dataModel = stackingTreeModel.getDataModel();
+ argument2.range = range;
+ argument2.dataModel.walk(context, dataVisitor, range,
+ argument2);
+ }
+
+ private class Argument {
+ private ExtendedDataModel dataModel;
+ private ListRowKey listRowKey;
+ private StackingTreeModel model;
+ private Range range;
+ }
+
+ private class Argument2 {
+ private Object localKey;
+ private ExtendedDataModel dataModel;
+ }
+
+ private class Visitor1 implements DataVisitor, LastElementAware {
+ private DataVisitor dataVisitor;
+ private boolean theLast;
+
+ public Visitor1(DataVisitor dataVisitor) {
+ super();
+ this.dataVisitor = dataVisitor;
+ }
+
+ public void process(FacesContext context, Object rowKey, Object argument)
+ throws IOException {
+
+ Argument a = (Argument) argument;
+ ListRowKey listRowKey = new ListRowKey(a.listRowKey, new Key(
+ a.model.id, rowKey));
+ //System.out.println(".walk() " + (theLast ? " * " : "") + listRowKey);
+ Argument2 argument2 = new Argument2();
+ argument2.localKey = rowKey;
+ argument2.dataModel = a.dataModel;
+ a.model.doWalk(context, dataVisitor, a.range, listRowKey, argument2,
+ theLast);
+ }
+
+ public void resetLastElement() {
+ theLast = false;
+ }
+
+ public void setLastElement() {
+ theLast = true;
+ }
+
+ }
+
+ private static class ShiftingDataVisitor implements DataVisitor {
+
+ private DataVisitor dataVisitor;
+
+ public DataVisitor getDataVisitor() {
+ return dataVisitor;
+ }
+
+ public ShiftingDataVisitor(DataVisitor dataVisitor) {
+ super();
+ this.dataVisitor = dataVisitor;
+ }
+
+ private Object rowKey;
+ private Object argument;
+ private boolean shifted = false;
+
+ public void process(FacesContext context, Object rowKey, Object argument)
+ throws IOException {
+
+ if (!shifted) {
+ this.rowKey = rowKey;
+ this.argument = argument;
+ this.shifted = true;
+ } else {
+ dataVisitor.process(context, this.rowKey, this.argument);
+ this.rowKey = rowKey;
+ this.argument = argument;
+ }
+ }
+
+ public void end(FacesContext context) throws IOException {
+ if (shifted) {
+ if (dataVisitor instanceof LastElementAware) {
+ try {
+ ((LastElementAware) dataVisitor).setLastElement();
+ dataVisitor.process(context, this.rowKey, argument);
+ } finally {
+ ((LastElementAware) dataVisitor).resetLastElement();
+ }
+ } else {
+ dataVisitor.process(context, this.rowKey, argument);
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.model.AbstractTreeDataModel#walkModel(javax.faces.context.FacesContext,
+ * org.ajax4jsf.model.DataVisitor, org.ajax4jsf.model.Range,
+ * java.lang.Object, java.lang.Object, boolean)
+ */
+ public void walkModel(FacesContext facesContext, DataVisitor visitor,
+ Range range, Object key, Object argument, boolean last)
+ throws IOException {
+
+ walk(facesContext, visitor, range, key, argument, last);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.model.ExtendedDataModel#getRowKey()
+ */
+ public Object getRowKey() {
+ if (parent == null) {
+ ListRowKey listRowKey = new ListRowKey();
+ return listRowKey;
+ } else {
+ return new ListRowKey((ListRowKey) parent.getRowKey(), new Key(this.modelId, modelKey));
+ }
+ }
+
+ protected void setLocalRowKey(Object rowKey) {
+ ExtendedDataModel dataModel = getDataModel();
+ this.modelKey = rowKey;
+ dataModel.setRowKey(rowKey);
+ setupModel(dataModel.getRowData());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.model.ExtendedDataModel#setRowKey(java.lang.Object)
+ */
+ protected void doSetRowKey(Object key) {
+ ListRowKey listRowKey = (ListRowKey) key;
+ if (listRowKey != null) {
+ Key rowKey = (Key) listRowKey.get(0);
+ if (rowKey.modelId != null) {
+ StackingTreeModel stackingTreeModel = (StackingTreeModel) this.getModels().get(rowKey.modelId);
+
+ this.stackingTreeModel = stackingTreeModel;
+ this.modelId = rowKey.modelId;
+
+ if (listRowKey.depth() == 1) {
+ stackingTreeModel.setLocalRowKey(rowKey.modelKey);
+ } else {
+ stackingTreeModel.setLocalRowKey(rowKey.modelKey);
+ stackingTreeModel.doSetRowKey(listRowKey.getSubKey(1));
+ }
+ }
+ }
+ }
+
+ public void setRowKey(Object key) {
+ leaveModel();
+
+ doSetRowKey(key);
+ }
+
+ public void addStackingModel(StackingTreeModel model) {
+ this.models.put(model.id, model);
+ model.setParent(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#getRowData()
+ */
+ public Object getRowData() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.faces.model.DataModel#isRowAvailable()
+ */
+ public boolean isRowAvailable() {
+ // TODO Auto-generated method stub
+ return true;
+ }
+
+ protected static class Key {
+ protected Object modelKey;
+ protected String modelId;
+
+ public Key(String modelId, Object modelKey) {
+ super();
+ this.modelId = modelId;
+ this.modelKey = modelKey;
+ }
+
+ public String toString() {
+ return this.modelId + ":" + this.modelKey;
+ }
+ }
+
+ public void addTreeComponentModelListener(
+ TreeComponentModelListener listener) {
+ this.treeComponentModelListeners.add(listener);
+ }
+
+ public void removeTreeComponentModelListener(
+ TreeComponentModelListener listener) {
+ this.treeComponentModelListeners.remove(listener);
+ }
+
+ protected void componentSelected(UIComponent component) {
+ for (Iterator iterator = this.treeComponentModelListeners.iterator(); iterator.hasNext();) {
+ TreeComponentModelListener listener = (TreeComponentModelListener) iterator.next();
+
+ listener.componentSelected(component);
+ }
+
+ if (parent != null) {
+ parent.componentSelected(component);
+ }
+ }
+}
Added: trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModelProvider.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModelProvider.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModelProvider.java 2007-07-30 14:03:21 UTC (rev 1927)
@@ -0,0 +1,51 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+
+
+/**
+ * @author Nick Belaevski mailto:nbelaevski@exadel.com created 25.07.2007
+ *
+ */
+public abstract class StackingTreeModelProvider extends UIComponentBase {
+
+ public abstract Object getNodes();
+ public abstract void setNodes(Object nodes);
+
+ public Object[] getData() {
+ Object[] data;
+ List nodes = (List) getNodes();
+ if (nodes != null) {
+ data = nodes.toArray();
+ } else {
+ data = new Object[0];
+ }
+ return data;
+ }
+
+ protected abstract StackingTreeModel createStackingTreeModel();
+
+ public StackingTreeModel getStackingModel() {
+ StackingTreeModel stackingTreeModel = createStackingTreeModel();
+ if (getChildCount() > 0) {
+ Iterator children = getChildren().iterator();
+ while (children.hasNext()) {
+ UIComponent component = (UIComponent) children.next();
+ if (component instanceof StackingTreeModelProvider) {
+ StackingTreeModelProvider provider = (StackingTreeModelProvider) component;
+
+ stackingTreeModel.addStackingModel(provider.getStackingModel());
+ }
+ }
+ }
+
+ return stackingTreeModel;
+ }
+}
Added: trunk/framework/api/src/main/java/org/richfaces/model/TreeComponentModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/TreeComponentModel.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/model/TreeComponentModel.java 2007-07-30 14:03:21 UTC (rev 1927)
@@ -0,0 +1,15 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 24.07.2007
+ *
+ */
+public interface TreeComponentModel {
+ public void addTreeComponentModelListener(TreeComponentModelListener listener);
+ public void removeTreeComponentModelListener(TreeComponentModelListener listener);
+}
Added: trunk/framework/api/src/main/java/org/richfaces/model/TreeComponentModelListener.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/TreeComponentModelListener.java (rev 0)
+++ trunk/framework/api/src/main/java/org/richfaces/model/TreeComponentModelListener.java 2007-07-30 14:03:21 UTC (rev 1927)
@@ -0,0 +1,16 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import javax.faces.component.UIComponent;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 29.07.2007
+ *
+ */
+public interface TreeComponentModelListener {
+ public void componentSelected(UIComponent component);
+}
Property changes on: trunk/samples/ajaxPortlet
___________________________________________________________________
Name: svn:ignore
- target
+ target
.classpath
.project
.settings
Modified: trunk/ui/tree/src/main/config/component/treeNode.xml
===================================================================
--- trunk/ui/tree/src/main/config/component/treeNode.xml 2007-07-30 14:02:57 UTC (rev 1926)
+++ trunk/ui/tree/src/main/config/component/treeNode.xml 2007-07-30 14:03:21 UTC (rev 1927)
@@ -44,7 +44,7 @@
&attributes;
&ui_component_attributes;
- <property required="true">
+ <property>
<name>type</name>
<classname>java.lang.String</classname>
<description>A node type</description>
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2007-07-30 14:02:57 UTC (rev 1926)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/UITree.java 2007-07-30 14:03:21 UTC (rev 1927)
@@ -23,10 +23,12 @@
import java.io.IOException;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.Map;
import javax.faces.application.Application;
import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
import javax.faces.component.UIOutput;
import javax.faces.context.FacesContext;
import javax.faces.el.MethodBinding;
@@ -60,6 +62,9 @@
import org.richfaces.event.NodeSelectedListener;
import org.richfaces.event.TreeListenerEventsProducer;
import org.richfaces.model.AbstractTreeDataModel;
+import org.richfaces.model.StackingTreeModel;
+import org.richfaces.model.StackingTreeModelProvider;
+import org.richfaces.model.TreeComponentModelListener;
import org.richfaces.model.TreeDataModel;
import org.richfaces.model.TreeNode;
import org.richfaces.model.TreeRange;
@@ -136,10 +141,10 @@
return defaultFacet;
}
- /**
- * Return the data object representing the node for the currently
- * selected row key, if any
- *
+ /**
+ * Return the data object representing the node for the currently
+ * selected row key, if any
+ *
* @return {@link TreeNode} instance corresponding to the current row key
*/
public TreeNode getTreeNode() {
@@ -158,7 +163,6 @@
return facesEvent;
}
-
public void queueEvent(FacesEvent event) {
FacesEvent resultEvent = event;
if (event instanceof NodeExpandedEvent) {
@@ -213,13 +217,50 @@
public UITreeNode getNodeFacet() {
String facetName = this.getNodeFace();
if (facetName != null) {
- Iterator iterator = getChildren().iterator();
- while (iterator.hasNext()) {
- Object object = iterator.next();
- if (object instanceof UITreeNode) {
- UITreeNode treeNode = (UITreeNode) object;
+ if (getChildCount() > 0) {
+ Iterator iterator = getChildren().iterator();
+ while (iterator.hasNext()) {
+ Object object = iterator.next();
+ if (object instanceof UITreeNode) {
+ UITreeNode treeNode = (UITreeNode) object;
- if (facetName.equals(treeNode.getType())) {
+ if (!treeNode.isRendered()) {
+ continue;
+ }
+
+ if (facetName.equals(treeNode.getType())) {
+ return treeNode;
+ }
+ }
+ }
+ }
+ } else {
+ Iterator iterator = null;
+ if (visualModelComponent != null && visualModelComponent.isRendered()) {
+ if (visualModelComponent.getChildCount() > 0) {
+ iterator = visualModelComponent.getChildren().iterator();
+ }
+ } else {
+ if (getChildCount() > 0) {
+ iterator = getChildren().iterator();
+ }
+ }
+
+ if (iterator != null) {
+ while (iterator.hasNext()) {
+ UIComponent child = (UIComponent) iterator.next();
+
+ if (child instanceof UITreeNode) {
+ UITreeNode treeNode = (UITreeNode) child;
+
+ if (!treeNode.isRendered()) {
+ continue;
+ }
+
+ if (treeNode.getType() != null) {
+ continue;
+ }
+
return treeNode;
}
}
@@ -243,7 +284,7 @@
state.transferQueuedNodes();
// re-set stopInCollapsed to handle AJAX switch type change
state.setStopInCollapsed(isStopInCollapsed());
-
+
setExtendedDataModel(createDataModel(false));
}
@@ -442,7 +483,7 @@
// fire node events
TreeEvents.invokeListenerBindings(this, event, getFacesContext());
-
+
if (event instanceof AjaxEvent) {
AjaxRendererUtils.addRegionsFromComponent(this, getFacesContext());
}
@@ -452,24 +493,51 @@
return isAjaxSubmitSelection();
}
+ private transient UIComponent visualModelComponent;
+
private ExtendedDataModel createDataModel(boolean allowCached) {
- TreeDataModel treeDataModel = new TreeDataModel();
- treeDataModel.setWrappedData(this.getValue());
+ Object value = this.getValue();
+ if (value != null) {
+ TreeDataModel treeDataModel = new TreeDataModel();
+ treeDataModel.setWrappedData(this.getValue());
+
+ if (allowCached && PRESERVE_MODEL_REQUEST.equals(getPreserveModel())) {
+ treeDataModel = new CacheableTreeDataModel(treeDataModel);
+ }
- if (allowCached && PRESERVE_MODEL_REQUEST.equals(getPreserveModel())) {
- treeDataModel = new CacheableTreeDataModel(treeDataModel);
+ return treeDataModel;
+ } else {
+ //TODO implement request caching
+ StackingTreeModel stackingTreeModel = new StackingTreeModel(null);
+ if (getChildCount() > 0) {
+ Iterator children = getChildren().iterator();
+ while (children.hasNext()) {
+ UIComponent component = (UIComponent) children.next();
+ if (component instanceof StackingTreeModelProvider) {
+ StackingTreeModelProvider provider = (StackingTreeModelProvider) component;
+ stackingTreeModel.addStackingModel(provider.getStackingModel());
+ }
+ }
+ }
+
+ stackingTreeModel.addTreeComponentModelListener(new TreeComponentModelListener() {
+
+ public void componentSelected(UIComponent component) {
+ visualModelComponent = component;
+ }
+ });
+
+ return stackingTreeModel;
}
-
- return treeDataModel;
}
-
+
public void processUpdates(FacesContext faces) {
super.processUpdates(faces);
if (getExtendedDataModel() instanceof CacheableTreeDataModel) {
setExtendedDataModel(createDataModel(false));
}
}
-
+
protected ExtendedDataModel createDataModel() {
return createDataModel(true);
}
@@ -557,23 +625,23 @@
public abstract String getSelectedClass();
public abstract void setNodeFace(String nodeFace);
-
+
public abstract String getNodeFace();
public abstract void setToggleOnClick(boolean toggleOnClick);
public abstract boolean isToggleOnClick();
-
+
public abstract void setStateAdvisor(Object nodeFace);
-
+
public abstract Object getStateAdvisor();
-
+
public abstract MethodBinding getAdviseNodeOpened();
-
+
public abstract void setAdviseNodeOpened(MethodBinding adviseNodeOpened);
-
+
public abstract MethodBinding getAdviseNodeSelected();
-
+
public abstract void setAdviseNodeSelected(MethodBinding adviseNodeSelected);
public void addChangeExpandListener(NodeExpandedListener listener) {
@@ -631,7 +699,7 @@
public void removeDragListener(DragListener listener) {
removeFacesListener(listener);
}
-
+
public void setDragValue(Object value) {
// TODO Auto-generated method stub
@@ -642,16 +710,16 @@
}
- /**
- * Return the data object representing the node data for the contextual row key
- *
+ /**
+ * Return the data object representing the node data for the contextual row key
+ *
* @param rowKey contextual row key
* @return data corresponding to the current row key
*/
public Object getRowData(Object rowKey) {
Object storedKey = getRowKey();
FacesContext context = FacesContext.getCurrentInstance();
-
+
try {
setRowKey(context, rowKey);
@@ -665,9 +733,9 @@
}
}
- /**
- * Return the data object representing the node for the contextual row key
- *
+ /**
+ * Return the data object representing the node for the contextual row key
+ *
* @param rowKey contextual row key
* @return {@link TreeNode} instance corresponding to the current row key
*/
@@ -686,7 +754,7 @@
}
}
}
-
+
private UIOutput createDefaultNodeFaceOutput(FacesContext facesContext) {
UIOutput component = new UIOutput() {
@@ -713,7 +781,7 @@
public void setTransient(boolean transientFlag) {
if (!transientFlag) {
throw new IllegalArgumentException(
- "Default representation for node face cannot be set non-persistent!");
+ "Default representation for node face cannot be set non-persistent!");
}
}
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/UITreeNode.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/UITreeNode.java 2007-07-30 14:02:57 UTC (rev 1926)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/UITreeNode.java 2007-07-30 14:03:21 UTC (rev 1927)
@@ -146,23 +146,20 @@
/**
* Finds direct parent {@link UITree} component or throws
- * {@link ClassCastException} if parent is not {@link UITree}
*
* @return {@link UITree} instance
- * @throws ClassCastException
*/
- public UITree getUITree() throws ClassCastException {
+ public UITree getUITree() {
UIComponent parent = getParent();
- if (parent == null) {
- return null;
+ while (parent != null) {
+ if (parent instanceof UITree) {
+ return (UITree) parent;
+ } else {
+ parent = parent.getParent();
+ }
}
- if (parent instanceof UITree) {
- return (UITree) parent;
-
- } else {
- throw new ClassCastException("Parent should be UITree.");
- }
+ return null;
}
public void addDropListener(DropListener listener) {
Modified: trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeDataModelEventNavigator.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeDataModelEventNavigator.java 2007-07-30 14:02:57 UTC (rev 1926)
+++ trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeDataModelEventNavigator.java 2007-07-30 14:03:21 UTC (rev 1927)
@@ -62,6 +62,8 @@
int level = this.rowKey != null ? this.rowKey.depth() : 0;
int delta = level - newRowKey.depth();
+
+ //System.out.println("TreeDataModelEventNavigator.followRowKey() " + delta);
if (delta > 0) {
beforeUp(delta);
Modified: trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js
===================================================================
--- trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js 2007-07-30 14:02:57 UTC (rev 1926)
+++ trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js 2007-07-30 14:03:21 UTC (rev 1927)
@@ -111,7 +111,8 @@
getElements: function() {
var contentId = this.id;
- this.elements.contentTd = $(contentId);
+ this.elements.contentTd = $(contentId +
+ Tree.ID_DEVIDER + Tree.ID_CHILDS_ROW + Tree.ID_DEVIDER + Tree.ID_CHILDS_TD);
if (this.elements.contentTd) {
for(var child = this.elements.contentTd.firstChild; child != null; child = child.nextSibling ) {
Modified: trunk/ui/tree/src/main/templates/htmlTree.jspx
===================================================================
--- trunk/ui/tree/src/main/templates/htmlTree.jspx 2007-07-30 14:02:57 UTC (rev 1926)
+++ trunk/ui/tree/src/main/templates/htmlTree.jspx 2007-07-30 14:03:21 UTC (rev 1927)
@@ -44,8 +44,12 @@
<f:parameter value="id,style,class"/>
</f:call>
- <vcp:body />
-
+ <table width="100%" cellpadding="0" cellspacing="0" border="0">
+ <tbody>
+ <vcp:body />
+ </tbody>
+ </table>
+
<f:call name="encodeSelectionStateInput" />
<f:clientId var="clientId" />
<script type="text/javascript">
17 years, 4 months
JBoss Rich Faces SVN: r1926 - trunk/sandbox/samples/rich-message-demo/src/main/webapp/pages.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-07-30 10:02:57 -0400 (Mon, 30 Jul 2007)
New Revision: 1926
Modified:
trunk/sandbox/samples/rich-message-demo/src/main/webapp/pages/message-demo.xhtml
Log:
Modified: trunk/sandbox/samples/rich-message-demo/src/main/webapp/pages/message-demo.xhtml
===================================================================
--- trunk/sandbox/samples/rich-message-demo/src/main/webapp/pages/message-demo.xhtml 2007-07-30 13:59:04 UTC (rev 1925)
+++ trunk/sandbox/samples/rich-message-demo/src/main/webapp/pages/message-demo.xhtml 2007-07-30 14:02:57 UTC (rev 1926)
@@ -136,16 +136,10 @@
fatalClass="fatalClass"
warnClass="warnClass"
infoClass="infoClass"
- headerClass="headerClass"
+ labelClass="labelClass"
var="messages"
styleClass="class"
>
- <f:facet name="header">
- <h:outputText value="Common Header"></h:outputText>
- </f:facet>
- <f:facet name="passedHeader">
- <h:outputText value="Passed Header"></h:outputText>
- </f:facet>
<f:facet name="errorMarker">
<h:graphicImage url="/image/error.gif"/>
</f:facet>
17 years, 4 months
JBoss Rich Faces SVN: r1925 - in trunk/sandbox/ui/message/src/main: java/org/richfaces/component and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-07-30 09:59:04 -0400 (Mon, 30 Jul 2007)
New Revision: 1925
Modified:
trunk/sandbox/ui/message/src/main/config/component/message.xml
trunk/sandbox/ui/message/src/main/java/org/richfaces/component/UIRichMessages.java
Log:
Modified: trunk/sandbox/ui/message/src/main/config/component/message.xml
===================================================================
--- trunk/sandbox/ui/message/src/main/config/component/message.xml 2007-07-30 13:58:37 UTC (rev 1924)
+++ trunk/sandbox/ui/message/src/main/config/component/message.xml 2007-07-30 13:59:04 UTC (rev 1925)
@@ -19,9 +19,9 @@
</description>
<renderer generate="false" override="true">
- <name>org.richfaces.renderkit.html.RichMessageBaseRenderer</name>
- <classname>org.richfaces.renderkit.html.RichMessageHtmlBaseRenderer</classname>
- <superclass>org.richfaces.renderkit.html.RichMessageBaseRenderer</superclass>
+ <name>org.richfaces.RichMessageRenderer</name>
+ <classname>org.richfaces.renderkit.html.HtmlRichMessageRenderer</classname>
+ <superclass>org.richfaces.renderkit.RichMessageBaseRenderer</superclass>
</renderer>
<tag>
<name>message</name>
@@ -198,9 +198,9 @@
</description>
<renderer generate="false" override="true">
- <name>org.richfaces.renderkit.html.RichMessagesBaseRenderer</name>
- <classname>org.richfaces.renderkit.html.RichMessagesHtmlBaseRenderer</classname>
- <superclass>org.richfaces.renderkit.html.RichMessageBaseRenderer</superclass>
+ <name>org.richfaces.RichMessagesRenderer</name>
+ <classname>org.richfaces.renderkit.html.HtmlRichMessagesRenderer</classname>
+ <superclass>org.richfaces.renderkit.RichMessageBaseRenderer</superclass>
</renderer>
<tag>
@@ -236,12 +236,6 @@
<defaultvalue>"list"</defaultvalue>
</property>
- <property attachedstate="true">
- <name>headerLocation</name>
- <classname>java.lang.String</classname>
- <defaultvalue>"top"</defaultvalue>
- </property>
-
<property>
<name>globalOnly</name>
<classname>boolean</classname>
@@ -272,16 +266,6 @@
</property>
<property>
- <name>headerClass</name>
- <classname>java.lang.String</classname>
- </property>
-
- <property>
- <name>headerStyle</name>
- <classname>java.lang.String</classname>
- </property>
-
- <property>
<name>errorClass</name>
<classname>java.lang.String</classname>
</property>
Modified: trunk/sandbox/ui/message/src/main/java/org/richfaces/component/UIRichMessages.java
===================================================================
--- trunk/sandbox/ui/message/src/main/java/org/richfaces/component/UIRichMessages.java 2007-07-30 13:58:37 UTC (rev 1924)
+++ trunk/sandbox/ui/message/src/main/java/org/richfaces/component/UIRichMessages.java 2007-07-30 13:59:04 UTC (rev 1925)
@@ -22,12 +22,6 @@
public static String HEADER_LOCATION_RIGHT = "right";
- //TODO nick - anton - make wroteTable local renderer variable
- private boolean wroteTable = false;
-
- //TODO nick - anton - make isIteratorLayout local renderer variable. do we need it at all?
- private boolean isIteratorLayout = false;
-
private boolean isPassed = false;
@@ -39,22 +33,6 @@
public abstract String getHeaderLocation();
- public boolean isWroteTable(){
- return wroteTable;
- }
-
- public void setWroteTable(boolean wroteTable){
- this.wroteTable = wroteTable;
- }
-
- public boolean isIteratorLayout(){
- return isIteratorLayout;
- }
-
- public void setIteratorLayout(boolean isIteratorLayout){
- this.isIteratorLayout = isIteratorLayout;
- }
-
/* (non-Javadoc)
* @see org.ajax4jsf.component.AjaxOutput#isAjaxRendered()
*/
17 years, 4 months
JBoss Rich Faces SVN: r1924 - in trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit: html and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-07-30 09:58:37 -0400 (Mon, 30 Jul 2007)
New Revision: 1924
Added:
trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/RichMessageBaseRenderer.java
trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessageRenderer.java
trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessagesRenderer.java
Log:
new reviewed renders classes
Added: trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/RichMessageBaseRenderer.java
===================================================================
--- trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/RichMessageBaseRenderer.java (rev 0)
+++ trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/RichMessageBaseRenderer.java 2007-07-30 13:58:37 UTC (rev 1924)
@@ -0,0 +1,268 @@
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.application.FacesMessage.Severity;
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.richfaces.renderkit.html.HtmlRichMessageRenderer;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
+public abstract class RichMessageBaseRenderer extends HeaderResourcesRendererBase{
+
+ protected static final Log log = LogFactory.getLog(HtmlRichMessageRenderer.class);
+
+ public static final String NULL_PARAMETER_ERROR_MESSAGE = "null parameter ERROR";
+
+ public static final String COMPONENT_NOT_FOUND_IN_VIEW_WARN_MESSAGE = "component not found in the view WARNING";
+
+
+ protected Iterator getMessageIterator(FacesContext context, String forClientId, UIComponent component) throws IOException{
+
+ Iterator msgIter = null;
+
+ if(forClientId != null && forClientId.length() != 0){
+
+ UIComponent result = findForComponent(context, forClientId,component);
+ if (result == null) {
+ msgIter = CollectionUtils.EMPTY_COLLECTION.iterator();
+ } else {
+ msgIter = context.getMessages(result.getClientId(context));
+ }
+ }else{
+ msgIter = context.getMessages(null);
+ msgIter = context.getMessages();
+ }
+
+ return msgIter;
+ }
+
+ protected void renderMarkerFacet(UIComponent uiMsg, FacesContext context, ResponseWriter writer,FacesMessage facesMsg) throws IOException{
+
+ UIComponent marker = null;
+
+ String markerClass = null;
+
+ String markerStyle = null;
+
+ Severity severity = null;
+
+
+ if(facesMsg != null){
+
+ severity = facesMsg.getSeverity();
+
+ if(severity == FacesMessage.SEVERITY_ERROR){
+
+ markerClass = (String)uiMsg.getAttributes().get("errorMarkerClass");
+ markerStyle = (String)uiMsg.getAttributes().get("errorMarkerStyle");
+ marker = uiMsg.getFacet("errorMarker");
+
+ }else if (severity == FacesMessage.SEVERITY_FATAL) {
+
+ markerClass = (String)uiMsg.getAttributes().get("fatalMarkerClass");
+ markerStyle = (String)uiMsg.getAttributes().get("fatalMarkerStyle");
+ marker = uiMsg.getFacet("fatalMarker");
+
+ }else if (severity == FacesMessage.SEVERITY_INFO) {
+
+ markerClass = (String)uiMsg.getAttributes().get("infoMarkerClass");
+ markerStyle = (String)uiMsg.getAttributes().get("infoMarkerStyle");
+ marker = uiMsg.getFacet("infoMarker");
+
+ }else if (severity == FacesMessage.SEVERITY_WARN) {
+
+ markerClass = (String)uiMsg.getAttributes().get("warnMarkerClass");
+ markerStyle = (String)uiMsg.getAttributes().get("warnMarkerStyle");
+ marker = uiMsg.getFacet("infoMarker");
+
+ }
+
+ }else if(uiMsg.getFacet("passedMarker") != null){
+
+ marker = uiMsg.getFacet("passedMarker");
+ markerClass = (String) uiMsg.getAttributes().get("markerClass");
+ markerStyle = (String) uiMsg.getAttributes().get("markerStyle");
+
+ }
+
+ if(marker == null){
+ return;
+ }
+
+ if(!marker.isRendered()){
+ return;
+ }
+
+ renderMarkerHtml(uiMsg, marker, context, writer, markerClass, markerStyle);
+ }
+
+ protected void renderLabel(UIComponent component, FacesContext context, ResponseWriter writer,FacesMessage facesMsg) throws IOException{
+
+ String labelClass = null;
+
+ String labelStyle = null;
+
+ String passLabel = null;
+
+ Severity severity = null;
+
+
+ if(facesMsg != null){
+
+ severity = facesMsg.getSeverity();
+
+ if(severity == FacesMessage.SEVERITY_ERROR){
+
+ labelClass = (String)component.getAttributes().get("errorLabelClass");
+ labelStyle = (String)component.getAttributes().get("errorLabelStyle");
+
+ }else if(severity == FacesMessage.SEVERITY_FATAL){
+
+ labelClass = (String)component.getAttributes().get("fatalLabelClass");
+ labelStyle = (String)component.getAttributes().get("fatalLabelStyle");
+
+ }else if(severity == FacesMessage.SEVERITY_WARN){
+
+ labelClass = (String)component.getAttributes().get("warnLabelClass");
+ labelStyle = (String)component.getAttributes().get("warnLabelStyle");
+
+ }else if(severity == FacesMessage.SEVERITY_INFO){
+
+ labelClass = (String)component.getAttributes().get("infoLabelClass");
+ labelStyle = (String)component.getAttributes().get("infoLabelStyle");
+
+ }
+
+ }else if(component.getAttributes().get("passedLabel") != null){
+
+ passLabel = (String) component.getAttributes().get("passedLabel");
+ labelClass = (String) component.getAttributes().get("labelClass");
+ labelStyle = (String) component.getAttributes().get("labelStyle");
+
+ }
+
+ renderLabelHtml(component, context, writer, facesMsg, labelClass, labelStyle, passLabel);
+ }
+
+ protected void outerStyles(UIComponent component, FacesContext context, ResponseWriter writer,FacesMessage facesMsg) throws IOException{
+
+ String outerClass = null;
+
+ String outerStyle = null;
+
+ Severity severity = null;
+
+
+ if(facesMsg != null){
+
+ severity = facesMsg.getSeverity();
+ if(severity == FacesMessage.SEVERITY_ERROR){
+
+ outerClass = (String)component.getAttributes().get("errorClass");
+ outerStyle = (String)component.getAttributes().get("errorStyle");
+
+ }else if(severity == FacesMessage.SEVERITY_FATAL){
+
+ outerClass = (String)component.getAttributes().get("fatalClass");
+ outerStyle = (String)component.getAttributes().get("fatalStyle");
+
+ }else if(severity == FacesMessage.SEVERITY_WARN){
+
+ outerClass = (String)component.getAttributes().get("warnClass");
+ outerStyle = (String)component.getAttributes().get("warnStyle");
+
+ }else if(severity == FacesMessage.SEVERITY_INFO){
+
+ outerClass = (String)component.getAttributes().get("infoClass");
+ outerStyle = (String)component.getAttributes().get("infoStyle");
+ }
+ }
+
+ renderOuterStyles(component, context, writer, outerStyle, outerClass);
+
+ }
+
+ protected UIComponent findForComponent(FacesContext context, String forClientId, UIComponent component) throws IOException{
+
+ if(null == forClientId || forClientId.length() == 0){
+ return null;
+ }
+
+ UIComponent result = null;
+ UIComponent parent = component;
+
+ while(parent != null){
+ result = parent.findComponent(forClientId);
+
+ if(result != null){
+ break;
+ }
+ parent = parent.getParent();
+ }
+
+ if(result == null){
+ result = findComponentBelow(context.getViewRoot(), forClientId);
+ }
+
+ if(result == null){
+ if(log.isWarnEnabled()){
+ log.warn(COMPONENT_NOT_FOUND_IN_VIEW_WARN_MESSAGE + ":"+ forClientId);
+ }
+ }
+
+ return result;
+ }
+
+ protected UIComponent findComponentBelow(UIComponent startComponent, String forClientId){
+
+ UIComponent retComp = null;
+
+ if(startComponent.getChildCount() == 0){
+ return null;
+ }
+
+ List children = startComponent.getChildren();
+
+ for(int i = 0, size = children.size(); i < size; i++){
+ UIComponent comp = (UIComponent) children.get(i);
+
+ if(comp instanceof NamingContainer){
+ retComp = comp.findComponent(forClientId);
+ }
+
+ if(retComp == null){
+ if(comp.getChildCount() > 0){
+ retComp = findComponentBelow(comp, forClientId);
+ }
+ }
+
+ if(retComp != null)
+ break;
+ }
+
+ return retComp;
+ };
+
+ public abstract void renderMarkerHtml(UIComponent component, UIComponent markerFacet, FacesContext context, ResponseWriter writer,
+ String markerClass, String markerStyle) throws IOException;
+
+ public abstract void renderLabelHtml(UIComponent component, FacesContext context, ResponseWriter writer,
+ FacesMessage facesMsg, String labelClass, String labelStyle, String passLabel) throws IOException;
+
+ public abstract void renderOuterStyles(UIComponent component, FacesContext context, ResponseWriter writer, String outerStyle, String outerClass) throws IOException;
+}
Added: trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessageRenderer.java
===================================================================
--- trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessageRenderer.java (rev 0)
+++ trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessageRenderer.java 2007-07-30 13:58:37 UTC (rev 1924)
@@ -0,0 +1,235 @@
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIMessage;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.resource.InternetResource;
+import org.richfaces.component.UIRichMessage;
+import org.richfaces.renderkit.RichMessageBaseRenderer;
+
+
+/**
+ * @author Anton Belevich
+ *
+ */
+public class HtmlRichMessageRenderer extends RichMessageBaseRenderer{
+
+ private final InternetResource[] styles = {getResource("/org/richfaces/renderkit/html/css/msg.css")};
+
+ private InternetResource[] stylesAll = null;
+
+
+ protected InternetResource[] getStyles(){
+ synchronized (this){
+ if(stylesAll == null){
+
+ InternetResource[] rsrcs = super.getStyles();
+ boolean ignoreSuper = rsrcs == null || rsrcs.length == 0;
+ boolean ignoreThis = styles == null || styles.length == 0;
+
+ if(ignoreSuper){
+
+ if (ignoreThis) {
+ stylesAll = new InternetResource[0];
+ } else {
+ stylesAll = styles;
+ }
+
+ }else{
+ if(ignoreThis){
+ stylesAll = rsrcs;
+ }else{
+ Set rsrcsSet = new java.util.LinkedHashSet();
+
+ for(int i = 0; i < rsrcs.length; i++ ){
+ rsrcsSet.add(rsrcs[i]);
+ }
+
+ for(int i = 0; i < styles.length; i++ ){
+ rsrcsSet.add(styles[i]);
+ }
+
+ stylesAll = (InternetResource[]) rsrcsSet.toArray(new InternetResource[rsrcsSet.size()]);
+ }
+ }
+ }
+ }
+
+ return stylesAll;
+ }
+
+
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+
+ Iterator msgIter = null;
+
+ UIRichMessage msgComponent = (UIRichMessage)component;
+ String forClientId = msgComponent.getFor();
+
+ if(forClientId == null){
+
+ if(log.isInfoEnabled()){
+ log.info(NULL_PARAMETER_ERROR_MESSAGE);
+ }
+
+ }else{
+
+ msgIter = getMessageIterator(context, forClientId, msgComponent);
+ writer.startElement(HTML.SPAN_ELEM, msgComponent);
+ getUtils().writeAttribute(writer, HTML.id_ATTRIBUTE, msgComponent.getClientId(context));
+
+ if(!msgIter.hasNext() && msgComponent.isPassed()){
+
+ encodingUIContent(msgComponent, context, null);
+
+ }else if(msgIter.hasNext() ){
+
+ FacesMessage message = (FacesMessage)msgIter.next();
+ encodingUIContent(msgComponent, context, message);
+
+ }
+
+ writer.endElement(HTML.SPAN_ELEM);
+ }
+ }
+
+ protected void encodingUIContent(UIRichMessage uiMsg, FacesContext context, FacesMessage facesMsg) throws IOException{
+
+ ResponseWriter writer = context.getResponseWriter();
+
+ outerStyles(uiMsg, context, writer, facesMsg);
+ renderMarkerFacet(uiMsg,context, writer,facesMsg);
+ renderLabel(uiMsg, context, writer, facesMsg);
+
+
+ }
+
+ public void renderOuterStyles(UIComponent component, FacesContext context, ResponseWriter writer,String outerStyle, String outerClass) throws IOException{
+
+ UIRichMessage uiMsg = null;
+
+ if(!(component instanceof UIRichMessage)){
+ return;
+ }
+
+ uiMsg = (UIRichMessage)component;
+
+ String parentStyle = (String)uiMsg.getAttributes().get("style");
+ String parentClass = (String)uiMsg.getAttributes().get("styleClass");
+
+ String richMessageClass = "rich-message" + (null != outerClass ? (outerClass + " ") : "");
+ String richMessageStyle = (null != outerStyle ? outerStyle + " ," : "");
+
+ parentStyle = parentStyle != null ? (richMessageStyle + parentStyle) : richMessageStyle;
+ parentClass = parentClass != null ? (richMessageClass + parentClass) : richMessageClass;
+
+ getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE, parentClass);
+ getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, parentStyle);
+ }
+
+ public void renderMarkerHtml(UIComponent component,UIComponent marker, FacesContext context,
+ ResponseWriter writer,String markerClass, String markerStyle) throws IOException{
+
+ UIRichMessage uiMsg = null;
+
+ if(!(component instanceof UIRichMessage)){
+ return;
+ }
+
+ uiMsg = (UIRichMessage)component;
+
+ writer.startElement(HTML.SPAN_ELEM, uiMsg);
+
+ String classes = markerClass == null ? "rich-message-marker" : "rich-message-marker " + markerClass;
+
+ getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE, classes);
+ getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, markerStyle);
+
+ renderChild(context, marker);
+
+ writer.endElement(HTML.SPAN_ELEM);
+
+ }
+
+ public void renderLabelHtml(UIComponent component, FacesContext context, ResponseWriter writer,
+ FacesMessage facesMsg, String labelClass, String labelStyle, String passLabel) throws IOException{
+
+ String summary = null;
+
+ String detail = null;
+
+ String title = null;
+
+ UIRichMessage uiMsg = null;
+
+ if(!(component instanceof UIRichMessage)){
+ return;
+ }
+
+ uiMsg = (UIRichMessage)component;
+
+ boolean isTooltip = getUtils().isBooleanAttribute(uiMsg, "tooltip");
+
+ boolean showSummary = uiMsg.isShowSummary();
+
+ boolean showDetail = uiMsg.isShowDetail();
+
+
+ if(facesMsg != null){
+ summary = (null != (summary = facesMsg.getSummary())) ? summary : "";
+ detail = (null != (detail = facesMsg.getDetail())) ? detail : "";
+ }
+
+ String classes = labelClass == null ? "rich-message-label" : "rich-message-label " + labelClass;
+
+ writer.startElement(HTML.SPAN_ELEM, uiMsg);
+
+ getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE,classes);
+ getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, labelStyle);
+
+ if(facesMsg != null){
+ if(isTooltip){
+ title = (String) uiMsg.getAttributes().get("title");
+ if(title != null){
+ getUtils().writeAttribute(writer, HTML.title_ATTRIBUTE, title);
+ }else{
+ getUtils().writeAttribute(writer, HTML.title_ATTRIBUTE, summary);
+ }
+ }
+
+ if(showDetail){
+ writer.writeText(detail, null);
+ writer.writeText("\t", null);
+ }
+
+ if(showSummary){
+ writer.writeText(summary, null);
+ writer.writeText("\t", null);
+ }
+ }else {
+
+ if(passLabel != null){
+ writer.writeText(passLabel, null);
+ writer.writeText("\t", null);
+ }
+
+ }
+
+ writer.endElement(HTML.SPAN_ELEM);
+
+ }
+
+ protected Class getComponentClass() {
+
+ return UIMessage.class;
+ }
+}
+
\ No newline at end of file
Added: trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessagesRenderer.java
===================================================================
--- trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessagesRenderer.java (rev 0)
+++ trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/HtmlRichMessagesRenderer.java 2007-07-30 13:58:37 UTC (rev 1924)
@@ -0,0 +1,390 @@
+/**
+ *
+ */
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.faces.FacesException;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIMessages;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.ajax4jsf.resource.InternetResource;
+import org.richfaces.component.UIRichMessages;
+import org.richfaces.renderkit.RichMessageBaseRenderer;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+public class HtmlRichMessagesRenderer extends RichMessageBaseRenderer {
+
+ private boolean isWroteTable = false;
+
+ private boolean isIteratorLayout = false;
+
+ private final InternetResource[] styles = {getResource("/org/richfaces/renderkit/html/css/msgs.css")};
+
+ private InternetResource[] stylesAll = null;
+
+
+ protected InternetResource[] getStyles(){
+
+ synchronized (this){
+
+ if(stylesAll == null){
+
+ InternetResource[] rsrcs = super.getStyles();
+ boolean ignoreSuper = rsrcs == null || rsrcs.length == 0;
+ boolean ignoreThis = styles == null || styles.length == 0;
+
+ if(ignoreSuper){
+
+ if (ignoreThis) {
+ stylesAll = new InternetResource[0];
+ } else {
+ stylesAll = styles;
+ }
+
+ }else{
+
+ if(ignoreThis){
+ stylesAll = rsrcs;
+ }else{
+
+ Set rsrcsSet = new java.util.LinkedHashSet();
+ for(int i = 0; i < rsrcs.length; i++ ){
+ rsrcsSet.add(rsrcs[i]);
+ }
+
+ for(int i = 0; i < styles.length; i++ ){
+ rsrcsSet.add(styles[i]);
+ }
+
+ stylesAll = (InternetResource[]) rsrcsSet.toArray(new InternetResource[rsrcsSet.size()]);
+ }
+
+ }
+
+ }
+ }
+
+ return stylesAll;
+ }
+
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+
+ String forIds = null;
+
+ Iterator messagesIter = null;
+
+
+ UIRichMessages uiMessages = (UIRichMessages)component;
+
+ if(uiMessages.isGlobalOnly()){
+ forIds = "";
+ }
+
+ messagesIter = getMessageIterator(context, forIds, component);
+
+ renderComponentUI(writer, context, component, messagesIter);
+ }
+
+ public void renderComponentUI(ResponseWriter writer, FacesContext context, UIComponent component, Iterator messagesIter) throws IOException{
+
+ String layout = null;
+
+ String var = null;
+
+
+
+ UIRichMessages uiMessages = (UIRichMessages)component;
+
+ layout = (String)uiMessages.getAttributes().get("layout");
+ if((layout != null) && (layout.equals("table"))){
+
+ writer.startElement("table", uiMessages);
+
+ getUtils().writeAttribute(writer, HTML.cellpadding_ATTRIBUTE, "0");
+ getUtils().writeAttribute(writer, HTML.cellspacing_ATTRIBUTE, "0");
+
+ renderComponentOuterStyles(uiMessages, context, writer);
+
+ writer.startElement("tbody", uiMessages);
+ isWroteTable = true;
+
+ }else if((layout != null) && (layout.equals("iterator"))){
+
+ var = (String)uiMessages.getAttributes().get("var");
+ if(var == null){
+ FacesException e = new FacesException(new IllegalArgumentException("var attribute is not defined"));
+ throw e;
+ }
+
+ writer.startElement(HTML.SPAN_ELEM, uiMessages);
+
+ renderComponentOuterStyles(uiMessages, context, writer);
+
+ isIteratorLayout = true;
+
+ }else if((layout != null) && (layout.equals("list"))){
+
+ writer.startElement("dl", uiMessages);
+
+ renderComponentOuterStyles(uiMessages, context, writer);
+
+ }
+
+ getUtils().writeAttribute(writer,HTML.id_ATTRIBUTE ,uiMessages.getClientId(context));
+
+ if(log.isInfoEnabled()){
+ log.info("start render messages");
+ }
+
+ if(!messagesIter.hasNext()){
+
+ renderBody(uiMessages, context, writer, null);
+
+ }else{
+
+ while(messagesIter.hasNext()){
+
+ FacesMessage facesMsg = (FacesMessage)(messagesIter.next());
+
+ if(!isIteratorLayout){
+
+ renderBody(uiMessages, context, writer, facesMsg);
+
+ }else{
+
+ Map requestMap = context.getExternalContext().getRequestMap();
+ Object value = requestMap.get(var);
+ requestMap.put(var, facesMsg);
+
+ try {
+
+ if(log.isInfoEnabled()){
+ log.info("start render children of " + uiMessages.getClientId(context) + " component");
+ }
+
+ renderChildren(context, uiMessages);
+ } finally {
+
+ if(value != null){
+ requestMap.put(var, value);
+ }
+
+ }
+
+ }
+
+ }
+
+ }
+
+ if(!isIteratorLayout){
+
+ if(isWroteTable){
+ writer.endElement("tbody");
+ writer.endElement("table");
+ }else{
+ writer.endElement("dl");
+ }
+
+ }else{
+ writer.endElement(HTML.SPAN_ELEM);
+ }
+
+ }
+
+ public void renderLabelHtml(UIComponent component, FacesContext context, ResponseWriter writer,
+ FacesMessage facesMsg, String labelClass, String labelStyle, String passLabel) throws IOException {
+
+ String summary = null;
+
+ String detail = null;
+
+ String title = null;
+
+ UIRichMessages uiMessages = null;
+
+
+ if(!(component instanceof UIRichMessages)){
+ return;
+ }
+
+ uiMessages = (UIRichMessages)component;
+
+ if(log.isInfoEnabled()){
+ log.info("start render label HTML");
+ }
+
+ boolean isTooltip = getUtils().isBooleanAttribute(uiMessages, "tooltip");
+
+ boolean showSummary = uiMessages.isShowSummary();
+
+ boolean showDetail = uiMessages.isShowDetail();
+
+ if(facesMsg != null){
+ summary = (null != (summary = facesMsg.getSummary())) ? summary : "";
+ detail = (null != (detail = facesMsg.getDetail())) ? detail : "";
+ }
+
+ labelClass = labelClass == null ? "rich-messages-label" : "rich-messages-label " + labelClass;
+
+ if(isWroteTable){
+ writer.startElement(HTML.td_ELEM,uiMessages);
+ }
+
+ writer.startElement(HTML.SPAN_ELEM, uiMessages);
+
+ getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE,labelClass);
+ getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, labelStyle);
+
+ if(facesMsg != null){
+
+ if(isTooltip){
+
+ title = (String) uiMessages.getAttributes().get("title");
+ if(title != null){
+ getUtils().writeAttribute(writer, HTML.title_ATTRIBUTE, title);
+ }else{
+ getUtils().writeAttribute(writer, HTML.title_ATTRIBUTE, summary);
+ }
+
+ }
+
+ if(showDetail){
+ writer.writeText(detail, null);
+ writer.writeText("\t", null);
+ }
+
+ if(showSummary){
+ writer.writeText(summary, null);
+ writer.writeText("\t", null);
+ }
+
+ }else {
+
+ if(passLabel != null){
+ writer.writeText(passLabel, null);
+ writer.writeText("\t", null);
+ }
+
+ }
+
+ writer.endElement(HTML.SPAN_ELEM);
+
+ if(isWroteTable){
+ writer.endElement(HTML.td_ELEM);
+ }
+ }
+
+ public void renderMarkerHtml(UIComponent component, UIComponent markerFacet, FacesContext context,
+ ResponseWriter writer, String markerClass, String markerStyle)throws IOException {
+
+ UIRichMessages uiMessages = null;
+
+ if(!(component instanceof UIRichMessages)){
+ return;
+ }
+
+ if(log.isInfoEnabled()){
+ log.info("start render marker HTML: " + markerFacet.getClientId(context));
+ }
+
+ uiMessages = (UIRichMessages)component;
+
+ if(isWroteTable){
+ writer.startElement(HTML.td_ELEM, uiMessages);
+ }else{
+ writer.startElement(HTML.SPAN_ELEM, uiMessages);
+ }
+
+ String classes = markerClass == null ? "rich-messages-marker" : "rich-messages-marker " + markerClass;
+ getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE, classes);
+ getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, markerStyle);
+
+ renderChild(context, markerFacet);
+
+ if(isWroteTable){
+ writer.endElement(HTML.td_ELEM);
+ }else{
+ writer.endElement(HTML.SPAN_ELEM);
+ }
+
+ }
+
+ public void renderComponentOuterStyles(UIComponent component, FacesContext context, ResponseWriter writer) throws IOException {
+
+ UIRichMessages uiMessages = null;
+
+ if(!(component instanceof UIRichMessages)){
+ return;
+ }
+
+ uiMessages = (UIRichMessages)component;
+
+ if(log.isInfoEnabled()){
+ log.info("start render component outer styles: " + uiMessages.getClientId(context));
+ }
+
+ String parentStyle = (String)uiMessages.getAttributes().get("style");
+ String parentClass = (String)uiMessages.getAttributes().get("styleClass");
+
+ String richMessageClass = "rich-messages";
+
+ parentClass = parentClass != null ? (richMessageClass + " " + parentClass) : richMessageClass;
+
+ getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE, parentClass);
+ getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, parentStyle);
+
+ }
+
+ public void renderOuterStyles(UIComponent component, FacesContext context, ResponseWriter writer,
+ String outerStyle, String outerClass) throws IOException {
+
+ String richMessageClass = null != outerClass ? outerClass:"";
+ String richMessageStyle = (null != outerStyle ? outerStyle : "");
+
+ getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE, richMessageClass);
+ getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, richMessageStyle);
+
+ }
+
+ public void renderBody(UIRichMessages uiMessages, FacesContext context, ResponseWriter writer,FacesMessage facesMsg) throws IOException{
+
+ if(uiMessages.isPassed()){
+
+ if(isWroteTable){
+ writer.startElement(HTML.TR_ELEMENT, uiMessages);
+ }else if(!isIteratorLayout){
+ writer.startElement("dt", uiMessages);
+ }
+
+ outerStyles(uiMessages, context, writer, facesMsg);
+ renderMarkerFacet(uiMessages, context, writer, facesMsg);
+ renderLabel(uiMessages, context, writer, facesMsg);
+
+ if(isWroteTable){
+ writer.endElement(HTML.TR_ELEMENT);
+ }else if(!isIteratorLayout){
+ writer.endElement("dt");
+ }
+
+ }
+
+ }
+
+ protected Class getComponentClass() {
+ return UIMessages.class;
+ }
+
+}
17 years, 4 months
JBoss Rich Faces SVN: r1923 - trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-07-30 09:57:48 -0400 (Mon, 30 Jul 2007)
New Revision: 1923
Removed:
trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessageBaseRenderer.java
trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessageHtmlBaseRenderer.java
trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessagesHtmlBaseRenderer.java
Log:
rename classes
Deleted: trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessageBaseRenderer.java
===================================================================
--- trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessageBaseRenderer.java 2007-07-30 13:52:52 UTC (rev 1922)
+++ trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessageBaseRenderer.java 2007-07-30 13:57:48 UTC (rev 1923)
@@ -1,311 +0,0 @@
-package org.richfaces.renderkit.html;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.application.FacesMessage.Severity;
-import javax.faces.component.NamingContainer;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * @author Anton Belevich
- *
- */
-//TODO nick - anton - please review our naming conventions:
-
-//Naming Conventions
-//During the development we should follow the naming convention for all project stuff. The rules are defined below:
-//
-//
-//By default, a geterator expects the following structure for Java classes :
-//
-//<prefix>.component.Abstract<Name> ia an optional abstract superclass for a JSF component. To avoid manual writing for EL-enabled getters/setters, saveState/restoreState methods, listener-related methods etc, a developer can create an abstract class, and a generator creates the implementation.
-//<prefix>.component.UI<Name> is a Base component class. It can be generated from the abstract superclass or created by a developer.
-//<prefix>.component.<markup>.<Markup><RendererName>renderer-specific generated component( where the markup is a render-kit specific generation name, such as html | xml | wml ). In addition to the UI Component class, contains Java Bean getter/setter methods for renderer-specific attributes. This class is generated by CDK.
-//<prefix>.<Name> - JSF UI component-type. Can be provided in the configuration or calculated from a component class name.
-//<prefix>.<Markup><RendererName> - renderer-specific JSF component-type. Can be provided in the configuration or calculated from the renderer name.
-//<prefix>.renderkit.<RendererName>RendererBase - optional Renderer superclass, implements methods from template renderer used by generated. Created by a component developer.
-//<prefix>.renderkit.<markup>.<RendererName>Renderer is a generated renderer.
-//<prefix>.<RendererName>Renderer - JSF renderer-type. Can be provided in the configuration or calculated from a renderer name.
-//<prefix>.<Markup><RendererName>.xml is a template for generating the renderer class. jspx - like syntax is used. Provided by a component developer.
-//<prefix>.taglib.<RendererName>Tag - JSP tag class.
-//<prefix>.taglib.<RendererName>TagHandler is a facelets tag handler class.
-//<renderername> - JSP/facelets tag name.
-//For components, that uses JSF events :
-//
-//<prefix>.event.<Event>Event is a event class. Provided by component a developer.
-//<prefix>.event.<Event>Listener is an event listener interface. Can be generated by CDK
-//process<Event> is an event processing method name in a listener interface.
-//<prefix>.event.<Event>Source - is an interface for an event processing component ( with methods add<Event>Listener(<Event>Listener listener ) , remove<Event>Listener.... )
-//<prefix>.event.<Event>EventWrapper - wrapper class. Uses for binding listener's EL-expression in user's beans.
-//<prefix>.taglib.<Event>ListenerTag - JSP tag class for a creating listener instance. A parent tag must creates component implementing Source interface.
-//<prefix>.taglib.<Event>ListenerTagHandler is a facelets tag class for creation of listener instance.
-//
-//
-//Definitions that are used in this structure ( uppercase symbols means Java names notation, for name "foo" <name> mean "foo", and <Name> - "Foo" ):
-//
-//<prefix>
-//is a common library name ( for example, base JSF components use <javax.faces> prefix ). Value for prefix get from an abstract component package or a renderer template path.
-//<name>
-//is a name for base component ( for UIInput component <name> is "input" ). Value for a component name generator can got from UI... or Abstract... class name.
-//<markup>
-//is a render-kit generated a content name, "html" for HTML/XHTML pages, "wml" for mobile content etc. It must be provided in the render-kit description by ant task or maven POM. By default, "html" is used
-//<rendererName>
-//- name of renderer for concreting a visual component implementation, e.g. "commandButton" , "panelGroup" etc. A generator can take rendererName from a template file name.
-//<event>
-//is a name for Faces Event ( "action" for all ActionSource components like UICommand ). Can be provided in the component configuration, or got from the implemented ...Source interface.
-
-//TODO nick - anton - please consider using jspx templates
-public abstract class RichMessageBaseRenderer extends HeaderResourcesRendererBase{
-
- protected static final Log log = LogFactory.getLog(RichMessageHtmlBaseRenderer.class);
-
- public static final String NULL_PARAMETER_ERROR_MESSAGE = "null parameter ERROR";
-
- public static final String COMPONENT_NOT_FOUND_IN_VIEW_WARN_MESSAGE = "component not found in the view WARNING";
-
-
- protected Iterator getMessageIterator(FacesContext context, String forClientId, UIComponent component) throws IOException{
-
- Iterator msgIter = null;
-
- if(forClientId != null && forClientId.length() != 0){
-
- UIComponent result = findForComponent(context, forClientId,component);
- if (result == null) {
- msgIter = CollectionUtils.EMPTY_COLLECTION.iterator();
- } else {
- msgIter = context.getMessages(result.getClientId(context));
- }
- }else{
- msgIter = context.getMessages(null);
- msgIter = context.getMessages();
- }
-
- return msgIter;
- }
-
- protected void renderMarkerFacet(UIComponent uiMsg, FacesContext context, ResponseWriter writer,FacesMessage facesMsg) throws IOException{
-
- UIComponent marker = null;
-
- String markerClass = null;
-
- String markerStyle = null;
-
- Severity severity = null;
-
-
- if(facesMsg != null){
-
- severity = facesMsg.getSeverity();
-
- if(severity == FacesMessage.SEVERITY_ERROR){
-
- markerClass = (String)uiMsg.getAttributes().get("errorMarkerClass");
- markerStyle = (String)uiMsg.getAttributes().get("errorMarkerStyle");
- marker = uiMsg.getFacet("errorMarker");
-
- }else if (severity == FacesMessage.SEVERITY_FATAL) {
-
- markerClass = (String)uiMsg.getAttributes().get("fatalMarkerClass");
- markerStyle = (String)uiMsg.getAttributes().get("fatalMarkerStyle");
- marker = uiMsg.getFacet("fatalMarker");
-
- }else if (severity == FacesMessage.SEVERITY_INFO) {
-
- markerClass = (String)uiMsg.getAttributes().get("infoMarkerClass");
- markerStyle = (String)uiMsg.getAttributes().get("infoMarkerStyle");
- marker = uiMsg.getFacet("infoMarker");
-
- }else if (severity == FacesMessage.SEVERITY_WARN) {
-
- markerClass = (String)uiMsg.getAttributes().get("warnMarkerClass");
- markerStyle = (String)uiMsg.getAttributes().get("warnMarkerStyle");
- marker = uiMsg.getFacet("infoMarker");
-
- }
-
- }else if(uiMsg.getFacet("passedMarker") != null){
-
- marker = uiMsg.getFacet("passedMarker");
- markerClass = (String) uiMsg.getAttributes().get("markerClass");
- markerStyle = (String) uiMsg.getAttributes().get("markerStyle");
-
- }
-
- if(marker == null){
- return;
- }
-
- if(!marker.isRendered()){
- return;
- }
-
- renderMarkerHtml(uiMsg, marker, context, writer, markerClass, markerStyle);
- }
-
- protected void renderLabel(UIComponent component, FacesContext context, ResponseWriter writer,FacesMessage facesMsg) throws IOException{
-
- String labelClass = null;
-
- String labelStyle = null;
-
- String passLabel = null;
-
- Severity severity = null;
-
-
- if(facesMsg != null){
-
- severity = facesMsg.getSeverity();
-
- if(severity == FacesMessage.SEVERITY_ERROR){
-
- labelClass = (String)component.getAttributes().get("errorLabelClass");
- labelStyle = (String)component.getAttributes().get("errorLabelStyle");
-
- }else if(severity == FacesMessage.SEVERITY_FATAL){
-
- labelClass = (String)component.getAttributes().get("fatalLabelClass");
- labelStyle = (String)component.getAttributes().get("fatalLabelStyle");
-
- }else if(severity == FacesMessage.SEVERITY_WARN){
-
- labelClass = (String)component.getAttributes().get("warnLabelClass");
- labelStyle = (String)component.getAttributes().get("warnLabelStyle");
-
- }else if(severity == FacesMessage.SEVERITY_INFO){
-
- labelClass = (String)component.getAttributes().get("infoLabelClass");
- labelStyle = (String)component.getAttributes().get("infoLabelStyle");
-
- }
-
- }else if(component.getAttributes().get("passedLabel") != null){
-
- passLabel = (String) component.getAttributes().get("passedLabel");
- labelClass = (String) component.getAttributes().get("labelClass");
- labelStyle = (String) component.getAttributes().get("labelStyle");
-
- }
-
- renderLabelHtml(component, context, writer, facesMsg, labelClass, labelStyle, passLabel);
- }
-
- protected void outerStyles(UIComponent component, FacesContext context, ResponseWriter writer,FacesMessage facesMsg) throws IOException{
-
- String outerClass = null;
-
- String outerStyle = null;
-
- Severity severity = null;
-
-
- if(facesMsg != null){
-
- severity = facesMsg.getSeverity();
- if(severity == FacesMessage.SEVERITY_ERROR){
-
- outerClass = (String)component.getAttributes().get("errorClass");
- outerStyle = (String)component.getAttributes().get("errorStyle");
-
- }else if(severity == FacesMessage.SEVERITY_FATAL){
-
- outerClass = (String)component.getAttributes().get("fatalClass");
- outerStyle = (String)component.getAttributes().get("fatalStyle");
-
- }else if(severity == FacesMessage.SEVERITY_WARN){
-
- outerClass = (String)component.getAttributes().get("warnClass");
- outerStyle = (String)component.getAttributes().get("warnStyle");
-
- }else if(severity == FacesMessage.SEVERITY_INFO){
-
- outerClass = (String)component.getAttributes().get("infoClass");
- outerStyle = (String)component.getAttributes().get("infoStyle");
- }
- }
-
- renderOuterStyles(component, context, writer, outerStyle, outerClass);
-
- }
-
- protected UIComponent findForComponent(FacesContext context, String forClientId, UIComponent component) throws IOException{
-
- if(null == forClientId || forClientId.length() == 0){
- return null;
- }
-
- UIComponent result = null;
- UIComponent parent = component;
-
- while(parent != null){
- result = parent.findComponent(forClientId);
-
- if(result != null){
- break;
- }
- parent = parent.getParent();
- }
-
- if(result == null){
- result = findComponentBelow(context.getViewRoot(), forClientId);
- }
-
- if(result == null){
- if(log.isWarnEnabled()){
- log.warn(COMPONENT_NOT_FOUND_IN_VIEW_WARN_MESSAGE + ":"+ forClientId);
- }
- }
-
- return result;
- }
-
- protected UIComponent findComponentBelow(UIComponent startComponent, String forClientId){
-
- UIComponent retComp = null;
-
- if(startComponent.getChildCount() == 0){
- return null;
- }
-
- List children = startComponent.getChildren();
-
- for(int i = 0, size = children.size(); i < size; i++){
- UIComponent comp = (UIComponent) children.get(i);
-
- if(comp instanceof NamingContainer){
- retComp = comp.findComponent(forClientId);
- }
-
- if(retComp == null){
- if(comp.getChildCount() > 0){
- retComp = findComponentBelow(comp, forClientId);
- }
- }
-
- if(retComp != null)
- break;
- }
-
- return retComp;
- };
-
- public abstract void renderMarkerHtml(UIComponent component, UIComponent markerFacet, FacesContext context, ResponseWriter writer,
- String markerClass, String markerStyle) throws IOException;
-
- public abstract void renderLabelHtml(UIComponent component, FacesContext context, ResponseWriter writer,
- FacesMessage facesMsg, String labelClass, String labelStyle, String passLabel) throws IOException;
-
- public abstract void renderOuterStyles(UIComponent component, FacesContext context, ResponseWriter writer, String outerStyle, String outerClass) throws IOException;
-}
Deleted: trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessageHtmlBaseRenderer.java
===================================================================
--- trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessageHtmlBaseRenderer.java 2007-07-30 13:52:52 UTC (rev 1922)
+++ trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessageHtmlBaseRenderer.java 2007-07-30 13:57:48 UTC (rev 1923)
@@ -1,234 +0,0 @@
-package org.richfaces.renderkit.html;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIMessage;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.resource.InternetResource;
-import org.richfaces.component.UIRichMessage;
-
-
-/**
- * @author Anton Belevich
- *
- */
-public class RichMessageHtmlBaseRenderer extends RichMessageBaseRenderer{
-
- private final InternetResource[] styles = {getResource("/org/richfaces/renderkit/html/css/msg.css")};
-
- private InternetResource[] stylesAll = null;
-
-
- protected InternetResource[] getStyles(){
- synchronized (this){
- if(stylesAll == null){
-
- InternetResource[] rsrcs = super.getStyles();
- boolean ignoreSuper = rsrcs == null || rsrcs.length == 0;
- boolean ignoreThis = styles == null || styles.length == 0;
-
- if(ignoreSuper){
-
- if (ignoreThis) {
- stylesAll = new InternetResource[0];
- } else {
- stylesAll = styles;
- }
-
- }else{
- if(ignoreThis){
- stylesAll = rsrcs;
- }else{
- Set rsrcsSet = new java.util.LinkedHashSet();
-
- for(int i = 0; i < rsrcs.length; i++ ){
- rsrcsSet.add(rsrcs[i]);
- }
-
- for(int i = 0; i < styles.length; i++ ){
- rsrcsSet.add(styles[i]);
- }
-
- stylesAll = (InternetResource[]) rsrcsSet.toArray(new InternetResource[rsrcsSet.size()]);
- }
- }
- }
- }
-
- return stylesAll;
- }
-
-
- protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
-
- Iterator msgIter = null;
-
- UIRichMessage msgComponent = (UIRichMessage)component;
- String forClientId = msgComponent.getFor();
-
- if(forClientId == null){
-
- if(log.isInfoEnabled()){
- log.info(NULL_PARAMETER_ERROR_MESSAGE);
- }
-
- }else{
-
- msgIter = getMessageIterator(context, forClientId, msgComponent);
- writer.startElement(HTML.SPAN_ELEM, msgComponent);
- getUtils().writeAttribute(writer, HTML.id_ATTRIBUTE, msgComponent.getClientId(context));
-
- if(!msgIter.hasNext() && msgComponent.isPassed()){
-
- encodingUIContent(msgComponent, context, null);
-
- }else if(msgIter.hasNext() ){
-
- FacesMessage message = (FacesMessage)msgIter.next();
- encodingUIContent(msgComponent, context, message);
-
- }
-
- writer.endElement(HTML.SPAN_ELEM);
- }
- }
-
- protected void encodingUIContent(UIRichMessage uiMsg, FacesContext context, FacesMessage facesMsg) throws IOException{
-
- ResponseWriter writer = context.getResponseWriter();
-
- outerStyles(uiMsg, context, writer, facesMsg);
- renderMarkerFacet(uiMsg,context, writer,facesMsg);
- renderLabel(uiMsg, context, writer, facesMsg);
-
-
- }
-
- public void renderOuterStyles(UIComponent component, FacesContext context, ResponseWriter writer,String outerStyle, String outerClass) throws IOException{
-
- UIRichMessage uiMsg = null;
-
- if(!(component instanceof UIRichMessage)){
- return;
- }
-
- uiMsg = (UIRichMessage)component;
-
- String parentStyle = (String)uiMsg.getAttributes().get("style");
- String parentClass = (String)uiMsg.getAttributes().get("styleClass");
-
- String richMessageClass = "rich-message" + (null != outerClass ? (outerClass + " ") : "");
- String richMessageStyle = (null != outerStyle ? outerStyle + " ," : "");
-
- parentStyle = parentStyle != null ? (richMessageStyle + parentStyle) : richMessageStyle;
- parentClass = parentClass != null ? (richMessageClass + parentClass) : richMessageClass;
-
- getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE, parentClass);
- getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, parentStyle);
- }
-
- public void renderMarkerHtml(UIComponent component,UIComponent marker, FacesContext context,
- ResponseWriter writer,String markerClass, String markerStyle) throws IOException{
-
- UIRichMessage uiMsg = null;
-
- if(!(component instanceof UIRichMessage)){
- return;
- }
-
- uiMsg = (UIRichMessage)component;
-
- writer.startElement(HTML.SPAN_ELEM, uiMsg);
-
- String classes = markerClass == null ? "rich-message-marker" : "rich-message-marker " + markerClass;
-
- getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE, classes);
- getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, markerStyle);
-
- renderChild(context, marker);
-
- writer.endElement(HTML.SPAN_ELEM);
-
- }
-
- public void renderLabelHtml(UIComponent component, FacesContext context, ResponseWriter writer,
- FacesMessage facesMsg, String labelClass, String labelStyle, String passLabel) throws IOException{
-
- String summary = null;
-
- String detail = null;
-
- String title = null;
-
- UIRichMessage uiMsg = null;
-
- if(!(component instanceof UIRichMessage)){
- return;
- }
-
- uiMsg = (UIRichMessage)component;
-
- boolean isTooltip = getUtils().isBooleanAttribute(uiMsg, "tooltip");
-
- boolean showSummary = uiMsg.isShowSummary();
-
- boolean showDetail = uiMsg.isShowDetail();
-
-
- if(facesMsg != null){
- summary = (null != (summary = facesMsg.getSummary())) ? summary : "";
- detail = (null != (detail = facesMsg.getDetail())) ? detail : "";
- }
-
- String classes = labelClass == null ? "rich-message-label" : "rich-message-label " + labelClass;
-
- writer.startElement(HTML.SPAN_ELEM, uiMsg);
-
- getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE,classes);
- getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, labelStyle);
-
- if(facesMsg != null){
- if(isTooltip){
- title = (String) uiMsg.getAttributes().get("title");
- if(title != null){
- getUtils().writeAttribute(writer, HTML.title_ATTRIBUTE, title);
- }else{
- getUtils().writeAttribute(writer, HTML.title_ATTRIBUTE, summary);
- }
- }
-
- if(showDetail){
- writer.writeText(detail, null);
- writer.writeText("\t", null);
- }
-
- if(showSummary){
- writer.writeText(summary, null);
- writer.writeText("\t", null);
- }
- }else {
-
- if(passLabel != null){
- writer.writeText(passLabel, null);
- writer.writeText("\t", null);
- }
-
- }
-
- writer.endElement(HTML.SPAN_ELEM);
-
- }
-
- protected Class getComponentClass() {
-
- return UIMessage.class;
- }
-}
-
\ No newline at end of file
Deleted: trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessagesHtmlBaseRenderer.java
===================================================================
--- trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessagesHtmlBaseRenderer.java 2007-07-30 13:52:52 UTC (rev 1922)
+++ trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessagesHtmlBaseRenderer.java 2007-07-30 13:57:48 UTC (rev 1923)
@@ -1,512 +0,0 @@
-/**
- *
- */
-package org.richfaces.renderkit.html;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import javax.faces.FacesException;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIMessages;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.ajax4jsf.resource.InternetResource;
-import org.richfaces.component.UIRichMessages;
-
-/**
- * @author Anton Belevich
- *
- */
-public class RichMessagesHtmlBaseRenderer extends RichMessageBaseRenderer {
-
- private final InternetResource[] styles = {getResource("/org/richfaces/renderkit/html/css/msgs.css")};
-
- private InternetResource[] stylesAll = null;
-
-
- protected InternetResource[] getStyles(){
-
- synchronized (this){
-
- if(stylesAll == null){
-
- InternetResource[] rsrcs = super.getStyles();
- boolean ignoreSuper = rsrcs == null || rsrcs.length == 0;
- boolean ignoreThis = styles == null || styles.length == 0;
-
- if(ignoreSuper){
-
- if (ignoreThis) {
- stylesAll = new InternetResource[0];
- } else {
- stylesAll = styles;
- }
-
- }else{
-
- if(ignoreThis){
- stylesAll = rsrcs;
- }else{
-
- Set rsrcsSet = new java.util.LinkedHashSet();
- for(int i = 0; i < rsrcs.length; i++ ){
- rsrcsSet.add(rsrcs[i]);
- }
-
- for(int i = 0; i < styles.length; i++ ){
- rsrcsSet.add(styles[i]);
- }
-
- stylesAll = (InternetResource[]) rsrcsSet.toArray(new InternetResource[rsrcsSet.size()]);
- }
-
- }
-
- }
- }
-
- return stylesAll;
- }
-
- protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
-
- String forIds = null;
-
- Iterator messagesIter = null;
-
-
- UIRichMessages uiMessages = (UIRichMessages)component;
-
- if(uiMessages.isGlobalOnly()){
- forIds = "";
- }
-
- messagesIter = getMessageIterator(context, forIds, component);
-
- renderBody(component, writer, context, messagesIter);
- }
-
- public void renderComponentUI(ResponseWriter writer, FacesContext context, UIComponent component, Iterator messagesIter) throws IOException{
-
- String layout = null;
-
- String var = null;
-
-
-
- UIRichMessages uiMessages = (UIRichMessages)component;
-
- layout = (String)uiMessages.getAttributes().get("layout");
- if((layout != null) && (layout.equals("table"))){
-
- writer.startElement("table", component);
-
- getUtils().writeAttribute(writer, HTML.cellpadding_ATTRIBUTE, "0");
- getUtils().writeAttribute(writer, HTML.cellspacing_ATTRIBUTE, "0");
-
-// renderComponentOuterStyles(uiMessages, context, writer);
-
- writer.startElement("tbody", uiMessages);
- uiMessages.setWroteTable(true);
-
- }else if((layout != null) && (layout.equals("iterator"))){
-
- var = (String)uiMessages.getAttributes().get("var");
- if(var == null){
- FacesException e = new FacesException(new IllegalArgumentException("var attribute is not defined"));
- throw e;
- }
-
- writer.startElement(HTML.SPAN_ELEM, component);
-
- uiMessages.setIteratorLayout(true);
-
- }else if((layout != null) && (layout.equals("list"))){
-
- writer.startElement("dl", component);
-
-// renderComponentOuterStyles(uiMessages, context, writer);
-
- }
-
- if(log.isInfoEnabled()){
- log.info("start render messages");
- }
-
- while(messagesIter.hasNext()){
-
- FacesMessage facesMsg = (FacesMessage)(messagesIter.next());
-
- if(!uiMessages.isIteratorLayout()){
-
- if(uiMessages.isWroteTable()){
- writer.startElement(HTML.TR_ELEMENT, component);
- }else{
- writer.startElement("dt", component);
- }
-
- outerStyles(component, context, writer, facesMsg);
- renderMarkerFacet(uiMessages, context, writer, facesMsg);
- renderLabel(uiMessages, context, writer, facesMsg);
-
- if(uiMessages.isWroteTable()){
- writer.endElement(HTML.TR_ELEMENT);
- }else{
- writer.endElement("dt");
- }
-
- }else{
-
- Map requestMap = context.getExternalContext().getRequestMap();
- Object value = requestMap.get(var);
- requestMap.put(var, facesMsg);
-
- try {
-
- if(log.isInfoEnabled()){
- log.info("start render children of " + uiMessages.getClientId(context) + " component");
- }
-
- renderChildren(context, uiMessages);
- } finally {
-
- if(value != null){
- requestMap.put(var, value);
- }
-
- }
-
- }
-
- }
-
- if(!uiMessages.isIteratorLayout()){
-
- if(uiMessages.isWroteTable()){
- writer.endElement("tbody");
- writer.endElement("table");
- }else{
- writer.endElement("dl");
- }
-
- }else{
- writer.endElement(HTML.SPAN_ELEM);
- }
-
- }
-
- public void renderLabelHtml(UIComponent component, FacesContext context, ResponseWriter writer,
- FacesMessage facesMsg, String labelClass, String labelStyle, String passLabel) throws IOException {
-
- String summary = null;
-
- String detail = null;
-
- String title = null;
-
- UIRichMessages uiMessages = null;
-
-
- if(!(component instanceof UIRichMessages)){
- return;
- }
-
- uiMessages = (UIRichMessages)component;
-
- if(log.isInfoEnabled()){
- log.info("start render label HTML");
- }
-
- boolean isTooltip = getUtils().isBooleanAttribute(uiMessages, "tooltip");
-
- boolean showSummary = uiMessages.isShowSummary();
-
- boolean showDetail = uiMessages.isShowDetail();
-
- if(facesMsg != null){
- summary = (null != (summary = facesMsg.getSummary())) ? summary : "";
- detail = (null != (detail = facesMsg.getDetail())) ? detail : "";
- }
-
- labelClass = labelClass == null ? "rich-messages-label" : "rich-messages-label " + labelClass;
-
- if(uiMessages.isWroteTable()){
- writer.startElement(HTML.td_ELEM, component);
- }
-
- writer.startElement(HTML.SPAN_ELEM, uiMessages);
-
- getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE,labelClass);
- getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, labelStyle);
-
- if(facesMsg != null){
-
- if(isTooltip){
-
- title = (String) uiMessages.getAttributes().get("title");
- if(title != null){
- getUtils().writeAttribute(writer, HTML.title_ATTRIBUTE, title);
- }else{
- getUtils().writeAttribute(writer, HTML.title_ATTRIBUTE, summary);
- }
-
- }
-
- if(showDetail){
- writer.writeText(detail, null);
- writer.writeText("\t", null);
- }
-
- if(showSummary){
- writer.writeText(summary, null);
- writer.writeText("\t", null);
- }
-
- }else {
-
- if(passLabel != null){
- writer.writeText(passLabel, null);
- writer.writeText("\t", null);
- }
-
- }
-
- writer.endElement(HTML.SPAN_ELEM);
-
- if(uiMessages.isWroteTable()){
- writer.endElement(HTML.td_ELEM);
- }
- }
-
- public void renderMarkerHtml(UIComponent component, UIComponent markerFacet, FacesContext context,
- ResponseWriter writer, String markerClass, String markerStyle)throws IOException {
-
- UIRichMessages uiMessages = null;
-
-
- if(!(component instanceof UIRichMessages)){
- return;
- }
-
- if(log.isInfoEnabled()){
- log.info("start render marker HTML: " + markerFacet.getClientId(context));
- }
-
- uiMessages = (UIRichMessages)component;
-
- if(uiMessages.isWroteTable()){
- writer.startElement(HTML.td_ELEM, component);
- }else{
- writer.startElement(HTML.SPAN_ELEM, component);
- }
-
- String classes = markerClass == null ? "rich-messages-marker" : "rich-messages-marker " + markerClass;
- getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE, classes);
- getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, markerStyle);
-
- renderChild(context, markerFacet);
-
- if(uiMessages.isWroteTable()){
- writer.endElement(HTML.td_ELEM);
- }else{
- writer.endElement(HTML.SPAN_ELEM);
- }
-
-
- }
-
- public void renderComponentOuterStyles(UIComponent component, FacesContext context, ResponseWriter writer) throws IOException {
-
- UIRichMessages uiMessages = null;
-
-
- if(!(component instanceof UIRichMessages)){
- return;
- }
-
- uiMessages = (UIRichMessages)component;
-
- if(log.isInfoEnabled()){
- log.info("start render component outer styles: " + uiMessages.getClientId(context));
- }
-
- String parentStyle = (String)uiMessages.getAttributes().get("style");
- String parentClass = (String)uiMessages.getAttributes().get("styleClass");
-
- String richMessageClass = "rich-messages";
-
- parentClass = parentClass != null ? (richMessageClass + " " + parentClass) : richMessageClass;
-
- getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE, parentClass);
- getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, parentStyle);
-
- }
-
- public void renderOuterStyles(UIComponent component, FacesContext context, ResponseWriter writer,
- String outerStyle, String outerClass) throws IOException {
-
- String richMessageClass = null != outerClass ? outerClass:"";
- String richMessageStyle = (null != outerStyle ? outerStyle : "");
-
- getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE, richMessageClass);
- getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, richMessageStyle);
-
- }
-
-
-
- public void renderHeaderFacet(ResponseWriter writer, FacesContext context, UIRichMessages uiMessages, UIComponent headerFacet) throws IOException{
-
- String headerClass = null;
-
- String headerStyle = null;
-
-
- headerClass = (String)uiMessages.getAttributes().get("headerClass");
-
- headerStyle = (String)uiMessages.getAttributes().get("headerStyle");
-
- getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE, headerClass);
- getUtils().writeAttribute(writer,HTML.style_ATTRIBUTE, headerStyle);
-
- renderChild(context, headerFacet);
-
-
- }
-
- public void renderBody(UIComponent component, ResponseWriter writer, FacesContext context, Iterator messagesIter) throws IOException{
-
- UIRichMessages uiMessages = (UIRichMessages)component;
-
- String clientId = uiMessages.getClientId(context);
-
- String headerLocation = uiMessages.getHeaderLocation();
-
- boolean isPassed = uiMessages.isPassed();
-
- if(headerLocation == null){
- return;
- }
-
- UIComponent headerFacet = null;
-
- UIComponent passedHeaderFacet = uiMessages.getFacet("passedHeader");
- UIComponent commonHeaderFacet = uiMessages.getFacet("header");
-
- if(passedHeaderFacet != null && !messagesIter.hasNext()){
- headerFacet = passedHeaderFacet;
- }else if(commonHeaderFacet != null){
- headerFacet = commonHeaderFacet;
- }
-
- writer.startElement("table", uiMessages);
- getUtils().writeAttribute(writer, HTML.id_ATTRIBUTE,clientId);
- renderComponentOuterStyles(component, context, writer);
-
- writer.startElement("tbody", uiMessages);
-
- if(headerLocation.equals(UIRichMessages.HEADER_LOCATION_BOTTOM)){
-
- writer.startElement(HTML.TR_ELEMENT, uiMessages);
- writer.startElement(HTML.td_ELEM, uiMessages);
-
- renderComponentUI(writer, context, uiMessages, messagesIter);
-
- writer.endElement(HTML.td_ELEM);
- writer.endElement(HTML.TR_ELEMENT);
-
- if(headerFacet != null && headerFacet.isRendered() && isPassed){
-
- writer.startElement(HTML.TR_ELEMENT, uiMessages);
- writer.startElement(HTML.td_ELEM, uiMessages);
-
- renderHeaderFacet(writer, context, uiMessages, headerFacet);
-
- writer.endElement(HTML.td_ELEM);
- writer.endElement(HTML.TR_ELEMENT);
-
- }
-
- }else if(headerLocation.equals(UIRichMessages.HEADER_LOCATION_TOP)){
-
- if(headerFacet != null && headerFacet.isRendered() && isPassed){
-
- writer.startElement(HTML.TR_ELEMENT, uiMessages);
- writer.startElement(HTML.td_ELEM, uiMessages);
-
- renderHeaderFacet(writer, context, uiMessages, headerFacet);
-
- writer.endElement(HTML.td_ELEM);
- writer.endElement(HTML.TR_ELEMENT);
-
- }
-
- writer.startElement(HTML.TR_ELEMENT, uiMessages);
- writer.startElement(HTML.td_ELEM, uiMessages);
-
- renderComponentUI(writer, context, uiMessages, messagesIter);
-
- writer.endElement(HTML.td_ELEM);
- writer.endElement(HTML.TR_ELEMENT);
-
- }else if(headerLocation.equals(UIRichMessages.HEADER_LOCATION_LEFT)){
-
- writer.startElement(HTML.TR_ELEMENT, uiMessages);
-
- if(headerFacet != null && headerFacet.isRendered()&& isPassed){
-
- writer.startElement(HTML.td_ELEM, uiMessages);
-
- renderHeaderFacet(writer, context, uiMessages, headerFacet);
-
- writer.endElement(HTML.td_ELEM);
-
- }
-
- writer.startElement(HTML.td_ELEM, uiMessages);
-
- renderComponentUI(writer, context, uiMessages, messagesIter);
-
- writer.endElement(HTML.td_ELEM);
- writer.endElement(HTML.TR_ELEMENT);
-
-
- }else if(headerLocation.equals(UIRichMessages.HEADER_LOCATION_RIGHT)){
-
- writer.startElement(HTML.TR_ELEMENT, uiMessages);
- writer.startElement(HTML.td_ELEM, uiMessages);
-
- renderComponentUI(writer, context, uiMessages, messagesIter);
-
- writer.endElement(HTML.td_ELEM);
-
- if(headerFacet != null && headerFacet.isRendered() && isPassed){
-
- writer.startElement(HTML.td_ELEM, uiMessages);
-
- renderHeaderFacet(writer, context, uiMessages, headerFacet);
-
- writer.endElement(HTML.td_ELEM);
-
- }
-
- writer.endElement(HTML.TR_ELEMENT);
-
- }
-
- writer.endElement("tbody");
- writer.endElement("table");
-
- }
-
- protected Class getComponentClass() {
- return UIMessages.class;
- }
-
-}
17 years, 4 months
JBoss Rich Faces SVN: r1922 - in trunk/cdk: maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-07-30 09:52:52 -0400 (Mon, 30 Jul 2007)
New Revision: 1922
Modified:
trunk/cdk/maven-archetype-jsf-component/src/main/resources/archetype-resources/src/main/config/component/_compName.xml
trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/CreateComponentMojo.java
Log:
CDK updated for 3.1.0
Modified: trunk/cdk/maven-archetype-jsf-component/src/main/resources/archetype-resources/src/main/config/component/_compName.xml
===================================================================
--- trunk/cdk/maven-archetype-jsf-component/src/main/resources/archetype-resources/src/main/config/component/_compName.xml 2007-07-30 13:32:06 UTC (rev 1921)
+++ trunk/cdk/maven-archetype-jsf-component/src/main/resources/archetype-resources/src/main/config/component/_compName.xml 2007-07-30 13:52:52 UTC (rev 1922)
@@ -21,7 +21,7 @@
<name>${artifactId}</name>
<classname>${groupId}.taglib.${artifactId}Tag</classname>
<superclass>
- org.ajax4jsf.framework.taglib.HtmlComponentTagBase
+ org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
</superclass>
</tag>
<!--
Modified: trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/CreateComponentMojo.java
===================================================================
--- trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/CreateComponentMojo.java 2007-07-30 13:32:06 UTC (rev 1921)
+++ trunk/cdk/maven-cdk-plugin/src/main/java/org/ajax4jsf/builder/mojo/CreateComponentMojo.java 2007-07-30 13:52:52 UTC (rev 1922)
@@ -81,10 +81,19 @@
// Search for this plugin in project pom
for (Iterator iter = plugins.iterator(); iter.hasNext();) {
plugin = (Plugin) iter.next();
- if("maven-cdk-plugin".equals(plugin.getArtifactId()) &&
- "org.ajax4jsf.cdk".equals(plugin.getGroupId())){
- found = true;
- break;
+ if("maven-cdk-plugin".equals(plugin.getArtifactId())) {
+
+ String groupId;
+ if ("3.1.0".compareTo(plugin.getVersion()) > 0) {
+ groupId = "org.ajax4jsf.cdk";
+ } else {
+ groupId = "org.richfaces.cdk";
+ }
+
+ if (groupId.equals(plugin.getGroupId())) {
+ found = true;
+ break;
+ }
}
}
if(found){
17 years, 4 months
JBoss Rich Faces SVN: r1921 - in trunk/sandbox: samples/treeModelDemo and 39 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-07-30 09:32:06 -0400 (Mon, 30 Jul 2007)
New Revision: 1921
Added:
trunk/sandbox/samples/treeModelDemo/
trunk/sandbox/samples/treeModelDemo/pom.xml
trunk/sandbox/samples/treeModelDemo/src/
trunk/sandbox/samples/treeModelDemo/src/main/
trunk/sandbox/samples/treeModelDemo/src/main/java/
trunk/sandbox/samples/treeModelDemo/src/main/java/org/
trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/
trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/TreeModelBean.java
trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/
trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Class.java
trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Directory.java
trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Entry.java
trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/File.java
trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Package.java
trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Project.java
trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/SourceDirectory.java
trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/service/
trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/service/Loader.java
trunk/sandbox/samples/treeModelDemo/src/main/resources/
trunk/sandbox/samples/treeModelDemo/src/main/resources/org/
trunk/sandbox/samples/treeModelDemo/src/main/resources/org/richfaces/
trunk/sandbox/samples/treeModelDemo/src/main/resources/org/richfaces/model/
trunk/sandbox/samples/treeModelDemo/src/main/resources/org/richfaces/model/tree-model-data.xml
trunk/sandbox/samples/treeModelDemo/src/main/resources/org/richfaces/service/
trunk/sandbox/samples/treeModelDemo/src/main/resources/org/richfaces/service/digester-rules.dtd
trunk/sandbox/samples/treeModelDemo/src/main/resources/org/richfaces/service/tree-model-rules.xml
trunk/sandbox/samples/treeModelDemo/src/main/webapp/
trunk/sandbox/samples/treeModelDemo/src/main/webapp/META-INF/
trunk/sandbox/samples/treeModelDemo/src/main/webapp/META-INF/MANIFEST.MF
trunk/sandbox/samples/treeModelDemo/src/main/webapp/WEB-INF/
trunk/sandbox/samples/treeModelDemo/src/main/webapp/WEB-INF/faces-config.xml
trunk/sandbox/samples/treeModelDemo/src/main/webapp/WEB-INF/web.xml
trunk/sandbox/samples/treeModelDemo/src/main/webapp/index.jsp
trunk/sandbox/samples/treeModelDemo/src/main/webapp/pages/
trunk/sandbox/samples/treeModelDemo/src/main/webapp/pages/index.jsp
trunk/sandbox/samples/treeModelDemo/src/main/webapp/pages/index.xhtml
trunk/sandbox/samples/treeModelDemo/src/test/
trunk/sandbox/samples/treeModelDemo/src/test/java/
trunk/sandbox/samples/treeModelDemo/src/test/java/org/
trunk/sandbox/samples/treeModelDemo/src/test/java/org/richfaces/
trunk/sandbox/samples/treeModelDemo/src/test/java/org/richfaces/BeanTest.java
trunk/sandbox/ui/treeModel/
trunk/sandbox/ui/treeModel/pom.xml
trunk/sandbox/ui/treeModel/src/
trunk/sandbox/ui/treeModel/src/main/
trunk/sandbox/ui/treeModel/src/main/config/
trunk/sandbox/ui/treeModel/src/main/config/component/
trunk/sandbox/ui/treeModel/src/main/config/component/README
trunk/sandbox/ui/treeModel/src/main/config/component/recursiveTreeNodes.xml
trunk/sandbox/ui/treeModel/src/main/config/component/treeNodes.xml
trunk/sandbox/ui/treeModel/src/main/java/
trunk/sandbox/ui/treeModel/src/main/java/org/
trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/
trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/component/
trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/component/README
trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/component/UIRecursiveTreeNodes.java
trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/component/UITreeNodes.java
trunk/sandbox/ui/treeModel/src/main/resources/
trunk/sandbox/ui/treeModel/src/main/templates/
trunk/sandbox/ui/treeModel/src/main/templates/README
trunk/sandbox/ui/treeModel/src/main/templates/org/
trunk/sandbox/ui/treeModel/src/main/templates/org/richfaces/
trunk/sandbox/ui/treeModel/src/main/templates/org/richfaces/htmlRecursiveTreeNodes.jspx
trunk/sandbox/ui/treeModel/src/main/templates/org/richfaces/htmlTreeNodes.jspx
trunk/sandbox/ui/treeModel/src/main/templates/org/richfaces/htmlTreeRecursion.jspx
trunk/sandbox/ui/treeModel/src/test/
trunk/sandbox/ui/treeModel/src/test/java/
trunk/sandbox/ui/treeModel/src/test/java/org/
trunk/sandbox/ui/treeModel/src/test/java/org/richfaces/
trunk/sandbox/ui/treeModel/src/test/java/org/richfaces/component/
trunk/sandbox/ui/treeModel/src/test/java/org/richfaces/component/JSFComponentTest.java
Modified:
trunk/sandbox/samples/pom.xml
trunk/sandbox/ui/pom.xml
trunk/sandbox/ui/scrollable-grid/
Log:
TreeModel components initial import
Modified: trunk/sandbox/samples/pom.xml
===================================================================
--- trunk/sandbox/samples/pom.xml 2007-07-30 13:21:11 UTC (rev 1920)
+++ trunk/sandbox/samples/pom.xml 2007-07-30 13:32:06 UTC (rev 1921)
@@ -18,5 +18,6 @@
<module>panel2-sample</module>
<module>simpleTogglePanel2-sample</module>
<module>rich-message-demo </module>
+ <module>treeModelDemo</module>
</modules>
</project>
\ No newline at end of file
Property changes on: trunk/sandbox/samples/treeModelDemo
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
target
Added: trunk/sandbox/samples/treeModelDemo/pom.xml
===================================================================
--- trunk/sandbox/samples/treeModelDemo/pom.xml (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/pom.xml 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,26 @@
+<?xml version="1.0"?><project>
+ <parent>
+ <artifactId>samples</artifactId>
+ <groupId>org.richfaces.sandbox</groupId>
+ <version>3.1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>treeModelDemo</artifactId>
+ <packaging>war</packaging>
+ <name>Tree Model Maven Webapp</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.sandbox.ui</groupId>
+ <artifactId>treeModel</artifactId>
+ <version>3.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>tree</artifactId>
+ <version>3.1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>treeModelDemo</finalName>
+ </build>
+</project>
\ No newline at end of file
Added: trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/TreeModelBean.java
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/TreeModelBean.java (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/TreeModelBean.java 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,18 @@
+/**
+ *
+ */
+package org.richfaces;
+
+import org.richfaces.component.UITree;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 25.07.2007
+ *
+ */
+public class TreeModelBean {
+ public Boolean adviseNodeOpened(UITree tree) {
+ return Boolean.TRUE;
+ }
+}
Added: trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Class.java
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Class.java (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Class.java 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,14 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 25.07.2007
+ *
+ */
+public class Class extends Entry {
+}
Added: trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Directory.java
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Directory.java (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Directory.java 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,44 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 24.07.2007
+ *
+ */
+public class Directory extends Entry {
+ private List directories = new ArrayList();
+ private List files = new ArrayList();;
+
+ public List getDirectories() {
+ return directories;
+ }
+
+ public void setDirectories(List directories) {
+ this.directories = directories;
+ }
+
+ public List getFiles() {
+ return files;
+ }
+
+ public void setFiles(List files) {
+ this.files = files;
+ }
+
+ public void addDir(Directory directory) {
+ this.directories.add(directory);
+ directory.setParent(this);
+ }
+
+ public void addFile(File file) {
+ this.files.add(file);
+ file.setParent(this);
+ }
+}
Added: trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Entry.java
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Entry.java (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Entry.java 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,54 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 29.07.2007
+ *
+ */
+public class Entry {
+ private String name;
+ private Entry parent;
+
+ public String getPath() {
+ StringBuffer result = new StringBuffer();
+
+ Entry parent = getParent();
+ if (parent != null) {
+ result.append(parent.getPath());
+ result.append(" -> ");
+ }
+
+ result.append(this.toString());
+
+ return result.toString();
+ }
+
+ public String toString() {
+ return this.getClass().getSimpleName() + "[" + name + "]";
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Entry getParent() {
+ return parent;
+ }
+
+ public void setParent(Entry parent) {
+ this.parent = parent;
+ }
+
+ public void click() {
+ System.out.println("Entry.click() " + getPath());
+ }
+}
Added: trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/File.java
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/File.java (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/File.java 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,13 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 25.07.2007
+ *
+ */
+public class File extends Entry {
+}
Added: trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Package.java
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Package.java (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Package.java 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,30 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 25.07.2007
+ *
+ */
+public class Package extends Entry {
+ private List classes = new ArrayList();
+
+ public List getClasses() {
+ return classes;
+ }
+
+ public void setClasses(List classes) {
+ this.classes = classes;
+ }
+
+ public void addClass(Class clazz) {
+ this.classes.add(clazz);
+ clazz.setParent(this);
+ }
+}
Added: trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Project.java
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Project.java (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/Project.java 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,45 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 24.07.2007
+ *
+ */
+public class Project extends Entry {
+ private List srcDirs = new ArrayList();
+
+ public List getSrcDirs() {
+ return srcDirs;
+ }
+
+ public void setSrcDirs(List srcDirs) {
+ this.srcDirs = srcDirs;
+ }
+
+ public void addSrcDir(SourceDirectory directory) {
+ this.srcDirs.add(directory);
+ directory.setParent(this);
+ }
+
+ public void addDir(Directory directory) {
+ this.dirs.add(directory);
+ directory.setParent(this);
+ }
+
+ private List dirs = new ArrayList();
+
+ public List getDirs() {
+ return dirs;
+ }
+
+ public void setDirs(List dirs) {
+ this.dirs = dirs;
+ }
+}
Added: trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/SourceDirectory.java
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/SourceDirectory.java (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/model/SourceDirectory.java 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,30 @@
+/**
+ *
+ */
+package org.richfaces.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Nick Belaevski
+ * mailto:nbelaevski@exadel.com
+ * created 24.07.2007
+ *
+ */
+public class SourceDirectory extends Directory {
+ private List packages = new ArrayList();
+
+ public List getPackages() {
+ return packages;
+ }
+
+ public void setPackages(List packages) {
+ this.packages = packages;
+ }
+
+ public void addPackage(Package pkg) {
+ this.packages.add(pkg);
+ pkg.setParent(this);
+ }
+}
Added: trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/service/Loader.java
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/service/Loader.java (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/src/main/java/org/richfaces/service/Loader.java 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,53 @@
+/**
+ *
+ */
+package org.richfaces.service;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.FacesException;
+
+import org.apache.commons.digester.Digester;
+import org.apache.commons.digester.xmlrules.DigesterLoader;
+import org.xml.sax.SAXException;
+
+/**
+ * @author Nick Belaevski mailto:nbelaevski@exadel.com created 25.07.2007
+ *
+ */
+public class Loader {
+ private List projects;
+
+ public synchronized List getProjects() {
+ if (projects == null) {
+ projects = Loader.load();
+ }
+ return projects;
+ }
+
+ private static List load() throws FacesException {
+ URL url = Loader.class.getResource("tree-model-rules.xml");
+ Digester digester = DigesterLoader.createDigester(url);
+ List list = new ArrayList();
+ digester.push(list);
+ InputStream stream = Loader.class.getResourceAsStream("/org/richfaces/model/tree-model-data.xml");
+ try {
+ digester.parse(stream);
+ return list;
+ } catch (IOException e) {
+ throw new FacesException(e.getMessage(), e);
+ } catch (SAXException e) {
+ throw new FacesException(e.getMessage(), e);
+ } finally {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ throw new FacesException(e.getMessage(), e);
+ }
+ }
+ }
+}
Added: trunk/sandbox/samples/treeModelDemo/src/main/resources/org/richfaces/model/tree-model-data.xml
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/main/resources/org/richfaces/model/tree-model-data.xml (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/src/main/resources/org/richfaces/model/tree-model-data.xml 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<root>
+ <project name="ajax4jsf">
+ <sourceDirectory name="src/main/java">
+ <package name="org.ajax4jsf">
+ <class name="FastFilter.java" />
+ <class name="Filter.java" />
+ </package>
+ <package name="org.ajax4jsf.component">
+ <class name="UIDataAdaptor.java" />
+ <class name="AjaxActionComponent.java" />
+ </package>
+ <package name="org.ajax4jsf.renderkit">
+ <class name="AjaxChildrenRenderer.java" />
+ <class name="AjaxComponentRendererBase.java" />
+ </package>
+ </sourceDirectory>
+ <sourceDirectory name="src/main/resources">
+ <package name="org.ajax4jsf">
+ </package>
+ <package name="org.ajax4jsf.javascript">
+ </package>
+ </sourceDirectory>
+ </project>
+
+ <project name="richfaces">
+ <sourceDirectory name="src/main/java">
+ <package name="org.richfaces">
+ </package>
+ <package name="org.richfaces.component">
+ </package>
+ <package name="org.richfaces.model">
+ </package>
+ </sourceDirectory>
+ <sourceDirectory name="src/main/resources">
+ <package name="org.richfaces">
+ </package>
+ <package name="org.richfaces.renderkit">
+ </package>
+ </sourceDirectory>
+ <sourceDirectory name="target/generated/java">
+ <package name="org.richfaces">
+ </package>
+ <package name="org.richfaces.component">
+ </package>
+ <package name="org.richfaces.renderkit">
+ </package>
+ </sourceDirectory>
+ <directory name="design">
+ <directory name="funcspec">
+ <file name="FunctionalSpecification-1.0.doc" />
+ <file name="Requirements-1.0.doc" />
+ </directory>
+ </directory>
+ <directory name="src">
+ <directory name="main">
+ <directory name="config">
+ <directory name="org">
+ <directory name="richfaces">
+ <directory name="component">
+ <file name="tree.config.xml" />
+ <file name="treeNode.config.xml" />
+ </directory>
+ </directory>
+ </directory>
+ </directory>
+ <directory name="templates"></directory>
+ </directory>
+ <directory name="test"></directory>
+ </directory>
+ <directory name="target">
+ <directory name="generated-component">
+ </directory>
+ <directory name="surefire-reports">
+ <file name="org.richfaces.JSFComponentTest.txt" />
+ <file name="TEST-ComponentTest.xml" />
+ </directory>
+ <file name="richfaces-3.1.0-snapshot" />
+ <file name="richfaces-3.1.0-sources" />
+ <file name="richfaces-3.1.0-javadoc" />
+ </directory>
+ </project>
+</root>
\ No newline at end of file
Added: trunk/sandbox/samples/treeModelDemo/src/main/resources/org/richfaces/service/digester-rules.dtd
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/main/resources/org/richfaces/service/digester-rules.dtd (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/src/main/resources/org/richfaces/service/digester-rules.dtd 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!--
+ "Digester" component of the Jakarta Commons Subproject
+ DTD for the definition of Digester rules in XML.
+ $Id: digester-rules.dtd,v 1.8 2003/03/27 18:54:45 rdonkin Exp $
+-->
+
+<!-- This document type defines an XML format for defining Digester rules.
+ Digester is a framework for pattern-matching-based parsing of XML into
+ Java objects. See http://jakarta.apache.org/commons/digester.html. -->
+
+<!ENTITY % rule-elements "bean-property-setter-rule | call-method-rule | call-param-rule |
+ factory-create-rule | object-create-rule |
+ set-properties-rule | set-property-rule | set-top-rule |
+ set-next-rule" >
+
+<!-- digester-rules is the root element. -->
+<!ELEMENT digester-rules (pattern | include | bean-property-setter-rule | call-method-rule | call-param-rule | factory-create-rule | object-create-rule | set-properties-rule | set-property-rule | set-top-rule | set-next-rule )*>
+
+
+<!-- <pattern> defines a matching pattern, or part of a matching pattern. Any
+ rule nested in a pattern element prepends its parent's to its pattern.
+ Patterns may be recursively nested.
+ Example:
+ <pattern value="foo">
+ <pattern value="bar">
+ <object-create-rule pattern="baz" classname="Fubar" />
+ </pattern>
+ </pattern>
+
+ The above sample fragment defines an ObjectCreateRule associated
+ with the pattern "foo/bar/baz".
+
+ Note that the use of pattern elements is optional; an alternative is for
+ each rule element to contain a 'pattern' attribute. -->
+<!ELEMENT pattern (pattern | include | bean-property-setter-rule | call-method-rule | call-param-rule |
+ factory-create-rule | object-create-rule |
+ set-properties-rule | set-property-rule | set-top-rule |
+ set-next-rule )*>
+<!ATTLIST pattern
+ value CDATA #REQUIRED>
+
+
+<!--
+ <include> allows one set of digester rules to be included inside
+ another. The 'path' attribute contains the URI of the document to
+ include. Inclusion behaves as if the included rules document is
+ 'macro-expanded' within the outer document.
+ Programmatically initialized rules can be included as well, via the
+ 'class' attribute. The 'class' attribute should contain the name
+ of a class that implements
+ org.apache.commons.digester.xmlrules.DigesterRulesSource.
+-->
+<!ELEMENT include EMPTY>
+<!ATTLIST include
+ path CDATA #IMPLIED
+ class CDATA #IMPLIED>
+
+
+<!-- Each 'rule' element below corresponds to a concrete subclass
+ of org.apache.framework.digester.Rule.
+ Each 'rule' element has an optional 'pattern' attribute, which
+ defines the pattern for that rule instance. If the rule element
+ is nested inside one or more <pattern> elements, those patterns
+ will be prepended to the pattern specified in the rule's 'pattern'
+ attribute. -->
+
+<!-- Bean Property Setter Rule -->
+<!ELEMENT bean-property-setter-rule EMPTY>
+<!ATTLIST bean-property-setter-rule
+ pattern CDATA #IMPLIED
+ propertyname CDATA #IMPLIED>
+
+<!-- CallMethodRule -->
+<!ELEMENT call-method-rule EMPTY>
+<!ATTLIST call-method-rule
+ pattern CDATA #IMPLIED
+ methodname CDATA #REQUIRED
+ paramcount CDATA #IMPLIED
+ paramtypes CDATA #IMPLIED>
+
+<!--
+ CallParamRule
+ attrname - set param from attribute value (cannot be combined with from-stack)
+ from-stack - set param from stack (cannot be combined with attrname)
+ -->
+<!ELEMENT call-param-rule EMPTY>
+<!ATTLIST call-param-rule
+ pattern CDATA #IMPLIED
+ paramnumber CDATA #REQUIRED
+ attrname CDATA #IMPLIED
+ from-stack CDATA #IMPLIED>
+
+<!--
+ FactoryCreateRule
+
+ ignore-exceptions - if this attribute is (ignore case) 'true' then any exceptions
+ thrown by the object create rule will be ignore.
+ This will allow processing to continue.
+ -->
+<!ELEMENT factory-create-rule EMPTY>
+<!ATTLIST factory-create-rule
+ pattern CDATA #IMPLIED
+ classname CDATA #REQUIRED
+ attrname CDATA #IMPLIED
+ ignore-exceptions CDATA #IMPLIED>
+
+<!-- ObjectCreateRule -->
+<!ELEMENT object-create-rule EMPTY>
+<!ATTLIST object-create-rule
+ pattern CDATA #IMPLIED
+ classname CDATA #REQUIRED
+ attrname CDATA #IMPLIED>
+
+<!-- SetPropertiesRule -->
+<!ELEMENT set-properties-rule (alias)*>
+<!ATTLIST factory-create-rule
+ pattern CDATA #IMPLIED>
+
+<!-- An alias is a custom attribute->property name mapping -->
+<!ELEMENT alias EMPTY>
+<!ATTLIST alias
+ attr-name CDATA #REQUIRED
+ prop-name CDATA #IMPLIED>
+
+<!-- SetPropertyRule -->
+<!ELEMENT set-property-rule EMPTY>
+<!ATTLIST set-property-rule
+ pattern CDATA #IMPLIED
+ name CDATA #IMPLIED
+ value CDATA #IMPLIED>
+
+<!-- SetTopRule -->
+<!ELEMENT set-top-rule EMPTY>
+<!ATTLIST set-top-rule
+ pattern CDATA #IMPLIED
+ methodname CDATA #REQUIRED
+ paramtype CDATA #IMPLIED>
+
+<!-- SetNextRule -->
+<!ELEMENT set-next-rule EMPTY>
+<!ATTLIST set-next-rule
+ pattern CDATA #IMPLIED
+ methodname CDATA #REQUIRED
+ paramtype CDATA #IMPLIED>
Added: trunk/sandbox/samples/treeModelDemo/src/main/resources/org/richfaces/service/tree-model-rules.xml
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/main/resources/org/richfaces/service/tree-model-rules.xml (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/src/main/resources/org/richfaces/service/tree-model-rules.xml 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+<!DOCTYPE digester-rules SYSTEM "digester-rules.dtd">
+ -->
+
+<digester-rules>
+ <pattern value="*/project">
+ <object-create-rule classname="org.richfaces.model.Project" />
+ <set-next-rule methodname="add" />
+ <set-properties-rule>
+ <alias attr-name="name" prop-name="name" />
+ </set-properties-rule>
+ </pattern>
+
+ <pattern value="*/sourceDirectory">
+ <object-create-rule classname="org.richfaces.model.SourceDirectory" />
+ <set-next-rule methodname="addSrcDir" />
+ <set-properties-rule>
+ <alias attr-name="name" prop-name="name" />
+ </set-properties-rule>
+ </pattern>
+
+ <pattern value="*/directory">
+ <object-create-rule classname="org.richfaces.model.Directory" />
+ <set-next-rule methodname="addDir" />
+ <set-properties-rule>
+ <alias attr-name="name" prop-name="name" />
+ </set-properties-rule>
+ </pattern>
+
+ <pattern value="*/file">
+ <object-create-rule classname="org.richfaces.model.File" />
+ <set-next-rule methodname="addFile" />
+ <set-properties-rule>
+ <alias attr-name="name" prop-name="name" />
+ </set-properties-rule>
+ </pattern>
+
+ <pattern value="*/package">
+ <object-create-rule classname="org.richfaces.model.Package" />
+ <set-next-rule methodname="addPackage" />
+ <set-properties-rule>
+ <alias attr-name="name" prop-name="name" />
+ </set-properties-rule>
+ </pattern>
+
+ <pattern value="*/class">
+ <object-create-rule classname="org.richfaces.model.Class" />
+ <set-next-rule methodname="addClass" />
+ <set-properties-rule>
+ <alias attr-name="name" prop-name="name" />
+ </set-properties-rule>
+ </pattern>
+</digester-rules>
\ No newline at end of file
Added: trunk/sandbox/samples/treeModelDemo/src/main/webapp/META-INF/MANIFEST.MF
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/main/webapp/META-INF/MANIFEST.MF (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/src/main/webapp/META-INF/MANIFEST.MF 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+
Added: trunk/sandbox/samples/treeModelDemo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/main/webapp/WEB-INF/faces-config.xml (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/src/main/webapp/WEB-INF/faces-config.xml 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
+<faces-config>
+
+ <managed-bean>
+ <managed-bean-name>treeModelBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.TreeModelBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>loaderBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.service.Loader</managed-bean-class>
+ <managed-bean-scope>application</managed-bean-scope>
+ </managed-bean>
+</faces-config>
Added: trunk/sandbox/samples/treeModelDemo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/src/main/webapp/WEB-INF/web.xml 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <display-name>Archetype Created Web Application</display-name>
+ <!-- context-param>
+ <param-name>javax.faces.CONFIG_FILES</param-name>
+ <param-value>/WEB-INF/faces-config.xml</param-value>
+ </context-param-->
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
+ <param-value>false</param-value>
+ </context-param>
+ <!--
+ -->
+ <filter>
+ <display-name>Ajax4jsf Filter</display-name>
+ <filter-name>ajax4jsf</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>ajax4jsf</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ </filter-mapping>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
+</web-app>
Added: trunk/sandbox/samples/treeModelDemo/src/main/webapp/index.jsp
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/main/webapp/index.jsp (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/src/main/webapp/index.jsp 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,11 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+
+<html>
+
+<head></head>
+
+ <body>
+ <jsp:forward page="/pages/index.jsf" />
+ </body>
+
+</html>
\ No newline at end of file
Added: trunk/sandbox/samples/treeModelDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/main/webapp/pages/index.jsp (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/src/main/webapp/pages/index.jsp 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,79 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
+
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/ui/treeModel" prefix="model" %>
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/tree" prefix="tree" %>
+
+<html>
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+ <tree:tree adviseNodeOpened="#{treeModelBean.adviseNodeOpened}" switchType="client">
+ <model:treeNodes id="project" nodes="#{loaderBean.projects}" var="project">
+ <tree:treeNode>
+ <h:commandLink action="#{project.click}" value="Project: #{project.name}" />
+ </tree:treeNode>
+
+ <model:treeNodes id="srcDir" var="srcDir" nodes="#{project.srcDirs}">
+ <tree:treeNode>
+ <h:commandLink action="#{srcDir.click}" value="Source directory: #{srcDir.name}" />
+ </tree:treeNode>
+
+ <model:treeNodes id="pkg" var="pkg" nodes="#{srcDir.packages}">
+ <tree:treeNode>
+ <h:commandLink action="#{pkg.click}" value="Package: #{pkg.name}" />
+ </tree:treeNode>
+
+ <model:treeNodes id="class" var="class" nodes="#{pkg.classes}">
+ <tree:treeNode>
+ <h:commandLink action="#{class.click}" value="Class: #{class.name}" />
+ </tree:treeNode>
+ </model:treeNodes>
+ </model:treeNodes>
+
+ <model:treeNodes id="pkg1" var="pkg" nodes="#{srcDir.packages}">
+ <tree:treeNode>
+ <h:commandLink action="#{pkg.click}" value="Package1: #{pkg.name}" />
+ </tree:treeNode>
+
+ <model:treeNodes id="class1" var="class" nodes="#{pkg.classes}">
+ <tree:treeNode>
+ <h:commandLink action="#{class.click}" value="Class1: #{class.name}" />
+ </tree:treeNode>
+ </model:treeNodes>
+ </model:treeNodes>
+ </model:treeNodes>
+
+ <model:recursiveTreeNodes id="dir" var="dir"
+ root="#{project.dirs}" nodes="#{dir.directories}">
+ <tree:treeNode>
+ <h:commandLink action="#{dir.click}" value="Directory: #{dir.name}" />
+ </tree:treeNode>
+
+ <model:treeNodes id="file" var="file" nodes="#{dir.files}">
+ <tree:treeNode>
+ <h:commandLink action="#{file.click}" value="File: #{file.name}" />
+ </tree:treeNode>
+ </model:treeNodes>
+
+ <model:treeNodes id="file1" var="file" nodes="#{dir.files}">
+ <tree:treeNode>
+ <h:commandLink action="#{file.click}" value="File1: #{file.name}" />
+ </tree:treeNode>
+ </model:treeNodes>
+ </model:recursiveTreeNodes>
+
+ <%--model:treeNodes var="file" nodes="#{proj.dir.files}">
+ <tree:treeNode>
+ <h:outputText value="File: #{file.name}" />
+ </tree:treeNode>
+ </model:treeNodes--%>
+ </model:treeNodes>
+ </tree:tree>
+ </h:form>
+ </f:view>
+ </body>
+</html>
Added: trunk/sandbox/samples/treeModelDemo/src/main/webapp/pages/index.xhtml
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/main/webapp/pages/index.xhtml (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/src/main/webapp/pages/index.xhtml 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,12 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
+ >
+ <f:view>
+
+ </f:view>
+</html>
\ No newline at end of file
Added: trunk/sandbox/samples/treeModelDemo/src/test/java/org/richfaces/BeanTest.java
===================================================================
--- trunk/sandbox/samples/treeModelDemo/src/test/java/org/richfaces/BeanTest.java (rev 0)
+++ trunk/sandbox/samples/treeModelDemo/src/test/java/org/richfaces/BeanTest.java 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,46 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+*/
+public class BeanTest
+ extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public BeanTest( String testName )
+ {
+ super( testName );
+ }
+
+ public void testStub() throws Exception {
+
+ }
+}
Modified: trunk/sandbox/ui/pom.xml
===================================================================
--- trunk/sandbox/ui/pom.xml 2007-07-30 13:21:11 UTC (rev 1920)
+++ trunk/sandbox/ui/pom.xml 2007-07-30 13:32:06 UTC (rev 1921)
@@ -17,5 +17,6 @@
<module>scrollable-grid</module>
<module>simpleTogglePanel2</module>
<module>message</module>
+ <module>treeModel</module>
</modules>
</project>
\ No newline at end of file
Property changes on: trunk/sandbox/ui/scrollable-grid
___________________________________________________________________
Name: svn:ignore
- target
+ target
.classpath
.project
.settings
bin
Property changes on: trunk/sandbox/ui/treeModel
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
target
Added: trunk/sandbox/ui/treeModel/pom.xml
===================================================================
--- trunk/sandbox/ui/treeModel/pom.xml (rev 0)
+++ trunk/sandbox/ui/treeModel/pom.xml 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>ui</artifactId>
+ <groupId>org.richfaces.sandbox</groupId>
+ <version>3.1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.sandbox.ui</groupId>
+ <artifactId>treeModel</artifactId>
+ <name>Tree Model</name>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>3.1.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>generate-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>generate-tests</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <library>
+ <prefix>org.richfaces</prefix>
+ <taglib>
+ <shortName>tree-model</shortName>
+ </taglib>
+ </library>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-impl</artifactId>
+ <version>3.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>tree</artifactId>
+ <version>3.1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
+
Added: trunk/sandbox/ui/treeModel/src/main/config/component/README
===================================================================
Added: trunk/sandbox/ui/treeModel/src/main/config/component/recursiveTreeNodes.xml
===================================================================
--- trunk/sandbox/ui/treeModel/src/main/config/component/recursiveTreeNodes.xml (rev 0)
+++ trunk/sandbox/ui/treeModel/src/main/config/component/recursiveTreeNodes.xml 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "https://ajax4jsf.dev.java.net/nonav/dtds/component-config.dtd" >
+<components>
+ <component>
+ <name>org.richfaces.RecursiveTreeNodes</name>
+ <family>org.richfaces.RecursiveTreeNodes</family>
+ <classname>org.richfaces.component.html.HtmlRecursiveTreeNodes</classname>
+ <superclass>org.richfaces.component.UIRecursiveTreeNodes</superclass>
+ <description>
+ <![CDATA[
+ ]]>
+ </description>
+ <!-- renderer generate="true" override="true">
+ <name>org.richfaces.RecursiveTreeNodesRenderer</name>
+ <template>org/richfaces/htmlRecursiveTreeNodes.jspx</template>
+ </renderer -->
+ <tag>
+ <name>recursiveTreeNodes</name>
+ <classname>org.richfaces.taglib.RecursiveTreeNodesTag</classname>
+ <superclass>
+ org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
+ </superclass>
+ </tag>
+ <!--
+ <taghandler>
+ <classname>org.ajax4jsf.tag.TestHandler</classname>
+ </taghandler>
+ -->
+ &ui_component_attributes;
+ <!--
+ <property>
+ <name>param</name>
+ <classname>java.lang.String</classname>
+ <description>
+ </description>
+ <defaultvalue>"default"</defaultvalue>
+ </property>
+ -->
+ <property>
+ <name>var</name>
+ <classname>java.lang.String</classname>
+ <description>
+ </description>
+ </property>
+ <property elonly="true">
+ <name>nodes</name>
+ <classname>java.lang.Object</classname>
+ <description>
+ </description>
+ </property>
+ <property elonly="true">
+ <name>root</name>
+ <classname>java.lang.Object</classname>
+ <description>
+ </description>
+ </property>
+ </component>
+</components>
Added: trunk/sandbox/ui/treeModel/src/main/config/component/treeNodes.xml
===================================================================
--- trunk/sandbox/ui/treeModel/src/main/config/component/treeNodes.xml (rev 0)
+++ trunk/sandbox/ui/treeModel/src/main/config/component/treeNodes.xml 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "https://ajax4jsf.dev.java.net/nonav/dtds/component-config.dtd" >
+<components>
+ <component>
+ <name>org.richfaces.TreeNodes</name>
+ <family>org.richfaces.TreeNodes</family>
+ <classname>org.richfaces.component.html.HtmlTreeNodes</classname>
+ <superclass>org.richfaces.component.UITreeNodes</superclass>
+ <description>
+ <![CDATA[
+ ]]>
+ </description>
+ <!-- renderer generate="false" override="true">
+ <name>org.richfaces.TreeNodesRenderer</name>
+ <template>org/richfaces/htmlTreeNodes.jspx</template>
+ </renderer -->
+ <tag>
+ <name>treeNodes</name>
+ <classname>org.richfaces.taglib.TreeNodesTag</classname>
+ <superclass>
+ org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
+ </superclass>
+ </tag>
+ <!--
+ <taghandler>
+ <classname>org.ajax4jsf.tag.TestHandler</classname>
+ </taghandler>
+ -->
+ &ui_component_attributes;
+ <!--
+ <property>
+ <name>param</name>
+ <classname>java.lang.String</classname>
+ <description>
+ </description>
+ <defaultvalue>"default"</defaultvalue>
+ </property>
+ -->
+ <property>
+ <name>var</name>
+ <classname>java.lang.String</classname>
+ <description>
+ </description>
+ </property>
+ <property elonly="true">
+ <name>nodes</name>
+ <classname>java.lang.Object</classname>
+ <description>
+ </description>
+ </property>
+ </component>
+</components>
Added: trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/component/README
===================================================================
Added: trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/component/UIRecursiveTreeNodes.java
===================================================================
--- trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/component/UIRecursiveTreeNodes.java (rev 0)
+++ trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/component/UIRecursiveTreeNodes.java 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,144 @@
+/**
+ *
+ */
+
+package org.richfaces.component;
+
+import java.io.IOException;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.model.DataVisitor;
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.model.Range;
+import org.richfaces.model.LastAwareArrayDataModel;
+import org.richfaces.model.StackingTreeModel;
+import org.richfaces.model.StackingTreeModelProvider;
+
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UIRecursiveTreeNodes extends StackingTreeModelProvider {
+
+ private static final String COMPONENT_TYPE = "org.richfaces.RecursiveTreeNodes";
+
+ private static final String COMPONENT_FAMILY = "org.richfaces.RecursiveTreeNodes";
+
+ public abstract Object getRoot();
+ public abstract void setRoot(Object root);
+
+ public Object[] getRoots() {
+ List nodes = (List) getRoot();
+ Object[] roots;
+ if (nodes != null) {
+ roots = nodes.toArray();
+ } else {
+ roots = new Object[0];
+ }
+ return roots;
+ }
+
+ protected StackingTreeModel createStackingTreeModel() {
+ StackingTreeModel treeModel = new StackingTreeModel(getId()) {
+
+ private Object varObject;
+
+ public void walk(FacesContext context, DataVisitor dataVisitor,
+ Range range, Object rowKey, Object argument, boolean last)
+ throws IOException {
+
+ Object var = getAttributes().get("var");
+ Map map = context.getExternalContext().getRequestMap();
+ Object varObject = map.get(var);
+
+ super.walk(context, dataVisitor, range, rowKey, argument, last);
+
+ map.put(var, varObject);
+ }
+
+ public void setupModel(Object object) {
+ super.setupModel(object);
+ Object var = getAttributes().get("var");
+
+ Map map = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+ varObject = map.get(var);
+ map.put(var, object);
+ componentSelected(UIRecursiveTreeNodes.this);
+ }
+
+ public void leaveModel() {
+ super.leaveModel();
+ Object var = getAttributes().get("var");
+
+ Map map = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+ map.put(var, varObject);
+ }
+
+ public ExtendedDataModel getDataModel() {
+ return new LastAwareArrayDataModel(getRoots());
+ }
+
+ public Map getModels() {
+ LinkedHashMap models = new LinkedHashMap();
+ models.putAll(super.getModels());
+ StackingTreeModel model = new StackingTreeModel(getId()) {
+
+ private Object varObject;
+
+ public void walk(FacesContext context, DataVisitor dataVisitor,
+ Range range, Object rowKey, Object argument, boolean last)
+ throws IOException {
+
+ Object var = getAttributes().get("var");
+ Map map = context.getExternalContext().getRequestMap();
+ Object varObject = map.get(var);
+
+ super.walk(context, dataVisitor, range, rowKey, argument, last);
+
+ map.put(var, varObject);
+ }
+
+ public void setupModel(Object object) {
+ super.setupModel(object);
+ Object var = getAttributes().get("var");
+
+ Map map = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+ varObject = map.get(var);
+ map.put(var, object);
+ componentSelected(UIRecursiveTreeNodes.this);
+ }
+
+ public void leaveModel() {
+ super.leaveModel();
+ Object var = getAttributes().get("var");
+
+ Map map = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+ map.put(var, varObject);
+ }
+
+ public ExtendedDataModel getDataModel() {
+ return new LastAwareArrayDataModel(getData());
+ }
+
+ public Map getModels() {
+ LinkedHashMap models = new LinkedHashMap();
+ models.putAll(this.parent.getModels());
+
+ return models;
+ }
+ };
+ model.setParent(this);
+ models.put(getId(), model);
+
+ return models;
+ }
+ };
+
+ return treeModel;
+ }
+}
Added: trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/component/UITreeNodes.java
===================================================================
--- trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/component/UITreeNodes.java (rev 0)
+++ trunk/sandbox/ui/treeModel/src/main/java/org/richfaces/component/UITreeNodes.java 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,43 @@
+/**
+ *
+ */
+
+package org.richfaces.component;
+
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.model.ExtendedDataModel;
+import org.richfaces.model.LastAwareArrayDataModel;
+import org.richfaces.model.StackingTreeModel;
+import org.richfaces.model.StackingTreeModelProvider;
+
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UITreeNodes extends StackingTreeModelProvider {
+
+ private static final String COMPONENT_TYPE = "org.richfaces.TreeNodes";
+
+ private static final String COMPONENT_FAMILY = "org.richfaces.TreeNodes";
+
+ protected StackingTreeModel createStackingTreeModel() {
+ StackingTreeModel treeModel = new StackingTreeModel(getId()) {
+ public void setupModel(Object object) {
+ super.setupModel(object);
+ Map map = FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+ map.put(getAttributes().get("var"), object);
+ componentSelected(UITreeNodes.this);
+ }
+
+ public ExtendedDataModel getDataModel() {
+ return new LastAwareArrayDataModel(getData());
+ }
+ };
+
+ return treeModel;
+ }
+}
Added: trunk/sandbox/ui/treeModel/src/main/templates/README
===================================================================
Added: trunk/sandbox/ui/treeModel/src/main/templates/org/richfaces/htmlRecursiveTreeNodes.jspx
===================================================================
--- trunk/sandbox/ui/treeModel/src/main/templates/org/richfaces/htmlRecursiveTreeNodes.jspx (rev 0)
+++ trunk/sandbox/ui/treeModel/src/main/templates/org/richfaces/htmlRecursiveTreeNodes.jspx 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+ xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c=" http://java.sun.com/jsf/core"
+ xmlns:ui=" http://ajax4jsf.org/cdk/ui"
+ xmlns:u=" http://ajax4jsf.org/cdk/u"
+ xmlns:x=" http://ajax4jsf.org/cdk/x"
+ class="org.richfaces.renderkit.html.RecursiveTreeNodesRenderer"
+ baseclass="org.ajax4jsf.framework.renderer.AjaxComponentRendererBase"
+ component="org.richfaces.component.UIRecursiveTreeNodes"
+ >
+ <f:clientid var="clientId"/>
+ <div id="#{clientId}"
+ x:passThruWithExclusions="value,name,type,id"
+ >
+ </div>
+</f:root>
\ No newline at end of file
Added: trunk/sandbox/ui/treeModel/src/main/templates/org/richfaces/htmlTreeNodes.jspx
===================================================================
--- trunk/sandbox/ui/treeModel/src/main/templates/org/richfaces/htmlTreeNodes.jspx (rev 0)
+++ trunk/sandbox/ui/treeModel/src/main/templates/org/richfaces/htmlTreeNodes.jspx 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+ xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c=" http://java.sun.com/jsf/core"
+ xmlns:ui=" http://ajax4jsf.org/cdk/ui"
+ xmlns:u=" http://ajax4jsf.org/cdk/u"
+ xmlns:x=" http://ajax4jsf.org/cdk/x"
+ class="org.richfaces.renderkit.html.TreeNodesRenderer"
+ baseclass="org.ajax4jsf.framework.renderer.AjaxComponentRendererBase"
+ component="org.richfaces.component.UITreeNodes"
+ >
+ <f:clientid var="clientId"/>
+ <div id="#{clientId}"
+ x:passThruWithExclusions="value,name,type,id"
+ >
+ </div>
+</f:root>
\ No newline at end of file
Added: trunk/sandbox/ui/treeModel/src/main/templates/org/richfaces/htmlTreeRecursion.jspx
===================================================================
--- trunk/sandbox/ui/treeModel/src/main/templates/org/richfaces/htmlTreeRecursion.jspx (rev 0)
+++ trunk/sandbox/ui/treeModel/src/main/templates/org/richfaces/htmlTreeRecursion.jspx 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:root
+ xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c=" http://java.sun.com/jsf/core"
+ xmlns:ui=" http://ajax4jsf.org/cdk/ui"
+ xmlns:u=" http://ajax4jsf.org/cdk/u"
+ xmlns:x=" http://ajax4jsf.org/cdk/x"
+ class="org.richfaces.renderkit.html.TreeRecursionRenderer"
+ baseclass="org.ajax4jsf.framework.renderer.AjaxComponentRendererBase"
+ component="org.richfaces.component.UITreeRecursion"
+ >
+ <f:clientid var="clientId"/>
+ <div id="#{clientId}"
+ x:passThruWithExclusions="value,name,type,id"
+ >
+ </div>
+</f:root>
\ No newline at end of file
Added: trunk/sandbox/ui/treeModel/src/test/java/org/richfaces/component/JSFComponentTest.java
===================================================================
--- trunk/sandbox/ui/treeModel/src/test/java/org/richfaces/component/JSFComponentTest.java (rev 0)
+++ trunk/sandbox/ui/treeModel/src/test/java/org/richfaces/component/JSFComponentTest.java 2007-07-30 13:32:06 UTC (rev 1921)
@@ -0,0 +1,53 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import javax.faces.component.UIComponent;
+
+/**
+ * Unit test for simple Component.
+ */
+public class JSFComponentTest
+ extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public JSFComponentTest( String testName )
+ {
+ super( testName );
+ }
+
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testComponent()
+ {
+ assertTrue( true );
+ }
+}
17 years, 4 months
JBoss Rich Faces SVN: r1920 - in trunk/ui/inputnumber-spinner/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2007-07-30 09:21:11 -0400 (Mon, 30 Jul 2007)
New Revision: 1920
Modified:
trunk/ui/inputnumber-spinner/src/main/resources/org/richfaces/renderkit/html/script/SpinnerScript.js
trunk/ui/inputnumber-spinner/src/main/templates/inputNumberSpinner.jspx
Log:
Fix "required" attribute for spinner like http://jira.jboss.com/jira/browse/RF-504
Modified: trunk/ui/inputnumber-spinner/src/main/resources/org/richfaces/renderkit/html/script/SpinnerScript.js
===================================================================
--- trunk/ui/inputnumber-spinner/src/main/resources/org/richfaces/renderkit/html/script/SpinnerScript.js 2007-07-30 12:44:17 UTC (rev 1919)
+++ trunk/ui/inputnumber-spinner/src/main/resources/org/richfaces/renderkit/html/script/SpinnerScript.js 2007-07-30 13:21:11 UTC (rev 1920)
@@ -33,6 +33,7 @@
this.max = null;
this.min = null;
this.delta = null;
+ this.required = options.required;
this._attachBehaviors();
this._load();
@@ -158,7 +159,7 @@
this.edit = $ (edit);
this.originalColor = edit.style.color;
- this.prevEditValue = (this.edit.value || this.spinner.min);
+ this.prevEditValue = (this.edit.value || !this.spinner.required) ? this.edit.value : this.spinner.min;
this.edit.value = this.prevEditValue;
this.previousMU = window.document.onmouseup;
this.previousMM = window.document.onmousemove;
@@ -265,14 +266,17 @@
},
inputChange: function(e) {
- if (this.edit.value == "" || isNaN(Number(this.edit.value))){
+ if ((this.edit.value == "" && this.spinner.required) || isNaN(Number(this.edit.value))){
this.edit.value = this.prevEditValue;
- } else if (this.edit.value > this.spinner.max){
- this.edit.value = this.spinner.max;
- } else if (this.edit.value < this.spinner.min) {
- this.edit.value = this.spinner.min;
+ } else if ("" != this.edit.value) {
+ if (this.edit.value > this.spinner.max){
+ this.edit.value = this.spinner.max;
+ } else if (this.edit.value < this.spinner.min) {
+ this.edit.value = this.spinner.min;
+ }
}
- this.prevEditValue = this.edit.value;
+ if ("" != this.edit.value)
+ this.prevEditValue = this.edit.value;
if (this.eventEditOnChange)
this.eventEditOnChange();
@@ -283,7 +287,8 @@
this.prevEditValue = this.edit.value;
}
if (e.keyCode == 13){
- this.edit.value = this.getValidValue(this.edit.value);
+ if (this.spinner.required || "" != this.edit.value)
+ this.edit.value = this.getValidValue(this.edit.value);
this.edit.form.submit();
}
},
Modified: trunk/ui/inputnumber-spinner/src/main/templates/inputNumberSpinner.jspx
===================================================================
--- trunk/ui/inputnumber-spinner/src/main/templates/inputNumberSpinner.jspx 2007-07-30 12:44:17 UTC (rev 1919)
+++ trunk/ui/inputnumber-spinner/src/main/templates/inputNumberSpinner.jspx 2007-07-30 13:21:11 UTC (rev 1920)
@@ -102,7 +102,8 @@
cycled:#{component.attributes['cycled']},
edited:#{component.attributes['enableManualInput']},
disabled:#{component.attributes['disabled']},
- chameleon:false
+ chameleon:false,
+ required: #{component.attributes['required']}
},
{
min:#{component.attributes['minValue']},
17 years, 4 months
JBoss Rich Faces SVN: r1919 - trunk/ui/tooltip/design/funcspec.
by richfaces-svn-commits@lists.jboss.org
Author: dbiatenia
Date: 2007-07-30 08:44:17 -0400 (Mon, 30 Jul 2007)
New Revision: 1919
Modified:
trunk/ui/tooltip/design/funcspec/FuncSpec - RF Tool Tip Component.doc
Log:
onshow, onhide, oncomplete trigger names will be used now
Modified: trunk/ui/tooltip/design/funcspec/FuncSpec - RF Tool Tip Component.doc
===================================================================
(Binary files differ)
17 years, 4 months
JBoss Rich Faces SVN: r1918 - trunk/docs/userguide/en/src/main/docbook/modules.
by richfaces-svn-commits@lists.jboss.org
Author: vkorluzhenko
Date: 2007-07-30 07:28:11 -0400 (Mon, 30 Jul 2007)
New Revision: 1918
Modified:
trunk/docs/userguide/en/src/main/docbook/modules/RFCfaq.xml
Log:
http://jira.jboss.com/jira/browse/RF-507
Modified: trunk/docs/userguide/en/src/main/docbook/modules/RFCfaq.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/modules/RFCfaq.xml 2007-07-30 11:15:10 UTC (rev 1917)
+++ trunk/docs/userguide/en/src/main/docbook/modules/RFCfaq.xml 2007-07-30 11:28:11 UTC (rev 1918)
@@ -44,8 +44,8 @@
<section>
<?dbhtml filename="HowtobuildRichFacessnapshotmanually.html"?>
<title>How to build RichFaces snapshot manually?</title>
- <para>As it was mentioned <ulink url="index.html#Wherearethesnapshots">
- before</ulink> you can download the snapshots or you can build them
+ <para>As it was mentioned <link linkend="Wherearethesnapshots">
+ before</link> you can download the snapshots or you can build them
manually. This <ulink
url="http://labs.jboss.com/wiki/HowToBuildRichFacesSnapshotManually"
> wiki article</ulink> helps you.</para>
17 years, 4 months