JBoss Rich Faces SVN: r20095 - trunk/ui/iteration/ui/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-11-18 11:21:47 -0500 (Thu, 18 Nov 2010)
New Revision: 20095
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
Log:
Checkstyle error fixed
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-11-18 16:20:00 UTC (rev 20094)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-11-18 16:21:47 UTC (rev 20095)
@@ -51,8 +51,6 @@
import org.richfaces.convert.SequenceRowKeyConverter;
import org.richfaces.event.TreeSelectionEvent;
import org.richfaces.event.TreeSelectionListener;
-import org.richfaces.log.Logger;
-import org.richfaces.log.RichfacesLogger;
import org.richfaces.model.ExtendedTreeDataModelImpl;
import org.richfaces.model.SwingTreeNodeDataModelImpl;
import org.richfaces.model.TreeDataModel;
14 years, 2 months
JBoss Rich Faces SVN: r20094 - in trunk/ui/iteration/ui/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-11-18 11:20:00 -0500 (Thu, 18 Nov 2010)
New Revision: 20094
Modified:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml
Log:
https://jira.jboss.org/browse/RF-9715
Modified: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-11-18 16:17:55 UTC (rev 20093)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-11-18 16:20:00 UTC (rev 20094)
@@ -67,8 +67,8 @@
});
},
- __getHandles: function() {
- return this.__rootElt.find(" > .rf-trn:first > .rf-trn-hnd");
+ __getHandle: function() {
+ return this.__rootElt.find(" > .rf-trn:first > .rf-trn-hnd:first");
},
__getContent: function() {
Modified: trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml
===================================================================
--- trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml 2010-11-18 16:17:55 UTC (rev 20093)
+++ trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml 2010-11-18 16:20:00 UTC (rev 20094)
@@ -19,19 +19,11 @@
<cdk:object name="nodeState" value="#{getNodeState(facesContext)}" type="org.richfaces.renderkit.TreeNodeState" />
<div class="#{concatClasses('rf-trn', component.attributes['styleClass'])}">
-<<<<<<< HEAD
<span class="#{concatClasses(nodeState.handleClass, component.attributes['handleClass'])}"></span>
<span class="rf-trn-cnt">
<cdk:call expression="encodeIcon(facesContext, component)" />
<span class="#{concatClasses('rf-trn-lbl', component.attributes['labelClass'])}">
-=======
- <cdk:call expression="encodeHandle(facesContext, component)" />
-
- <span class="rf-trn-cnt">
- <span class="rf-trn-ico #{nodeState.iconClass}" />
- <span class="rf-trn-lbl">
->>>>>>> https://jira.jboss.org/browse/RF-9715
<cdk:body />
</span>
</span>
14 years, 2 months
JBoss Rich Faces SVN: r20093 - in trunk/ui/iteration/ui/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-11-18 11:17:55 -0500 (Thu, 18 Nov 2010)
New Revision: 20093
Modified:
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml
Log:
https://jira.jboss.org/browse/RF-9715
Modified: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-11-18 16:15:48 UTC (rev 20092)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-11-18 16:17:55 UTC (rev 20093)
@@ -67,8 +67,8 @@
});
},
- __getHandle: function() {
- return this.__rootElt.find(" > .rf-trn:first > .rf-trn-hnd:first");
+ __getHandles: function() {
+ return this.__rootElt.find(" > .rf-trn:first > .rf-trn-hnd");
},
__getContent: function() {
Modified: trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml
===================================================================
--- trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml 2010-11-18 16:15:48 UTC (rev 20092)
+++ trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml 2010-11-18 16:17:55 UTC (rev 20093)
@@ -19,11 +19,19 @@
<cdk:object name="nodeState" value="#{getNodeState(facesContext)}" type="org.richfaces.renderkit.TreeNodeState" />
<div class="#{concatClasses('rf-trn', component.attributes['styleClass'])}">
+<<<<<<< HEAD
<span class="#{concatClasses(nodeState.handleClass, component.attributes['handleClass'])}"></span>
<span class="rf-trn-cnt">
<cdk:call expression="encodeIcon(facesContext, component)" />
<span class="#{concatClasses('rf-trn-lbl', component.attributes['labelClass'])}">
+=======
+ <cdk:call expression="encodeHandle(facesContext, component)" />
+
+ <span class="rf-trn-cnt">
+ <span class="rf-trn-ico #{nodeState.iconClass}" />
+ <span class="rf-trn-lbl">
+>>>>>>> https://jira.jboss.org/browse/RF-9715
<cdk:body />
</span>
</span>
14 years, 2 months
JBoss Rich Faces SVN: r20092 - in trunk: examples/iteration-demo/src/main/webapp/WEB-INF and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-11-18 11:15:48 -0500 (Thu, 18 Nov 2010)
New Revision: 20092
Modified:
trunk/examples/iteration-demo/src/main/webapp/WEB-INF/web.xml
trunk/examples/iteration-demo/src/main/webapp/tree.xhtml
trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java
trunk/ui/iteration/api/src/main/java/org/richfaces/model/SwingTreeNodeImpl.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ExtendedTreeDataModelImpl.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeDataModelImpl.java
Log:
https://jira.jboss.org/browse/RF-9716
Modified: trunk/examples/iteration-demo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/WEB-INF/web.xml 2010-11-18 16:10:17 UTC (rev 20091)
+++ trunk/examples/iteration-demo/src/main/webapp/WEB-INF/web.xml 2010-11-18 16:15:48 UTC (rev 20092)
@@ -72,6 +72,11 @@
<param-value>true</param-value>
</context-param>
+ <context-param>
+ <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
<context-param>
<description>
Set this flag to true if you want the JavaServer Faces
Modified: trunk/examples/iteration-demo/src/main/webapp/tree.xhtml
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-11-18 16:10:17 UTC (rev 20091)
+++ trunk/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-11-18 16:15:48 UTC (rev 20092)
@@ -83,6 +83,9 @@
</it:treeNode>
</it:tree>
+ <it:tree id="defaultNodeTree" var="node" value="#{treeBean.rootNodes}"
+ selectionType="#{treeBean.selectionType}" toggleType="#{treeBean.toggleType}">
+ </it:tree>
</h:form>
</h:body>
</html>
Modified: trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-11-18 16:10:17 UTC (rev 20091)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/component/UIDataAdaptor.java 2010-11-18 16:15:48 UTC (rev 20092)
@@ -1489,7 +1489,7 @@
int separatorIndex = substring.indexOf(separatorChar);
if (separatorIndex < 0) {
- return substring;
+ return null;
} else {
return substring.substring(0, separatorIndex);
}
Modified: trunk/ui/iteration/api/src/main/java/org/richfaces/model/SwingTreeNodeImpl.java
===================================================================
--- trunk/ui/iteration/api/src/main/java/org/richfaces/model/SwingTreeNodeImpl.java 2010-11-18 16:10:17 UTC (rev 20091)
+++ trunk/ui/iteration/api/src/main/java/org/richfaces/model/SwingTreeNodeImpl.java 2010-11-18 16:15:48 UTC (rev 20092)
@@ -28,6 +28,8 @@
import javax.swing.tree.TreeNode;
+import com.google.common.base.Objects;
+import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.Iterators;
/**
@@ -99,4 +101,12 @@
public List<TreeNode> getChildrenList() {
return children;
}
+
+ @Override
+ public String toString() {
+ ToStringHelper toStringHelper = Objects.toStringHelper(this);
+ toStringHelper.add("data", data);
+
+ return toStringHelper.toString();
+ }
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-11-18 16:10:17 UTC (rev 20091)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTree.java 2010-11-18 16:15:48 UTC (rev 20092)
@@ -27,7 +27,9 @@
import java.util.Iterator;
import javax.el.ValueExpression;
+import javax.faces.application.Application;
import javax.faces.component.UIComponent;
+import javax.faces.component.html.HtmlOutputText;
import javax.faces.component.visit.VisitCallback;
import javax.faces.component.visit.VisitContext;
import javax.faces.component.visit.VisitResult;
@@ -49,12 +51,15 @@
import org.richfaces.convert.SequenceRowKeyConverter;
import org.richfaces.event.TreeSelectionEvent;
import org.richfaces.event.TreeSelectionListener;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
import org.richfaces.model.ExtendedTreeDataModelImpl;
import org.richfaces.model.SwingTreeNodeDataModelImpl;
import org.richfaces.model.TreeDataModel;
import org.richfaces.renderkit.MetaComponentRenderer;
import com.google.common.base.Predicate;
+import com.google.common.base.Strings;
import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
@@ -76,6 +81,8 @@
public static final String SELECTION_META_COMPONENT_ID = "selection";
+ private static final String DEFAULT_TREE_NODE_CREATED = AbstractTree.class.getName() + ":DEFAULT_TREE_NODE_CREATED";
+
private static final class MatchingTreeNodePredicate implements Predicate<UIComponent> {
private String type;
@@ -193,17 +200,36 @@
}
public AbstractTreeNode findTreeNodeComponent() {
- if (getChildCount() == 0) {
- return null;
- }
-
+ FacesContext facesContext = getFacesContext();
+
+ String nodeType = getNodeType();
Iterator<UIComponent> iterator = Iterators.filter(getChildren().iterator(),
- new MatchingTreeNodePredicate(getNodeType()));
+ new MatchingTreeNodePredicate(nodeType));
if (iterator.hasNext()) {
return (AbstractTreeNode) iterator.next();
}
+ if (Strings.isNullOrEmpty(nodeType)) {
+ //make PSS happy
+ if (getAttributes().put(DEFAULT_TREE_NODE_CREATED, Boolean.TRUE) != null) {
+ return null;
+ }
+
+ Application application = facesContext.getApplication();
+ AbstractTreeNode treeNode = (AbstractTreeNode) application.createComponent(AbstractTreeNode.COMPONENT_TYPE);
+ treeNode.setId("__defaultTreeNode");
+
+ getChildren().add(treeNode);
+
+ UIComponent text = application.createComponent(HtmlOutputText.COMPONENT_TYPE);
+ text.setValueExpression("value", application.getExpressionFactory().createValueExpression(facesContext.getELContext(),
+ "#{" + getVar() + "}", String.class));
+ treeNode.getChildren().add(text);
+
+ return treeNode;
+ }
+
return null;
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ExtendedTreeDataModelImpl.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ExtendedTreeDataModelImpl.java 2010-11-18 16:10:17 UTC (rev 20091)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/ExtendedTreeDataModelImpl.java 2010-11-18 16:15:48 UTC (rev 20092)
@@ -88,8 +88,12 @@
public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) {
TreeRange treeRange = (TreeRange) range;
if (treeRange.shouldIterateChildren(null)) {
- Iterator<Object> iterator = getChildrenRowKeysIterator(null);
- walk(context, visitor, range, argument, iterator);
+ setRowKey(null);
+ DataVisitResult visitResult = visitor.process(context, null, argument);
+ if (visitResult == DataVisitResult.CONTINUE) {
+ Iterator<Object> iterator = getChildrenRowKeysIterator(null);
+ walk(context, visitor, range, argument, iterator);
+ }
}
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeDataModelImpl.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeDataModelImpl.java 2010-11-18 16:10:17 UTC (rev 20091)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/model/SwingTreeNodeDataModelImpl.java 2010-11-18 16:15:48 UTC (rev 20092)
@@ -166,7 +166,7 @@
}
public boolean isDataAvailable() {
- return selectedNode != null;
+ return selectedRowKey == null || selectedNode != null;
}
public Object getWrappedData() {
14 years, 2 months
JBoss Rich Faces SVN: r20091 - in trunk: examples/iteration-demo/src/main/webapp and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-11-18 11:10:17 -0500 (Thu, 18 Nov 2010)
New Revision: 20091
Modified:
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java
trunk/examples/iteration-demo/src/main/webapp/tree.xhtml
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeNode.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeRendererBase.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeState.java
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml
Log:
https://jira.jboss.org/browse/RF-9715
Modified: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java 2010-11-18 16:05:30 UTC (rev 20090)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java 2010-11-18 16:10:17 UTC (rev 20091)
@@ -56,6 +56,8 @@
private Object nodeData;
+ private boolean showCustomClasses = true;
+
private Collection<Object> selection = new TracingSet<Object>();
@PostConstruct
@@ -113,4 +115,12 @@
FacesContext facesContext = FacesContext.getCurrentInstance();
facesContext.addMessage(null, new FacesMessage("Clicked node: " + getNodeData()));
}
+
+ public boolean isShowCustomClasses() {
+ return showCustomClasses;
+ }
+
+ public void setShowCustomClasses(boolean showCustomClasses) {
+ this.showCustomClasses = showCustomClasses;
+ }
}
Modified: trunk/examples/iteration-demo/src/main/webapp/tree.xhtml
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-11-18 16:05:30 UTC (rev 20090)
+++ trunk/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-11-18 16:10:17 UTC (rev 20091)
@@ -8,6 +8,25 @@
<h:head>
<title>Richfaces Tree</title>
+
+ <h:outputStylesheet>/*<![CDATA[*/
+ .customClass .customNodeClass {
+ border: 1px solid navy;
+ }
+
+ .customClass .customHandleClass {
+ border: 1px solid red;
+ }
+
+ .customClass .customIconClass {
+ border: 1px solid yellow;
+ }
+
+ .customClass .customLabelClass {
+ border: 1px solid green;
+ }
+
+ /*]]>*/</h:outputStylesheet>
</h:head>
<h:body>
@@ -21,6 +40,8 @@
Selection mode: <h:selectOneRadio value="#{treeBean.selectionType}" onclick="submit()">
<f:selectItems value="#{treeBean.types}" itemDisabled="#{item == 'server'}" var="item" itemValue="#{item}" />
</h:selectOneRadio>
+
+ Show custom classes: <h:selectBooleanCheckbox value="#{treeBean.showCustomClasses}" onclick="submit()" />
</h:form>
<h:form id="form">
@@ -53,9 +74,11 @@
</h:commandLink>
<it:tree id="customizedTree" var="node" value="#{treeBean.rootNodes}"
- selectionType="#{treeBean.selectionType}" toggleType="#{treeBean.toggleType}">
+ selectionType="#{treeBean.selectionType}" toggleType="#{treeBean.toggleType}"
+ styleClass="#{treeBean.showCustomClasses ? 'customClass' : ''}">
- <it:treeNode iconLeaf="/images/leaf.png" iconExpanded="/images/minus.png" iconCollapsed="/images/plus.png">
+ <it:treeNode iconLeaf="/images/leaf.png" iconExpanded="/images/minus.png" iconCollapsed="/images/plus.png"
+ styleClass="customNodeClass" handleClass="customHandleClass" iconClass="customIconClass" labelClass="customLabelClass">
#{node.data}
</it:treeNode>
</it:tree>
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeNode.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeNode.java 2010-11-18 16:05:30 UTC (rev 20090)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeNode.java 2010-11-18 16:10:17 UTC (rev 20091)
@@ -99,7 +99,13 @@
public abstract String getIconExpanded();
public abstract String getIconCollapsed();
+
+ public abstract String getHandleClass();
+ public abstract String getIconClass();
+
+ public abstract String getLabelClass();
+
protected Boolean getLocalExpandedValue(FacesContext facesContext) {
return (Boolean) getStateHelper().get(PropertyKeys.expanded);
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeRendererBase.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeRendererBase.java 2010-11-18 16:05:30 UTC (rev 20090)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeRendererBase.java 2010-11-18 16:10:17 UTC (rev 20091)
@@ -87,19 +87,21 @@
return (TreeNodeState) context.getAttributes().get(TreeEncoderBase.TREE_NODE_STATE_ATTRIBUTE);
}
- protected void encodeDefaultHandle(FacesContext context, UIComponent component, String styleClass) throws IOException {
+ protected void encodeDefaultIcon(FacesContext context, UIComponent component, String styleClass) throws IOException {
ResponseWriter writer = context.getResponseWriter();
writer.startElement(HtmlConstants.SPAN_ELEM, component);
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, styleClass, null);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE,
+ concatClasses(styleClass, component.getAttributes().get("iconClass")), null);
writer.endElement(HtmlConstants.SPAN_ELEM);
}
- protected void encodeCustomHandle(FacesContext context, UIComponent component, String styleClass, String iconSource) throws IOException {
+ protected void encodeCustomIcon(FacesContext context, UIComponent component, String styleClass, String iconSource) throws IOException {
ResponseWriter writer = context.getResponseWriter();
writer.startElement(HtmlConstants.IMG_ELEMENT, component);
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, styleClass, null);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE,
+ concatClasses(styleClass, component.getAttributes().get("iconClass")), null);
writer.writeAttribute(HtmlConstants.ALT_ATTRIBUTE, "", null);
writer.writeURIAttribute(HtmlConstants.SRC_ATTRIBUTE, RenderKitUtils.getResourceURL(iconSource, context), null);
writer.endElement(HtmlConstants.IMG_ELEMENT);
@@ -107,39 +109,39 @@
- protected void encodeHandle(FacesContext context, UIComponent component) throws IOException {
+ protected void encodeIcon(FacesContext context, UIComponent component) throws IOException {
TreeNodeState nodeState = getNodeState(context);
AbstractTreeNode treeNode = (AbstractTreeNode) component;
if (nodeState.isLeaf()) {
String iconLeaf = (String) treeNode.getAttributes().get("iconLeaf");
- encodeHandleForNodeState(context, treeNode, nodeState, iconLeaf);
+ encodeIconForNodeState(context, treeNode, nodeState, iconLeaf);
} else {
String iconExpanded = (String) treeNode.getAttributes().get("iconExpanded");
String iconCollapsed = (String) treeNode.getAttributes().get("iconCollapsed");
if (Strings.isNullOrEmpty(iconCollapsed) && Strings.isNullOrEmpty(iconExpanded)) {
- encodeDefaultHandle(context, component, nodeState.getDefaultHandleClass());
+ encodeDefaultIcon(context, component, nodeState.getIconClass());
} else {
SwitchType toggleType = treeNode.findTreeComponent().getToggleType();
if (toggleType == SwitchType.client || nodeState == TreeNodeState.collapsed) {
- encodeHandleForNodeState(context, treeNode, TreeNodeState.collapsed, iconCollapsed);
+ encodeIconForNodeState(context, treeNode, TreeNodeState.collapsed, iconCollapsed);
}
if (toggleType == SwitchType.client || nodeState == TreeNodeState.expanded) {
- encodeHandleForNodeState(context, treeNode, TreeNodeState.expanded, iconExpanded);
+ encodeIconForNodeState(context, treeNode, TreeNodeState.expanded, iconExpanded);
}
}
}
}
- protected void encodeHandleForNodeState(FacesContext context, AbstractTreeNode treeNode, TreeNodeState nodeState, String cutomIcon) throws IOException {
- if (Strings.isNullOrEmpty(cutomIcon)) {
- encodeDefaultHandle(context, treeNode, nodeState.getDefaultHandleClass());
+ protected void encodeIconForNodeState(FacesContext context, AbstractTreeNode treeNode, TreeNodeState nodeState, String customIcon) throws IOException {
+ if (Strings.isNullOrEmpty(customIcon)) {
+ encodeDefaultIcon(context, treeNode, nodeState.getIconClass());
} else {
- encodeCustomHandle(context, treeNode, nodeState.getCustomHandleClass(), cutomIcon);
+ encodeCustomIcon(context, treeNode, nodeState.getCustomIconClass(), customIcon);
}
}
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeState.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeState.java 2010-11-18 16:05:30 UTC (rev 20090)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeState.java 2010-11-18 16:10:17 UTC (rev 20091)
@@ -24,19 +24,19 @@
import org.richfaces.component.util.HtmlUtil;
public enum TreeNodeState {
- expanded("rf-tr-nd-exp", "rf-trn-hnd-exp", "rf-trn-hnd-exp rf-trn-hnd-cst", "rf-trn-ico-nd") {
+ expanded("rf-tr-nd-exp", "rf-trn-hnd-exp", "rf-trn-ico-exp") {
@Override
public boolean isLeaf() {
return false;
}
},
- collapsed("rf-tr-nd-colps", "rf-trn-hnd-colps", "rf-trn-hnd-colps rf-trn-hnd-cst", "rf-trn-ico-nd") {
+ collapsed("rf-tr-nd-colps", "rf-trn-hnd-colps", "rf-trn-ico-colps") {
@Override
public boolean isLeaf() {
return false;
}
},
- leaf("rf-tr-nd-lf", "rf-trn-hnd-lf", "rf-trn-hnd-lf rf-trn-hnd-cst", "rf-trn-ico-lf") {
+ leaf("rf-tr-nd-lf", "rf-trn-hnd-lf", "rf-trn-ico-lf") {
@Override
public boolean isLeaf() {
return true;
@@ -45,17 +45,17 @@
private String nodeClass;
- private String defaultHandleClass;
+ private String handleClass;
- private String customHandleClass;
+ private String iconClass;
- private String iconClass;
+ private String customIconClass;
- private TreeNodeState(String nodeClass, String defaultHandleClass, String customHandleClass, String iconClass) {
+ private TreeNodeState(String nodeClass, String defaultHandleClass, String iconClass) {
this.nodeClass = nodeClass;
- this.defaultHandleClass = HtmlUtil.concatClasses(defaultHandleClass, "rf-trn-hnd");
- this.customHandleClass = HtmlUtil.concatClasses(customHandleClass, "rf-trn-hnd");
- this.iconClass = iconClass;
+ this.handleClass = HtmlUtil.concatClasses(defaultHandleClass, "rf-trn-hnd");
+ this.iconClass = HtmlUtil.concatClasses(iconClass, "rf-trn-ico");
+ this.customIconClass = HtmlUtil.concatClasses(this.iconClass, "rf-trn-ico-cst");
}
public abstract boolean isLeaf();
@@ -64,15 +64,15 @@
return nodeClass;
}
- public String getDefaultHandleClass() {
- return defaultHandleClass;
+ public String getHandleClass() {
+ return handleClass;
}
public String getIconClass() {
return iconClass;
}
- public String getCustomHandleClass() {
- return customHandleClass;
+ public String getCustomIconClass() {
+ return customIconClass;
}
}
\ No newline at end of file
Modified: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss 2010-11-18 16:05:30 UTC (rev 20090)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss 2010-11-18 16:10:17 UTC (rev 20091)
@@ -58,7 +58,7 @@
background: "url(#{resource['org.richfaces.images:minus.png']}) no-repeat center";
}
-.rf-trn-ico-nd {
+.rf-trn-ico-exp, .rf-trn-ico-colps {
background: "url(#{resource['org.richfaces.images:node_icon.gif']}) no-repeat center";
}
@@ -66,12 +66,12 @@
background: "url(#{resource['org.richfaces.images:leaf_icon.gif']}) no-repeat center";
}
-.rf-trn-hnd-cst {
- background: none;
+.rf-trn-ico-cst {
+ background-image: none;
+ background-position: 0% 0%;
}
-.rf-tr-nd-colps > .rf-trn > .rf-trn-hnd-exp,
-.rf-tr-nd-exp > .rf-trn > .rf-trn-hnd-colps {
+.rf-tr-nd-exp > .rf-trn > .rf-trn-cnt > .rf-trn-ico-colps, .rf-tr-nd-colps > .rf-trn > .rf-trn-cnt > .rf-trn-ico-exp {
display: none;
}
Modified: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-11-18 16:05:30 UTC (rev 20090)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-11-18 16:10:17 UTC (rev 20091)
@@ -31,6 +31,8 @@
var TREE_HANDLE_CLASSES = ["rf-trn-hnd-colps", "rf-trn-hnd-exp"];
+ var TREE_ICON_CLASSES = ["rf-trn-ico-colps", "rf-trn-ico-exp"];
+
richfaces.ui = richfaces.ui || {};
richfaces.ui.TreeNode = richfaces.BaseComponent.extendClass({
@@ -65,14 +67,18 @@
});
},
- __getHandles: function() {
- return this.__rootElt.find(" > .rf-trn:first > .rf-trn-hnd");
+ __getHandle: function() {
+ return this.__rootElt.find(" > .rf-trn:first > .rf-trn-hnd:first");
},
__getContent: function() {
return this.__rootElt.find(" > .rf-trn:first > .rf-trn-cnt:first");
},
+ __getIcons: function() {
+ return this.__getContent().find(" > .rf-trn-ico");
+ },
+
getParent: function() {
return this.__parent;
},
@@ -157,11 +163,11 @@
switch (tree.getToggleType()) {
case 'client':
this.__rootElt.addClass(TREE_CLASSES[newState ? 1 : 0]).removeClass(TREE_CLASSES[!newState ? 1 : 0]);
-
- var handles = this.__getHandles();
-
- if (handles.length == 1) {
- handles.addClass(TREE_HANDLE_CLASSES[newState ? 1 : 0]).removeClass(TREE_HANDLE_CLASSES[!newState ? 1 : 0]);
+ this.__getHandle().addClass(TREE_HANDLE_CLASSES[newState ? 1 : 0]).removeClass(TREE_HANDLE_CLASSES[!newState ? 1 : 0]);
+
+ var icons = this.__getIcons();
+ if (icons.length == 1) {
+ icons.addClass(TREE_ICON_CLASSES[newState ? 1 : 0]).removeClass(TREE_ICON_CLASSES[!newState ? 1 : 0]);
}
this.__updateClientToggleStateInput(newState);
Modified: trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml
===================================================================
--- trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml 2010-11-18 16:05:30 UTC (rev 20090)
+++ trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml 2010-11-18 16:10:17 UTC (rev 20091)
@@ -19,11 +19,11 @@
<cdk:object name="nodeState" value="#{getNodeState(facesContext)}" type="org.richfaces.renderkit.TreeNodeState" />
<div class="#{concatClasses('rf-trn', component.attributes['styleClass'])}">
- <cdk:call expression="encodeHandle(facesContext, component)" />
+ <span class="#{concatClasses(nodeState.handleClass, component.attributes['handleClass'])}"></span>
<span class="rf-trn-cnt">
- <span class="rf-trn-ico #{nodeState.iconClass}" />
- <span class="rf-trn-lbl">
+ <cdk:call expression="encodeIcon(facesContext, component)" />
+ <span class="#{concatClasses('rf-trn-lbl', component.attributes['labelClass'])}">
<cdk:body />
</span>
</span>
14 years, 2 months
JBoss Rich Faces SVN: r20090 - in trunk/ui/iteration/ui/src/main: resources/META-INF/resources/org.richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-11-18 11:05:30 -0500 (Thu, 18 Nov 2010)
New Revision: 20090
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeState.java
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss
Log:
https://jira.jboss.org/browse/RF-9715
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeState.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeState.java 2010-11-18 16:03:02 UTC (rev 20089)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeState.java 2010-11-18 16:05:30 UTC (rev 20090)
@@ -24,19 +24,19 @@
import org.richfaces.component.util.HtmlUtil;
public enum TreeNodeState {
- expanded("rf-tr-nd-exp", "rf-trn-hnd-exp", "rf-trn-hnd-exp rf-trn-hnd-exp-cst", "rf-trn-ico-nd") {
+ expanded("rf-tr-nd-exp", "rf-trn-hnd-exp", "rf-trn-hnd-exp rf-trn-hnd-cst", "rf-trn-ico-nd") {
@Override
public boolean isLeaf() {
return false;
}
},
- collapsed("rf-tr-nd-colps", "rf-trn-hnd-colps", "rf-trn-hnd-colps rf-trn-hnd-colps-cst", "rf-trn-ico-nd") {
+ collapsed("rf-tr-nd-colps", "rf-trn-hnd-colps", "rf-trn-hnd-colps rf-trn-hnd-cst", "rf-trn-ico-nd") {
@Override
public boolean isLeaf() {
return false;
}
},
- leaf("rf-tr-nd-lf", "rf-trn-hnd-lf", "rf-trn-hnd-lf rf-trn-hnd-lf-cst", "rf-trn-ico-lf") {
+ leaf("rf-tr-nd-lf", "rf-trn-hnd-lf", "rf-trn-hnd-lf rf-trn-hnd-cst", "rf-trn-ico-lf") {
@Override
public boolean isLeaf() {
return true;
Modified: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss 2010-11-18 16:03:02 UTC (rev 20089)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss 2010-11-18 16:05:30 UTC (rev 20090)
@@ -66,7 +66,7 @@
background: "url(#{resource['org.richfaces.images:leaf_icon.gif']}) no-repeat center";
}
-.rf-trn-hnd-colps-cst, .rf-trn-hnd-exp-cst {
+.rf-trn-hnd-cst {
background: none;
}
14 years, 2 months
JBoss Rich Faces SVN: r20089 - trunk.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-11-18 11:03:02 -0500 (Thu, 18 Nov 2010)
New Revision: 20089
Added:
trunk/.gitignore
Log:
added
Added: trunk/.gitignore
===================================================================
--- trunk/.gitignore (rev 0)
+++ trunk/.gitignore 2010-11-18 16:03:02 UTC (rev 20089)
@@ -0,0 +1,8 @@
+target
+.settings
+.project
+.classpath
+.clover
+.externalToolBuilders
+
+
14 years, 2 months
JBoss Rich Faces SVN: r20088 - in trunk: examples/iteration-demo/src/main/webapp and 7 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-11-18 11:02:06 -0500 (Thu, 18 Nov 2010)
New Revision: 20088
Added:
trunk/examples/iteration-demo/src/main/webapp/images/
trunk/examples/iteration-demo/src/main/webapp/images/leaf.png
trunk/examples/iteration-demo/src/main/webapp/images/minus.png
trunk/examples/iteration-demo/src/main/webapp/images/plus.png
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeState.java
Removed:
trunk/core/impl/src/main/java/org/richfaces/component/util/ViewUtil.java
Modified:
trunk/examples/iteration-demo/src/main/webapp/tree.xhtml
trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/RenderKitUtils.java
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeNode.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeRendererBase.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml
Log:
https://jira.jboss.org/browse/RF-9715
Deleted: trunk/core/impl/src/main/java/org/richfaces/component/util/ViewUtil.java
===================================================================
--- trunk/core/impl/src/main/java/org/richfaces/component/util/ViewUtil.java 2010-11-18 14:44:10 UTC (rev 20087)
+++ trunk/core/impl/src/main/java/org/richfaces/component/util/ViewUtil.java 2010-11-18 16:02:06 UTC (rev 20088)
@@ -1,53 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * 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.util;
-
-import javax.faces.context.FacesContext;
-
-/**
- * @author Nick Belaevski - nbelaevski(a)exadel.com
- * created 19.02.2007
- */
-public final class ViewUtil {
- private ViewUtil() {
- }
-
- public static String getResourceURL(String url) {
- if (null == url) {
- return null;
- }
-
- return ViewUtil.getResourceURL(url, FacesContext.getCurrentInstance());
- }
-
- public static String getResourceURL(String url, FacesContext context) {
- if (null == url) {
- return null;
- }
-
- String value = url;
-
- value = context.getApplication().getViewHandler().getResourceURL(context, value);
-
- return context.getExternalContext().encodeResourceURL(value);
- }
-}
Added: trunk/examples/iteration-demo/src/main/webapp/images/leaf.png
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/images/leaf.png (rev 0)
+++ trunk/examples/iteration-demo/src/main/webapp/images/leaf.png 2010-11-18 16:02:06 UTC (rev 20088)
@@ -0,0 +1,4 @@
+�PNG
+
+
\ No newline at end of file
Added: trunk/examples/iteration-demo/src/main/webapp/images/minus.png
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/images/minus.png (rev 0)
+++ trunk/examples/iteration-demo/src/main/webapp/images/minus.png 2010-11-18 16:02:06 UTC (rev 20088)
@@ -0,0 +1,4 @@
+�PNG
+
+
\ No newline at end of file
Added: trunk/examples/iteration-demo/src/main/webapp/images/plus.png
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/images/plus.png (rev 0)
+++ trunk/examples/iteration-demo/src/main/webapp/images/plus.png 2010-11-18 16:02:06 UTC (rev 20088)
@@ -0,0 +1,5 @@
+�PNG
+
+
+�<n3�%ϥh�
\ No newline at end of file
Modified: trunk/examples/iteration-demo/src/main/webapp/tree.xhtml
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-11-18 14:44:10 UTC (rev 20087)
+++ trunk/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-11-18 16:02:06 UTC (rev 20088)
@@ -51,6 +51,15 @@
<h:commandLink value="Re-render">
<f:ajax render=":form:tree" execute="@all" />
</h:commandLink>
+
+ <it:tree id="customizedTree" var="node" value="#{treeBean.rootNodes}"
+ selectionType="#{treeBean.selectionType}" toggleType="#{treeBean.toggleType}">
+
+ <it:treeNode iconLeaf="/images/leaf.png" iconExpanded="/images/minus.png" iconCollapsed="/images/plus.png">
+ #{node.data}
+ </it:treeNode>
+ </it:tree>
+
</h:form>
</h:body>
</html>
Modified: trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/RenderKitUtils.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/RenderKitUtils.java 2010-11-18 14:44:10 UTC (rev 20087)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/RenderKitUtils.java 2010-11-18 16:02:06 UTC (rev 20088)
@@ -699,6 +699,18 @@
return path;
}
+ public static String getResourceURL(String url, FacesContext context) {
+ if (null == url) {
+ return null;
+ }
+
+ String value = url;
+
+ value = context.getApplication().getViewHandler().getResourceURL(context, value);
+
+ return context.getExternalContext().encodeResourceURL(value);
+ }
+
@SuppressWarnings("serial")
public static final class Attributes extends TreeSet<ComponentAttribute> {
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2010-11-18 14:44:10 UTC (rev 20087)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2010-11-18 16:02:06 UTC (rev 20088)
@@ -54,7 +54,6 @@
import org.richfaces.component.util.HtmlUtil;
import org.richfaces.component.util.MessageUtil;
import org.richfaces.component.util.SelectUtils;
-import org.richfaces.component.util.ViewUtil;
import org.richfaces.event.CurrentDateChangeEvent;
import org.richfaces.utils.CalendarHelper;
@@ -305,8 +304,8 @@
buttonIcon = (String)component.getAttributes().get("buttonIconDisabled");
}
- if (buttonIcon != null && buttonIcon.trim().length() != 0) {
- buttonIcon = ViewUtil.getResourceURL(buttonIcon, facesContext);
+ if(buttonIcon != null && buttonIcon.trim().length() != 0) {
+ buttonIcon = RenderKitUtils.getResourceURL(buttonIcon, facesContext);
} else {
buttonIcon = disable ? CALENDAR_ICON_RESOURCE_NAME: CALENDAR_ICON_RESOURCE_NAME;
buttonIcon = RenderKitUtils.getResourcePath(facesContext, "org.richfaces.images",buttonIcon);
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeNode.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeNode.java 2010-11-18 14:44:10 UTC (rev 20087)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractTreeNode.java 2010-11-18 16:02:06 UTC (rev 20088)
@@ -94,6 +94,12 @@
//TODO - move to template
public abstract String getStyleClass();
+ public abstract String getIconLeaf();
+
+ public abstract String getIconExpanded();
+
+ public abstract String getIconCollapsed();
+
protected Boolean getLocalExpandedValue(FacesContext facesContext) {
return (Boolean) getStateHelper().get(PropertyKeys.expanded);
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java 2010-11-18 14:44:10 UTC (rev 20087)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeEncoderBase.java 2010-11-18 16:02:06 UTC (rev 20088)
@@ -32,7 +32,6 @@
import org.richfaces.component.AbstractTreeNode;
import org.richfaces.component.TreeRange;
import org.richfaces.component.util.HtmlUtil;
-import org.richfaces.renderkit.TreeRendererBase.NodeState;
import org.richfaces.renderkit.TreeRendererBase.QueuedData;
import com.google.common.base.Predicate;
@@ -41,10 +40,8 @@
abstract class TreeEncoderBase {
- private static final String TREE_NODE_HANDLE_CLASS_ATTRIBUTE = "__treeNodeHandleClass";
+ static final String TREE_NODE_STATE_ATTRIBUTE = "__treeNodeState";
- private static final String TREE_NODE_ICON_CLASS_ATTRIBUTE = "__treeNodeIconClass";
-
protected final FacesContext context;
protected final ResponseWriter responseWriter;
@@ -91,7 +88,7 @@
if (!data.isEncoded()) {
tree.setRowKey(context, data.getRowKey());
- writeTreeNodeStartElement(data.isExpanded() ? NodeState.expanded : NodeState.collapsed, data.isLastNode());
+ writeTreeNodeStartElement(data.isExpanded() ? TreeNodeState.expanded : TreeNodeState.collapsed, data.isLastNode());
data.setEncoded(true);
}
@@ -110,18 +107,17 @@
QueuedData data = queuedData.removeLast();
if (!data.isEncoded()) {
- NodeState nodeState = iterateChildren ? NodeState.leaf : NodeState.collapsed;
+ TreeNodeState nodeState = iterateChildren ? TreeNodeState.leaf : TreeNodeState.collapsed;
writeTreeNodeStartElement(nodeState, data.isLastNode());
}
writeTreeNodeEndElement();
}
- protected void writeTreeNodeStartElement(NodeState nodeState, boolean isLast) throws IOException {
+ protected void writeTreeNodeStartElement(TreeNodeState nodeState, boolean isLast) throws IOException {
AbstractTreeNode treeNodeComponent = tree.findTreeNodeComponent();
- context.getAttributes().put(TREE_NODE_HANDLE_CLASS_ATTRIBUTE, nodeState.getHandleClass());
- context.getAttributes().put(TREE_NODE_ICON_CLASS_ATTRIBUTE, nodeState.getIconClass());
+ context.getAttributes().put(TREE_NODE_STATE_ATTRIBUTE, nodeState);
responseWriter.startElement(HtmlConstants.DIV_ELEM, tree);
responseWriter.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE,
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeRendererBase.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeRendererBase.java 2010-11-18 14:44:10 UTC (rev 20087)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeRendererBase.java 2010-11-18 16:02:06 UTC (rev 20088)
@@ -27,11 +27,15 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.PartialViewContext;
+import javax.faces.context.ResponseWriter;
import org.richfaces.component.AbstractTreeNode;
import org.richfaces.component.MetaComponentResolver;
+import org.richfaces.component.SwitchType;
import org.richfaces.event.TreeToggleEvent;
+import com.google.common.base.Strings;
+
/**
* @author Nick Belaevski
*
@@ -77,6 +81,65 @@
} else {
throw new IllegalArgumentException(metaComponentId);
}
+ }
+
+ protected TreeNodeState getNodeState(FacesContext context) {
+ return (TreeNodeState) context.getAttributes().get(TreeEncoderBase.TREE_NODE_STATE_ATTRIBUTE);
+ }
+
+ protected void encodeDefaultHandle(FacesContext context, UIComponent component, String styleClass) throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+
+ writer.startElement(HtmlConstants.SPAN_ELEM, component);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, styleClass, null);
+ writer.endElement(HtmlConstants.SPAN_ELEM);
+ }
+
+ protected void encodeCustomHandle(FacesContext context, UIComponent component, String styleClass, String iconSource) throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+
+ writer.startElement(HtmlConstants.IMG_ELEMENT, component);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, styleClass, null);
+ writer.writeAttribute(HtmlConstants.ALT_ATTRIBUTE, "", null);
+ writer.writeURIAttribute(HtmlConstants.SRC_ATTRIBUTE, RenderKitUtils.getResourceURL(iconSource, context), null);
+ writer.endElement(HtmlConstants.IMG_ELEMENT);
+ }
+
+
+
+ protected void encodeHandle(FacesContext context, UIComponent component) throws IOException {
+ TreeNodeState nodeState = getNodeState(context);
+
+ AbstractTreeNode treeNode = (AbstractTreeNode) component;
+
+ if (nodeState.isLeaf()) {
+ String iconLeaf = (String) treeNode.getAttributes().get("iconLeaf");
+ encodeHandleForNodeState(context, treeNode, nodeState, iconLeaf);
+ } else {
+ String iconExpanded = (String) treeNode.getAttributes().get("iconExpanded");
+ String iconCollapsed = (String) treeNode.getAttributes().get("iconCollapsed");
+
+ if (Strings.isNullOrEmpty(iconCollapsed) && Strings.isNullOrEmpty(iconExpanded)) {
+ encodeDefaultHandle(context, component, nodeState.getDefaultHandleClass());
+ } else {
+ SwitchType toggleType = treeNode.findTreeComponent().getToggleType();
+ if (toggleType == SwitchType.client || nodeState == TreeNodeState.collapsed) {
+ encodeHandleForNodeState(context, treeNode, TreeNodeState.collapsed, iconCollapsed);
+ }
+
+ if (toggleType == SwitchType.client || nodeState == TreeNodeState.expanded) {
+ encodeHandleForNodeState(context, treeNode, TreeNodeState.expanded, iconExpanded);
+ }
+ }
+ }
}
+
+ protected void encodeHandleForNodeState(FacesContext context, AbstractTreeNode treeNode, TreeNodeState nodeState, String cutomIcon) throws IOException {
+ if (Strings.isNullOrEmpty(cutomIcon)) {
+ encodeDefaultHandle(context, treeNode, nodeState.getDefaultHandleClass());
+ } else {
+ encodeCustomHandle(context, treeNode, nodeState.getCustomHandleClass(), cutomIcon);
+ }
+ }
}
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeState.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeState.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeNodeState.java 2010-11-18 16:02:06 UTC (rev 20088)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.renderkit;
+
+import org.richfaces.component.util.HtmlUtil;
+
+public enum TreeNodeState {
+ expanded("rf-tr-nd-exp", "rf-trn-hnd-exp", "rf-trn-hnd-exp rf-trn-hnd-exp-cst", "rf-trn-ico-nd") {
+ @Override
+ public boolean isLeaf() {
+ return false;
+ }
+ },
+ collapsed("rf-tr-nd-colps", "rf-trn-hnd-colps", "rf-trn-hnd-colps rf-trn-hnd-colps-cst", "rf-trn-ico-nd") {
+ @Override
+ public boolean isLeaf() {
+ return false;
+ }
+ },
+ leaf("rf-tr-nd-lf", "rf-trn-hnd-lf", "rf-trn-hnd-lf rf-trn-hnd-lf-cst", "rf-trn-ico-lf") {
+ @Override
+ public boolean isLeaf() {
+ return true;
+ }
+ };
+
+ private String nodeClass;
+
+ private String defaultHandleClass;
+
+ private String customHandleClass;
+
+ private String iconClass;
+
+ private TreeNodeState(String nodeClass, String defaultHandleClass, String customHandleClass, String iconClass) {
+ this.nodeClass = nodeClass;
+ this.defaultHandleClass = HtmlUtil.concatClasses(defaultHandleClass, "rf-trn-hnd");
+ this.customHandleClass = HtmlUtil.concatClasses(customHandleClass, "rf-trn-hnd");
+ this.iconClass = iconClass;
+ }
+
+ public abstract boolean isLeaf();
+
+ public String getNodeClass() {
+ return nodeClass;
+ }
+
+ public String getDefaultHandleClass() {
+ return defaultHandleClass;
+ }
+
+ public String getIconClass() {
+ return iconClass;
+ }
+
+ public String getCustomHandleClass() {
+ return customHandleClass;
+ }
+}
\ No newline at end of file
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2010-11-18 14:44:10 UTC (rev 20087)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2010-11-18 16:02:06 UTC (rev 20088)
@@ -84,37 +84,6 @@
}
}
- enum NodeState {
- expanded("rf-tr-nd-exp", "rf-trn-hnd-exp", "rf-trn-ico-nd"),
- collapsed("rf-tr-nd-colps", "rf-trn-hnd-colps", "rf-trn-ico-nd"),
- leaf("rf-tr-nd-lf", "rf-trn-hnd-lf", "rf-trn-ico-lf");
-
- private String nodeClass;
-
- private String handleClass;
-
- private String iconClass;
-
- private NodeState(String nodeClass, String handleClass, String iconClass) {
- this.nodeClass = nodeClass;
- this.handleClass = handleClass;
- this.iconClass = iconClass;
- }
-
- public String getNodeClass() {
- return nodeClass;
- }
-
- public String getHandleClass() {
- return handleClass;
- }
-
- public String getIconClass() {
- return iconClass;
- }
-
- }
-
static final class QueuedData {
private Object rowKey;
Modified: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss 2010-11-18 14:44:10 UTC (rev 20087)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.ecss 2010-11-18 16:02:06 UTC (rev 20088)
@@ -66,6 +66,15 @@
background: "url(#{resource['org.richfaces.images:leaf_icon.gif']}) no-repeat center";
}
+.rf-trn-hnd-colps-cst, .rf-trn-hnd-exp-cst {
+ background: none;
+}
+
+.rf-tr-nd-colps > .rf-trn > .rf-trn-hnd-exp,
+.rf-tr-nd-exp > .rf-trn > .rf-trn-hnd-colps {
+ display: none;
+}
+
.rf-tr-nd.rf-tr-nd-colps .rf-tr-nd {
display: none;
}
Modified: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-11-18 14:44:10 UTC (rev 20087)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/tree.js 2010-11-18 16:02:06 UTC (rev 20088)
@@ -65,8 +65,8 @@
});
},
- __getHandle: function() {
- return this.__rootElt.find(" > .rf-trn:first > .rf-trn-hnd:first");
+ __getHandles: function() {
+ return this.__rootElt.find(" > .rf-trn:first > .rf-trn-hnd");
},
__getContent: function() {
@@ -116,15 +116,15 @@
},
isExpanded: function() {
- return !this.isLeaf() && this.__getHandle().hasClass("rf-trn-hnd-exp");
+ return !this.isLeaf() && this.__rootElt.hasClass("rf-tr-nd-exp");
},
isCollapsed: function() {
- return !this.isLeaf() && this.__getHandle().hasClass("rf-trn-hnd-colps");
+ return !this.isLeaf() && this.__rootElt.hasClass("rf-tr-nd-colps");
},
isLeaf: function() {
- return this.__getHandle().hasClass("rf-trn-hnd-lf");
+ return this.__rootElt.hasClass("rf-tr-nd-lf");
},
toggle: function() {
@@ -157,7 +157,13 @@
switch (tree.getToggleType()) {
case 'client':
this.__rootElt.addClass(TREE_CLASSES[newState ? 1 : 0]).removeClass(TREE_CLASSES[!newState ? 1 : 0]);
- this.__getHandle().addClass(TREE_HANDLE_CLASSES[newState ? 1 : 0]).removeClass(TREE_HANDLE_CLASSES[!newState ? 1 : 0]);
+
+ var handles = this.__getHandles();
+
+ if (handles.length == 1) {
+ handles.addClass(TREE_HANDLE_CLASSES[newState ? 1 : 0]).removeClass(TREE_HANDLE_CLASSES[!newState ? 1 : 0]);
+ }
+
this.__updateClientToggleStateInput(newState);
break;
Modified: trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml
===================================================================
--- trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml 2010-11-18 14:44:10 UTC (rev 20087)
+++ trunk/ui/iteration/ui/src/main/templates/treeNode.template.xml 2010-11-18 16:02:06 UTC (rev 20088)
@@ -16,10 +16,13 @@
</cc:interface>
<cc:implementation>
+ <cdk:object name="nodeState" value="#{getNodeState(facesContext)}" type="org.richfaces.renderkit.TreeNodeState" />
+
<div class="#{concatClasses('rf-trn', component.attributes['styleClass'])}">
- <span class="rf-trn-hnd #{facesContext.attributes['__treeNodeHandleClass']}" />
+ <cdk:call expression="encodeHandle(facesContext, component)" />
+
<span class="rf-trn-cnt">
- <span class="rf-trn-ico #{facesContext.attributes['__treeNodeIconClass']}" />
+ <span class="rf-trn-ico #{nodeState.iconClass}" />
<span class="rf-trn-lbl">
<cdk:body />
</span>
14 years, 2 months
JBoss Rich Faces SVN: r20087 - in sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces: event and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-11-18 09:44:10 -0500 (Thu, 18 Nov 2010)
New Revision: 20087
Modified:
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Draggable.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Dropzone.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DnDEvent.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragEvent.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragListener.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropListener.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropSource.java
Log:
checkstyles fixes
Modified: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Draggable.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Draggable.java 2010-11-18 14:37:57 UTC (rev 20086)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Draggable.java 2010-11-18 14:44:10 UTC (rev 20087)
@@ -25,107 +25,130 @@
import org.richfaces.event.DragListener;
-
/**
- * Interface for all draggable components. Describe bean properties, implemented by component.
+ * Interface for all draggable components. Describe bean properties, implemented
+ * by component.
+ *
* @author shura
- *
+ *
*/
-public interface Draggable {
-
- /**
- * Getter for value parameter, used as key for draggable component.
- * @return
- */
- public Object getDragValue();
-
- public void setDragValue(Object value);
-
- /**
- * Getter for id of component ( instance of {@link UIDragIndicator} ) used for create drag cursor.
- * @return
- */
- public String getDragIndicator();
-
- /**
- * @param dragIndicator - id of cursor component
- */
- public void setDragIndicator(String dragIndicator);
-
- /**
- * Draggable implementation may wish to resolve drag indicator id to clientId itself
- * @param facesContext {@link FacesContext} instance
- * @return resolved indicator client id or null
- * @since 3.1
- */
- public String getResolvedDragIndicator(FacesContext facesContext);
-
- /**
- * Getter for type of this draggable ( file, mail etc ).
- * @return
- */
- public String getDragType();
-
- /**
- * @param dragType
- */
- public void setDragType(String dragType);
-
- /**
- * Getter for JavaScript event handler, called before start drag operation.
- * If this handler return false, drag operation is cancelled.
- * @return javaScript code of event handler.
- */
- public String getOndragstart();
-
- /**
- * @param dragType
- */
- public void setOndragstart(String ondrag);
+public interface Draggable {
- /**
- * Getter for JavaScript event handler; Called when drag operation end.
- * @return javaScript code of event handler.
- */
- public String getOndragend();
- public void setOndragend(String ondrag);
-
- /**
- * Getter for JavaScript event handler; Called when dragged element over the dropzone.
- * @return javaScript code of event handler.
- */
- public String getOndropover();
- public void setOndropover(String ondropover);
+ /**
+ * Getter for value parameter, used as key for draggable component.
+ *
+ * @return
+ */
+ public Object getDragValue();
- /**
- * Getter for JavaScript event handler; Called when dragged element out the dropzone.
- * @return javaScript code of event handler.
- */
- public String getOndropout();
- public void setOndropout(String ondropout);
-
- /**
- * Append drag listener to component listeners collection
- * @param listener
- */
- public void addDragListener(DragListener listener);
-
- /**
- * Get array of all Drop Listeners
- * @return
- */
- public DragListener[] getDragListeners();
-
- /**
- * Remove drop listener from component listeners array.
- * @param listener
- */
- public void removeDragListener(DragListener listener);
+ public void setDragValue(Object value);
- public String getGrabCursors();
- public void setGrabCursors(String grabCursors);
+ /**
+ * Getter for id of component ( instance of {@link UIDragIndicator} ) used
+ * for create drag cursor.
+ *
+ * @return
+ */
+ public String getDragIndicator();
- public String getGrabbingCursors();
- public void setGrabbingCursors(String grabbingCursors);
+ /**
+ * @param dragIndicator
+ * - id of cursor component
+ */
+ public void setDragIndicator(String dragIndicator);
+ /**
+ * Draggable implementation may wish to resolve drag indicator id to
+ * clientId itself
+ *
+ * @param facesContext
+ * {@link FacesContext} instance
+ * @return resolved indicator client id or null
+ * @since 3.1
+ */
+ public String getResolvedDragIndicator(FacesContext facesContext);
+
+ /**
+ * Getter for type of this draggable ( file, mail etc ).
+ *
+ * @return
+ */
+ public String getDragType();
+
+ /**
+ * @param dragType
+ */
+ public void setDragType(String dragType);
+
+ /**
+ * Getter for JavaScript event handler, called before start drag operation.
+ * If this handler return false, drag operation is cancelled.
+ *
+ * @return javaScript code of event handler.
+ */
+ public String getOndragstart();
+
+ /**
+ * @param dragType
+ */
+ public void setOndragstart(String ondrag);
+
+ /**
+ * Getter for JavaScript event handler; Called when drag operation end.
+ *
+ * @return javaScript code of event handler.
+ */
+ public String getOndragend();
+
+ public void setOndragend(String ondrag);
+
+ /**
+ * Getter for JavaScript event handler; Called when dragged element over the
+ * dropzone.
+ *
+ * @return javaScript code of event handler.
+ */
+ public String getOndropover();
+
+ public void setOndropover(String ondropover);
+
+ /**
+ * Getter for JavaScript event handler; Called when dragged element out the
+ * dropzone.
+ *
+ * @return javaScript code of event handler.
+ */
+ public String getOndropout();
+
+ public void setOndropout(String ondropout);
+
+ /**
+ * Append drag listener to component listeners collection
+ *
+ * @param listener
+ */
+ public void addDragListener(DragListener listener);
+
+ /**
+ * Get array of all Drop Listeners
+ *
+ * @return
+ */
+ public DragListener[] getDragListeners();
+
+ /**
+ * Remove drop listener from component listeners array.
+ *
+ * @param listener
+ */
+ public void removeDragListener(DragListener listener);
+
+ public String getGrabCursors();
+
+ public void setGrabCursors(String grabCursors);
+
+ public String getGrabbingCursors();
+
+ public void setGrabbingCursors(String grabbingCursors);
+
}
Modified: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Dropzone.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Dropzone.java 2010-11-18 14:37:57 UTC (rev 20086)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Dropzone.java 2010-11-18 14:44:10 UTC (rev 20087)
@@ -25,98 +25,115 @@
/**
* Base interface for all components, accesible as drop zone.
+ *
* @author shura
- *
+ *
*/
public interface Dropzone extends DropSource {
-
- /**
- * Getter for dropType's , accepted by this zone.
- * @return
- */
- public Object getAcceptedTypes();
-
- public void setAcceptedTypes(Object types);
-
- /**
- * Getter for mapping between drop types and indicator states.
- * @return
- */
- public Object getTypeMapping();
-
- public void setTypeMapping(Object types);
-
-
- /**
- * Getter for mapping between drop types and acceptable cursors
- * @return
- */
- public Object getCursorTypeMapping();
- public void setCursorTypeMapping(Object types);
-
- /**
- * Getter for JavaScript event handler, called then drag curcor enter in component area.
- * If this handler return false, or "declined", drop operation on this component not allowed.
- * If handler return true or "allowed" , or any other supported indicator states, drop operation
- * is allowed and corresponding indicator state will be displayed.
- * @return javaScript code of event handler.
- */
- public String getOndragenter();
-
- /**
- * @param dragType
- */
- public void setOndragenter(String ondrag);
- /**
- * Getter for JavaScript event handler, called before drag cursor leave component area.
- * @return javaScript code of event handler.
- */
- public String getOndragexit();
-
- /**
- * @param dragType
- */
- public void setOndragexit(String ondrag);
+ /**
+ * Getter for dropType's , accepted by this zone.
+ *
+ * @return
+ */
+ public Object getAcceptedTypes();
- public Object getDropValue();
-
- public void setDropValue(Object o);
-
- /**
- * Javascript code called before drop event.
- * @parameter
- * @return the acceptClass
- */
- public abstract String getOndrop();
+ public void setAcceptedTypes(Object types);
- /**
- * @param newOndrop the value to set
- */
- public abstract void setOndrop(String newOndrop);
-
- /**
- * Javascript handler for event fired on drop even the drop for given type is not available
- * @parameter
- * @return the acceptClass
- */
- public abstract String getOndropend();
+ /**
+ * Getter for mapping between drop types and indicator states.
+ *
+ * @return
+ */
+ public Object getTypeMapping();
- /**
- * @param newname the value to set
- */
- public abstract void setOndropend(String ondropend);
-
- /**
- * Getter for the list of comma separated cursors that indicates when acceptable draggable over dropzone
- */
- public String getAcceptCursors();
- public void setAcceptCursors(String acceptCursors);
+ public void setTypeMapping(Object types);
- /**
- * Getter for the list of comma separated cursors that indicates when rejectable draggable over dropzone
- */
- public String getRejectCursors();
- public void setRejectCursors(String rejectCursors);
+ /**
+ * Getter for mapping between drop types and acceptable cursors
+ *
+ * @return
+ */
+ public Object getCursorTypeMapping();
+ public void setCursorTypeMapping(Object types);
+
+ /**
+ * Getter for JavaScript event handler, called then drag curcor enter in
+ * component area. If this handler return false, or "declined", drop
+ * operation on this component not allowed. If handler return true or
+ * "allowed" , or any other supported indicator states, drop operation is
+ * allowed and corresponding indicator state will be displayed.
+ *
+ * @return javaScript code of event handler.
+ */
+ public String getOndragenter();
+
+ /**
+ * @param dragType
+ */
+ public void setOndragenter(String ondrag);
+
+ /**
+ * Getter for JavaScript event handler, called before drag cursor leave
+ * component area.
+ *
+ * @return javaScript code of event handler.
+ */
+ public String getOndragexit();
+
+ /**
+ * @param dragType
+ */
+ public void setOndragexit(String ondrag);
+
+ public Object getDropValue();
+
+ public void setDropValue(Object o);
+
+ /**
+ * Javascript code called before drop event.
+ *
+ * @parameter
+ * @return the acceptClass
+ */
+ public abstract String getOndrop();
+
+ /**
+ * @param newOndrop
+ * the value to set
+ */
+ public abstract void setOndrop(String newOndrop);
+
+ /**
+ * Javascript handler for event fired on drop even the drop for given type
+ * is not available
+ *
+ * @parameter
+ * @return the acceptClass
+ */
+ public abstract String getOndropend();
+
+ /**
+ * @param newname
+ * the value to set
+ */
+ public abstract void setOndropend(String ondropend);
+
+ /**
+ * Getter for the list of comma separated cursors that indicates when
+ * acceptable draggable over dropzone
+ */
+ public String getAcceptCursors();
+
+ public void setAcceptCursors(String acceptCursors);
+
+ /**
+ * Getter for the list of comma separated cursors that indicates when
+ * rejectable draggable over dropzone
+ */
+ public String getRejectCursors();
+
+ public void setRejectCursors(String rejectCursors);
+
}
Modified: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DnDEvent.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DnDEvent.java 2010-11-18 14:37:57 UTC (rev 20086)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DnDEvent.java 2010-11-18 14:44:10 UTC (rev 20087)
@@ -26,21 +26,23 @@
/**
*
- * <br /><br />
+ * <br />
+ * <br />
*
* Created 12.11.2007
+ *
* @author Nick Belaevski
* @since 3.2
*/
public abstract class DnDEvent extends FacesEvent {
- /**
+ /**
*
*/
- private static final long serialVersionUID = -2455016405742082110L;
+ private static final long serialVersionUID = -2455016405742082110L;
- public DnDEvent(UIComponent component) {
- super(component);
- }
+ public DnDEvent(UIComponent component) {
+ super(component);
+ }
}
Modified: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragEvent.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragEvent.java 2010-11-18 14:37:57 UTC (rev 20086)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragEvent.java 2010-11-18 14:44:10 UTC (rev 20087)
@@ -28,75 +28,81 @@
import org.richfaces.component.Dropzone;
/**
- * @author Nick Belaevski - nbelaevski(a)exadel.com
- * created 27.12.2006
+ * @author Nick Belaevski - nbelaevski(a)exadel.com created 27.12.2006
*
*/
public class DragEvent extends DnDEvent {
- private Dropzone dropTarget;
- private Object acceptedTypes;
- private Object dropValue;
- /**
+ private static final long serialVersionUID = 6179268394391836905L;
+
+ private Dropzone dropTarget;
+ private Object acceptedTypes;
+ private Object dropValue;
+ /**
*
*/
- private static final long serialVersionUID = 6179268394391836905L;
- public DragEvent(UIComponent uiComponent) {
- super(uiComponent);
- }
+ public DragEvent(UIComponent uiComponent) {
+ super(uiComponent);
+ }
- /* (non-Javadoc)
- * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
- */
- public boolean isAppropriateListener(FacesListener faceslistener) {
- return faceslistener instanceof DragListener;
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.
+ * FacesListener)
+ */
+ public boolean isAppropriateListener(FacesListener faceslistener) {
+ return faceslistener instanceof DragListener;
+ }
- /* (non-Javadoc)
- * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
- */
- public void processListener(FacesListener faceslistener) {
- ((DragListener) faceslistener).processDrag(this);
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener
+ * )
+ */
+ public void processListener(FacesListener faceslistener) {
+ ((DragListener) faceslistener).processDrag(this);
+ }
- public Object getDragValue() {
- return ((Draggable) this.getSource()).getDragValue();
- }
+ public Object getDragValue() {
+ return ((Draggable) this.getSource()).getDragValue();
+ }
- public Dropzone getDropTarget() {
- return dropTarget;
- }
-
- /**
- * @see java.util.EventObject#toString()
- */
-/* public String toString() {
- return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).
- append("component", getComponent()).append("source", getSource()).append("phaseId", getPhaseId()).
- append("dragValue", getDragValue()).
- append("dropTarget", getDropTarget()).
- append("dropValue", getDropValue()).
- toString();
- }
-*/
- public void setDropTarget(Dropzone dropTarget) {
- this.dropTarget = dropTarget;
- }
+ public Dropzone getDropTarget() {
+ return dropTarget;
+ }
- public Object getAcceptedTypes() {
- return acceptedTypes;
- }
+ /**
+ * @see java.util.EventObject#toString()
+ */
+ /*
+ * public String toString() { return new ToStringBuilder(this,
+ * ToStringStyle.MULTI_LINE_STYLE). append("component",
+ * getComponent()).append("source", getSource()).append("phaseId",
+ * getPhaseId()). append("dragValue", getDragValue()). append("dropTarget",
+ * getDropTarget()). append("dropValue", getDropValue()). toString(); }
+ */
+ public void setDropTarget(Dropzone dropTarget) {
+ this.dropTarget = dropTarget;
+ }
- public void setAcceptedTypes(Object acceptedTypes) {
- this.acceptedTypes = acceptedTypes;
- }
+ public Object getAcceptedTypes() {
+ return acceptedTypes;
+ }
- public Object getDropValue() {
- return dropValue;
- }
+ public void setAcceptedTypes(Object acceptedTypes) {
+ this.acceptedTypes = acceptedTypes;
+ }
- public void setDropValue(Object dropValue) {
- this.dropValue = dropValue;
- }
+ public Object getDropValue() {
+ return dropValue;
+ }
+
+ public void setDropValue(Object dropValue) {
+ this.dropValue = dropValue;
+ }
}
Modified: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragListener.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragListener.java 2010-11-18 14:37:57 UTC (rev 20086)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragListener.java 2010-11-18 14:44:10 UTC (rev 20087)
@@ -24,11 +24,10 @@
import javax.faces.event.FacesListener;
/**
- * @author Nick Belaevski - nbelaevski(a)exadel.com
- * created 27.12.2006
+ * @author Nick Belaevski - nbelaevski(a)exadel.com created 27.12.2006
*
*/
public interface DragListener extends FacesListener {
- public void processDrag(DragEvent event);
+ public void processDrag(DragEvent event);
}
Modified: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java 2010-11-18 14:37:57 UTC (rev 20086)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java 2010-11-18 14:44:10 UTC (rev 20087)
@@ -29,79 +29,83 @@
/**
* @author shura
- *
+ *
*/
public class DropEvent extends DnDEvent {
- /**
+ /**
*
*/
- private static final long serialVersionUID = 1660545054556302746L;
-
- private Draggable draggableSource;
- private String dragType;
- private Object dragValue;
-
- public DropEvent(UIComponent component) {
- super(component);
- }
+ private static final long serialVersionUID = 1660545054556302746L;
- /* (non-Javadoc)
- * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
- */
- public boolean isAppropriateListener(FacesListener listener) {
- return listener instanceof DropListener;
- }
+ private Draggable draggableSource;
+ private String dragType;
+ private Object dragValue;
- /* (non-Javadoc)
- * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
- */
- public void processListener(FacesListener listener) {
- ((DropListener) listener).processDrop(this);
- }
+ public DropEvent(UIComponent component) {
+ super(component);
+ }
- /**
- * @return the dropValue
- */
- public Object getDropValue() {
- return ((Dropzone) this.getSource()).getDropValue();
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.
+ * FacesListener)
+ */
+ public boolean isAppropriateListener(FacesListener listener) {
+ return listener instanceof DropListener;
+ }
- public Draggable getDraggableSource() {
- return draggableSource;
- }
-
- /**
- * @see java.util.EventObject#toString()
- */
-/* public String toString() {
- return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).
- append("component", getComponent()).
- append("source", getSource()).
- append("phaseId", getPhaseId()).
- append("dropValue", getDropValue()).
- append("draggableSource", getDraggableSource()).
- append("dragValue", getDragValue()).
- toString();
- }
-*/
- public void setDraggableSource(Draggable draggableSource) {
- this.draggableSource = draggableSource;
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener
+ * )
+ */
+ public void processListener(FacesListener listener) {
+ ((DropListener) listener).processDrop(this);
+ }
- public String getDragType() {
- return dragType;
- }
+ /**
+ * @return the dropValue
+ */
+ public Object getDropValue() {
+ return ((Dropzone) this.getSource()).getDropValue();
+ }
- public void setDragType(String dragType) {
- this.dragType = dragType;
- }
+ public Draggable getDraggableSource() {
+ return draggableSource;
+ }
- public Object getDragValue() {
- return dragValue;
- }
+ /**
+ * @see java.util.EventObject#toString()
+ */
+ /*
+ * public String toString() { return new ToStringBuilder(this,
+ * ToStringStyle.MULTI_LINE_STYLE). append("component", getComponent()).
+ * append("source", getSource()). append("phaseId", getPhaseId()).
+ * append("dropValue", getDropValue()). append("draggableSource",
+ * getDraggableSource()). append("dragValue", getDragValue()). toString(); }
+ */
+ public void setDraggableSource(Draggable draggableSource) {
+ this.draggableSource = draggableSource;
+ }
- public void setDragValue(Object dragValue) {
- this.dragValue = dragValue;
- }
+ public String getDragType() {
+ return dragType;
+ }
+
+ public void setDragType(String dragType) {
+ this.dragType = dragType;
+ }
+
+ public Object getDragValue() {
+ return dragValue;
+ }
+
+ public void setDragValue(Object dragValue) {
+ this.dragValue = dragValue;
+ }
}
Modified: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropListener.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropListener.java 2010-11-18 14:37:57 UTC (rev 20086)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropListener.java 2010-11-18 14:44:10 UTC (rev 20087)
@@ -25,15 +25,17 @@
/**
* Listener for process Drop events
+ *
* @author shura
- *
+ *
*/
public interface DropListener extends FacesListener {
-
- /**
- * Process event on Drop for this component.
- * @param event
- */
- public void processDrop(DropEvent event);
+ /**
+ * Process event on Drop for this component.
+ *
+ * @param event
+ */
+ public void processDrop(DropEvent event);
+
}
Modified: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropSource.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropSource.java 2010-11-18 14:37:57 UTC (rev 20086)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropSource.java 2010-11-18 14:44:10 UTC (rev 20087)
@@ -25,30 +25,35 @@
/**
* Interface for component applicable to process drag/drop events.
+ *
* @author shura
- *
+ *
*/
public interface DropSource {
-
- /**
- * Append drop listener to component listeners collection
- * @param listener
- */
- public void addDropListener(DropListener listener);
-
- /**
- * Get array of all Drop Listeners
- * @return
- */
- public DropListener[] getDropListeners();
-
- /**
- * Remove drop listener from component listeners array.
- * @param listener
- */
- public void removeDropListener(DropListener listener);
-
- public void setDropListener(MethodBinding binding);
- public MethodBinding getDropListener();
+ /**
+ * Append drop listener to component listeners collection
+ *
+ * @param listener
+ */
+ public void addDropListener(DropListener listener);
+
+ /**
+ * Get array of all Drop Listeners
+ *
+ * @return
+ */
+ public DropListener[] getDropListeners();
+
+ /**
+ * Remove drop listener from component listeners array.
+ *
+ * @param listener
+ */
+ public void removeDropListener(DropListener listener);
+
+ public void setDropListener(MethodBinding binding);
+
+ public MethodBinding getDropListener();
+
}
14 years, 2 months
JBoss Rich Faces SVN: r20086 - in sandbox/trunk/ui/drag-drop: api and 7 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-11-18 09:37:57 -0500 (Thu, 18 Nov 2010)
New Revision: 20086
Added:
sandbox/trunk/ui/drag-drop/api/
sandbox/trunk/ui/drag-drop/api/pom.xml
sandbox/trunk/ui/drag-drop/api/src/
sandbox/trunk/ui/drag-drop/api/src/main/
sandbox/trunk/ui/drag-drop/api/src/main/java/
sandbox/trunk/ui/drag-drop/api/src/main/java/org/
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Draggable.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Dropzone.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DnDEvent.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragEvent.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragListener.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropListener.java
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropSource.java
Log:
initial commit api
Added: sandbox/trunk/ui/drag-drop/api/pom.xml
===================================================================
--- sandbox/trunk/ui/drag-drop/api/pom.xml (rev 0)
+++ sandbox/trunk/ui/drag-drop/api/pom.xml 2010-11-18 14:37:57 UTC (rev 20086)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the
+ copyright.txt in the distribution for a full listing of
+ individual contributors. This is free software; you can
+ redistribute it and/or modify it under the terms of the GNU
+ Lesser General Public License as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your
+ option) any later version. This software 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 software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St,
+ Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
+ http://www.fsf.org.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-ui-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>../../parent/pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.richfaces.ui.dnd</groupId>
+ <artifactId>richfaces-ui-dnd-api</artifactId>
+ <name>Richfaces UI Components: DND UI</name>
+ <packaging>jar</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <suppressionsLocation>${project.basedir}/richfaces-suppressions.xml</suppressionsLocation>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>xmlunit</groupId>
+ <artifactId>xmlunit</artifactId>
+ <version>1.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/trunk/ui/output/panels/ui</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/trunk/ui/output/panels/ui</developerConnection>
+ <url>http://fisheye.jboss.org/browse/richfaces</url>
+ </scm>
+
+</project>
\ No newline at end of file
Added: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Draggable.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Draggable.java (rev 0)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Draggable.java 2010-11-18 14:37:57 UTC (rev 20086)
@@ -0,0 +1,131 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - 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 javax.faces.context.FacesContext;
+
+import org.richfaces.event.DragListener;
+
+
+/**
+ * Interface for all draggable components. Describe bean properties, implemented by component.
+ * @author shura
+ *
+ */
+public interface Draggable {
+
+ /**
+ * Getter for value parameter, used as key for draggable component.
+ * @return
+ */
+ public Object getDragValue();
+
+ public void setDragValue(Object value);
+
+ /**
+ * Getter for id of component ( instance of {@link UIDragIndicator} ) used for create drag cursor.
+ * @return
+ */
+ public String getDragIndicator();
+
+ /**
+ * @param dragIndicator - id of cursor component
+ */
+ public void setDragIndicator(String dragIndicator);
+
+ /**
+ * Draggable implementation may wish to resolve drag indicator id to clientId itself
+ * @param facesContext {@link FacesContext} instance
+ * @return resolved indicator client id or null
+ * @since 3.1
+ */
+ public String getResolvedDragIndicator(FacesContext facesContext);
+
+ /**
+ * Getter for type of this draggable ( file, mail etc ).
+ * @return
+ */
+ public String getDragType();
+
+ /**
+ * @param dragType
+ */
+ public void setDragType(String dragType);
+
+ /**
+ * Getter for JavaScript event handler, called before start drag operation.
+ * If this handler return false, drag operation is cancelled.
+ * @return javaScript code of event handler.
+ */
+ public String getOndragstart();
+
+ /**
+ * @param dragType
+ */
+ public void setOndragstart(String ondrag);
+
+ /**
+ * Getter for JavaScript event handler; Called when drag operation end.
+ * @return javaScript code of event handler.
+ */
+ public String getOndragend();
+ public void setOndragend(String ondrag);
+
+ /**
+ * Getter for JavaScript event handler; Called when dragged element over the dropzone.
+ * @return javaScript code of event handler.
+ */
+ public String getOndropover();
+ public void setOndropover(String ondropover);
+
+ /**
+ * Getter for JavaScript event handler; Called when dragged element out the dropzone.
+ * @return javaScript code of event handler.
+ */
+ public String getOndropout();
+ public void setOndropout(String ondropout);
+
+ /**
+ * Append drag listener to component listeners collection
+ * @param listener
+ */
+ public void addDragListener(DragListener listener);
+
+ /**
+ * Get array of all Drop Listeners
+ * @return
+ */
+ public DragListener[] getDragListeners();
+
+ /**
+ * Remove drop listener from component listeners array.
+ * @param listener
+ */
+ public void removeDragListener(DragListener listener);
+
+ public String getGrabCursors();
+ public void setGrabCursors(String grabCursors);
+
+ public String getGrabbingCursors();
+ public void setGrabbingCursors(String grabbingCursors);
+
+}
Added: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Dropzone.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Dropzone.java (rev 0)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/component/Dropzone.java 2010-11-18 14:37:57 UTC (rev 20086)
@@ -0,0 +1,122 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - 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 org.richfaces.event.DropSource;
+
+/**
+ * Base interface for all components, accesible as drop zone.
+ * @author shura
+ *
+ */
+public interface Dropzone extends DropSource {
+
+ /**
+ * Getter for dropType's , accepted by this zone.
+ * @return
+ */
+ public Object getAcceptedTypes();
+
+ public void setAcceptedTypes(Object types);
+
+ /**
+ * Getter for mapping between drop types and indicator states.
+ * @return
+ */
+ public Object getTypeMapping();
+
+ public void setTypeMapping(Object types);
+
+
+ /**
+ * Getter for mapping between drop types and acceptable cursors
+ * @return
+ */
+ public Object getCursorTypeMapping();
+ public void setCursorTypeMapping(Object types);
+
+ /**
+ * Getter for JavaScript event handler, called then drag curcor enter in component area.
+ * If this handler return false, or "declined", drop operation on this component not allowed.
+ * If handler return true or "allowed" , or any other supported indicator states, drop operation
+ * is allowed and corresponding indicator state will be displayed.
+ * @return javaScript code of event handler.
+ */
+ public String getOndragenter();
+
+ /**
+ * @param dragType
+ */
+ public void setOndragenter(String ondrag);
+
+ /**
+ * Getter for JavaScript event handler, called before drag cursor leave component area.
+ * @return javaScript code of event handler.
+ */
+ public String getOndragexit();
+
+ /**
+ * @param dragType
+ */
+ public void setOndragexit(String ondrag);
+
+ public Object getDropValue();
+
+ public void setDropValue(Object o);
+
+ /**
+ * Javascript code called before drop event.
+ * @parameter
+ * @return the acceptClass
+ */
+ public abstract String getOndrop();
+
+ /**
+ * @param newOndrop the value to set
+ */
+ public abstract void setOndrop(String newOndrop);
+
+ /**
+ * Javascript handler for event fired on drop even the drop for given type is not available
+ * @parameter
+ * @return the acceptClass
+ */
+ public abstract String getOndropend();
+
+ /**
+ * @param newname the value to set
+ */
+ public abstract void setOndropend(String ondropend);
+
+ /**
+ * Getter for the list of comma separated cursors that indicates when acceptable draggable over dropzone
+ */
+ public String getAcceptCursors();
+ public void setAcceptCursors(String acceptCursors);
+
+ /**
+ * Getter for the list of comma separated cursors that indicates when rejectable draggable over dropzone
+ */
+ public String getRejectCursors();
+ public void setRejectCursors(String rejectCursors);
+
+}
Added: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DnDEvent.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DnDEvent.java (rev 0)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DnDEvent.java 2010-11-18 14:37:57 UTC (rev 20086)
@@ -0,0 +1,46 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * 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.event;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+
+/**
+ *
+ * <br /><br />
+ *
+ * Created 12.11.2007
+ * @author Nick Belaevski
+ * @since 3.2
+ */
+
+public abstract class DnDEvent extends FacesEvent {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -2455016405742082110L;
+
+ public DnDEvent(UIComponent component) {
+ super(component);
+ }
+
+}
Added: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragEvent.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragEvent.java (rev 0)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragEvent.java 2010-11-18 14:37:57 UTC (rev 20086)
@@ -0,0 +1,102 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - 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.event;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesListener;
+
+import org.richfaces.component.Draggable;
+import org.richfaces.component.Dropzone;
+
+/**
+ * @author Nick Belaevski - nbelaevski(a)exadel.com
+ * created 27.12.2006
+ *
+ */
+public class DragEvent extends DnDEvent {
+
+ private Dropzone dropTarget;
+ private Object acceptedTypes;
+ private Object dropValue;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 6179268394391836905L;
+
+ public DragEvent(UIComponent uiComponent) {
+ super(uiComponent);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
+ */
+ public boolean isAppropriateListener(FacesListener faceslistener) {
+ return faceslistener instanceof DragListener;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
+ */
+ public void processListener(FacesListener faceslistener) {
+ ((DragListener) faceslistener).processDrag(this);
+ }
+
+ public Object getDragValue() {
+ return ((Draggable) this.getSource()).getDragValue();
+ }
+
+ public Dropzone getDropTarget() {
+ return dropTarget;
+ }
+
+ /**
+ * @see java.util.EventObject#toString()
+ */
+/* public String toString() {
+ return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).
+ append("component", getComponent()).append("source", getSource()).append("phaseId", getPhaseId()).
+ append("dragValue", getDragValue()).
+ append("dropTarget", getDropTarget()).
+ append("dropValue", getDropValue()).
+ toString();
+ }
+*/
+ public void setDropTarget(Dropzone dropTarget) {
+ this.dropTarget = dropTarget;
+ }
+
+ public Object getAcceptedTypes() {
+ return acceptedTypes;
+ }
+
+ public void setAcceptedTypes(Object acceptedTypes) {
+ this.acceptedTypes = acceptedTypes;
+ }
+
+ public Object getDropValue() {
+ return dropValue;
+ }
+
+ public void setDropValue(Object dropValue) {
+ this.dropValue = dropValue;
+ }
+}
Added: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragListener.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragListener.java (rev 0)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DragListener.java 2010-11-18 14:37:57 UTC (rev 20086)
@@ -0,0 +1,34 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - 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.event;
+
+import javax.faces.event.FacesListener;
+
+/**
+ * @author Nick Belaevski - nbelaevski(a)exadel.com
+ * created 27.12.2006
+ *
+ */
+public interface DragListener extends FacesListener {
+ public void processDrag(DragEvent event);
+
+}
Added: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java (rev 0)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java 2010-11-18 14:37:57 UTC (rev 20086)
@@ -0,0 +1,107 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - 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.event;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesListener;
+
+import org.richfaces.component.Draggable;
+import org.richfaces.component.Dropzone;
+
+/**
+ * @author shura
+ *
+ */
+public class DropEvent extends DnDEvent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1660545054556302746L;
+
+ private Draggable draggableSource;
+ private String dragType;
+ private Object dragValue;
+
+ public DropEvent(UIComponent component) {
+ super(component);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.FacesEvent#isAppropriateListener(javax.faces.event.FacesListener)
+ */
+ public boolean isAppropriateListener(FacesListener listener) {
+ return listener instanceof DropListener;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.event.FacesEvent#processListener(javax.faces.event.FacesListener)
+ */
+ public void processListener(FacesListener listener) {
+ ((DropListener) listener).processDrop(this);
+ }
+
+ /**
+ * @return the dropValue
+ */
+ public Object getDropValue() {
+ return ((Dropzone) this.getSource()).getDropValue();
+ }
+
+ public Draggable getDraggableSource() {
+ return draggableSource;
+ }
+
+ /**
+ * @see java.util.EventObject#toString()
+ */
+/* public String toString() {
+ return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).
+ append("component", getComponent()).
+ append("source", getSource()).
+ append("phaseId", getPhaseId()).
+ append("dropValue", getDropValue()).
+ append("draggableSource", getDraggableSource()).
+ append("dragValue", getDragValue()).
+ toString();
+ }
+*/
+ public void setDraggableSource(Draggable draggableSource) {
+ this.draggableSource = draggableSource;
+ }
+
+ public String getDragType() {
+ return dragType;
+ }
+
+ public void setDragType(String dragType) {
+ this.dragType = dragType;
+ }
+
+ public Object getDragValue() {
+ return dragValue;
+ }
+
+ public void setDragValue(Object dragValue) {
+ this.dragValue = dragValue;
+ }
+}
Added: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropListener.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropListener.java (rev 0)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropListener.java 2010-11-18 14:37:57 UTC (rev 20086)
@@ -0,0 +1,39 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - 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.event;
+
+import javax.faces.event.FacesListener;
+
+/**
+ * Listener for process Drop events
+ * @author shura
+ *
+ */
+public interface DropListener extends FacesListener {
+
+ /**
+ * Process event on Drop for this component.
+ * @param event
+ */
+ public void processDrop(DropEvent event);
+
+}
Added: sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropSource.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropSource.java (rev 0)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropSource.java 2010-11-18 14:37:57 UTC (rev 20086)
@@ -0,0 +1,54 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - 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.event;
+
+import javax.faces.el.MethodBinding;
+
+/**
+ * Interface for component applicable to process drag/drop events.
+ * @author shura
+ *
+ */
+public interface DropSource {
+
+ /**
+ * Append drop listener to component listeners collection
+ * @param listener
+ */
+ public void addDropListener(DropListener listener);
+
+ /**
+ * Get array of all Drop Listeners
+ * @return
+ */
+ public DropListener[] getDropListeners();
+
+ /**
+ * Remove drop listener from component listeners array.
+ * @param listener
+ */
+ public void removeDropListener(DropListener listener);
+
+ public void setDropListener(MethodBinding binding);
+ public MethodBinding getDropListener();
+
+}
14 years, 2 months