JBoss Rich Faces SVN: r258 - in trunk/richfaces/dropdown-menu/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: d.bulahov
Date: 2007-04-04 03:33:14 -0400 (Wed, 04 Apr 2007)
New Revision: 258
Modified:
trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
Development. Has added closing the menu at a choice
Modified: trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2007-04-03 19:42:23 UTC (rev 257)
+++ trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2007-04-04 07:33:14 UTC (rev 258)
@@ -187,16 +187,23 @@
for(Iterator it = children.iterator();it.hasNext();) {
UIComponent kid = (UIComponent)it.next();
String itemId = null;
+ int flcloseonclick=1;
if (kid instanceof UIMenuItem) {
+ UIMenuItem MenuItem=(UIMenuItem)kid;
itemId = kid.getClientId(context);
+ if (MenuItem.isDisabled()){
+ flcloseonclick=0;
+ }
} else if (kid instanceof UIMenuGroup) {
itemId = "ref" + kid.getClientId(context);
+ flcloseonclick=0;
}
if(itemId != null){
buffer
.append(".addItem('")
.append(itemId)
- .append("')");
+ .append("',")
+ .append(flcloseonclick+")");
}
}
Modified: trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2007-04-03 19:42:23 UTC (rev 257)
+++ trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2007-04-04 07:33:14 UTC (rev 258)
@@ -738,33 +738,40 @@
}
},
- addItem: function(itemId, hoverClass, plainClass, hoverStyle, plainStyle){
+ //addItem: function(itemId, hoverClass, plainClass, hoverStyle, plainStyle){
+ addItem: function(itemId, flag_close_onclick){
var dis = this;
var item = {};
- item.hoverClass = hoverClass;// = hoverClass.split(" ");
- item.plainClass = plainClass;//.split(" ");
- if (hoverStyle) item.hoverStyle = Exadel.extractCamelizedRules(hoverStyle);
- if (plainStyle) item.plainStyle = Exadel.extractCamelizedRules(plainStyle);
+ //item.hoverClass = hoverClass;// = hoverClass.split(" ");
+ //item.plainClass = plainClass;//.split(" ");
+ //if (hoverStyle) item.hoverStyle = Exadel.extractCamelizedRules(hoverStyle);
+ //if (plainStyle) item.plainStyle = Exadel.extractCamelizedRules(plainStyle);
item.id = itemId;
item.obj = $(itemId);
item.menu = this;
this.items[itemId] = item;
var onmouseover =
function(e){
- if (this.hoverClass) $(this.id).className = this.hoverClass;
- if(this.hoverStyle) {
- Exadel.replaceStyleHash($(this.id), this.plainStyle, this.hoverStyle);
- }
+ //if (this.hoverClass) $(this.id).className = this.hoverClass;
+ //if(this.hoverStyle) {
+ // Exadel.replaceStyleHash($(this.id), this.plainStyle, this.hoverStyle);
+ //}
this.menu.closeMinors(this.id);
}.bindAsEventListener(item);
- var onmouseout =
+ //var onmouseout =
+ // function(e){
+ //if (this.plainClass) $(this.id).className = this.plainClass;
+ //if(this.hoverStyle) {
+ // Exadel.replaceStyleHash($(this.id), this.hoverStyle, this.plainStyle);
+ //}
+ // }.bindAsEventListener(item);
+
+ var onmouseclick =
function(e){
- if (this.plainClass) $(this.id).className = this.plainClass;
- if(this.hoverStyle) {
- Exadel.replaceStyleHash($(this.id), this.hoverStyle, this.plainStyle);
- }
+ Exadel.Menu.Layers.shutdown();
}.bindAsEventListener(item);
+
var binding = new Exadel.Menu.Layer.Binding (
item.id,
"mouseover",
@@ -772,12 +779,21 @@
this.bindings.push(binding);
binding.refresh();
+ //binding = new Exadel.Menu.Layer.Binding (
+ // item.id,
+ // "mouseout",
+ // onmouseout);
+ //this.bindings.push(binding);
+ //binding.refresh();
+ if (flag_close_onclick==1){
binding = new Exadel.Menu.Layer.Binding (
item.id,
- "mouseout",
- onmouseout);
+ "click",
+ onmouseclick);
this.bindings.push(binding);
binding.refresh();
+ }
+
return this;
},
hideMe: function(e){
17 years, 9 months
JBoss Rich Faces SVN: r257 - in trunk/richfaces/simpleTogglePanel/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-03 15:42:23 -0400 (Tue, 03 Apr 2007)
New Revision: 257
Modified:
trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java
trunk/richfaces/simpleTogglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel.js
trunk/richfaces/simpleTogglePanel/src/main/templates/simpleTogglePanel.jspx
Log:
http://jira.jboss.com/jira/browse/RF-65 fixed
Modified: trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java
===================================================================
--- trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java 2007-04-03 19:14:54 UTC (rev 256)
+++ trunk/richfaces/simpleTogglePanel/src/main/java/org/richfaces/renderkit/html/SimpleTogglePanelRenderer.java 2007-04-03 19:42:23 UTC (rev 257)
@@ -153,19 +153,7 @@
// Server
- //xxx by nick - denis - use org.ajax4jsf.framework.renderer.RendererUtils#getNestingForm(FacesContext, UIComponent)
- RendererUtils rendererUtils = new RendererUtils();
- UIForm Form= rendererUtils.getNestingForm(context, component);
- String formId=null;
- if (Form!=null){
- formId = Form.getClientId(context);
- }
- if(formId==null) {
- throw new RuntimeException("simpleToogleControl (id=\"" + component.getClientId(context) + "\") did not find parent form.");
- }
onClick.append("SimpleTogglePanelManager.toggleOnServer('")
- .append(formId)
- .append("','")
.append(component.getClientId(context))
.append("'")
Modified: trunk/richfaces/simpleTogglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel.js
===================================================================
--- trunk/richfaces/simpleTogglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel.js 2007-04-03 19:14:54 UTC (rev 256)
+++ trunk/richfaces/simpleTogglePanel/src/main/resources/org/richfaces/renderkit/html/scripts/simpleTogglePanel.js 2007-04-03 19:42:23 UTC (rev 257)
@@ -75,9 +75,9 @@
this.panels=this.panels.merge(tmp);
}
-SimpleTogglePanelManager.toggleOnServer = function (formId,clientId) {
- var parentForm = document.forms[formId];
- if(!parentForm) return;
+SimpleTogglePanelManager.toggleOnServer = function (clientId) {
+ var parentForm = A4J.findForm($(clientId + "_header"));
+ if(!parentForm || !parentForm.appendChild /* findForm returns surrogate form object */) return;
var fInput = parentForm[clientId];
if(!fInput) {
Modified: trunk/richfaces/simpleTogglePanel/src/main/templates/simpleTogglePanel.jspx
===================================================================
--- trunk/richfaces/simpleTogglePanel/src/main/templates/simpleTogglePanel.jspx 2007-04-03 19:14:54 UTC (rev 256)
+++ trunk/richfaces/simpleTogglePanel/src/main/templates/simpleTogglePanel.jspx 2007-04-03 19:42:23 UTC (rev 257)
@@ -15,15 +15,11 @@
new org.ajax4jsf.framework.resource.PrototypeScript(),
new org.ajax4jsf.framework.ajax.AjaxScript(),
new org.ajax4jsf.framework.ajax.ImageCacheScript(),
+/org/ajax4jsf/renderkit/html/scripts/form.js,
/org/richfaces/renderkit/html/scripts/browser_info.js,
scripts/simpleTogglePanel.js
</h:scripts>
- <jsp:scriptlet>
- <![CDATA[org.richfaces.component.util.FormUtil.throwEnclFormReqExceptionIfNeed(context,component);]]>
- </jsp:scriptlet>
-
-
<div id="#{clientId}" x:passThruWithExclusions="id,value,styleClass"
class="dr-stglpnl rich-stglpanel #{component.attributes['styleClass']}"
style="width: #{component.attributes['width']}; #{component.attributes['style']};">
@@ -55,6 +51,7 @@
));
</script>
+ <f:call name="utils.encodeBeginFormIfNessesary"/>
<div id="#{clientId}_header"
class="dr-stglpnl-h rich-stglpanel-header #{component.attributes['headerClass']}"
style="position : relative;"
17 years, 9 months
JBoss Rich Faces SVN: r256 - in trunk: richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-03 15:14:54 -0400 (Tue, 03 Apr 2007)
New Revision: 256
Modified:
trunk/richfaces-samples/tree-demo/src/main/java/org/richfaces/Bean.java
trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp
trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js
Log:
http://jira.jboss.com/jira/browse/RF-50 fixed. Test app updated
Modified: trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
===================================================================
--- trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2007-04-03 15:58:16 UTC (rev 255)
+++ trunk/richfaces/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2007-04-03 19:14:54 UTC (rev 256)
@@ -22,7 +22,9 @@
package org.richfaces.renderkit;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -38,6 +40,7 @@
import org.ajax4jsf.framework.renderer.ComponentsVariableResolver;
import org.ajax4jsf.framework.util.javascript.JSFunction;
import org.ajax4jsf.framework.util.javascript.JSReference;
+import org.ajax4jsf.framework.util.javascript.ScriptUtils;
import org.richfaces.component.LastElementAware;
import org.richfaces.component.TreeRowKey;
import org.richfaces.component.UITree;
@@ -145,6 +148,8 @@
responseWriter.startElement("div", tree);
writeNamespace(context, component);
+ List encodedAreaIds = new ArrayList();
+
try {
Set ajaxKeys = tree.getAjaxKeys();
if (ajaxKeys != null) {
@@ -154,10 +159,11 @@
tree.setRowKey(key);
String id = tree.getNodeFacet().getClientId(context);
- if (ids.isEmpty() || ids.contains(id)) {
+ if (ids.isEmpty() || ids.contains(id) || ids.contains(tree.getClientId(context))/* handle tree updates requests */) {
writeContent(context, tree, key);
encodeScripts = true;
renderedAreas.add(id);
+ encodedAreaIds.add(id);
}
}
}
@@ -168,7 +174,7 @@
tree.restoreOrigValue();
}
if (encodeScripts) {
- writeScript(context, tree, renderedAreas);
+ writeScript(context, tree, encodedAreaIds, renderedAreas);
}
String inputId = encodeSelectionStateInput(context, tree);
@@ -243,7 +249,7 @@
return "Richfaces_Tree_" + id.replaceAll("[^A-Za-z0-9_]", "_");
}
- private void writeScript(FacesContext context, UITree tree,
+ private void writeScript(FacesContext context, UITree tree, List encodedAreaIds,
Set renderedAreas) throws IOException {
final ResponseWriter writer = context.getResponseWriter();
final String clientId = tree.getBaseClientId(context);
@@ -254,30 +260,12 @@
writer.startElement("script", tree);
getUtils().writeAttribute(writer, "type", "text/javascript");
- Set set = tree.getAjaxKeys();
String varName = getJavaScriptVarName(context, tree);
- Object storedRowKey = tree.getRowKey();
+ writer.writeText(varName + ".getNodeElements(" +
+ ScriptUtils.toScript(encodedAreaIds) + ");", null);
- try {
- if (set != null) {
- Iterator iterator = set.iterator();
- while (iterator.hasNext()) {
- TreeRowKey rowKey = (TreeRowKey) iterator.next();
- tree.setRowKey(rowKey);
-
- writer.writeText(varName + ".getNodeElements(" + varName
- + ", \"" + tree.getNodeFacet().getClientId(context) + "\");", null);
- }
-
- set.clear();
- }
- } finally {
- tree.setRowKey(storedRowKey);
- }
-
-
writer.endElement("script");
writer.endElement("div");
Modified: trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js
===================================================================
--- trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js 2007-04-03 15:58:16 UTC (rev 255)
+++ trunk/richfaces/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js 2007-04-03 19:14:54 UTC (rev 256)
@@ -128,15 +128,25 @@
this.items.each(function(item) {item.deselect();} );
},
- getNodeElements: function(node, nodeId) {
+
+ getNodeElements: function(nodeIds) {
+ if (nodeIds) {
+ for (var i = 0; i < nodeIds.length; i++ ) {
+ this._getNodeElements(this, nodeIds[i]);
+ }
+
+ this.selectionManager.restoreSelection();
+ }
+ },
+
+ _getNodeElements: function(node, nodeId) {
if (node.id == nodeId) {
node.getElements();
node.observeEvents();
- this.selectionManager.restoreSelection();
this.input = $(this.inputId);
} else {
for (var i = 0; i < node.childs.length; i++) {
- this.getNodeElements(node.childs[i], nodeId);
+ this._getNodeElements(node.childs[i], nodeId);
}
}
},
Modified: trunk/richfaces-samples/tree-demo/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/richfaces-samples/tree-demo/src/main/java/org/richfaces/Bean.java 2007-04-03 15:58:16 UTC (rev 255)
+++ trunk/richfaces-samples/tree-demo/src/main/java/org/richfaces/Bean.java 2007-04-03 19:14:54 UTC (rev 256)
@@ -22,9 +22,11 @@
package org.richfaces;
import java.io.IOException;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
+import java.util.Set;
import javax.faces.FacesException;
import javax.faces.component.UIComponent;
@@ -32,8 +34,10 @@
import javax.faces.event.FacesEvent;
import org.ajax4jsf.dnd.event.DropEvent;
+import org.ajax4jsf.framework.ajax.AjaxContext;
import org.richfaces.component.ListRowKey;
import org.richfaces.component.TreeNode;
+import org.richfaces.component.TreeNodeImpl;
import org.richfaces.component.TreeRowKey;
import org.richfaces.component.UITree;
import org.richfaces.component.UITreeNode;
@@ -65,6 +69,10 @@
private String pathToExpand;
private boolean dragOn = true;
+
+ private TreeNodeImpl data1;
+
+ private int counter = 0;
public String getIcon() {
return icon;
@@ -116,6 +124,20 @@
e.printStackTrace();
}
+ data1 = new TreeNodeImpl();
+ data1.setData("Root node");
+ for (int i = 0; i < 10; i++)
+ {
+ TreeNodeImpl child = new TreeNodeImpl() {
+
+ public Object getData() {
+ return super.getData() + " " + counter;
+ }
+ };
+ String id = Integer.toString(i);
+ child.setData("Node: " + id);
+ data1.addChild(id, child);
+ }
initData();
}
@@ -159,6 +181,32 @@
}
}
+ public void onSelectInc(NodeSelectedEvent event) {
+ counter ++;
+
+ UITree tree = getTree(event);
+ TreeRowKey key = (TreeRowKey)tree.getRowKey();
+ Set keys = tree.getAjaxKeys();
+ if (keys == null)
+ {
+ keys = new HashSet();
+ tree.setAjaxKeys(keys);
+ }
+
+ AjaxContext ajaxCtx = AjaxContext.getCurrentInstance();
+ FacesContext fctx = FacesContext.getCurrentInstance();
+ tree.setRowKey(null);
+ // Force more than one node to update here:
+ for (int i = 0; i < 5; i++)
+ {
+ ListRowKey dirtyKey = new ListRowKey(Integer.toString(i));
+ keys.add(dirtyKey);
+ tree.setRowKey(dirtyKey);
+ ajaxCtx.addComponentToAjaxRender(tree.getParent(), tree.getClientId(fctx));
+ }
+ tree.setRowKey(key);
+ }
+
private void initData() {
selectedNodeChildren.clear();
if (selectedNode != null) {
@@ -302,4 +350,12 @@
public void setDragOn(boolean dragOn) {
this.dragOn = dragOn;
}
+
+ public TreeNodeImpl getData1() {
+ return data1;
+ }
+
+ public void setData1(TreeNodeImpl data1) {
+ this.data1 = data1;
+ }
}
\ No newline at end of file
Modified: trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp 2007-04-03 15:58:16 UTC (rev 255)
+++ trunk/richfaces-samples/tree-demo/src/main/webapp/pages/index.jsp 2007-04-03 19:14:54 UTC (rev 256)
@@ -97,6 +97,25 @@
<a4j:support event="onchange" reRender="tree" action="#{bean.expandNode}"/>
</h:inputText>
+ <f:verbatim>
+ <br />
+ <br />
+ </f:verbatim>
+
+ <rich:tree id="testTree"
+ var="_data"
+ switchType="ajax"
+ ajaxSubmitSelection="true"
+ preserveModel="none"
+ value="#{bean.data1}"
+ nodeSelectListener="#{bean.onSelectInc}"
+ nodeFace="node">
+ <rich:treeNode type="node">
+ <h:outputText value="#{_data}" />
+ </rich:treeNode>
+ </rich:tree>
+
+
</h:form>
<a4j:status startText="...start..." />
17 years, 9 months
JBoss Rich Faces SVN: r255 - trunk/richfaces/panelmenu.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-04-03 11:58:16 -0400 (Tue, 03 Apr 2007)
New Revision: 255
Modified:
trunk/richfaces/panelmenu/
Log:
service files svn:ignored
Property changes on: trunk/richfaces/panelmenu
___________________________________________________________________
Name: svn:ignore
- target
+ target
.settings
.project
.classpath
17 years, 9 months
JBoss Rich Faces SVN: r254 - trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: A.Skokov
Date: 2007-04-03 11:06:11 -0400 (Tue, 03 Apr 2007)
New Revision: 254
Modified:
trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/SuggestionBoxComponentTest.java
Log:
test updated
Modified: trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/SuggestionBoxComponentTest.java
===================================================================
--- trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/SuggestionBoxComponentTest.java 2007-04-03 14:50:11 UTC (rev 253)
+++ trunk/richfaces/suggestionbox/src/test/java/org/richfaces/component/SuggestionBoxComponentTest.java 2007-04-03 15:06:11 UTC (rev 254)
@@ -82,7 +82,6 @@
sb = new HtmlSuggestionBox();
sb.setId("suggestionBox");
sb.setFor(input.getId());
- sb.setRendererType(HtmlSuggestionBox.COMPONENT_TYPE);
renderKit.addRenderer(HtmlSuggestionBox.COMPONENT_FAMILY, HtmlSuggestionBox.COMPONENT_TYPE, new SuggestionBoxRenderer());
form.getChildren().add(sb);
17 years, 9 months
JBoss Rich Faces SVN: r253 - trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html.
by richfaces-svn-commits@lists.jboss.org
Author: a.izobov
Date: 2007-04-03 10:50:11 -0400 (Tue, 03 Apr 2007)
New Revision: 253
Modified:
trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
Log:
do not render submenu for disabled menuGroup
Modified: trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2007-04-03 14:30:02 UTC (rev 252)
+++ trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2007-04-03 14:50:11 UTC (rev 253)
@@ -62,7 +62,7 @@
for (Iterator iter = flatListOfNodes.iterator(); iter.hasNext();) {
UIMenuGroup node = (UIMenuGroup) iter.next();
- processLayer(context, node, width);
+ if (node.isRendered() && !node.isDisabled()) processLayer(context, node, width);
}
}
17 years, 9 months
JBoss Rich Faces SVN: r252 - trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: d.bulahov
Date: 2007-04-03 10:30:02 -0400 (Tue, 03 Apr 2007)
New Revision: 252
Modified:
trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
Development
Modified: trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2007-04-03 14:17:46 UTC (rev 251)
+++ trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2007-04-03 14:30:02 UTC (rev 252)
@@ -567,13 +567,13 @@
Event.stop(e);
}.bindAsEventListener();
-Exadel.Menu.Layer.openSelect = function(){
+Exadel.Menu.Layer.openSelect = function(event){
Exadel.Menu.selectOpen = true;
var ClickInput = Exadel.Menu.Layer.ClickInput.bindAsEventListener(this);
Event.observe(Event.element(event), "click", Exadel.Menu.Layer.ClickInput);
}
-Exadel.Menu.Layer.closeSelect = function(){
+Exadel.Menu.Layer.closeSelect = function(event){
Exadel.Menu.selectOpen = false;
var ClickInput = Exadel.Menu.Layer.ClickInput.bindAsEventListener(this);
17 years, 9 months
JBoss Rich Faces SVN: r251 - trunk/richfaces/menu-components/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: d.bulahov
Date: 2007-04-03 10:17:46 -0400 (Tue, 03 Apr 2007)
New Revision: 251
Modified:
trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx
Log:
remove css-rules.js
Modified: trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx
===================================================================
--- trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx 2007-04-03 14:15:41 UTC (rev 250)
+++ trunk/richfaces/menu-components/src/main/templates/org/richfaces/htmlMenuGroup.jspx 2007-04-03 14:17:46 UTC (rev 251)
@@ -15,8 +15,7 @@
<h:scripts>
new org.ajax4jsf.framework.resource.PrototypeScript(),
new org.ajax4jsf.framework.ajax.AjaxScript(),
- scripts/menu.js,
- scripts/css-rules.js
+ scripts/menu.js
</h:scripts>
<f:call name="initializeResources" />
17 years, 9 months
JBoss Rich Faces SVN: r250 - trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: a.izobov
Date: 2007-04-03 10:15:41 -0400 (Tue, 03 Apr 2007)
New Revision: 250
Modified:
trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
event support(onclose, onopen) for menuGroup added
Modified: trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2007-04-03 14:14:48 UTC (rev 249)
+++ trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2007-04-03 14:15:41 UTC (rev 250)
@@ -710,8 +710,8 @@
//LOG.a4j_debug('show me ' + this.id +' ' +this.level);
Exadel.Menu.Layers.showMenuLayer(this.id, e, this.delay);
Exadel.Menu.Layers.levels[this.level] = this;
+ if (this.eventOnOpen) this.eventOnOpen();
-
},
closeSiblings: function(e){
//LOG.a4j_debug('closeASiblins ' + this.id +' ' +this.level);
@@ -784,7 +784,7 @@
Exadel.Menu.Layers.clearPopUpTO();
Exadel.Menu.Layers.levels[this.level] = null;
Exadel.Menu.Layers.LMPopUpL(this.id, false);
-
+ if (this.eventOnClose) this.eventOnClose();
},
asDropDown: function(topLevel, onEvt, offEvt, options){
this.options = options || {};
@@ -826,6 +826,13 @@
},
asSubMenu: function(parent, refLayerName, evtName, options){
this.options = options || {};
+ if (this.options.onclose != ""){
+ this.eventOnClose = new Function("event",this.options.onclose).bindAsEventListener(this);
+ }
+ if (this.options.onopen != ""){
+ this.eventOnOpen = new Function("event",this.options.onopen).bindAsEventListener(this);
+ }
+
if(!evtName){
evtName = 'onmouseover';
}
17 years, 9 months
JBoss Rich Faces SVN: r249 - in trunk/richfaces/dropdown-menu/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: d.bulahov
Date: 2007-04-03 10:14:48 -0400 (Tue, 03 Apr 2007)
New Revision: 249
Removed:
trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/css-rules.js
Modified:
trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
trunk/richfaces/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx
Log:
Development add events attributes in javascript, remove css-rules.js
Modified: trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2007-04-03 14:08:52 UTC (rev 248)
+++ trunk/richfaces/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2007-04-03 14:14:48 UTC (rev 249)
@@ -39,7 +39,10 @@
import org.richfaces.component.UIMenuGroup;
import org.richfaces.component.UIMenuItem;
import org.richfaces.component.UIMenuSeparator;
+import org.richfaces.renderkit.ScriptOptions;
+import org.ajax4jsf.framework.util.javascript.JSFunction;
+
public class DropDownMenuRendererBase extends HeaderResourcesRendererBase {
protected Class getComponentClass() {
@@ -124,81 +127,62 @@
}
public void encodeScript(FacesContext context, UIComponent component) throws IOException {
- StringBuffer buffer =
- new StringBuffer("new Exadel.Menu.Layer('")
- .append(component.getClientId(context)+"_menu")
- .append("','")
- .append(component.getAttributes().get("showDelay"))
- .append("',");
- if (component instanceof UIDropDownMenu) {
- buffer.append("'")
- .append(component.getAttributes().get("hideDelay"))
- .append("'");
- }
- else{
- buffer.append("null");
- }
- buffer.append( ")");
- if (component instanceof UIMenuGroup) {
- buffer.append(".asSubMenu('")
- .append(component.getParent().getClientId(context)+"_menu")
- .append("','")
- .append("ref")
- .append(component.getClientId(context))
- .append("',");
- String evt = (String) component.getAttributes().get("event");
- if(evt == null || evt.trim().length() == 0){
+
+
+ StringBuffer buffer = new StringBuffer();
+ JSFunction function = new JSFunction("new Exadel.Menu.Layer");
+ function.addParameter(component.getClientId(context)+"_menu");
+ function.addParameter(component.getAttributes().get("showDelay"));
+ if (component instanceof UIDropDownMenu) {
+ function.addParameter(component.getAttributes().get("hideDelay"));
+ }
+ else{
+ function.addParameter("null");
+ }
+ function.appendScript(buffer);
+ if (component instanceof UIMenuGroup) {
+ buffer.append(".");
+ function = new JSFunction("asSubMenu");
+ function.addParameter(component.getParent().getClientId(context)+"_menu");
+ function.addParameter("ref"+component.getClientId(context));
+ String evt = (String) component.getAttributes().get("event");
+ if(evt == null || evt.trim().length() == 0){
evt = "onmouseover";
- }
- buffer.append("'").append(evt).append("',")
- .append("{")
- .append("onmouseout:'" + component.getAttributes().get("onmouseout")+"'")
- .append(",")
- .append("onmousemove:'" + component.getAttributes().get("onmousemove")+"'")
- .append(",")
- .append("onmouseover:'" + component.getAttributes().get("onmouseover")+"'")
- .append(",")
- .append("onopen:'" + component.getAttributes().get("onopen")+"'")
- .append(",")
- .append("onclose:'" + component.getAttributes().get("onclose")+"'")
- .append("}")
- .append(")");
+ }
+ function.addParameter(evt);
+ ScriptOptions Optionssub = new ScriptOptions(component);
+ Optionssub.addOption("onopen", component.getAttributes().get("onopen"));
+ Optionssub.addOption("onclose", component.getAttributes().get("onclose"));
+ function.addParameter(Optionssub);
+ function.appendScript(buffer);
+
} else {
- buffer
- .append(".asDropDown('")
- .append(component.getClientId(context))
- .append("'");
-
- String evt = (String) component.getAttributes().get("event");
- if(evt == null || evt.trim().length() == 0){
- evt = "onmouseover";
- }
- buffer.append(",'").append(evt).append("','onmouseout',")
- .append("{")
- .append("direction:'" + component.getAttributes().get("direction")+"'")
- .append(",")
- .append("jointPoint:'" + component.getAttributes().get("jointPoint")+"'")
- .append(",")
- .append("verticalOffset:'" + component.getAttributes().get("verticalOffset")+"'")
- .append(",")
- .append("horizontalOffset:'" + component.getAttributes().get("horizontalOffset")+"'")
- .append(",")
- .append("oncollapse:'" + component.getAttributes().get("oncollapse")+"'")
- .append(",")
- .append("onexpand:'" + component.getAttributes().get("onexpand")+"'")
- .append(",")
- .append("onmouseout:'" + component.getAttributes().get("onmouseout")+"'")
- .append(",")
- .append("onmousemove:'" + component.getAttributes().get("onmousemove")+"'")
- .append(",")
- .append("onmouseover:'" + component.getAttributes().get("onmouseover")+"'")
- .append(",")
- .append("onitemselect:'" + component.getAttributes().get("onitemselect")+"'")
- .append(",")
- .append("ongroupactivate:'" + component.getAttributes().get("ongroupactivate")+"'")
- .append("}")
- .append(")");
+ buffer.append(".");
+ function = new JSFunction("asDropDown");
+ function.addParameter(component.getClientId(context));
+ String evt = (String) component.getAttributes().get("event");
+ if(evt == null || evt.trim().length() == 0){
+ evt = "onmouseover";
+ }
+ function.addParameter(evt);
+ function.addParameter("onmouseout");
+ ScriptOptions Options = new ScriptOptions(component);
+
+ Options.addOption("direction", component.getAttributes().get("direction"));
+ Options.addOption("jointPoint", component.getAttributes().get("jointPoint"));
+ Options.addOption("verticalOffset", component.getAttributes().get("verticalOffset"));
+
+
+ Options.addOption("horizontalOffset", component.getAttributes().get("horizontalOffset"));
+ Options.addOption("oncollapse", component.getAttributes().get("oncollapse"));
+ Options.addOption("onexpand", component.getAttributes().get("onexpand"));
+ Options.addOption("onitemselect", component.getAttributes().get("onitemselect"));
+ Options.addOption("ongroupactivate", component.getAttributes().get("ongroupactivate"));
+ function.addParameter(Options);
+ function.appendScript(buffer);
+
}
+
List children = component.getChildren();
for(Iterator it = children.iterator();it.hasNext();) {
UIComponent kid = (UIComponent)it.next();
@@ -215,9 +199,13 @@
.append("')");
}
}
+
ResponseWriter out = context.getResponseWriter();
String script =buffer.append(";").toString();
out.write(script);
+
+
+
}
Deleted: trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/css-rules.js
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/css-rules.js 2007-04-03 14:08:52 UTC (rev 248)
+++ trunk/richfaces/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/css-rules.js 2007-04-03 14:14:48 UTC (rev 249)
@@ -1,49 +0,0 @@
-if(!Exadel) var Exadel = {};
-Exadel.extractRules = function(style){
- var rules = style.split(";");
- var rulesHash = {};
- $A(rules).each(
- function(rule){
- if(!rule) return;
- var i = rule.indexOf(':');
- if(i > 0){
- var nam = Exadel.trimString(rule.substr(0, i));
- val = Exadel.trimString(rule.substr(i + 1));
- rulesHash[nam] = val;
- }
-
- }
- );
- return rulesHash;
-}
-Exadel.extractCamelizedRules = function(style){
- var hash = Exadel.extractRules(style);
- var newHash = {};
- for(key in hash){
- newHash[key.camelize()] = hash[key];
- }
- return newHash;
-}
-Exadel.trimString = function(s){
- return s.replace(/^\s+/, '').replace(/\s+$/, '');
-}
-
-Exadel.replaceStyleHash = function(obj, hash1, hash2){
- for(key in hash1){
- obj.style[key] = '';
- }
- for(key in hash2){
- obj.style[key] = hash2[key];
- }
-}
-
-Exadel.replaceStyle = function(obj, style1, style2){
- var hash1 = Exadel.extractRules(style1);
- for(key in hash1){
- hash1[key] = '';
- }
- var hash2 = Exadel.extractRules(style2);
- Element.setStyle(obj, hash1);
- Element.setStyle(obj, hash2);
- return $H(obj.style).inspect();
-}
\ No newline at end of file
Modified: trunk/richfaces/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx
===================================================================
--- trunk/richfaces/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx 2007-04-03 14:08:52 UTC (rev 248)
+++ trunk/richfaces/dropdown-menu/src/main/templates/org/richfaces/htmlDropDownMenu.jspx 2007-04-03 14:14:48 UTC (rev 249)
@@ -14,8 +14,7 @@
<h:scripts>
new org.ajax4jsf.framework.resource.PrototypeScript(),
new org.ajax4jsf.framework.ajax.AjaxScript(),
- scripts/menu.js,
- scripts/css-rules.js
+ scripts/menu.js
</h:scripts>
<f:clientid var="clientId"/>
@@ -24,8 +23,9 @@
</jsp:scriptlet>
<div id="#{clientId}" class="dr-menu-label dr-menu-label-unselect rich-menu-label rich-menu-label-unselect #{component.attributes['styleClass']}"
style="#{component.attributes['style']};"
- onmouseover="this.className='dr-menu-label dr-menu-label-select rich-menu-label rich-menu-label-select'"
- onmouseout="this.className='dr-menu-label dr-menu-label-unselect rich-menu-label rich-menu-label-unselect'">
+ onmouseover="this.className='dr-menu-label dr-menu-label-select rich-menu-label rich-menu-label-select' ; #{component.attributes['onmouseover']}"
+ onmouseout="this.className='dr-menu-label dr-menu-label-unselect rich-menu-label rich-menu-label-unselect'; #{component.attributes['onmouseout']}"
+ onmousemove="#{component.attributes['onmousemove']}">
<jsp:scriptlet>
<![CDATA[if(component.getFacet("label")!=null && component.getFacet("label").isRendered()) {]]>
</jsp:scriptlet>
17 years, 9 months