JBoss Rich Faces SVN: r20343 - sandbox/trunk/ui.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-03 08:49:38 -0500 (Fri, 03 Dec 2010)
New Revision: 20343
Removed:
sandbox/trunk/ui/drag-drop/
Log:
remove from sandbox
14 years, 1 month
JBoss Rich Faces SVN: r20342 - in sandbox/trunk/ui/dropdown-menu/ui/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-12-03 08:49:37 -0500 (Fri, 03 Dec 2010)
New Revision: 20342
Added:
sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/menugroup.js
Modified:
sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js
sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/menugroup.template.xml
Log:
drop-down menu and menu group client-code update
https://jira.jboss.org/browse/RF-9785
Modified: sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js 2010-12-03 13:42:22 UTC (rev 20341)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js 2010-12-03 13:49:37 UTC (rev 20342)
@@ -1,20 +1,14 @@
(function($, rf) {
rf.ui = rf.ui || {};
- var defaultPopupListOptions = {
- showEvent: 'mouseover',
- attachToBody: false,
- positionOffset: [0, 0],
- selectItemCss: "rf-ddm-itm-sel",
- listCss: "rf-ddm-lst"
- };
+
var defaultOptions = {
mode: 'server',
attachToBody: false,
positionOffset: [0, 0],
showDelay: 50,
hideDelay: 800,
- verticalOffset: 10,
- horisantalOffset: 10,
+ verticalOffset: 0,
+ horisantalOffset: 0,
showEvent: 'mouseover',
direction: "AA",
jointPoint: "AA",
@@ -26,8 +20,7 @@
};
//constructor definition
- rf.ui.Menu = function(componentId, options) {
- this.id = componentId;
+ rf.ui.Menu = function(componentId, options) {
$super.constructor.call(this, componentId);
this.id = componentId;
this.groupList = new Array();
@@ -35,32 +28,20 @@
$.extend(this.options, defaultOptions, options || {});
this.attachToDom(componentId);
- //bindEventHandlers.call(this);
this.element = rf.getDomElement(this.id);
this.selectItemCss = this.options.selectItemCss;
this.unselectItemCss = this.options.unselectItemCss;
-
- //menu items list
- //this.target = 'dd_menu_id_label_container';
- //popup for item menu list
- //var base = rf.getDomElement(this.id);
-
+
this.displayed = false;
- //this.popup = $(rf.getDomElement(this.id + "_list"));
- //this.initiatePopup(this.popup, base, this.options.showEvent);
- //this.initiateMenu(this.popup, base, this.options.showEvent);
this.options.attachTo = this.id;
+ this.options.positionOffset=[this.options.horisantalOffset, this.options.verticalOffset];
this.popupList = new RichFaces.ui.PopupList(this.id + "_list", this, this.options);
this.selectedGroup = null;
rf.Event.bindById(this.id, this.options.showEvent, $.proxy(this.___showHandler, this), this);
- //rf.Event.bindById(this.id, 'mouseenter', $.proxy(this.__enterHandler, this), this);
rf.Event.bindById(this.id, "mouseleave", $.proxy(this.__leaveHandler, this), this);
- //rf.Event.bindById(this.id, "mouseover", $.proxy(this.__overHandler, this), this);
- //rf.Event.bindById(this.id, "blur", $.proxy(this.__blurHandler, this), this);
- // rf.Event.bindById(this.id, "focus", $.proxy(this.__focusHandler, this), this);
- //this.popupList.show();
+
};
rf.BaseComponent.extend(rf.ui.Menu);
@@ -73,40 +54,17 @@
initiateGroups: function(groupOptions) {
for (var i in groupOptions) {
- var groupId = groupOptions[i].id;
- var horizontalOffset = groupOptions[i].horizontalOffset;
- var verticalOffset = groupOptions[i].verticalOffset;
+ var groupId = groupOptions[i].id;
+ var positionOffset = [groupOptions[i].horizontalOffset, groupOptions[i].verticalOffset]
+ var onshow = groupOptions[i].onshow;
+ var onhide = groupOptions[i].onhide;
var eventType = "mouseover";
if (null != groupId) {
- var options = defaultPopupListOptions;
- options.attachTo = groupId;
- var base = rf.getDomElement(groupId);
- //var popup=$("#"+groupId+" .rf-ddm-sublst:first");
- var menu = this;
- var popup = new RichFaces.ui.Popup(groupId + '_list', options);
- this.groupList[groupId] = popup;
-
- rf.Event.bindById(groupId, "mouseenter",
- function(event) {
- var id = event.target.id;
- if (menu.groupList[id]) {
- menu.invokeEvent("groupshow", rf.getDomElement(menu.id), null);
- //menu.invokeEvent("show", rf.getDomElement(id), null);
- menu.groupList[id].popup.show();
- }
- },
- this);
- rf.Event.bindById(groupId, "mouseleave",
- function(event) {
- var id = event.target.id;
- if (menu.groupList[id]) {
- menu.invokeEvent("grouphide", rf.getDomElement(menu.id), null);
- //menu.invokeEvent("hide", rf.getDomElement(id), null);
- menu.groupList[id].popup.hide();
- }
- });
+ //var popup = new RichFaces.ui.Popup(groupId + '_list', options);
+ var group= new RichFaces.ui.MenuGroup(groupId,{parentMenuId: this.id, onshow: onshow, onhide: onhide});
+ this.groupList[groupId] = group;
}
}
},
@@ -114,11 +72,9 @@
submitForm: function(item) {
var form = this.__getParentForm(item);
if (this.options.mode == "server") {
- console.info('server submit ' + item.attr('id'));
//rf.submitForm(form, {selectedMenuItem: item.id});
}
if (this.options.mode == "ajax") {
- console.info('ajax submit');
//rf.ajax(item.id);
}
},
@@ -126,8 +82,7 @@
processItem: function(item) {
if (item && item.atrr('id') && !this.isDisabled(item) && this.isGroup(item)) {
this.invokeEvent("itemclick", rf.getDomElement(this.id), null);
- this.hidePopup();
- //this.submitForm(item);
+ this.hidePopup();
}
},
@@ -148,23 +103,10 @@
// item.addClass(this.unselectItemCss);
// }
- },
- isGroup: function(item) {
- return 'object' == typeof this.groupList[item.atrr('id')];
- },
- isDisabled: function(item) {
- return item.hasClass(this.options.disabledItemCss);
- },
- isWithin: function(item){
- if (this.selectedGroup && item.parents().is('#'+this.selectedGroup)){
- return true;
- } else {
- return false;
- }
- },
+ },
showPopup: function() {
- if (!this.___isShown()){
+ if (!this.__isShown()){
this.invokeEvent("show", rf.getDomElement(this.id), null);
this.popupList.show();
this.displayed=true;
@@ -172,61 +114,60 @@
},
hidePopup: function() {
- for (var i in this.groupList) {
- this.groupList[i].popup.hide();
- }
- if (this.___isShown()){
+ /* for (var i in this.groupList) {
+ this.groupList[i].hide();
+ }*/
+ if (this.__isShown()){
this.invokeEvent("hide", rf.getDomElement(this.id), null);
this.popupList.hide();
this.displayed=false;
}
- this.popupList.hide();
+
},
- ___isShown: function() {
+
+ __isGroup: function(item) {
+ return 'object' == typeof this.groupList[item.atrr('id')];
+ },
+
+ __isDisabled: function(item) {
+ return item.hasClass(this.options.disabledItemCss);
+ },
+
+ __isShown: function() {
return this.displayed;
},
+
___showHandler: function() {
this.showTimeoutId = window.setTimeout($.proxy(function(){
this.showPopup();
- }, this), this.options.showDelay)
+ }, this), this.options.showDelay);
},
+
__getParentForm: function(item) {
return item.parents("form")[0];
},
- __enterHandler: function(e) {
- // this.showPopup();
- },
+
+
+
__leaveHandler: function(e) {
window.clearTimeout(this.showTimeoutId);
this.hideTimeoutId = window.setTimeout($.proxy(function(){
this.hidePopup();
}, this), this.options.hideDelay);
},
+
__overHandler: function(e) {
window.clearTimeout(this.hideTimeoutId);
},
- __clickHandler: function(e) {
- //this.showPopup();
- },
- __blurHandler: function(event) {
-// this.timeoutId = window.setTimeout($.proxy(function(){
-// this.onblur();
-// this.hidePopup();
-// }, this), this.hidePopup);
-
- },
- __focusHandler: function(event) {
- //window.clearTimeout(this.timeoutId);
-
- },
+
destroy: function() {
// clean up code here
-
- // call parent's destroy method
+ this.detach(this.id);
+
+ // call parent's destroy method
$super.destroy.call(this);
}
-
};
})());
})(jQuery, RichFaces)
\ No newline at end of file
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/menugroup.js
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/menugroup.js (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/menugroup.js 2010-12-03 13:49:37 UTC (rev 20342)
@@ -0,0 +1,72 @@
+(function($, rf) {
+ rf.ui = rf.ui || {};
+ var defaultOptions = {
+ showEvent: 'mouseover',
+ attachToBody: false,
+ positionOffset: [0, 0],
+ selectItemCss: "rf-ddm-itm-sel",
+ listCss: "rf-ddm-lst"
+ }
+ //constructor definition
+ rf.ui.MenuGroup = function(componentId, options) {
+ this.id = componentId;
+ $super.constructor.call(this, componentId);
+ this.attachToDom(componentId);
+ this.options = {};
+ $.extend(this.options, defaultOptions, options || {});
+ this.parentMenu = rf.$(this.options.parentMenuId);
+ this.popup = new RichFaces.ui.Popup(this.id + '_list',
+ {attachTo: this.id,
+ positionOffset: this.options.positionOffset,
+ attachToBody: this.options.attachToBody
+ }
+ );
+ rf.Event.bindById(this.id, "mouseenter", $.proxy(this.__enterHandler,this), this);
+ rf.Event.bindById(this.id, "mouseleave",$.proxy(this.__leaveHandler,this), this);
+ this.shown = false;
+ };
+
+ rf.BaseComponent.extend(rf.ui.MenuGroup);
+
+ // define super class link
+ var $super = rf.ui.MenuGroup.$super;
+
+ $.extend(rf.ui.MenuGroup.prototype, (function() {
+ return {
+ name: "MenuGroup",
+ show: function() {
+ var id=this.id;
+ if (this.parentMenu.groupList[id] && !this.shown) {
+ this.parentMenu.invokeEvent("groupshow", rf.getDomElement(this.parentMenu.id), null);
+ this.invokeEvent("show", rf.getDomElement(id), null);
+ this.popup.show();
+ this.shown=true;
+ }
+ },
+ hide: function() {
+ var id=this.id;
+ var menu = this.parentMenu;
+ if (menu.groupList[this.id] && this.shown) {
+ menu.invokeEvent("grouphide", rf.getDomElement(menu.id), null);
+ this.invokeEvent("hide", rf.getDomElement(id), null);
+ this.popup.hide();
+ this.shown = false;
+ }
+ },
+
+ __enterHandler: function(){
+ this.show();
+ },
+ __leaveHandler: function(){
+ this.hide();
+ },
+ destroy: function() {
+ // clean up code here
+ this.detach(this.id);
+ // call parent's destroy method
+ $super.destroy.call(this);
+ }
+ }
+
+ })());
+})(jQuery, RichFaces)
\ No newline at end of file
Modified: sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/menugroup.template.xml
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/menugroup.template.xml 2010-12-03 13:42:22 UTC (rev 20341)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/menugroup.template.xml 2010-12-03 13:49:37 UTC (rev 20342)
@@ -12,6 +12,8 @@
<cdk:component-family>org.richfaces.DropDownMenu</cdk:component-family>
<cdk:renderer-type>org.richfaces.MenuGroupRenderer</cdk:renderer-type>
<cdk:renders-children>true</cdk:renders-children>
+
+ <cdk:resource-dependency name="menugroup.js" library="org.richfaces" />
</cc:interface>
<cc:implementation>
14 years, 1 month
JBoss Rich Faces SVN: r20341 - in trunk/ui/dnd: api/src/main/java/org/richfaces/event and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-03 08:42:22 -0500 (Fri, 03 Dec 2010)
New Revision: 20341
Added:
trunk/ui/dnd/api/
trunk/ui/dnd/api/src/main/java/org/richfaces/event/DropEvent.java
trunk/ui/dnd/pom.xml
trunk/ui/dnd/ui/
trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java
Removed:
trunk/ui/dnd/api/src/main/java/org/richfaces/event/DropEvent.java
trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java
Log:
move dnd from sandbox
Copied: trunk/ui/dnd/api (from rev 20328, sandbox/trunk/ui/drag-drop/api)
Deleted: trunk/ui/dnd/api/src/main/java/org/richfaces/event/DropEvent.java
===================================================================
--- sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java 2010-12-03 09:36:22 UTC (rev 20328)
+++ trunk/ui/dnd/api/src/main/java/org/richfaces/event/DropEvent.java 2010-12-03 13:42:22 UTC (rev 20341)
@@ -1,95 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, 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.event;
-
-import java.util.Set;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.behavior.Behavior;
-import javax.faces.event.BehaviorEvent;
-import javax.faces.event.FacesListener;
-
-/**
- * @author abelevich
- *
- */
-public class DropEvent extends BehaviorEvent {
-
- private static final long serialVersionUID = 3717071628237886288L;
-
- private Object dropValue;
-
- private Object dragValue;
-
- private Set<String> acceptedTypes;
-
- private UIComponent dragSource;
-
-
- public DropEvent(UIComponent component, Behavior behavior) {
- super(component, behavior);
- }
-
- public Set<String> getAcceptedTypes() {
- return acceptedTypes;
- }
-
- public void setAcceptedTypes(Set<String> acceptedTypes) {
- this.acceptedTypes = acceptedTypes;
- }
-
- public Object getDropValue() {
- return dropValue;
- }
-
- public void setDropValue(Object dropValue) {
- this.dropValue = dropValue;
- }
-
- public Object getDragValue() {
- return dragValue;
- }
-
- public void setDragValue(Object dragValue) {
- this.dragValue = dragValue;
- }
-
- public UIComponent getDragSource() {
- return dragSource;
- }
-
- public void setDragSource(UIComponent dragSource) {
- this.dragSource = dragSource;
- }
-
- @Override
- public boolean isAppropriateListener(FacesListener listener) {
- return (listener instanceof DropListener);
- }
-
- @Override
- public void processListener(FacesListener listener) {
- ((DropListener) listener).processDrop(this);
- }
-
-}
\ No newline at end of file
Copied: trunk/ui/dnd/api/src/main/java/org/richfaces/event/DropEvent.java (from rev 20335, sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java)
===================================================================
--- trunk/ui/dnd/api/src/main/java/org/richfaces/event/DropEvent.java (rev 0)
+++ trunk/ui/dnd/api/src/main/java/org/richfaces/event/DropEvent.java 2010-12-03 13:42:22 UTC (rev 20341)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.event;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.BehaviorEvent;
+import javax.faces.event.FacesListener;
+
+import org.richfaces.component.behavior.ClientDragBehavior;
+import org.richfaces.component.behavior.ClientDropBehavior;
+
+/**
+ * @author abelevich
+ *
+ */
+public class DropEvent extends BehaviorEvent {
+
+ private static final long serialVersionUID = 3717071628237886288L;
+
+ private ClientDragBehavior dragSource;
+
+ private UIComponent dragComponent;
+
+ public DropEvent(UIComponent component, ClientDropBehavior behavior) {
+ super(component, behavior);
+ }
+
+ public ClientDragBehavior getDragSource() {
+ return dragSource;
+ }
+
+
+ public void setDragSource(ClientDragBehavior dragSource) {
+ this.dragSource = dragSource;
+ }
+
+ public UIComponent getDragComponent() {
+ return dragComponent;
+ }
+
+ public void setDragComponent(UIComponent dragComponent) {
+ this.dragComponent = dragComponent;
+ }
+
+ public ClientDropBehavior getDropSource() {
+ return (ClientDropBehavior)getBehavior();
+ }
+
+ public UIComponent getDropComponent() {
+ return getComponent();
+ }
+
+
+ @Override
+ public boolean isAppropriateListener(FacesListener listener) {
+ return (listener instanceof DropListener);
+ }
+
+ @Override
+ public void processListener(FacesListener listener) {
+ ((DropListener) listener).processDrop(this);
+ }
+
+}
\ No newline at end of file
Copied: trunk/ui/dnd/pom.xml (from rev 20328, sandbox/trunk/ui/drag-drop/pom.xml)
===================================================================
--- trunk/ui/dnd/pom.xml (rev 0)
+++ trunk/ui/dnd/pom.xml 2010-12-03 13:42:22 UTC (rev 20341)
@@ -0,0 +1,48 @@
+<?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</groupId>
+ <artifactId>richfaces-root-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>../../parent/pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.richfaces.ui.output</groupId>
+ <artifactId>richfaces-ui-output-aggregator</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Richfaces UI Components: Drag-n-Drop Aggregator</name>
+
+ <modules>
+ <module>api</module>
+ <module>ui</module>
+ </modules>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/trunk/ui/output</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/trunk/ui/output</developerConnection>
+ <url>http://fisheye.jboss.org/browse/richfaces</url>
+ </scm>
+</project>
\ No newline at end of file
Copied: trunk/ui/dnd/ui (from rev 20328, sandbox/trunk/ui/drag-drop/ui)
Deleted: trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java 2010-12-03 09:36:22 UTC (rev 20328)
+++ trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java 2010-12-03 13:42:22 UTC (rev 20341)
@@ -1,179 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, 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 java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import javax.faces.application.ResourceDependencies;
-import javax.faces.application.ResourceDependency;
-import javax.faces.component.ActionSource;
-import javax.faces.component.ContextCallback;
-import javax.faces.component.EditableValueHolder;
-import javax.faces.component.UIComponent;
-import javax.faces.component.behavior.ClientBehavior;
-import javax.faces.component.behavior.ClientBehaviorContext;
-import javax.faces.component.behavior.ClientBehaviorHolder;
-import javax.faces.context.FacesContext;
-import javax.faces.event.PhaseId;
-import javax.faces.render.FacesBehaviorRenderer;
-import javax.faces.render.RenderKitFactory;
-
-import org.richfaces.component.behavior.ClientDragBehavior;
-import org.richfaces.component.behavior.ClientDropBehavior;
-import org.richfaces.component.behavior.DropBehavior;
-import org.richfaces.event.DropEvent;
-
-
-/**
- * @author abelevich
- *
- */
-
-
-@FacesBehaviorRenderer(rendererType = DropBehavior.BEHAVIOR_ID, renderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT)
-
-@ResourceDependencies({
- @ResourceDependency(name = "jquery.js"),
- @ResourceDependency(name = "jquery.position.js"),
- @ResourceDependency(name = "richfaces.js"),
- @ResourceDependency(name = "richfaces.js"),
- @ResourceDependency(library = "org.richfaces", name = "jquery-ui-core.js"),
- @ResourceDependency(library = "org.richfaces", name = "jquery-dnd.js"),
- @ResourceDependency(library = "org.richfaces", name = "dnd-droppable.js"),
- @ResourceDependency(library = "org.richfaces", name = "dnd-manager.js")
-})
-public class DropBehaviorRendererBase extends DnDBehaviorRenderBase {
-
- @Override
- public void decode(FacesContext facesContext, UIComponent component, ClientBehavior behavior) {
- if (null == facesContext || null == component || behavior == null) {
- throw new NullPointerException();
- }
-
- Map<String, String> requestParamMap = facesContext.getExternalContext().getRequestParameterMap();
- String dragSource = (String) requestParamMap.get("dragSource");
- facesContext.getViewRoot().invokeOnComponent(facesContext, dragSource, new DropBehaviorContextCallBack(component, (ClientDropBehavior)behavior));
- }
-
- @Override
- protected String getScriptName() {
- return "RichFaces.ui.DnDManager.droppable";
- }
-
- public Map<String, Object> getOptions(ClientBehaviorContext behaviorContext, ClientBehavior behavior) {
- Map<String, Object> options = new HashMap<String, Object>();
-
- if(behavior instanceof ClientDropBehavior) {
- ClientDropBehavior dropBehavior = (ClientDropBehavior)behavior;
- options.put("acceptedTypes", dropBehavior.getAcceptedTypes());
- }
-
- return options;
- }
-
- private final class DropBehaviorContextCallBack implements ContextCallback {
-
- private ClientDropBehavior dropBehavior;
-
- private UIComponent dropSource;
-
- public DropBehaviorContextCallBack(UIComponent dropSource, ClientDropBehavior dropBehavior) {
- this.dropSource = dropSource;
- this.dropBehavior = dropBehavior;
- }
-
- public void invokeContextCallback(FacesContext context, UIComponent target) {
- ClientDragBehavior dragBehavior = getDragBehavior(target, "mouseover");
- if(dragBehavior != null) {
- DropEvent dropEvent = new DropEvent(dropSource, dropBehavior);
- dropEvent.setDragSource(target);
- dropEvent.setDragValue(dragBehavior.getDragValue());
- dropEvent.setDropValue(dropBehavior.getDropValue());
- dropEvent.setAcceptedTypes(dropBehavior.getAcceptedTypes());
- queueDropEvent(dropEvent);
- } else {
- //TODO: log
- }
- }
-
- private void queueDropEvent(DropEvent event) {
- PhaseId phaseId = PhaseId.INVOKE_APPLICATION;
-
- if (isImmediate()) {
- phaseId = PhaseId.APPLY_REQUEST_VALUES;
- } else if (isBypassUpdates()) {
- phaseId = PhaseId.PROCESS_VALIDATIONS;
- }
-
- event.setPhaseId(phaseId);
- this.dropSource.queueEvent(event);
- }
-
- private boolean isImmediate(){
- boolean immediate = this.dropBehavior.isImmediate();
- if(!immediate) {
- if (dropSource instanceof EditableValueHolder) {
- immediate = ((EditableValueHolder) dropSource).isImmediate();
- } else if (dropSource instanceof ActionSource) {
- immediate = ((ActionSource) dropSource).isImmediate();
- }
- }
-
- return immediate;
- }
-
- private boolean isBypassUpdates(){
- boolean bypassUpdates = this.dropBehavior.isBypassUpdates();
- if (!bypassUpdates) {
- bypassUpdates = getUtils().isBooleanAttribute(this.dropSource, "bypassUpdates");
- }
- return bypassUpdates;
- }
-
- private ClientDragBehavior getDragBehavior(UIComponent parent, String event) {
- if(parent instanceof ClientBehaviorHolder) {
- Map<String, List<ClientBehavior>> behaviorsMap = ((ClientBehaviorHolder)parent).getClientBehaviors();
- Set<Map.Entry<String, List<ClientBehavior>>> entries = behaviorsMap.entrySet();
-
- for(Entry<String, List<ClientBehavior>> entry: entries) {
- if(event.equals(entry.getKey())){
- List<ClientBehavior> behaviors = entry.getValue();
- for(ClientBehavior behavior: behaviors) {
- if(behavior instanceof ClientDragBehavior) {
- return (ClientDragBehavior)behavior;
- }
- }
- }
- }
-
- }
- return null;
- }
-
- }
-
-}
Copied: trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java (from rev 20336, sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java)
===================================================================
--- trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java (rev 0)
+++ trunk/ui/dnd/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java 2010-12-03 13:42:22 UTC (rev 20341)
@@ -0,0 +1,177 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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 java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.ActionSource;
+import javax.faces.component.ContextCallback;
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+import javax.faces.component.behavior.ClientBehavior;
+import javax.faces.component.behavior.ClientBehaviorContext;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseId;
+import javax.faces.render.FacesBehaviorRenderer;
+import javax.faces.render.RenderKitFactory;
+
+import org.richfaces.component.behavior.ClientDragBehavior;
+import org.richfaces.component.behavior.ClientDropBehavior;
+import org.richfaces.component.behavior.DropBehavior;
+import org.richfaces.event.DropEvent;
+
+
+/**
+ * @author abelevich
+ *
+ */
+
+
+@FacesBehaviorRenderer(rendererType = DropBehavior.BEHAVIOR_ID, renderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT)
+
+@ResourceDependencies({
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "jquery.position.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(library = "org.richfaces", name = "jquery-ui-core.js"),
+ @ResourceDependency(library = "org.richfaces", name = "jquery-dnd.js"),
+ @ResourceDependency(library = "org.richfaces", name = "dnd-droppable.js"),
+ @ResourceDependency(library = "org.richfaces", name = "dnd-manager.js")
+})
+public class DropBehaviorRendererBase extends DnDBehaviorRenderBase {
+
+ @Override
+ public void decode(FacesContext facesContext, UIComponent component, ClientBehavior behavior) {
+ if (null == facesContext || null == component || behavior == null) {
+ throw new NullPointerException();
+ }
+
+ Map<String, String> requestParamMap = facesContext.getExternalContext().getRequestParameterMap();
+ String dragSource = (String) requestParamMap.get("dragSource");
+ facesContext.getViewRoot().invokeOnComponent(facesContext, dragSource, new DropBehaviorContextCallBack(component, (ClientDropBehavior)behavior));
+ }
+
+ @Override
+ protected String getScriptName() {
+ return "RichFaces.ui.DnDManager.droppable";
+ }
+
+ public Map<String, Object> getOptions(ClientBehaviorContext behaviorContext, ClientBehavior behavior) {
+ Map<String, Object> options = new HashMap<String, Object>();
+
+ if(behavior instanceof ClientDropBehavior) {
+ ClientDropBehavior dropBehavior = (ClientDropBehavior)behavior;
+ options.put("acceptedTypes", dropBehavior.getAcceptedTypes());
+ }
+
+ return options;
+ }
+
+ private final class DropBehaviorContextCallBack implements ContextCallback {
+
+ private ClientDropBehavior dropBehavior;
+
+ private UIComponent dropSource;
+
+ public DropBehaviorContextCallBack(UIComponent dropSource, ClientDropBehavior dropBehavior) {
+ this.dropSource = dropSource;
+ this.dropBehavior = dropBehavior;
+ }
+
+ public void invokeContextCallback(FacesContext context, UIComponent target) {
+ ClientDragBehavior dragBehavior = getDragBehavior(target, "mouseover");
+ if(dragBehavior != null) {
+ DropEvent dropEvent = new DropEvent(dropSource, dropBehavior);
+ dropEvent.setDragSource(dragBehavior);
+ dropEvent.setDragComponent(target);
+ queueDropEvent(dropEvent);
+ } else {
+ //TODO: log
+ }
+ }
+
+ private void queueDropEvent(DropEvent event) {
+ PhaseId phaseId = PhaseId.INVOKE_APPLICATION;
+
+ if (isImmediate()) {
+ phaseId = PhaseId.APPLY_REQUEST_VALUES;
+ } else if (isBypassUpdates()) {
+ phaseId = PhaseId.PROCESS_VALIDATIONS;
+ }
+
+ event.setPhaseId(phaseId);
+ this.dropSource.queueEvent(event);
+ }
+
+ private boolean isImmediate(){
+ boolean immediate = this.dropBehavior.isImmediate();
+ if(!immediate) {
+ if (dropSource instanceof EditableValueHolder) {
+ immediate = ((EditableValueHolder) dropSource).isImmediate();
+ } else if (dropSource instanceof ActionSource) {
+ immediate = ((ActionSource) dropSource).isImmediate();
+ }
+ }
+
+ return immediate;
+ }
+
+ private boolean isBypassUpdates(){
+ boolean bypassUpdates = this.dropBehavior.isBypassUpdates();
+ if (!bypassUpdates) {
+ bypassUpdates = getUtils().isBooleanAttribute(this.dropSource, "bypassUpdates");
+ }
+ return bypassUpdates;
+ }
+
+ private ClientDragBehavior getDragBehavior(UIComponent parent, String event) {
+ if(parent instanceof ClientBehaviorHolder) {
+ Map<String, List<ClientBehavior>> behaviorsMap = ((ClientBehaviorHolder)parent).getClientBehaviors();
+ Set<Map.Entry<String, List<ClientBehavior>>> entries = behaviorsMap.entrySet();
+
+ for(Entry<String, List<ClientBehavior>> entry: entries) {
+ if(event.equals(entry.getKey())){
+ List<ClientBehavior> behaviors = entry.getValue();
+ for(ClientBehavior behavior: behaviors) {
+ if(behavior instanceof ClientDragBehavior) {
+ return (ClientDragBehavior)behavior;
+ }
+ }
+ }
+ }
+
+ }
+ return null;
+ }
+
+ }
+
+}
14 years, 1 month
JBoss Rich Faces SVN: r20340 - trunk/ui.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-03 08:40:24 -0500 (Fri, 03 Dec 2010)
New Revision: 20340
Added:
trunk/ui/dnd/
Log:
prepare dnd dir
14 years, 1 month
JBoss Rich Faces SVN: r20339 - in sandbox/trunk: examples/dropdownmenu-demo/src/main/webapp and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-12-03 08:32:11 -0500 (Fri, 03 Dec 2010)
New Revision: 20339
Removed:
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/indexWithToolBar.xhtml
Modified:
sandbox/trunk/examples/dropdownmenu-demo/src/main/java/org/richfaces/demo/MenuBean.java
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/index.xhtml
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java
sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/dropdownmenu.ecss
sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/dropdownmenu.template.xml
Log:
RF-9676 :Dropdown menu component. Changes added.
Modified: sandbox/trunk/examples/dropdownmenu-demo/src/main/java/org/richfaces/demo/MenuBean.java
===================================================================
--- sandbox/trunk/examples/dropdownmenu-demo/src/main/java/org/richfaces/demo/MenuBean.java 2010-12-03 13:16:32 UTC (rev 20338)
+++ sandbox/trunk/examples/dropdownmenu-demo/src/main/java/org/richfaces/demo/MenuBean.java 2010-12-03 13:32:11 UTC (rev 20339)
@@ -7,7 +7,34 @@
@SessionScoped
public class MenuBean {
private String current;
+ private String mode = "server";
+ private boolean disabled = false;
+ private boolean checkbox = false;
+
+ public boolean isCheckbox() {
+ return checkbox;
+ }
+
+ public void setCheckbox(boolean checkbox) {
+ this.checkbox = checkbox;
+ }
+ public boolean isDisabled() {
+ return disabled;
+ }
+
+ public void setDisabled(boolean disabled) {
+ this.disabled = disabled;
+ }
+
+ public String getMode() {
+ return mode;
+ }
+
+ public void setMode(String mode) {
+ this.mode = mode;
+ }
+
public String getCurrent() {
return this.current;
}
@@ -32,12 +59,12 @@
this.current="Save";
return null;
}
- public String doSaveAll() {
- this.current="Save All";
- return null;
- }
public String doExit() {
this.current="Exit";
return null;
}
+
+ public void setValue(String value) {
+ this.current = value;
+ }
}
Modified: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/index.xhtml
===================================================================
--- sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/index.xhtml 2010-12-03 13:16:32 UTC (rev 20338)
+++ sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/index.xhtml 2010-12-03 13:32:11 UTC (rev 20339)
@@ -7,22 +7,18 @@
xmlns:a4j="http://richfaces.org/a4j">
<h:head>
<title>Drop Down Menu</title>
- <style>
- .pic {
- margin-bottom: -4px;
- margin-right: 2px;
- }
- </style>
</h:head>
<h:body>
<h:form id="form">
- <br />
+ <h:panelGrid id="panel" columns="2">
+ <h:panelGroup layout="block" style="width:300px;">
+
<a4j:outputPanel ajaxRendered="true">
<h:outputText value="Current Selection: "></h:outputText>
<h:outputText style="font-weight:bold" value="#{menuBean.current}"></h:outputText>
</a4j:outputPanel>
<br />
- <ddm:dropDownMenu disabled="false" mode="ajax" onshow="console.info('onshow event');">
+ <ddm:dropDownMenu id="ddmenu" disabled="#{menuBean.disabled}" mode="#{menuBean.mode}">
<f:facet name="label">
<h:panelGroup>
<h:graphicImage value="images/copy.gif" styleClass="pic"/>
@@ -35,9 +31,11 @@
<h:outputText value="(disabled)File"/>
</h:panelGroup>
</f:facet>
- <ddm:menuItem label="New" icon="images/create_doc.gif"
- action="#{menuBean.doNew}">
-
+ <ddm:menuItem id="menuNew" label="New" icon="images/create_doc.gif"
+ action="#{menuBean.doNew}" execute="@form">
+ <f:facet name="icon">
+ <h:selectBooleanCheckbox id="checkbox" value="#{menuBean.checkbox}"/>
+ </f:facet>
</ddm:menuItem>
<ddm:menuItem label="Open" action="#{menuBean.doOpen}">
<f:facet name="icon">
@@ -50,20 +48,49 @@
<h:graphicImage value="images/save.gif" />
</f:facet>
</ddm:menuItem>
- <ddm:menuItem label="Save All" icon="images/save_all.gif" ></ddm:menuItem>
+ <ddm:menuItem label="Save All" icon="images/save_all.gif" >
+ <f:setPropertyActionListener target="#{menuBean.value}" value="Save All" />
+ </ddm:menuItem>
</ddm:menuGroup>
<ddm:menuGroup label="Save As...">
- <ddm:menuItem label="Save" icon="images/save.gif" />
- <ddm:menuItem label="Save All" icon="images/save_all.gif" ></ddm:menuItem>
+ <ddm:menuItem label="Save" icon="images/save.gif" >
+ <f:setPropertyActionListener target="#{menuBean.value}" value="Save" />
+ </ddm:menuItem>
+ <ddm:menuGroup label="Save All" icon="images/save_all.gif" >
+ <ddm:menuItem label="Save All 1" icon="images/save_all.gif">
+ <f:setPropertyActionListener target="#{menuBean.value}" value="Save All 1" />
+ </ddm:menuItem>
+ <ddm:menuItem label="Save All 2" icon="images/save_all.gif" >
+ <f:setPropertyActionListener target="#{menuBean.value}" value="Save All 2" />
+ </ddm:menuItem>
+ </ddm:menuGroup>
</ddm:menuGroup>
<ddm:menuItem label="Close" action="#{menuBean.doClose}"/>
<ddm:menuItem label="Close" disabled="true"/>
<ddm:menuSeparator id="menuSeparator11" />
<ddm:menuItem label="Exit" action="#{menuBean.doExit}"/>
<ddm:menuItem action="#{menuBean.doExit}">
- ---EXIT--- <input type="text" />
+ <h:inputText />
</ddm:menuItem>
</ddm:dropDownMenu>
+
+ </h:panelGroup>
+ <h:panelGrid columns="2">
+
+ <h:outputText value="Disabled" />
+ <h:selectBooleanCheckbox value="#{menuBean.disabled}">
+ <f:ajax event="click" execute="@form" render="ddmenu @this" />
+ </h:selectBooleanCheckbox>
+
+ <h:outputText value="Mode" />
+ <h:selectOneMenu value="#{menuBean.mode}" onchange="submit()">
+ <f:selectItem itemValue="server"/>
+ <f:selectItem itemValue="ajax"/>
+ <f:selectItem itemValue="client"/>
+ </h:selectOneMenu><br/>
+ </h:panelGrid>
+
+ </h:panelGrid>
</h:form>
</h:body>
</html>
\ No newline at end of file
Deleted: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/indexWithToolBar.xhtml
===================================================================
--- sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/indexWithToolBar.xhtml 2010-12-03 13:16:32 UTC (rev 20338)
+++ sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/indexWithToolBar.xhtml 2010-12-03 13:32:11 UTC (rev 20339)
@@ -1,65 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:ddm="http://richfaces.org/dropDownMenu"
- xmlns:tb="http://richfaces.org/toolBar">
- <h:head>
- <title>Drop Down Menu</title>
- <style>
- .pic {
- margin-bottom: -4px;
- margin-right: 2px;
- }
- </style>
- </h:head>
- <h:body>
-
- <tb:toolBar height="45" itemSeparator="grid" contentStyle="color:red;">
- <f:facet name="itemSeparator">
- ||
- </f:facet>
- <tb:toolBarGroup itemSeparator="line" onitemclick="22">
- <h:graphicImage value="/images/icons/create_doc.gif" styleClass="pic"/>
- <a href="sdsd">link 1</a> Text
- <a href="sdsd 2">link 2</a>
- <h:graphicImage value="/images/icons/create_folder.gif" styleClass="pic" onclick="q1"/>
- <h:graphicImage value="/images/icons/copy.gif" styleClass="pic"/>
- <a href="sdsd">link 3</a> Text
- <a href="sdsd 2">link 4</a>
- </tb:toolBarGroup>
- <tb:toolBarGroup itemSeparator="none">
- <h:graphicImage value="/images/icons/save.gif" styleClass="pic" onclick="q2"/>
- <h:graphicImage value="/images/icons/save.gif" styleClass="pic" onclick="q2"/>
- <h:graphicImage value="/images/icons/save.gif" styleClass="pic" onclick="q2"/>
- <h:graphicImage value="/images/icons/save.gif" styleClass="pic" onclick="q2"/>
- </tb:toolBarGroup>
- <tb:toolBarGroup itemSeparator="line">
- <h:graphicImage value="/images/icons/save.gif" styleClass="pic" onclick="q2"/>
- <h:graphicImage value="/images/icons/save.gif" styleClass="pic" onclick="q2"/>
- </tb:toolBarGroup>
-
- <tb:toolBarGroup location="right" itemSeparator="square">
- <h:graphicImage value="/images/icons/find.gif" styleClass="pic"/>
- <h:graphicImage value="/images/icons/filter.gif" styleClass="pic"/>
- </tb:toolBarGroup>
- </tb:toolBar>
-
- <ddm:dropDownMenu value="File">
- <ddm:menuItem value="New" icon="/images/icons/create_doc.gif">
-
- </ddm:menuItem>
- <ddm:menuItem value="Open" icon="/images/icons/open.gif" />
- <ddm:menuGroup value="Save As...">
- <ddm:menuItem value="Save" icon="/images/icons/save.gif" />
- <ddm:menuItem value="Save All">
-
- </ddm:menuItem>
- </ddm:menuGroup>
- <ddm:menuItem value="Close" />
- <ddm:menuSeparator id="menuSeparator11" />
- <ddm:menuItem value="Exit" />
- </ddm:dropDownMenu>
- </h:body>
-</html>
\ No newline at end of file
Modified: sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2010-12-03 13:16:32 UTC (rev 20338)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2010-12-03 13:32:11 UTC (rev 20339)
@@ -37,7 +37,7 @@
public static final int DEFAULT_MIN_POPUP_WIDTH = 250;
@Override
- public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException {
+ public void renderChildren(FacesContext facesContext, UIComponent component) throws IOException {
AbstractDropDownMenu dropDownMenu = (AbstractDropDownMenu) component;
for (UIComponent child : dropDownMenu.getChildren()) {
@@ -75,7 +75,11 @@
public List<Map<String, Object>> getMenuGroups(FacesContext facesContext, UIComponent component) {
List<Map<String, Object>> results = new ArrayList<Map<String, Object>>();
List<AbstractMenuGroup> groups = new ArrayList<AbstractMenuGroup>();
- getMenuGroups(component, groups);
+ if (component instanceof AbstractDropDownMenu) {
+ if (component.isRendered() && !((AbstractDropDownMenu) component).isDisabled()) {
+ getMenuGroups(component, groups);
+ }
+ }
for (AbstractMenuGroup group : groups) {
if (group.isRendered() && !group.isDisabled()) {
Map<String, Object> map = new HashMap<String, Object>();
Modified: sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java 2010-12-03 13:16:32 UTC (rev 20338)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java 2010-12-03 13:32:11 UTC (rev 20339)
@@ -14,12 +14,7 @@
public static final String RENDERER_TYPE = "org.richfaces.MenuGroupRenderer";
public static final int DEFAULT_MIN_POPUP_WIDTH = 250;
-
- @Override
- public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException {
- }
-
protected boolean isDisabled(FacesContext facesContext, UIComponent component) {
if (component instanceof AbstractMenuGroup) {
return ((AbstractMenuGroup) component).isDisabled();
Modified: sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/dropdownmenu.ecss
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/dropdownmenu.ecss 2010-12-03 13:16:32 UTC (rev 20338)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/dropdownmenu.ecss 2010-12-03 13:32:11 UTC (rev 20339)
@@ -105,3 +105,17 @@
height: 16px;
line-height: 16px;
}
+
+.rf-ddm-itm-ic input[type="checkbox"] {
+ margin:0;
+ width:16px;
+}
+
+.rf-ddm-itm-lbl input[type="text"] {
+ font-family:Arial,Verdana,sans-serif;
+ font-size:11px;
+ background-position:1px 1px;
+ background-repeat:no-repeat;
+ border-style:inset;
+ border-width:1px;
+}
Modified: sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/dropdownmenu.template.xml
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/dropdownmenu.template.xml 2010-12-03 13:16:32 UTC (rev 20338)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/dropdownmenu.template.xml 2010-12-03 13:32:11 UTC (rev 20339)
@@ -38,21 +38,25 @@
</c:choose>
</div>
- <div class="rf-ddm-pos">
- <div id="#{clientId}_list" class="rf-ddm-lst" style="display:none;min-width:#{getMinPopupWidth(facesContext, component)}px;">
- <div class="rf-ddm-lst-bg">
- <cdk:body />
+
+ <c:if test="#{not isDisabled(facesContext, component)}">
+ <div class="rf-ddm-pos">
+ <div id="#{clientId}_list" class="rf-ddm-lst" style="display:none;min-width:#{getMinPopupWidth(facesContext, component)}px;">
+ <div class="rf-ddm-lst-bg">
+ <cdk:call expression="renderChildren(facesContext, component)" />
+ </div>
</div>
</div>
- </div>
- <script type="text/javascript">
- <cdk:scriptObject name="options">
- <cdk:scriptOption attributes="hideDelay showDelay popupWith jointPoint direction mode" />
- <cdk:scriptOption attributes="onshow onhide ongroupshow ongrouphide onitemclick" wrapper="eventHandler"/>
- </cdk:scriptObject>
-
- new RichFaces.ui.Menu(#{toScriptArgs(clientId, options)}).initiateGroups(#{toScriptArgs(getMenuGroups(facesContext, component))});
- </script>
+ <script type="text/javascript">
+ <cdk:scriptObject name="options">
+ <cdk:scriptOption attributes="hideDelay showDelay popupWith jointPoint direction mode" />
+ <cdk:scriptOption attributes="onshow onhide ongroupshow ongrouphide onitemclick" wrapper="eventHandler"/>
+ </cdk:scriptObject>
+
+ new RichFaces.ui.Menu(#{toScriptArgs(clientId, options)}).initiateGroups(#{toScriptArgs(getMenuGroups(facesContext, component))});
+
+ </script>
+ </c:if>
</div>
</cc:implementation>
14 years, 1 month
JBoss Rich Faces SVN: r20338 - management/design-4x/panelMenu.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-12-03 08:16:32 -0500 (Fri, 03 Dec 2010)
New Revision: 20338
Modified:
management/design-4x/panelMenu/taglib-panelmenu.png
Log:
RF-9317 panelMenu components
attributes diagram
Modified: management/design-4x/panelMenu/taglib-panelmenu.png
===================================================================
(Binary files differ)
14 years, 1 month
JBoss Rich Faces SVN: r20337 - sandbox/trunk/examples/dnd-demo/src/main/java/org/demo.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-03 05:54:00 -0500 (Fri, 03 Dec 2010)
New Revision: 20337
Modified:
sandbox/trunk/examples/dnd-demo/src/main/java/org/demo/DataBean.java
Log:
use new drop event api
Modified: sandbox/trunk/examples/dnd-demo/src/main/java/org/demo/DataBean.java
===================================================================
--- sandbox/trunk/examples/dnd-demo/src/main/java/org/demo/DataBean.java 2010-12-03 10:53:37 UTC (rev 20336)
+++ sandbox/trunk/examples/dnd-demo/src/main/java/org/demo/DataBean.java 2010-12-03 10:54:00 UTC (rev 20337)
@@ -54,7 +54,7 @@
}
public void processEvent(DropEvent event) {
- String value = (String)event.getDragValue();
+ String value = (String)event.getDragSource().getDragValue();
dropValues.add(value);
System.out.println("DataBean.processEvent()");
}
14 years, 1 month
JBoss Rich Faces SVN: r20336 - sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-03 05:53:37 -0500 (Fri, 03 Dec 2010)
New Revision: 20336
Modified:
sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java
Log:
event according to spec
Modified: sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java 2010-12-03 10:53:01 UTC (rev 20335)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/java/org/richfaces/renderkit/DropBehaviorRendererBase.java 2010-12-03 10:53:37 UTC (rev 20336)
@@ -86,7 +86,7 @@
public Map<String, Object> getOptions(ClientBehaviorContext behaviorContext, ClientBehavior behavior) {
Map<String, Object> options = new HashMap<String, Object>();
-
+
if(behavior instanceof ClientDropBehavior) {
ClientDropBehavior dropBehavior = (ClientDropBehavior)behavior;
options.put("acceptedTypes", dropBehavior.getAcceptedTypes());
@@ -110,10 +110,8 @@
ClientDragBehavior dragBehavior = getDragBehavior(target, "mouseover");
if(dragBehavior != null) {
DropEvent dropEvent = new DropEvent(dropSource, dropBehavior);
- dropEvent.setDragSource(target);
- dropEvent.setDragValue(dragBehavior.getDragValue());
- dropEvent.setDropValue(dropBehavior.getDropValue());
- dropEvent.setAcceptedTypes(dropBehavior.getAcceptedTypes());
+ dropEvent.setDragSource(dragBehavior);
+ dropEvent.setDragComponent(target);
queueDropEvent(dropEvent);
} else {
//TODO: log
14 years, 1 month
JBoss Rich Faces SVN: r20335 - sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-03 05:53:01 -0500 (Fri, 03 Dec 2010)
New Revision: 20335
Modified:
sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java
Log:
event according to spec
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-12-03 10:21:47 UTC (rev 20334)
+++ sandbox/trunk/ui/drag-drop/api/src/main/java/org/richfaces/event/DropEvent.java 2010-12-03 10:53:01 UTC (rev 20335)
@@ -22,13 +22,13 @@
package org.richfaces.event;
-import java.util.Set;
-
import javax.faces.component.UIComponent;
-import javax.faces.component.behavior.Behavior;
import javax.faces.event.BehaviorEvent;
import javax.faces.event.FacesListener;
+import org.richfaces.component.behavior.ClientDragBehavior;
+import org.richfaces.component.behavior.ClientDropBehavior;
+
/**
* @author abelevich
*
@@ -36,52 +36,41 @@
public class DropEvent extends BehaviorEvent {
private static final long serialVersionUID = 3717071628237886288L;
-
- private Object dropValue;
- private Object dragValue;
+ private ClientDragBehavior dragSource;
- private Set<String> acceptedTypes;
+ private UIComponent dragComponent;
- private UIComponent dragSource;
-
-
- public DropEvent(UIComponent component, Behavior behavior) {
+ public DropEvent(UIComponent component, ClientDropBehavior behavior) {
super(component, behavior);
}
-
- public Set<String> getAcceptedTypes() {
- return acceptedTypes;
+
+ public ClientDragBehavior getDragSource() {
+ return dragSource;
}
- public void setAcceptedTypes(Set<String> acceptedTypes) {
- this.acceptedTypes = acceptedTypes;
- }
-
- public Object getDropValue() {
- return dropValue;
- }
- public void setDropValue(Object dropValue) {
- this.dropValue = dropValue;
+ public void setDragSource(ClientDragBehavior dragSource) {
+ this.dragSource = dragSource;
}
- public Object getDragValue() {
- return dragValue;
+ public UIComponent getDragComponent() {
+ return dragComponent;
}
- public void setDragValue(Object dragValue) {
- this.dragValue = dragValue;
+ public void setDragComponent(UIComponent dragComponent) {
+ this.dragComponent = dragComponent;
}
- public UIComponent getDragSource() {
- return dragSource;
+ public ClientDropBehavior getDropSource() {
+ return (ClientDropBehavior)getBehavior();
}
-
- public void setDragSource(UIComponent dragSource) {
- this.dragSource = dragSource;
+
+ public UIComponent getDropComponent() {
+ return getComponent();
}
+
@Override
public boolean isAppropriateListener(FacesListener listener) {
return (listener instanceof DropListener);
14 years, 1 month
JBoss Rich Faces SVN: r20334 - trunk/examples/output-demo/src/main/webapp/examples.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-03 05:21:47 -0500 (Fri, 03 Dec 2010)
New Revision: 20334
Modified:
trunk/examples/output-demo/src/main/webapp/examples/toolbar.xhtml
Log:
use toolba, toolbarGroup
Modified: trunk/examples/output-demo/src/main/webapp/examples/toolbar.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/toolbar.xhtml 2010-12-03 10:19:42 UTC (rev 20333)
+++ trunk/examples/output-demo/src/main/webapp/examples/toolbar.xhtml 2010-12-03 10:21:47 UTC (rev 20334)
@@ -5,17 +5,17 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:tb="http://richfaces.org/output">
<h:head>
- <title>ToolBar sample</title>
+ <title>toolbar sample</title>
<style>
</style>
</h:head>
<h:body>
- <tb:toolBar height="45" itemSeparator="grid" contentStyle="color:red;">
+ <tb:toolbar height="45" itemSeparator="grid" contentStyle="color:red;">
<f:facet name="itemSeparator">
||
</f:facet>
- <tb:toolBarGroup itemSeparator="line" onitemclick="22">
+ <tb:toolbarGroup itemSeparator="line" onitemclick="22">
<h:graphicImage value="/images/icons/create_doc.gif"/>
<a href="#">link 1</a> Text
<a href="#">link 2</a>
@@ -23,57 +23,57 @@
<h:graphicImage value="/images/icons/copy.gif"/>
<a href="#">link 3</a> Text
<a href="#">link 4</a>
- </tb:toolBarGroup>
- <tb:toolBarGroup itemSeparator="none">
+ </tb:toolbarGroup>
+ <tb:toolbarGroup itemSeparator="none">
<h:graphicImage value="/images/icons/save.gif" onclick="q2"/>
<h:graphicImage value="/images/icons/save.gif" onclick="q2"/>
<h:graphicImage value="/images/icons/save.gif" onclick="q2"/>
<h:graphicImage value="/images/icons/save.gif" onclick="q2"/>
- </tb:toolBarGroup>
- <tb:toolBarGroup itemSeparator="line">
+ </tb:toolbarGroup>
+ <tb:toolbarGroup itemSeparator="line">
<h:graphicImage value="/images/icons/save.gif" onclick="q2"/>
<h:graphicImage value="/images/icons/save.gif" onclick="q2"/>
- </tb:toolBarGroup>
+ </tb:toolbarGroup>
- <tb:toolBarGroup location="right" itemSeparator="square">
+ <tb:toolbarGroup location="right" itemSeparator="square">
<h:graphicImage value="/images/icons/find.gif" />
<h:graphicImage value="/images/icons/filter.gif" />
- </tb:toolBarGroup>
- </tb:toolBar>
+ </tb:toolbarGroup>
+ </tb:toolbar>
<br/>
- <tb:toolBar itemSeparator="grid">
- <tb:toolBarGroup itemSeparator="line">
+ <tb:toolbar itemSeparator="grid">
+ <tb:toolbarGroup itemSeparator="line">
<h:graphicImage value="/images/icons/create_doc.gif"/>
<h:graphicImage value="/images/icons/create_folder.gif"/>
<h:graphicImage value="/images/icons/copy.gif"/>
- </tb:toolBarGroup>
- <tb:toolBarGroup itemSeparator="disc">
+ </tb:toolbarGroup>
+ <tb:toolbarGroup itemSeparator="disc">
<h:graphicImage value="/images/icons/save.gif"/>
<h:graphicImage value="/images/icons/save_as.gif"/>
<h:graphicImage value="/images/icons/save_all.gif"/>
- </tb:toolBarGroup>
- <tb:toolBarGroup location="right" itemSeparator="square">
+ </tb:toolbarGroup>
+ <tb:toolbarGroup location="right" itemSeparator="square">
<h:graphicImage value="/images/icons/find.gif"/>
<h:graphicImage value="/images/icons/filter.gif"/>
- </tb:toolBarGroup>
- </tb:toolBar>
+ </tb:toolbarGroup>
+ </tb:toolbar>
<br/>
- <tb:toolBar height="26" itemSeparator="grid">
- <tb:toolBarGroup itemSeparator="line">
+ <tb:toolbar height="26" itemSeparator="grid">
+ <tb:toolbarGroup itemSeparator="line">
<h:graphicImage value="/images/icons/create_doc.gif"/>
<h:graphicImage value="/images/icons/create_folder.gif"/>
<h:graphicImage value="/images/icons/copy.gif"/>
- </tb:toolBarGroup>
- <tb:toolBarGroup itemSeparator="disc">
+ </tb:toolbarGroup>
+ <tb:toolbarGroup itemSeparator="disc">
<h:graphicImage value="/images/icons/save.gif"/>
<h:graphicImage value="/images/icons/save_as.gif"/>
<h:graphicImage value="/images/icons/save_all.gif"/>
- </tb:toolBarGroup>
- <tb:toolBarGroup location="right" itemSeparator="square">
+ </tb:toolbarGroup>
+ <tb:toolbarGroup location="right" itemSeparator="square">
<h:graphicImage value="/images/icons/find.gif"/>
<h:graphicImage value="/images/icons/filter.gif"/>
- </tb:toolBarGroup>
- </tb:toolBar>
+ </tb:toolbarGroup>
+ </tb:toolbar>
</h:body>
</html>
\ No newline at end of file
14 years, 1 month