JBoss Rich Faces SVN: r20363 - trunk/ui/output/ui/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-12-03 10:35:08 -0500 (Fri, 03 Dec 2010)
New Revision: 20363
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java
Log:
RF-9317 panelMenu components
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java 2010-12-03 15:27:10 UTC (rev 20362)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractPanelMenuItem.java 2010-12-03 15:35:08 UTC (rev 20363)
@@ -24,21 +24,24 @@
package org.richfaces.component;
import org.richfaces.PanelMenuMode;
+import org.richfaces.event.ItemChangeListener;
+import org.richfaces.event.ItemChangeSource;
+import javax.faces.component.UICommand;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIOutput;
/**
* @author akolonitsky
* @since 2010-10-25
*/
-public abstract class AbstractPanelMenuItem extends UIOutput {
+public abstract class AbstractPanelMenuItem extends UICommand implements ItemChangeSource{
public static final String COMPONENT_TYPE = "org.richfaces.PanelMenuItem";
public static final String COMPONENT_FAMILY = "org.richfaces.PanelMenuItem";
public enum Icons {
+ none("rf-pm-none"),
disc("rf-pm-disc"),
grid("rf-pm-grid"),
chevron("rf-pm-chevron"),
@@ -48,7 +51,7 @@
triangleUp("rf-pm-triangle-up"),
triangleDown("rf-pm-triangle-down");
- public static final Icons DEFAULT = grid;
+ public static final Icons DEFAULT = none;
private final String cssClass;
@@ -121,6 +124,18 @@
public abstract Object getRender();
+ // ------------------------------------------------ Event Processing Methods
+ public void addItemChangeListener(ItemChangeListener listener) {
+ addFacesListener(listener);
+ }
+ public ItemChangeListener[] getItemChangeListeners() {
+ return (ItemChangeListener[]) getFacesListeners(ItemChangeListener.class);
+ }
+
+ public void removeItemChangeListener(ItemChangeListener listener) {
+ removeFacesListener(listener);
+ }
+
}
14 years, 1 month
JBoss Rich Faces SVN: r20362 - modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-12-03 10:27:10 -0500 (Fri, 03 Dec 2010)
New Revision: 20362
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
Log:
* added universal itemChangeListener
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-12-03 15:24:19 UTC (rev 20361)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-12-03 15:27:10 UTC (rev 20362)
@@ -39,6 +39,7 @@
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
import javax.servlet.http.HttpSession;
+import org.richfaces.event.ItemChangeEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -373,10 +374,20 @@
}
/**
+ * An item change listener that logs to the page old and new value.
+ *
+ * @param event
+ * an event representing the activation of a user interface component
+ */
+ public void itemChangeListener(ItemChangeEvent event) {
+ RichBean.logToPage("* item changed: " + event.getOldItem() + " -> " + event.getNewItem());
+ }
+
+ /**
* A value change listener that logs to the page old and new value.
*
* @param event
- * an event representing the activation of a user interface component (not used)
+ * an event representing the activation of a user interface component
*/
public void valueChangeListener(ValueChangeEvent event) {
RichBean.logToPage("* value changed: " + event.getOldValue() + " -> " + event.getNewValue());
14 years, 1 month
JBoss Rich Faces SVN: r20361 - trunk/core/impl/src/main/resources/META-INF/resources.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-12-03 10:24:19 -0500 (Fri, 03 Dec 2010)
New Revision: 20361
Modified:
trunk/core/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
Log:
http://jira.jboss.com/jira/browse/RF-9858
Modified: trunk/core/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2010-12-03 15:23:12 UTC (rev 20360)
+++ trunk/core/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2010-12-03 15:24:19 UTC (rev 20361)
@@ -64,7 +64,7 @@
* */
richfaces.BaseComponent = function(componentId) {
this.id = componentId;
- this.options = {};
+ this.options = this.options || {};
};
var $p = {};
@@ -133,7 +133,7 @@
* __overrideMethod : function () {
* // if you need to use method from parent class use link to parent prototype
* // like in previous solution with extend method
- * this.$super.__overrideMethod.call(this, ...params...);
+ * $super.__overrideMethod.call(this, ...params...);
*
* //...
* }
@@ -159,7 +159,6 @@
SupperClass.extend(DerivedClass);
DerivedClass.extendClass = SupperClass.extendClass;
- DerivedClass.prototype.$super = SupperClass.prototype;
$.extend(DerivedClass.prototype, methods);
@@ -228,11 +227,8 @@
source = source || this.id;
var element = richfaces.getDomElement(source);
if (element) {
- element[richfaces.RICH_CONTAINER] = $.extend(element[richfaces.RICH_CONTAINER] || {},
- {
- component:this
- }
- );
+ var container = element[richfaces.RICH_CONTAINER] = element[richfaces.RICH_CONTAINER] || {};
+ container.component = this;
}
return element;
},
@@ -297,7 +293,6 @@
*
* */
destroy: function() {
- this.detach();
}
};
})(params));
14 years, 1 month
JBoss Rich Faces SVN: r20360 - trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-12-03 10:23:12 -0500 (Fri, 03 Dec 2010)
New Revision: 20360
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenu.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuGroup.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuItem.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js
Log:
http://jira.jboss.com/jira/browse/RF-9858
output components code refactoring
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion.js 2010-12-03 15:19:27 UTC (rev 20359)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion.js 2010-12-03 15:23:12 UTC (rev 20360)
@@ -37,7 +37,7 @@
* @param {Hash} options - params
* */
init : function (componentId, options) {
- rf.ui.TogglePanel.call(this, componentId, options);
+ $super.constructor.call(this, componentId, options);
this.items = [];
this.isKeepHeight = options["isKeepHeight"] || false
@@ -66,8 +66,10 @@
destroy: function () {
rf.Event.unbindById(this.id, "." + this.namespace);
-
- this.$super.destroy.call(this);
+ $super.destroy.call(this);
}
});
+
+ // define super class link
+ var $super = rf.ui.Accordion.$super;
})(jQuery, RichFaces);
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js 2010-12-03 15:19:27 UTC (rev 20359)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js 2010-12-03 15:23:12 UTC (rev 20360)
@@ -37,7 +37,7 @@
* @param {Hash} options - params
* */
init : function (componentId, options) {
- rf.ui.TogglePanelItem.call(this, componentId, options);
+ $super.constructor.call(this, componentId, options);
this.index = options["index"];
this.getTogglePanel().getItems()[this.index] = this;
@@ -149,7 +149,10 @@
rf.Event.unbindById(this.id, "."+this.namespace);
- this.$super.destroy.call(this);
+ $super.destroy.call(this);
}
});
+
+ // define super class link
+ var $super = rf.ui.AccordionItem.$super;
})(jQuery, RichFaces);
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenu.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenu.js 2010-12-03 15:19:27 UTC (rev 20359)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenu.js 2010-12-03 15:23:12 UTC (rev 20360)
@@ -42,11 +42,11 @@
* @param {Hash} options - params
* */
init : function (componentId, options) {
- this.id = componentId;
+ $super.constructor.call(this, componentId);
this.items = [];
- this.attachToDom(componentId);
+ this.attachToDom();
- this.options = $.extend({}, __DEFAULT_OPTIONS, options || {});
+ this.options = $.extend(this.options, __DEFAULT_OPTIONS, options || {});
this.activeItem = this.__getValueInput().value;
this.nestingLevel = 0;
@@ -201,8 +201,12 @@
destroy: function () {
rf.Event.unbindById(this.id, "."+this.namespace);
-
- this.$super.destroy.call(this);
+ this.detach();
+ $super.destroy.call(this);
}
});
+
+ // define super class link
+ var $super = rf.ui.PanelMenu.$super;
+
})(jQuery, RichFaces);
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuGroup.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuGroup.js 2010-12-03 15:19:27 UTC (rev 20359)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuGroup.js 2010-12-03 15:23:12 UTC (rev 20360)
@@ -120,10 +120,9 @@
* @param {Hash} options - params
* */
init : function (componentId, options) {
- this.options = $.extend({}, __DEFAULT_OPTIONS, options || {});
+ $super.constructor.call(this, componentId);
+ this.options = $.extend(this.options, __DEFAULT_OPTIONS, options || {});
- rf.ui.PanelMenuItem.call(this, componentId);
-
if (!this.options.disabled) {
var menuGroup = this;
@@ -357,7 +356,10 @@
destroy: function () {
rf.Event.unbindById(this.id, "."+this.namespace);
- this.$super.destroy.call(this);
+ $super.destroy.call(this);
}
});
+
+ // define super class link
+ var $super = rf.ui.PanelMenuGroup.$super;
})(jQuery, RichFaces);
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuItem.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuItem.js 2010-12-03 15:19:27 UTC (rev 20359)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/PanelMenuItem.js 2010-12-03 15:23:12 UTC (rev 20360)
@@ -119,10 +119,10 @@
* @param {Hash} options - params
* */
init : function (componentId, options) {
- this.id = componentId;
- this.attachToDom(componentId);
+ $super.constructor.call(this, componentId);
+ this.attachToDom();
- this.options = $.extend({}, __DEFAULT_OPTIONS, this.options || {}, options || {});
+ this.options = $.extend(this.options, __DEFAULT_OPTIONS, options || {});
this.mode = this.options.mode
this.itemName = this.options.name
@@ -312,8 +312,11 @@
destroy: function () {
delete this.__rfPanelMenu().getItems()[this.itemName];
-
- rf.ui.PanelMenuItem.$super.destroy.call(this);
+ this.detach();
+ $super.destroy.call(this);
}
});
+
+ // define super class link
+ var $super = rf.ui.PanelMenuItem.$super;
})(jQuery, RichFaces);
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab.js 2010-12-03 15:19:27 UTC (rev 20359)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tab.js 2010-12-03 15:23:12 UTC (rev 20360)
@@ -37,7 +37,7 @@
* @param {Hash} options - params
* */
init : function (componentId, options) {
- rf.ui.TogglePanelItem.call(this, componentId, options);
+ $super.constructor.call(this, componentId, options);
this.index = options["index"];
this.getTogglePanel().getItems()[this.index] = this;
@@ -130,7 +130,10 @@
rf.Event.unbindById(this.id + ":header:active");
rf.Event.unbindById(this.id + ":header:inactive");
- this.$super.destroy.call(this);
+ $super.destroy.call(this);
}
});
+
+ // define super class link
+ var $super = rf.ui.Tab.$super;
})(jQuery, RichFaces);
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-12-03 15:19:27 UTC (rev 20359)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-12-03 15:23:12 UTC (rev 20360)
@@ -153,10 +153,10 @@
name:"TogglePanel",
init : function (componentId, options) {
- rf.BaseComponent.call(this, componentId);
- this.attachToDom(componentId);
+ $super.constructor.call(this, componentId);
+ this.attachToDom();
- this.options = options;
+ this.options = $.extend(this.options, options || {});
this.activeItem = this.options.activeItem;
this.items = this.options.items;
@@ -424,7 +424,11 @@
},
destroy: function () {
- rf.BaseComponent.prototype.destroy.call(this);
+ this.detach();
+ $super.destroy.call(this);
}
});
+
+ // define super class link
+ var $super = rf.ui.TogglePanel.$super;
})(jQuery, RichFaces);
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-12-03 15:19:27 UTC (rev 20359)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-12-03 15:23:12 UTC (rev 20360)
@@ -31,10 +31,10 @@
init : function (componentId, options) {
// call constructor of parent class
- rf.BaseComponent.call(this, componentId);
- this.attachToDom(componentId);
+ $super.constructor.call(this, componentId);
+ this.attachToDom();
- this.options = options;
+ this.options = $.extend(this.options, options || {});
this.name = this.options.name;
this.togglePanelId = this.options.togglePanelId;
this.switchMode = this.options.switchMode;
@@ -111,7 +111,11 @@
// class stuff
destroy: function () {
- rf.BaseComponent.prototype.destroy.call(this);
+ this.detach();
+ $super.destroy.call(this);
}
});
+
+ // define super class link
+ var $super = rf.ui.TogglePanelItem.$super;
})(jQuery, RichFaces);
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js 2010-12-03 15:19:27 UTC (rev 20359)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js 2010-12-03 15:23:12 UTC (rev 20360)
@@ -116,9 +116,9 @@
* @param {Hash} options - params
* */
init : function (componentId, options) {
- this.id = componentId
- this.options = $.extend({}, DEFAULT_OPTIONS, this.options || {}, options || {});
- this.attachToDom.call(this, componentId);
+ $super.constructor.call(this, componentId);
+ this.options = $.extend(this.options, DEFAULT_OPTIONS, options || {});
+ this.attachToDom();
this.mode = this.options.mode;
this.target = this.options.target;
@@ -286,7 +286,11 @@
},
destroy: function () {
- rf.ui.Tooltip.$super.destroy.call(this);
+ this.detach();
+ $super.destroy.call(this);
}
});
+
+ // define super class link
+ var $super = rf.ui.Tooltip.$super;
})(jQuery, RichFaces);
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js 2010-12-03 15:19:27 UTC (rev 20359)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/popupPanel.js 2010-12-03 15:23:12 UTC (rev 20360)
@@ -53,10 +53,10 @@
$super.constructor.call(this,id);
this.markerId = id;
- this.attachToDom(id);
- this.options = $.extend(this.options, defaultOptions, options);
+ this.attachToDom(this.markerId);
+ this.options = $.extend(this.options, defaultOptions, options || {});
- this.id = $(richfaces.getDomElement(id));
+ this.id = $(richfaces.getDomElement(id)); // Should be component Id string // NOT AN OBJECT
this.minWidth = this.getMinimumSize(this.options.minWidth);
this.minHeight = this.getMinimumSize(this.options.minHeight);
this.maxWidth = this.options.maxWidth;
@@ -93,14 +93,13 @@
};
- var $super = richfaces.BaseComponent.extend(richfaces.ui.PopupPanel);
- var $p = richfaces.BaseComponent.extend(richfaces.ui.PopupPanel, {});
+ richfaces.BaseComponent.extend(richfaces.ui.PopupPanel);
var $super = richfaces.ui.PopupPanel.$super;
- $.extend(richfaces.ui.PopupPanel.prototype, (function (options) {
+ $.extend(richfaces.ui.PopupPanel.prototype, (function (options) {
return {
- name: "RichFaces.ui.PopupPanel",
+ name: "PopupPanel",
saveInputValues: function(element) {
/* Fix for RF-3856 - Checkboxes in modal panel does not hold their states after modal was closed and opened again */
if ($.browser.msie /* reproducible for checkbox/radio in IE6, radio in IE 7/8 beta 2 */) {
@@ -154,7 +153,7 @@
this.firstOutside = null;
this.lastOutside = null;
this.firstHref = null;
- this.parent = null;
+ this.parent = null;
if (this.header) {
this.header.destroy();
this.header=null;
@@ -184,6 +183,9 @@
this.scrollerDiv = null;
this.userOptions = null;
this.eIframe= null;
+
+ this.detach(this.markerId);
+ $super.destroy.call(this);
},
@@ -747,39 +749,6 @@
});
return true;
- },
-
- invokeEvent: function(eventName, event, value, element) {
-
- var eventFunction = eval(this.options['on'+eventName]);
- var result;
-
- if (eventFunction) {
- var eventObj;
- if (event) {
- eventObj = event;
- }
- else if(document.createEventObject) {
- eventObj = document.createEventObject();
- }
- else if( document.createEvent ) {
- eventObj = document.createEvent('Events');
- eventObj.initEvent( eventName, true, false );
- }
-
- eventObj.rich = {component:this};
- eventObj.rich.value = value;
-
- try {
- result = eventFunction.call(element, eventObj);
- }
- catch (e) { LOG.warn("Exception: "+e.Message + "\n[on"+eventName + "]"); }
- }
-
- if (result!=false) {
- result = true;
- }
- return result;
}
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js 2010-12-03 15:19:27 UTC (rev 20359)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/progressBar.js 2010-12-03 15:23:12 UTC (rev 20360)
@@ -18,9 +18,8 @@
rf.ui.ProgressBar = function(componentId, options) {
// call constructor of parent class
$super.constructor.call(this, componentId);
- this.id = componentId;
- this.__elt = this.attachToDom(this.id);
- this.options = $.extend({}, defaultOptions, options);
+ this.__elt = this.attachToDom();
+ this.options = $.extend(this.options, defaultOptions, options || {});
this.enabled = this.options.enabled;
this.minValue = this.options.minValue;
this.maxValue = this.options.maxValue;
@@ -193,6 +192,7 @@
destroy: function() {
this.disable();
this.__elt = null;
+ this.detach();
$super.destroy.call(this);
}
}
14 years, 1 month
JBoss Rich Faces SVN: r20359 - in trunk/ui/output/ui/src/main: java/org/richfaces/renderkit/html and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-03 10:19:27 -0500 (Fri, 03 Dec 2010)
New Revision: 20359
Added:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbar.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbarGroup.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarGroupRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarRendererBase.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/ToolbarSeparatorImage.java
trunk/ui/output/ui/src/main/templates/toolbar.template.xml
Modified:
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/DotSeparatorImage.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/GridSeparatorImage.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/LineSeparatorImage.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/SquareSeparatorImage.java
trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
Log:
Rf-9884, RF-9885, RF-9886
Added: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbar.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbar.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbar.java 2010-12-03 15:19:27 UTC (rev 20359)
@@ -0,0 +1,82 @@
+/*
+ * 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.component;
+
+import javax.faces.component.UIComponentBase;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.EventName;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.renderkit.html.ToolbarRendererBase;
+
+@JsfComponent(family = AbstractToolbar.COMPONENT_FAMILY, type = AbstractToolbar.COMPONENT_TYPE,
+ renderer=@JsfRenderer(type = ToolbarRendererBase.RENDERER_TYPE), tag = @Tag(name="toolbar")
+)
+public abstract class AbstractToolbar extends UIComponentBase {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.Toolbar";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.Toolbar";
+
+ @Attribute
+ public abstract String getHeight();
+
+ @Attribute
+ public abstract String getWidth();
+
+ @Attribute
+ public abstract String getItemSeparator();
+
+ @Attribute(events=@EventName("itemclick"))
+ public abstract String getOnitemclick();
+
+ @Attribute(events=@EventName("itemdblclick"))
+ public abstract String getOnitemdblclick();
+
+ @Attribute(events=@EventName("itemmousedown"))
+ public abstract String getOnitemmousedown();
+
+ @Attribute(events=@EventName("itemmouseup"))
+ public abstract String getOnitemmouseup();
+
+ @Attribute(events=@EventName("itemmouseover"))
+ public abstract String getOnitemmouseover();
+
+ @Attribute(events=@EventName("itemmousemove"))
+ public abstract String getOnitemmousemove();
+
+ @Attribute(events=@EventName("itemmouseout"))
+ public abstract String getOnitemmouseout();
+
+ @Attribute(events=@EventName("itemkeypress"))
+ public abstract String getOnitemkeypress();
+
+ @Attribute(events=@EventName("itemkeydown"))
+ public abstract String getOnitemkeydown();
+
+ @Attribute(events=@EventName("itemkeyup"))
+ public abstract String getOnitemkeyup();
+
+}
Added: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbarGroup.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbarGroup.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolbarGroup.java 2010-12-03 15:19:27 UTC (rev 20359)
@@ -0,0 +1,106 @@
+/*
+ * 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.component;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.EventName;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.renderkit.html.ToolbarGroupRenderer;
+
+@JsfComponent(family = AbstractToolbar.COMPONENT_FAMILY, type = AbstractToolbarGroup.COMPONENT_TYPE,
+ renderer=@JsfRenderer(type = ToolbarGroupRenderer.RENDERER_TYPE), tag = @Tag(name="toolbarGroup"))
+public abstract class AbstractToolbarGroup extends UIComponentBase {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.ToolbarGroup";
+
+ @Attribute
+ public abstract String getItemSeparator();
+
+ @Attribute
+ public abstract String getLocation();
+
+ @Attribute(events=@EventName("itemclick"))
+ public abstract String getOnitemclick();
+
+ @Attribute(events=@EventName("itemdblclick"))
+ public abstract String getOnitemdblclick();
+
+ @Attribute(events=@EventName("itemmousedown"))
+ public abstract String getOnitemmousedown();
+
+ @Attribute(events=@EventName("itemmouseup"))
+ public abstract String getOnitemmouseup();
+
+ @Attribute(events=@EventName("itemmouseover"))
+ public abstract String getOnitemmouseover();
+
+ @Attribute(events=@EventName("itemmousemove"))
+ public abstract String getOnitemmousemove();
+
+ @Attribute(events=@EventName("itemmouseout"))
+ public abstract String getOnitemmouseout();
+
+ @Attribute(events=@EventName("itemkeypress"))
+ public abstract String getOnitemkeypress();
+
+ @Attribute(events=@EventName("itemkeydown"))
+ public abstract String getOnitemkeydown();
+
+ @Attribute(events=@EventName("itemkeyup"))
+ public abstract String getOnitemkeyup();
+
+ public AbstractToolbar getToolBar() {
+ UIComponent component = this.getParent();
+ if (component == null) {
+ throw new FacesException("The component: " + this.getClientId(getFacesContext()) +
+ " is not nested within " + AbstractToolbar.class.getSimpleName());
+ } else if (!(component instanceof AbstractToolbar)) {
+ throw new FacesException("The component: " + this.getClientId(getFacesContext()) +
+ " is not a direct child of " + AbstractToolbar.class.getSimpleName());
+ }
+ return (AbstractToolbar) component;
+ }
+
+ public List<UIComponent> getRenderedChildren() {
+ List<UIComponent> children = this.getChildren();
+ List<UIComponent> renderedChildren = new ArrayList<UIComponent>(children.size());
+
+ for (UIComponent child : children) {
+ if (child.isRendered()) {
+ renderedChildren.add(child);
+ }
+ }
+
+ return renderedChildren;
+ }
+
+}
Added: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarGroupRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarGroupRenderer.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarGroupRenderer.java 2010-12-03 15:19:27 UTC (rev 20359)
@@ -0,0 +1,107 @@
+/*
+ * 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.html;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractToolbar;
+import org.richfaces.component.AbstractToolbarGroup;
+import org.richfaces.renderkit.HtmlConstants;
+
+@JsfRenderer(type = ToolbarGroupRenderer.RENDERER_TYPE, family = AbstractToolbar.COMPONENT_FAMILY)
+public class ToolbarGroupRenderer extends ToolbarRendererBase {
+
+ public static final String RENDERER_TYPE = "org.richfaces.ToolbarGroupRenderer";
+
+ protected Class<? extends UIComponent> getComponentClass() {
+ return AbstractToolbarGroup.class;
+ }
+
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException {
+ AbstractToolbarGroup toolbarGroup = (AbstractToolbarGroup) component;
+ List<UIComponent> renderedChildren = toolbarGroup.getRenderedChildren();
+ if (renderedChildren.size() <= 0) {
+ return;
+ }
+
+ ResponseWriter writer = facesContext.getResponseWriter();
+ renderChild(facesContext, toolbarGroup, writer, renderedChildren.get(0));
+ for (int i = 1; i < renderedChildren.size(); i++) {
+ insertSeparatorIfNeed(facesContext, toolbarGroup, writer);
+ renderChild(facesContext, toolbarGroup, writer, renderedChildren.get(i));
+ }
+ }
+
+ private void renderChild(FacesContext facesContext, AbstractToolbarGroup toolbarGroup, ResponseWriter writer,
+ UIComponent child) throws IOException {
+ writer.startElement(HtmlConstants.TD_ELEM, toolbarGroup);
+ writeClassValue(toolbarGroup, writer);
+ writeStyleValue(toolbarGroup, writer);
+ encodeEventsAttributes(facesContext, toolbarGroup);
+ child.encodeAll(facesContext);
+ writer.endElement(HtmlConstants.TD_ELEM);
+ }
+
+ private void writeStyleValue(AbstractToolbarGroup toolbarGroup, ResponseWriter writer) throws IOException {
+ String style = getStringAttribute(toolbarGroup, HtmlConstants.STYLE_ATTRIBUTE);
+ String contentStyle = getStringAttribute(getParentToolBar(toolbarGroup), "contentStyle");
+
+ String value = concatStyles(contentStyle, style);
+
+ if (isPropertyRendered(value)) {
+ writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, value, null);
+ }
+ }
+
+ private void writeClassValue(AbstractToolbarGroup toolbarGroup, ResponseWriter writer) throws IOException {
+ String styleClass = getStringAttribute(toolbarGroup, HtmlConstants.STYLE_CLASS_ATTR);
+ AbstractToolbar toolbar = getParentToolBar(toolbarGroup);
+ String contentClass = null;
+
+ if(toolbar != null) {
+ contentClass = getStringAttribute(toolbar, "contentClass");
+ }
+
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, concatClasses("rf-tb-itm", contentClass, styleClass), null);
+ }
+
+ private String getStringAttribute(UIComponent toolbarGroup, String attribute) {
+ String value = (String) toolbarGroup.getAttributes().get(attribute);
+ return null == value ? "" : value;
+ }
+
+ public AbstractToolbar getParentToolBar(UIComponent component) {
+ return (component instanceof AbstractToolbarGroup) ? ((AbstractToolbarGroup) component).getToolBar() : null;
+ }
+
+}
\ No newline at end of file
Added: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarRendererBase.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarRendererBase.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolbarRendererBase.java 2010-12-03 15:19:27 UTC (rev 20359)
@@ -0,0 +1,279 @@
+/*
+ * 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.html;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.richfaces.component.AbstractToolbar;
+import org.richfaces.component.AbstractToolbarGroup;
+import org.richfaces.renderkit.ComponentAttribute;
+import org.richfaces.renderkit.HtmlConstants;
+import org.richfaces.renderkit.RenderKitUtils;
+import org.richfaces.renderkit.RendererBase;
+
+
+@ResourceDependency(library = "org.richfaces", name = "toolbar.ecss")
+public abstract class ToolbarRendererBase extends RendererBase {
+
+ public static final String RENDERER_TYPE = "org.richfaces.ToolbarRenderer";
+
+ public static final Map<String, ComponentAttribute> ITEMS_HANDLER_ATTRIBUTES = Collections
+ .unmodifiableMap(ComponentAttribute.createMap(
+ new ComponentAttribute(HtmlConstants.ONCLICK_ATTRIBUTE)
+ .setEventNames("itemclick")
+ .setComponentAttributeName("onitemclick"),
+ new ComponentAttribute(HtmlConstants.ONDBLCLICK_ATTRIBUTE)
+ .setEventNames("itemdblclick")
+ .setComponentAttributeName("onitemdblclick"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEDOWN_ATTRIBUTE)
+ .setEventNames("itemmousedown")
+ .setComponentAttributeName("onitemmousedown"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEUP_ATTRIBUTE)
+ .setEventNames("itemmouseup")
+ .setComponentAttributeName("onitemmouseup"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEOVER_ATTRIBUTE)
+ .setEventNames("itemmouseover")
+ .setComponentAttributeName("onitemmouseover"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEMOVE_ATTRIBUTE)
+ .setEventNames("itemmousemove")
+ .setComponentAttributeName("onitemmousemove"),
+ new ComponentAttribute(HtmlConstants.ONMOUSEOUT_ATTRIBUTE)
+ .setEventNames("itemmouseout")
+ .setComponentAttributeName("onitemmouseout"),
+ new ComponentAttribute(HtmlConstants.ONKEYPRESS_ATTRIBUTE)
+ .setEventNames("itemkeypress")
+ .setComponentAttributeName("onitemkeypress"),
+ new ComponentAttribute(HtmlConstants.ONKEYDOWN_ATTRIBUTE)
+ .setEventNames("itemkeydown")
+ .setComponentAttributeName("onitemkeydown"),
+ new ComponentAttribute(HtmlConstants.ONKEYUP_ATTRIBUTE)
+ .setEventNames("itemkeyup")
+ .setComponentAttributeName("onitemkeyup")
+ ));
+
+ public enum ItemSeparators {
+ NONE, SQUARE, DISC, GRID, LINE
+ }
+
+ public enum Locations {
+ RIGHT, LEFT
+ }
+
+ @Override
+ public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
+ AbstractToolbar toolbar = (AbstractToolbar) component;
+ String contentClass = (String) toolbar.getAttributes().get("contentClass");
+ String contentStyle = (String) toolbar.getAttributes().get("contentStyle");
+
+ List<UIComponent> children = toolbar.getChildren();
+
+ if (children != null) {
+ List<UIComponent> childrenToTheLeft = new LinkedList<UIComponent>();
+ List<UIComponent> childrenToTheRight = new LinkedList<UIComponent>();
+ for (UIComponent child : children) {
+ if (child.isRendered()) {
+ if (child instanceof AbstractToolbarGroup) {
+ AbstractToolbarGroup group = (AbstractToolbarGroup) child;
+ String location = group.getLocation();
+ if (location != null && location.equalsIgnoreCase(Locations.RIGHT.toString())) {
+ childrenToTheRight.add(child);
+ } else {
+ childrenToTheLeft.add(child);
+ }
+ } else {
+ childrenToTheLeft.add(child);
+ }
+ }
+ }
+
+ ResponseWriter writer = context.getResponseWriter();
+ for (Iterator<UIComponent> it = childrenToTheLeft.iterator(); it.hasNext();) {
+
+ UIComponent child = it.next();
+
+ if (!(child instanceof AbstractToolbarGroup)) {
+ writer.startElement(HtmlConstants.TD_ELEM, component);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, concatClasses("rf-tb-itm", contentClass), null);
+ if (isPropertyRendered(contentStyle)) {
+ writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, contentStyle, null);
+ }
+ encodeEventsAttributes(context, toolbar);
+ }
+
+ child.encodeAll(context);
+
+ if (!(child instanceof AbstractToolbarGroup)) {
+ writer.endElement(HtmlConstants.TD_ELEM);
+ }
+
+
+
+ if (it.hasNext()) {
+ insertSeparatorIfNeed(context, toolbar, writer);
+ }
+ }
+
+ writer.startElement(HtmlConstants.TD_ELEM, component);
+ writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, "width:100%", null);
+ writer.endElement(HtmlConstants.TD_ELEM);
+
+ for (Iterator<UIComponent> it = childrenToTheRight.iterator(); it.hasNext();) {
+ UIComponent child = it.next();
+ child.encodeAll(context);
+ if (it.hasNext()) {
+ insertSeparatorIfNeed(context, toolbar, writer);
+ }
+ }
+ }
+ }
+
+ public void encodeItem(FacesContext facesContext, UIComponent component, ResponseWriter writer, String contentStyle, String contentClass) throws IOException {
+ if (!(component instanceof AbstractToolbarGroup)) {
+ writer.startElement(HtmlConstants.TD_ELEM, component);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, concatClasses("rf-tb-itm", contentClass), null);
+ if (isPropertyRendered(contentStyle)) {
+ writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, contentStyle, null);
+ }
+ encodeEventsAttributes(facesContext, component);
+ }
+
+ component.encodeAll(facesContext);
+
+ if (!(component instanceof AbstractToolbarGroup)) {
+ writer.endElement(HtmlConstants.TD_ELEM);
+ }
+ }
+
+ /**
+ * Inserts separator between toolbar items. Uses facet "itemSeparator" if it
+ * is set and default separator implementation if facet is not set.
+ *
+ * @param context
+ * - faces context
+ * @param component
+ * - component
+ * @param writer
+ * - response writer
+ * @throws IOException
+ * - in case of IOException during writing to the ResponseWriter
+ */
+ protected void insertSeparatorIfNeed(FacesContext context, UIComponent component, ResponseWriter writer)
+ throws IOException {
+ UIComponent separatorFacet = component.getFacet("itemSeparator");
+ boolean isSeparatorFacetRendered = (separatorFacet != null) ? separatorFacet.isRendered() : false;
+ if (isSeparatorFacetRendered) {
+ writer.startElement(HtmlConstants.TD_ELEM, component);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-tb-sep", null);
+ separatorFacet.encodeAll(context);
+ writer.endElement(HtmlConstants.TD_ELEM);
+ } else {
+ insertDefaultSeparatorIfNeed(context, component, writer);
+ }
+ }
+
+ /**
+ * Inserts default separator. Possible values are: "square", "disc", "grid",
+ * "line" - for separators provided by component implementation; "none" -
+ * for no separators between toolbar items; URI string value - for custom
+ * images specified by the page author.
+ *
+ * @param context
+ * - faces context
+ * @param component
+ * - component
+ * @param writer
+ * - response writer
+ * @throws IOException
+ * - in case of IOException during writing to the ResponseWriter
+ */
+ protected void insertDefaultSeparatorIfNeed(FacesContext context, UIComponent component, ResponseWriter writer)
+ throws IOException {
+ String itemSeparator = (String) component.getAttributes().get("itemSeparator");
+
+ if (itemSeparator != null && itemSeparator.trim().length() != 0
+ && !itemSeparator.equalsIgnoreCase(ItemSeparators.NONE.toString())) {
+
+ ItemSeparators separator = null;
+ if (itemSeparator.equalsIgnoreCase(ItemSeparators.SQUARE.toString())) {
+ separator = ItemSeparators.SQUARE;
+ } else if (itemSeparator.equalsIgnoreCase(ItemSeparators.DISC.toString())) {
+ separator = ItemSeparators.DISC;
+ } else if (itemSeparator.equalsIgnoreCase(ItemSeparators.GRID.toString())) {
+ separator = ItemSeparators.GRID;
+ } else if (itemSeparator.equalsIgnoreCase(ItemSeparators.LINE.toString())) {
+ separator = ItemSeparators.LINE;
+ }
+
+ writer.startElement(HtmlConstants.TD_ELEM, component);
+ String separatorClass = "rf-tb-sep";
+ concatClasses(separatorClass, (String) component.getAttributes().get("separatorClass"));
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, separatorClass, null);
+
+ if (separator != null) {
+ String itemSeparatorClass = "rf-tb-sep-" + separator.toString().toLowerCase();
+ writer.startElement(HtmlConstants.DIV_ELEM, component);
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, itemSeparatorClass, null);
+ writer.write(" ");
+ writer.endElement(HtmlConstants.DIV_ELEM);
+ } else {
+ concatClasses(separatorClass, (String) component.getAttributes().get("separatorClass"));
+ writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, separatorClass, null);
+
+ String uri = RenderKitUtils.getResourceURL(itemSeparator, context);
+ writer.startElement(HtmlConstants.IMG_ELEMENT, component);
+ writer.writeAttribute(HtmlConstants.SRC_ATTRIBUTE, uri, null);
+ writer.writeAttribute(HtmlConstants.ALT_ATTRIBUTE, "", null);
+ writer.endElement(HtmlConstants.IMG_ELEMENT);
+ }
+
+ writer.endElement(HtmlConstants.TD_ELEM);
+ }
+ }
+
+ protected Class<? extends javax.faces.component.UIComponent> getComponentClass() {
+ return AbstractToolbar.class;
+ }
+
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ protected void encodeEventsAttributes(FacesContext facesContext, UIComponent component)
+ throws IOException {
+ RenderKitUtils.renderPassThroughAttributesOptimized(facesContext, component, ITEMS_HANDLER_ATTRIBUTES);
+ }
+
+ protected boolean isPropertyRendered(String property) {
+ return (null != property && !"".equals(property));
+ }
+}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/DotSeparatorImage.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/DotSeparatorImage.java 2010-12-03 15:19:09 UTC (rev 20358)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/DotSeparatorImage.java 2010-12-03 15:19:27 UTC (rev 20359)
@@ -36,7 +36,7 @@
*
*/
@DynamicUserResource
-public class DotSeparatorImage extends ToolBarSeparatorImage {
+public class DotSeparatorImage extends ToolbarSeparatorImage {
private static final Dimension DIMENSIONS = new Dimension(9, 9);
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/GridSeparatorImage.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/GridSeparatorImage.java 2010-12-03 15:19:09 UTC (rev 20358)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/GridSeparatorImage.java 2010-12-03 15:19:27 UTC (rev 20359)
@@ -10,7 +10,7 @@
import org.richfaces.resource.DynamicUserResource;
@DynamicUserResource
-public class GridSeparatorImage extends ToolBarSeparatorImage {
+public class GridSeparatorImage extends ToolbarSeparatorImage {
public Dimension getDimension() {
return calculateDimension();
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/LineSeparatorImage.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/LineSeparatorImage.java 2010-12-03 15:19:09 UTC (rev 20358)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/LineSeparatorImage.java 2010-12-03 15:19:27 UTC (rev 20359)
@@ -8,7 +8,7 @@
import org.richfaces.resource.DynamicUserResource;
@DynamicUserResource
-public class LineSeparatorImage extends ToolBarSeparatorImage {
+public class LineSeparatorImage extends ToolbarSeparatorImage {
public Dimension getDimension() {
return calculateDimension();
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/SquareSeparatorImage.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/SquareSeparatorImage.java 2010-12-03 15:19:09 UTC (rev 20358)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/SquareSeparatorImage.java 2010-12-03 15:19:27 UTC (rev 20359)
@@ -12,7 +12,7 @@
import org.richfaces.resource.DynamicUserResource;
@DynamicUserResource
-public class SquareSeparatorImage extends ToolBarSeparatorImage {
+public class SquareSeparatorImage extends ToolbarSeparatorImage {
private static final Dimension DIMENSIONS = new Dimension(9, 9);
Added: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/ToolbarSeparatorImage.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/ToolbarSeparatorImage.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/ToolbarSeparatorImage.java 2010-12-03 15:19:27 UTC (rev 20359)
@@ -0,0 +1,99 @@
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Date;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.richfaces.resource.ImageType;
+import org.richfaces.resource.Java2DUserResource;
+import org.richfaces.resource.PostConstructResource;
+import org.richfaces.resource.ResourceParameter;
+import org.richfaces.resource.StateHolderResource;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+
+public abstract class ToolbarSeparatorImage implements Java2DUserResource, StateHolderResource {
+
+ private int headerBackgroundColor;
+ private int separatorHeight;
+ private int headerGradientColor;
+
+ public int getHeaderBackgroundColor() {
+ return headerBackgroundColor;
+ }
+
+ public void setHeaderBackgroundColor(int bgColor) {
+ this.headerBackgroundColor = bgColor;
+ }
+
+ public int getSeparatorHeight() {
+ return separatorHeight;
+ }
+
+ @ResourceParameter(defaultValue = "9")
+ public void setSeparatorHeight(int separatorHeight) {
+ this.separatorHeight = separatorHeight;
+ }
+
+ public int getHeaderGradientColor() {
+ return headerGradientColor;
+ }
+
+ public void setHeaderGradientColor(int headerGradientColor) {
+ this.headerGradientColor = headerGradientColor;
+ }
+
+ public void writeState(FacesContext context, DataOutput dataOutput) throws IOException {
+ dataOutput.writeInt(headerBackgroundColor);
+ dataOutput.writeInt(separatorHeight);
+ dataOutput.writeInt(headerGradientColor);
+ }
+
+ public void readState(FacesContext context, DataInput dataInput) throws IOException {
+ this.headerBackgroundColor = dataInput.readInt();
+ this.separatorHeight = dataInput.readInt();
+ this.headerGradientColor = dataInput.readInt();
+ }
+
+ public boolean isTransient() {
+ return false;
+ }
+
+ public Map<String, String> getResponseHeaders() {
+ return null;
+ }
+
+ public Date getLastModified() {
+ return null;
+ }
+
+ public ImageType getImageType() {
+ return ImageType.GIF;
+ }
+
+ @PostConstructResource
+ public final void initialize() {
+ FacesContext context = FacesContext.getCurrentInstance();
+ Skin skin = SkinFactory.getInstance(context).getSkin(context);
+ Skin defaultSkin = SkinFactory.getInstance(context).getDefaultSkin(context);
+
+ String skinParameter = "headerBackgroundColor";
+ String tmp = (String) skin.getParameter(context, skinParameter);
+ if (null == tmp || "".equals(tmp)) {
+ tmp = (String) defaultSkin.getParameter(context, skinParameter);
+ }
+ this.setHeaderBackgroundColor(Color.decode(tmp == null ? "#224986" : tmp).getRGB());
+
+ skinParameter = "headerGradientColor";
+ tmp = (String) skin.getParameter(context, skinParameter);
+ if (null == tmp || "".equals(tmp)) {
+ tmp = (String) defaultSkin.getParameter(context, skinParameter);
+ }
+ this.setHeaderGradientColor(Color.decode(tmp == null ? "#CCCCFF" : tmp).getRGB());
+ }
+}
Modified: trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-12-03 15:19:09 UTC (rev 20358)
+++ trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-12-03 15:19:27 UTC (rev 20359)
@@ -11,8 +11,8 @@
</behavior>
<component>
- <component-type>org.richfaces.ToolBar</component-type>
- <component-class>org.richfaces.component.UIToolBar</component-class>
+ <component-type>org.richfaces.Toolbar</component-type>
+ <component-class>org.richfaces.component.UIToolbar</component-class>
<property>
<description>
A mutable Map of the attributes associated with
@@ -380,20 +380,20 @@
</property-extension>
</property>
<component-extension>
- <cdk:base-class>org.richfaces.component.AbstractToolBar</cdk:base-class>
+ <cdk:base-class>org.richfaces.component.AbstractToolbar</cdk:base-class>
<cdk:generate>true</cdk:generate>
- <cdk:component-family>org.richfaces.ToolBar</cdk:component-family>
- <cdk:renderer-type>org.richfaces.ToolBarRenderer</cdk:renderer-type>
+ <cdk:component-family>org.richfaces.Toolbar</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.ToolbarRenderer</cdk:renderer-type>
<cdk:tag>
<cdk:generate>false</cdk:generate>
- <cdk:tag-name>toolBar</cdk:tag-name>
+ <cdk:tag-name>toolbar</cdk:tag-name>
<cdk:tag-type>Facelets</cdk:tag-type>
</cdk:tag>
</component-extension>
</component>
<component>
- <component-type>org.richfaces.ToolBarGroup</component-type>
- <component-class>org.richfaces.component.UIToolBarGroup</component-class>
+ <component-type>org.richfaces.ToolbarGroup</component-type>
+ <component-class>org.richfaces.component.UIToolbarGroup</component-class>
<property>
<description>
A mutable Map of the attributes associated with
@@ -749,13 +749,13 @@
</property-extension>
</property>
<component-extension>
- <cdk:base-class>org.richfaces.component.AbstractToolBarGroup</cdk:base-class>
+ <cdk:base-class>org.richfaces.component.AbstractToolbarGroup</cdk:base-class>
<cdk:generate>true</cdk:generate>
- <cdk:component-family>org.richfaces.ToolBar</cdk:component-family>
- <cdk:renderer-type>org.richfaces.ToolBarGroupRenderer</cdk:renderer-type>
+ <cdk:component-family>org.richfaces.Toolbar</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.ToolbarGroupRenderer</cdk:renderer-type>
<cdk:tag>
<cdk:generate>false</cdk:generate>
- <cdk:tag-name>toolBarGroup</cdk:tag-name>
+ <cdk:tag-name>toolbarGroup</cdk:tag-name>
<cdk:tag-type>Facelets</cdk:tag-type>
</cdk:tag>
</component-extension>
@@ -1757,17 +1757,17 @@
<render-kit-id>HTML_BASIC</render-kit-id>
<renderer>
- <component-family>org.richfaces.ToolBar</component-family>
- <renderer-type>org.richfaces.ToolBarRenderer</renderer-type>
- <renderer-class>org.richfaces.renderkit.html.ToolBarRenderer</renderer-class>
+ <component-family>org.richfaces.Toolbar</component-family>
+ <renderer-type>org.richfaces.ToolbarRenderer</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.ToolbarRenderer</renderer-class>
<renderer-extension>
<cdk:renders-children>false</cdk:renders-children>
</renderer-extension>
</renderer>
<renderer>
- <component-family>org.richfaces.ToolBar</component-family>
- <renderer-type>org.richfaces.ToolBarGroupRenderer</renderer-type>
- <renderer-class>org.richfaces.renderkit.html.ToolBarGroupRenderer</renderer-class>
+ <component-family>org.richfaces.Toolbar</component-family>
+ <renderer-type>org.richfaces.ToolbarGroupRenderer</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.ToolbarGroupRenderer</renderer-class>
<renderer-extension>
<cdk:renders-children>false</cdk:renders-children>
</renderer-extension>
Modified: trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-12-03 15:19:09 UTC (rev 20358)
+++ trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-12-03 15:19:27 UTC (rev 20359)
@@ -9,8 +9,8 @@
<tag>
<tag-name>toolbar</tag-name>
<component>
- <component-type>org.richfaces.ToolBar</component-type>
- <renderer-type>org.richfaces.ToolBarRenderer</renderer-type>
+ <component-type>org.richfaces.Toolbar</component-type>
+ <renderer-type>org.richfaces.ToolbarRenderer</renderer-type>
</component>
<attribute>
<description>The value binding expression used to wire up this component to a component property of a JavaBean class</description>
@@ -88,8 +88,8 @@
<tag>
<tag-name>toolbarGroup</tag-name>
<component>
- <component-type>org.richfaces.ToolBarGroup</component-type>
- <renderer-type>org.richfaces.ToolBarGroupRenderer</renderer-type>
+ <component-type>org.richfaces.ToolbarGroup</component-type>
+ <renderer-type>org.richfaces.ToolbarGroupRenderer</renderer-type>
</component>
<attribute>
<description>The value binding expression used to wire up this component to a component property of a JavaBean class</description>
Added: trunk/ui/output/ui/src/main/templates/toolbar.template.xml
===================================================================
--- trunk/ui/output/ui/src/main/templates/toolbar.template.xml (rev 0)
+++ trunk/ui/output/ui/src/main/templates/toolbar.template.xml 2010-12-03 15:19:27 UTC (rev 20359)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<cdk:root xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el"
+ xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core"
+ xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core"
+ xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite"
+ xmlns:javaee="http://java.sun.com/xml/ns/javaee">
+
+ <cc:interface>
+ <cdk:class>org.richfaces.renderkit.html.ToolbarRenderer</cdk:class>
+ <cdk:superclass>org.richfaces.renderkit.html.ToolbarRendererBase</cdk:superclass>
+ <cdk:component-family>org.richfaces.Toolbar</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.ToolbarRenderer</cdk:renderer-type>
+ </cc:interface>
+
+ <cc:implementation>
+ <table border="0" cellpadding="0" cellspacing="0" id="#{clientId}" width="#{component.attributes['width']}"
+ height="#{component.attributes['height']}" class="rf-tb #{component.attributes['styleClass']}"
+ style="#{component.attributes['style']}"
+ cdk:passThroughWithExclusions="">
+ <tr class="rf-tb-cntr">
+ <cdk:body />
+ </tr>
+ </table>
+ </cc:implementation>
+</cdk:root>
14 years, 1 month
JBoss Rich Faces SVN: r20358 - in trunk/examples/richfaces-showcase/src/main: webapp/richfaces/treeAdaptors/samples and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-12-03 10:19:09 -0500 (Fri, 03 Dec 2010)
New Revision: 20358
Modified:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/adaptors/FileSystemBean.java
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/adaptors/FileSystemNode.java
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/treeAdaptors/samples/treeModelRecursiveAdaptor-sample.xhtml
Log:
treeAdaptors demo
Modified: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/adaptors/FileSystemBean.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/adaptors/FileSystemBean.java 2010-12-03 14:42:06 UTC (rev 20357)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/adaptors/FileSystemBean.java 2010-12-03 15:19:09 UTC (rev 20358)
@@ -14,7 +14,7 @@
public synchronized List<FileSystemNode> getSourceRoots() {
if (srcRoots == null) {
- srcRoots = new FileSystemNode(SRC_PATH).getNodes();
+ srcRoots = new FileSystemNode(SRC_PATH).getDirectories();
}
return srcRoots;
Modified: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/adaptors/FileSystemNode.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/adaptors/FileSystemNode.java 2010-12-03 14:42:06 UTC (rev 20357)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/tree/adaptors/FileSystemNode.java 2010-12-03 15:19:09 UTC (rev 20358)
@@ -1,17 +1,47 @@
package org.richfaces.demo.tree.adaptors;
+import static com.google.common.base.Predicates.containsPattern;
+import static com.google.common.base.Predicates.not;
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.transform;
+
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Set;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
+import com.google.common.base.Function;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
public class FileSystemNode {
+
+ private static final Function<String, FileSystemNode> FACTORY = new Function<String, FileSystemNode>() {
+ public FileSystemNode apply(String from) {
+ return new FileSystemNode(from.substring(0, from.length() - 1));
+ };
+ };
+
+ private static final Function<String, String> TO_SHORT_PATH = new Function<String, String>() {
+ public String apply(String from) {
+ int idx = from.lastIndexOf('/');
+
+ if (idx < 0) {
+ return from;
+ }
+
+ return from.substring(idx + 1);
+ };
+ };
+
private String path;
- private List<FileSystemNode> children;
+ private List<FileSystemNode> directories;
+ private List<String> files;
+
private String shortPath;
public FileSystemNode(String path) {
@@ -23,27 +53,39 @@
shortPath = path;
}
}
+
+ public synchronized List<FileSystemNode> getDirectories() {
+ if (directories == null) {
+ directories = Lists.newArrayList();
- public synchronized List<FileSystemNode> getNodes() {
- if (children == null) {
- children = new ArrayList<FileSystemNode>();
- FacesContext facesContext = FacesContext.getCurrentInstance();
- ExternalContext externalContext = facesContext.getExternalContext();
- Set resourcePaths = externalContext.getResourcePaths(this.path);
- if (resourcePaths != null) {
- Object[] nodes = (Object[]) resourcePaths.toArray();
- for (Object node : nodes) {
- String nodePath = node.toString();
- if (nodePath.endsWith("/")) {
- nodePath = nodePath.substring(0, nodePath.length() - 1);
- }
- children.add(new FileSystemNode(nodePath));
- }
- }
+ Iterables.addAll(directories, transform(filter(getResourcePaths(), containsPattern("/$")), FACTORY));
}
- return children;
+
+ return directories;
}
+ public synchronized List<String> getFiles() {
+ if (files == null) {
+ files = new ArrayList<String>();
+
+ Iterables.addAll(files, transform(filter(getResourcePaths(), not(containsPattern("/$"))), TO_SHORT_PATH));
+ }
+
+ return files;
+ }
+
+ private Iterable<String> getResourcePaths() {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ ExternalContext externalContext = facesContext.getExternalContext();
+ Set<String> resourcePaths = externalContext.getResourcePaths(this.path);
+
+ if (resourcePaths == null) {
+ resourcePaths = Collections.emptySet();
+ }
+
+ return resourcePaths;
+ }
+
public String getShortPath() {
return shortPath;
}
Modified: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/treeAdaptors/samples/treeModelRecursiveAdaptor-sample.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/treeAdaptors/samples/treeModelRecursiveAdaptor-sample.xhtml 2010-12-03 14:42:06 UTC (rev 20357)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/treeAdaptors/samples/treeModelRecursiveAdaptor-sample.xhtml 2010-12-03 15:19:09 UTC (rev 20358)
@@ -8,10 +8,13 @@
<h:form>
<rich:tree style="width:300px" toggleType="ajax" var="item">
- <rich:treeModelRecursiveAdaptor roots="#{fileSystemBean.sourceRoots}" nodes="#{item.nodes}" >
+ <rich:treeModelRecursiveAdaptor roots="#{fileSystemBean.sourceRoots}" nodes="#{item.directories}" >
<rich:treeNode>
#{item.shortPath}
</rich:treeNode>
+ <rich:treeModelAdaptor nodes="#{item.files}">
+ <rich:treeNode>#{item}</rich:treeNode>
+ </rich:treeModelAdaptor>
</rich:treeModelRecursiveAdaptor>
</rich:tree>
</h:form>
14 years, 1 month
JBoss Rich Faces SVN: r20357 - in trunk/ui/output/ui/src/main: java/org/richfaces/renderkit/html and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-03 09:42:06 -0500 (Fri, 03 Dec 2010)
New Revision: 20357
Removed:
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolBar.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolBarGroup.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolBarGroupRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/ToolBarSeparatorImage.java
trunk/ui/output/ui/src/main/templates/toolBar.template.xml
Log:
rename to the *toolbar* instead of toolBar
Deleted: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolBar.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolBar.java 2010-12-03 14:30:15 UTC (rev 20356)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolBar.java 2010-12-03 14:42:06 UTC (rev 20357)
@@ -1,82 +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.component;
-
-import javax.faces.component.UIComponentBase;
-
-import org.richfaces.cdk.annotations.Attribute;
-import org.richfaces.cdk.annotations.EventName;
-import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.cdk.annotations.Tag;
-import org.richfaces.renderkit.html.ToolBarRendererBase;
-
-@JsfComponent(family = AbstractToolBar.COMPONENT_FAMILY, type = AbstractToolBar.COMPONENT_TYPE,
- renderer=@JsfRenderer(type = ToolBarRendererBase.RENDERER_TYPE), tag = @Tag(name="toolbar")
-)
-public abstract class AbstractToolBar extends UIComponentBase {
-
- public static final String COMPONENT_TYPE = "org.richfaces.ToolBar";
-
- public static final String COMPONENT_FAMILY = "org.richfaces.ToolBar";
-
- @Attribute
- public abstract String getHeight();
-
- @Attribute
- public abstract String getWidth();
-
- @Attribute
- public abstract String getItemSeparator();
-
- @Attribute(events=@EventName("itemclick"))
- public abstract String getOnitemclick();
-
- @Attribute(events=@EventName("itemdblclick"))
- public abstract String getOnitemdblclick();
-
- @Attribute(events=@EventName("itemmousedown"))
- public abstract String getOnitemmousedown();
-
- @Attribute(events=@EventName("itemmouseup"))
- public abstract String getOnitemmouseup();
-
- @Attribute(events=@EventName("itemmouseover"))
- public abstract String getOnitemmouseover();
-
- @Attribute(events=@EventName("itemmousemove"))
- public abstract String getOnitemmousemove();
-
- @Attribute(events=@EventName("itemmouseout"))
- public abstract String getOnitemmouseout();
-
- @Attribute(events=@EventName("itemkeypress"))
- public abstract String getOnitemkeypress();
-
- @Attribute(events=@EventName("itemkeydown"))
- public abstract String getOnitemkeydown();
-
- @Attribute(events=@EventName("itemkeyup"))
- public abstract String getOnitemkeyup();
-
-}
Deleted: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolBarGroup.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolBarGroup.java 2010-12-03 14:30:15 UTC (rev 20356)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractToolBarGroup.java 2010-12-03 14:42:06 UTC (rev 20357)
@@ -1,106 +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.component;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIComponentBase;
-
-import org.richfaces.cdk.annotations.Attribute;
-import org.richfaces.cdk.annotations.EventName;
-import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.cdk.annotations.Tag;
-import org.richfaces.renderkit.html.ToolBarGroupRenderer;
-
-@JsfComponent(family = AbstractToolBar.COMPONENT_FAMILY, type = AbstractToolBarGroup.COMPONENT_TYPE,
- renderer=@JsfRenderer(type = ToolBarGroupRenderer.RENDERER_TYPE), tag = @Tag(name="toolbarGroup"))
-public abstract class AbstractToolBarGroup extends UIComponentBase {
-
- public static final String COMPONENT_TYPE = "org.richfaces.ToolBarGroup";
-
- @Attribute
- public abstract String getItemSeparator();
-
- @Attribute
- public abstract String getLocation();
-
- @Attribute(events=@EventName("itemclick"))
- public abstract String getOnitemclick();
-
- @Attribute(events=@EventName("itemdblclick"))
- public abstract String getOnitemdblclick();
-
- @Attribute(events=@EventName("itemmousedown"))
- public abstract String getOnitemmousedown();
-
- @Attribute(events=@EventName("itemmouseup"))
- public abstract String getOnitemmouseup();
-
- @Attribute(events=@EventName("itemmouseover"))
- public abstract String getOnitemmouseover();
-
- @Attribute(events=@EventName("itemmousemove"))
- public abstract String getOnitemmousemove();
-
- @Attribute(events=@EventName("itemmouseout"))
- public abstract String getOnitemmouseout();
-
- @Attribute(events=@EventName("itemkeypress"))
- public abstract String getOnitemkeypress();
-
- @Attribute(events=@EventName("itemkeydown"))
- public abstract String getOnitemkeydown();
-
- @Attribute(events=@EventName("itemkeyup"))
- public abstract String getOnitemkeyup();
-
- public AbstractToolBar getToolBar() {
- UIComponent component = this.getParent();
- if (component == null) {
- throw new FacesException("The component: " + this.getClientId(getFacesContext()) +
- " is not nested within " + AbstractToolBar.class.getSimpleName());
- } else if (!(component instanceof AbstractToolBar)) {
- throw new FacesException("The component: " + this.getClientId(getFacesContext()) +
- " is not a direct child of " + AbstractToolBar.class.getSimpleName());
- }
- return (AbstractToolBar) component;
- }
-
- public List<UIComponent> getRenderedChildren() {
- List<UIComponent> children = this.getChildren();
- List<UIComponent> renderedChildren = new ArrayList<UIComponent>(children.size());
-
- for (UIComponent child : children) {
- if (child.isRendered()) {
- renderedChildren.add(child);
- }
- }
-
- return renderedChildren;
- }
-
-}
Deleted: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolBarGroupRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolBarGroupRenderer.java 2010-12-03 14:30:15 UTC (rev 20356)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolBarGroupRenderer.java 2010-12-03 14:42:06 UTC (rev 20357)
@@ -1,121 +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.html;
-
-import java.io.IOException;
-import java.util.List;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.component.AbstractToolBar;
-import org.richfaces.component.AbstractToolBarGroup;
-import org.richfaces.renderkit.HtmlConstants;
-
-@JsfRenderer(type = ToolBarGroupRenderer.RENDERER_TYPE, family = AbstractToolBar.COMPONENT_FAMILY)
-public class ToolBarGroupRenderer extends ToolBarRendererBase {
-
- public static final String RENDERER_TYPE = "org.richfaces.ToolBarGroupRenderer";
-
- protected Class<? extends UIComponent> getComponentClass() {
- return AbstractToolBarGroup.class;
- }
-
- public boolean getRendersChildren() {
- return true;
- }
-
- public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException {
- AbstractToolBarGroup toolBarGroup = (AbstractToolBarGroup) component;
- List<UIComponent> renderedChildren = toolBarGroup.getRenderedChildren();
- if (renderedChildren.size() <= 0) {
- return;
- }
-
- ResponseWriter writer = facesContext.getResponseWriter();
- renderChild(facesContext, toolBarGroup, writer, renderedChildren.get(0));
- for (int i = 1; i < renderedChildren.size(); i++) {
- insertSeparatorIfNeed(facesContext, toolBarGroup, writer);
- renderChild(facesContext, toolBarGroup, writer, renderedChildren.get(i));
- }
- }
-
- private void renderChild(FacesContext facesContext, AbstractToolBarGroup toolBarGroup, ResponseWriter writer,
- UIComponent child) throws IOException {
- writer.startElement(HtmlConstants.TD_ELEM, toolBarGroup);
- writeClassValue(toolBarGroup, writer);
- writeStyleValue(toolBarGroup, writer);
- encodeEventsAttributes(facesContext, toolBarGroup);
- child.encodeAll(facesContext);
- writer.endElement(HtmlConstants.TD_ELEM);
- }
-
- private void writeStyleValue(AbstractToolBarGroup toolBarGroup, ResponseWriter writer) throws IOException {
- String style = getStringAttribute(toolBarGroup, HtmlConstants.STYLE_ATTRIBUTE);
- String contentStyle = getStringAttribute(getParentToolBar(toolBarGroup), "contentStyle");
-
- String value = getCompoundStyleValue(contentStyle, style);
-
- if (isPropertyRendered(value)) {
- writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, value, null);
- }
- }
-
- private String getCompoundStyleValue(String... styles) {
- if (styles != null) {
- StringBuilder result = new StringBuilder();
- for (int styleIndex = 0; styleIndex < styles.length; styleIndex++) {
- result.append(styles[styleIndex]);
- if (styleIndex != styles.length - 1) {
- result.append("; ");
- }
- }
- return result.toString();
- }
- return "";
- }
-
- private void writeClassValue(AbstractToolBarGroup toolBarGroup, ResponseWriter writer) throws IOException {
- String styleClass = getStringAttribute(toolBarGroup, HtmlConstants.STYLE_CLASS_ATTR);
- AbstractToolBar toolBar = getParentToolBar(toolBarGroup);
- String contentClass = null;
-
- if(toolBar != null) {
- contentClass = getStringAttribute(toolBar, "contentClass");
- }
-
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, concatClasses("rf-tb-itm", contentClass, styleClass), null);
- }
-
- private String getStringAttribute(UIComponent toolBarGroup, String attribute) {
- String value = (String) toolBarGroup.getAttributes().get(attribute);
- return null == value ? "" : value;
- }
-
- public AbstractToolBar getParentToolBar(UIComponent component) {
- return (component instanceof AbstractToolBarGroup) ? ((AbstractToolBarGroup) component).getToolBar() : null;
- }
-
-}
\ No newline at end of file
Deleted: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java 2010-12-03 14:30:15 UTC (rev 20356)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/ToolBarRendererBase.java 2010-12-03 14:42:06 UTC (rev 20357)
@@ -1,279 +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.html;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import javax.faces.application.ResourceDependency;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.richfaces.component.AbstractToolBar;
-import org.richfaces.component.AbstractToolBarGroup;
-import org.richfaces.renderkit.ComponentAttribute;
-import org.richfaces.renderkit.HtmlConstants;
-import org.richfaces.renderkit.RenderKitUtils;
-import org.richfaces.renderkit.RendererBase;
-
-
-@ResourceDependency(library = "org.richfaces", name = "toolbar.ecss")
-public abstract class ToolBarRendererBase extends RendererBase {
-
- public static final String RENDERER_TYPE = "org.richfaces.ToolBarRenderer";
-
- public static final Map<String, ComponentAttribute> ITEMS_HANDLER_ATTRIBUTES = Collections
- .unmodifiableMap(ComponentAttribute.createMap(
- new ComponentAttribute(HtmlConstants.ONCLICK_ATTRIBUTE)
- .setEventNames("itemclick")
- .setComponentAttributeName("onitemclick"),
- new ComponentAttribute(HtmlConstants.ONDBLCLICK_ATTRIBUTE)
- .setEventNames("itemdblclick")
- .setComponentAttributeName("onitemdblclick"),
- new ComponentAttribute(HtmlConstants.ONMOUSEDOWN_ATTRIBUTE)
- .setEventNames("itemmousedown")
- .setComponentAttributeName("onitemmousedown"),
- new ComponentAttribute(HtmlConstants.ONMOUSEUP_ATTRIBUTE)
- .setEventNames("itemmouseup")
- .setComponentAttributeName("onitemmouseup"),
- new ComponentAttribute(HtmlConstants.ONMOUSEOVER_ATTRIBUTE)
- .setEventNames("itemmouseover")
- .setComponentAttributeName("onitemmouseover"),
- new ComponentAttribute(HtmlConstants.ONMOUSEMOVE_ATTRIBUTE)
- .setEventNames("itemmousemove")
- .setComponentAttributeName("onitemmousemove"),
- new ComponentAttribute(HtmlConstants.ONMOUSEOUT_ATTRIBUTE)
- .setEventNames("itemmouseout")
- .setComponentAttributeName("onitemmouseout"),
- new ComponentAttribute(HtmlConstants.ONKEYPRESS_ATTRIBUTE)
- .setEventNames("itemkeypress")
- .setComponentAttributeName("onitemkeypress"),
- new ComponentAttribute(HtmlConstants.ONKEYDOWN_ATTRIBUTE)
- .setEventNames("itemkeydown")
- .setComponentAttributeName("onitemkeydown"),
- new ComponentAttribute(HtmlConstants.ONKEYUP_ATTRIBUTE)
- .setEventNames("itemkeyup")
- .setComponentAttributeName("onitemkeyup")
- ));
-
- public enum ItemSeparators {
- NONE, SQUARE, DISC, GRID, LINE
- }
-
- public enum Locations {
- RIGHT, LEFT
- }
-
- @Override
- public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
- AbstractToolBar toolBar = (AbstractToolBar) component;
- String contentClass = (String) toolBar.getAttributes().get("contentClass");
- String contentStyle = (String) toolBar.getAttributes().get("contentStyle");
-
- List<UIComponent> children = toolBar.getChildren();
-
- if (children != null) {
- List<UIComponent> childrenToTheLeft = new LinkedList<UIComponent>();
- List<UIComponent> childrenToTheRight = new LinkedList<UIComponent>();
- for (UIComponent child : children) {
- if (child.isRendered()) {
- if (child instanceof AbstractToolBarGroup) {
- AbstractToolBarGroup group = (AbstractToolBarGroup) child;
- String location = group.getLocation();
- if (location != null && location.equalsIgnoreCase(Locations.RIGHT.toString())) {
- childrenToTheRight.add(child);
- } else {
- childrenToTheLeft.add(child);
- }
- } else {
- childrenToTheLeft.add(child);
- }
- }
- }
-
- ResponseWriter writer = context.getResponseWriter();
- for (Iterator<UIComponent> it = childrenToTheLeft.iterator(); it.hasNext();) {
-
- UIComponent child = it.next();
-
- if (!(child instanceof AbstractToolBarGroup)) {
- writer.startElement(HtmlConstants.TD_ELEM, component);
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, concatClasses("rf-tb-itm", contentClass), null);
- if (isPropertyRendered(contentStyle)) {
- writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, contentStyle, null);
- }
- encodeEventsAttributes(context, toolBar);
- }
-
- child.encodeAll(context);
-
- if (!(child instanceof AbstractToolBarGroup)) {
- writer.endElement(HtmlConstants.TD_ELEM);
- }
-
-
-
- if (it.hasNext()) {
- insertSeparatorIfNeed(context, toolBar, writer);
- }
- }
-
- writer.startElement(HtmlConstants.TD_ELEM, component);
- writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, "width:100%", null);
- writer.endElement(HtmlConstants.TD_ELEM);
-
- for (Iterator<UIComponent> it = childrenToTheRight.iterator(); it.hasNext();) {
- UIComponent child = it.next();
- child.encodeAll(context);
- if (it.hasNext()) {
- insertSeparatorIfNeed(context, toolBar, writer);
- }
- }
- }
- }
-
- public void encodeItem(FacesContext facesContext, UIComponent component, ResponseWriter writer, String contentStyle, String contentClass) throws IOException {
- if (!(component instanceof AbstractToolBarGroup)) {
- writer.startElement(HtmlConstants.TD_ELEM, component);
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, concatClasses("rf-tb-itm", contentClass), null);
- if (isPropertyRendered(contentStyle)) {
- writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, contentStyle, null);
- }
- encodeEventsAttributes(facesContext, component);
- }
-
- component.encodeAll(facesContext);
-
- if (!(component instanceof AbstractToolBarGroup)) {
- writer.endElement(HtmlConstants.TD_ELEM);
- }
- }
-
- /**
- * Inserts separator between toolbar items. Uses facet "itemSeparator" if it
- * is set and default separator implementation if facet is not set.
- *
- * @param context
- * - faces context
- * @param component
- * - component
- * @param writer
- * - response writer
- * @throws IOException
- * - in case of IOException during writing to the ResponseWriter
- */
- protected void insertSeparatorIfNeed(FacesContext context, UIComponent component, ResponseWriter writer)
- throws IOException {
- UIComponent separatorFacet = component.getFacet("itemSeparator");
- boolean isSeparatorFacetRendered = (separatorFacet != null) ? separatorFacet.isRendered() : false;
- if (isSeparatorFacetRendered) {
- writer.startElement(HtmlConstants.TD_ELEM, component);
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-tb-sep", null);
- separatorFacet.encodeAll(context);
- writer.endElement(HtmlConstants.TD_ELEM);
- } else {
- insertDefaultSeparatorIfNeed(context, component, writer);
- }
- }
-
- /**
- * Inserts default separator. Possible values are: "square", "disc", "grid",
- * "line" - for separators provided by component implementation; "none" -
- * for no separators between toolbar items; URI string value - for custom
- * images specified by the page author.
- *
- * @param context
- * - faces context
- * @param component
- * - component
- * @param writer
- * - response writer
- * @throws IOException
- * - in case of IOException during writing to the ResponseWriter
- */
- protected void insertDefaultSeparatorIfNeed(FacesContext context, UIComponent component, ResponseWriter writer)
- throws IOException {
- String itemSeparator = (String) component.getAttributes().get("itemSeparator");
-
- if (itemSeparator != null && itemSeparator.trim().length() != 0
- && !itemSeparator.equalsIgnoreCase(ItemSeparators.NONE.toString())) {
-
- ItemSeparators separator = null;
- if (itemSeparator.equalsIgnoreCase(ItemSeparators.SQUARE.toString())) {
- separator = ItemSeparators.SQUARE;
- } else if (itemSeparator.equalsIgnoreCase(ItemSeparators.DISC.toString())) {
- separator = ItemSeparators.DISC;
- } else if (itemSeparator.equalsIgnoreCase(ItemSeparators.GRID.toString())) {
- separator = ItemSeparators.GRID;
- } else if (itemSeparator.equalsIgnoreCase(ItemSeparators.LINE.toString())) {
- separator = ItemSeparators.LINE;
- }
-
- writer.startElement(HtmlConstants.TD_ELEM, component);
- String separatorClass = "rf-tb-sep";
- concatClasses(separatorClass, (String) component.getAttributes().get("separatorClass"));
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, separatorClass, null);
-
- if (separator != null) {
- String itemSeparatorClass = "rf-tb-sep-" + separator.toString().toLowerCase();
- writer.startElement(HtmlConstants.DIV_ELEM, component);
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, itemSeparatorClass, null);
- writer.write(" ");
- writer.endElement(HtmlConstants.DIV_ELEM);
- } else {
- concatClasses(separatorClass, (String) component.getAttributes().get("separatorClass"));
- writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, separatorClass, null);
-
- String uri = RenderKitUtils.getResourceURL(itemSeparator, context);
- writer.startElement(HtmlConstants.IMG_ELEMENT, component);
- writer.writeAttribute(HtmlConstants.SRC_ATTRIBUTE, uri, null);
- writer.writeAttribute(HtmlConstants.ALT_ATTRIBUTE, "", null);
- writer.endElement(HtmlConstants.IMG_ELEMENT);
- }
-
- writer.endElement(HtmlConstants.TD_ELEM);
- }
- }
-
- protected Class<? extends javax.faces.component.UIComponent> getComponentClass() {
- return AbstractToolBar.class;
- }
-
- public boolean getRendersChildren() {
- return true;
- }
-
- protected void encodeEventsAttributes(FacesContext facesContext, UIComponent component)
- throws IOException {
- RenderKitUtils.renderPassThroughAttributesOptimized(facesContext, component, ITEMS_HANDLER_ATTRIBUTES);
- }
-
- protected boolean isPropertyRendered(String property) {
- return ((null != property && !"".equals(property)));
- }
-}
Deleted: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/ToolBarSeparatorImage.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/ToolBarSeparatorImage.java 2010-12-03 14:30:15 UTC (rev 20356)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/images/ToolBarSeparatorImage.java 2010-12-03 14:42:06 UTC (rev 20357)
@@ -1,99 +0,0 @@
-package org.richfaces.renderkit.html.images;
-
-import java.awt.Color;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.Date;
-import java.util.Map;
-
-import javax.faces.context.FacesContext;
-
-import org.richfaces.resource.ImageType;
-import org.richfaces.resource.Java2DUserResource;
-import org.richfaces.resource.PostConstructResource;
-import org.richfaces.resource.ResourceParameter;
-import org.richfaces.resource.StateHolderResource;
-import org.richfaces.skin.Skin;
-import org.richfaces.skin.SkinFactory;
-
-public abstract class ToolBarSeparatorImage implements Java2DUserResource, StateHolderResource {
-
- private int headerBackgroundColor;
- private int separatorHeight;
- private int headerGradientColor;
-
- public int getHeaderBackgroundColor() {
- return headerBackgroundColor;
- }
-
- public void setHeaderBackgroundColor(int bgColor) {
- this.headerBackgroundColor = bgColor;
- }
-
- public int getSeparatorHeight() {
- return separatorHeight;
- }
-
- @ResourceParameter(defaultValue = "9")
- public void setSeparatorHeight(int separatorHeight) {
- this.separatorHeight = separatorHeight;
- }
-
- public int getHeaderGradientColor() {
- return headerGradientColor;
- }
-
- public void setHeaderGradientColor(int headerGradientColor) {
- this.headerGradientColor = headerGradientColor;
- }
-
- public void writeState(FacesContext context, DataOutput dataOutput) throws IOException {
- dataOutput.writeInt(headerBackgroundColor);
- dataOutput.writeInt(separatorHeight);
- dataOutput.writeInt(headerGradientColor);
- }
-
- public void readState(FacesContext context, DataInput dataInput) throws IOException {
- this.headerBackgroundColor = dataInput.readInt();
- this.separatorHeight = dataInput.readInt();
- this.headerGradientColor = dataInput.readInt();
- }
-
- public boolean isTransient() {
- return false;
- }
-
- public Map<String, String> getResponseHeaders() {
- return null;
- }
-
- public Date getLastModified() {
- return null;
- }
-
- public ImageType getImageType() {
- return ImageType.GIF;
- }
-
- @PostConstructResource
- public final void initialize() {
- FacesContext context = FacesContext.getCurrentInstance();
- Skin skin = SkinFactory.getInstance(context).getSkin(context);
- Skin defaultSkin = SkinFactory.getInstance(context).getDefaultSkin(context);
-
- String skinParameter = "headerBackgroundColor";
- String tmp = (String) skin.getParameter(context, skinParameter);
- if (null == tmp || "".equals(tmp)) {
- tmp = (String) defaultSkin.getParameter(context, skinParameter);
- }
- this.setHeaderBackgroundColor(Color.decode(tmp == null ? "#224986" : tmp).getRGB());
-
- skinParameter = "headerGradientColor";
- tmp = (String) skin.getParameter(context, skinParameter);
- if (null == tmp || "".equals(tmp)) {
- tmp = (String) defaultSkin.getParameter(context, skinParameter);
- }
- this.setHeaderGradientColor(Color.decode(tmp == null ? "#CCCCFF" : tmp).getRGB());
- }
-}
Deleted: trunk/ui/output/ui/src/main/templates/toolBar.template.xml
===================================================================
--- trunk/ui/output/ui/src/main/templates/toolBar.template.xml 2010-12-03 14:30:15 UTC (rev 20356)
+++ trunk/ui/output/ui/src/main/templates/toolBar.template.xml 2010-12-03 14:42:06 UTC (rev 20357)
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<cdk:root xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el"
- xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core"
- xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core"
- xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite"
- xmlns:javaee="http://java.sun.com/xml/ns/javaee">
-
- <cc:interface>
- <cdk:class>org.richfaces.renderkit.html.ToolBarRenderer</cdk:class>
- <cdk:superclass>org.richfaces.renderkit.html.ToolBarRendererBase</cdk:superclass>
- <cdk:component-family>org.richfaces.ToolBar</cdk:component-family>
- <cdk:renderer-type>org.richfaces.ToolBarRenderer</cdk:renderer-type>
- </cc:interface>
-
- <cc:implementation>
- <table border="0" cellpadding="0" cellspacing="0" id="#{clientId}" width="#{component.attributes['width']}"
- height="#{component.attributes['height']}" class="rf-tb #{component.attributes['styleClass']}"
- style="#{component.attributes['style']}"
- cdk:passThroughWithExclusions="">
- <tr class="rf-tb-cntr">
- <cdk:body />
- </tr>
- </table>
- </cc:implementation>
-</cdk:root>
14 years, 1 month
JBoss Rich Faces SVN: r20356 - sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-12-03 09:30:15 -0500 (Fri, 03 Dec 2010)
New Revision: 20356
Modified:
sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.js
Log:
RF-9496
Modified: sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.js
===================================================================
--- sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.js 2010-12-03 14:29:57 UTC (rev 20355)
+++ sandbox/trunk/ui/fileupload/ui/src/main/resources/META-INF/resources/org.richfaces/fileupload.js 2010-12-03 14:30:15 UTC (rev 20356)
@@ -31,9 +31,9 @@
NEW: "new",
UPLOADING: "uploading",
DONE: "done",
- SIZE_EXCEEDED: "size_exceeded",
+ SIZE_EXCEEDED: "sizeExceeded",
STOPPED: "stopped",
- SERVER_ERROR: "server_error"
+ SERVER_ERROR: "serverError"
};
var pressButton = function(event) {
@@ -51,9 +51,15 @@
name: "FileUpload",
items: [],
-
submitedItems: [],
+ doneLabel: "Done",
+ sizeExceededLabel: "File size is exceeded",
+ stoppedLabel: "",
+ serverErrorLabel: "Server error",
+ clearLabel: "Clear",
+ deleteLabel: "Delete",
+
init: function(id, options) {
this.id = id;
jQuery.extend(this, options);
@@ -179,12 +185,12 @@
this.loadableItem = null;
this.__updateButtons();
var items = [];
+ for (var i in this.submitedItems) {
+ items.push(this.submitedItems[i].model);
+ }
for (var i in this.items) {
items.push(this.items[i].model);
}
- for (var i in this.submitedItems) {
- items.push(this.submitedItems[i].model);
- }
richfaces.Event.fire(this.element, "onuploadcomplete", items);
}
}
@@ -227,7 +233,7 @@
this.state = this.label.nextAll(".rf-fu-itm-st:first");
this.link = leftArea.next().children("a");
this.label.html(this.model.name);
- this.link.html("Delete");
+ this.link.html(this.fileUpload["deleteLabel"]);
this.link.click(jQuery.proxy(this.removeOrStop, this));
return this.element;
},
@@ -260,8 +266,8 @@
this.fileUpload.hiddenContainer.append(this.fileUpload.progressBarElement.detach());
}
this.input.remove();
- this.state.html(state == ITEM_STATE.DONE ? "Done" : "File size exceeded");
- this.link.html("Clear");
+ this.state.html(this.fileUpload[state + "Label"]);
+ this.link.html(this.fileUpload["clearLabel"]);
this.model.state = state;
}
});
14 years, 1 month
JBoss Rich Faces SVN: r20355 - in sandbox/trunk/ui/fileupload/ui/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-12-03 09:29:57 -0500 (Fri, 03 Dec 2010)
New Revision: 20355
Modified:
sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java
sandbox/trunk/ui/fileupload/ui/src/main/templates/fileupload.template.xml
Log:
RF-9497
Modified: sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java
===================================================================
--- sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java 2010-12-03 14:29:01 UTC (rev 20354)
+++ sandbox/trunk/ui/fileupload/ui/src/main/java/org/richfaces/context/FileUploadPartialViewContextFactory.java 2010-12-03 14:29:57 UTC (rev 20355)
@@ -51,7 +51,7 @@
public static final String UID_KEY = "rf_fu_uid";
private static enum ResponseState {
- size_exceeded, stopped, server_error
+ sizeExceeded, stopped, serverError
};
private static final Logger LOGGER = RichfacesLogger.CONTEXT.getLogger();
@@ -71,12 +71,13 @@
public FileUploadPartialViewContextFactory(PartialViewContextFactory parentFactory) {
this.parentFactory = parentFactory;
ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
- String param = context.getInitParameter("createTempFiles");
+ //TODO Use ConfigurationServiceHelper to initialize InitParameters.
+ String param = context.getInitParameter("org.richfaces.fileUpload.createTempFiles");
if (param != null) {
this.createTempFiles = Boolean.parseBoolean(param);
}
- this.tempFilesDirectory = context.getInitParameter("tempFilesDirectory");
- param = context.getInitParameter("maxRequestSize");
+ this.tempFilesDirectory = context.getInitParameter("org.richfaces.fileUpload.tempFilesDirectory");
+ param = context.getInitParameter("org.richfaces.fileUpload.maxRequestSize");
if (param != null) {
this.maxRequestSize = Integer.parseInt(param);
}
@@ -90,7 +91,7 @@
String uid = queryParamMap.get(UID_KEY);
if (uid != null) {
if (maxRequestSize != 0 && externalContext.getRequestContentLength() > maxRequestSize) {
- printResponse(facesContext, uid, ResponseState.size_exceeded);
+ printResponse(facesContext, uid, ResponseState.sizeExceeded);
} else {
MultipartRequest multipartRequest = new MultipartRequest(request, createTempFiles,
tempFilesDirectory, maxRequestSize, uid);
@@ -102,7 +103,7 @@
externalContext.setRequest(multipartRequest);
}
} catch (FileUploadException e) {
- printResponse(facesContext, uid, ResponseState.server_error);
+ printResponse(facesContext, uid, ResponseState.serverError);
} finally {
multipartRequest.clearRequestData();
}
Modified: sandbox/trunk/ui/fileupload/ui/src/main/templates/fileupload.template.xml
===================================================================
--- sandbox/trunk/ui/fileupload/ui/src/main/templates/fileupload.template.xml 2010-12-03 14:29:01 UTC (rev 20354)
+++ sandbox/trunk/ui/fileupload/ui/src/main/templates/fileupload.template.xml 2010-12-03 14:29:57 UTC (rev 20355)
@@ -38,8 +38,9 @@
<cdk:resource-dependency library="org.richfaces" name="fileupload.js" />
</cc:interface>
<cc:implementation>
- <cdk:object name="enabled" value="#{component.attributes['enabled']}"/>
- <div id="#{clientId}" class="rf-fu #{component.attributes['styleClass']}"
+ <cdk:object name="attributes" value="#{component.attributes}"/>
+ <cdk:object name="enabled" value="#{attributes['enabled']}"/>
+ <div id="#{clientId}" class="rf-fu #{attributes['styleClass']}"
cdk:passThroughWithExclusions="">
<div class="rf-fu-hdr">
<span class="rf-fu-btns-lft">
@@ -50,19 +51,22 @@
<input type="file" class="rf-fu-inp"/>
</span>
</c:if>
- Add...
+ <cdk:object name="addLabel" value="#{attributes['addLabel']}"/>
+ #{addLabel != null ? addLabel : 'Add...'}
</span>
</span>
<c:if test="#{enabled}">
<span class="rf-fu-btn-upl">
- <span class="rf-fu-btn-cnt-upl">Upload</span>
+ <cdk:object name="uploadLabel" value="#{attributes['uploadLabel']}"/>
+ <span class="rf-fu-btn-cnt-upl">#{uploadLabel != null ? uploadLabel : 'Upload'}</span>
</span>
</c:if>
</span>
<c:if test="#{enabled}">
<span class="rf-fu-btns-rgh">
<span class="rf-fu-btn-clr">
- <span class="rf-fu-btn-cnt-clr">Clear All</span>
+ <cdk:object name="clearAllLabel" value="#{attributes['clearAllLabel']}"/>
+ <span class="rf-fu-btn-cnt-clr">#{clearAllLabel != null ? clearAllLabel : 'Clear All'}</span>
</span>
</span>
</c:if>
@@ -77,7 +81,8 @@
</c:if>
</div>
<cdk:scriptObject name="options">
- <cdk:scriptOption attributes="acceptedTypes noDuplicate onfilesubmit onuploadcomplete"/>
+ <cdk:scriptOption attributes="acceptedTypes noDuplicate onfilesubmit onuploadcomplete doneLabel
+ sizeExceededLabel stoppedLabel serverErrorLabel clearLabel deleteLabel"/>
</cdk:scriptObject>
<script type="text/javascript">new RichFaces.ui.FileUpload(#{toScriptArgs(clientId, options)});</script>
</c:if>
14 years, 1 month
JBoss Rich Faces SVN: r20354 - sandbox/trunk/examples/fileupload-demo/src/main/webapp/WEB-INF.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-12-03 09:29:01 -0500 (Fri, 03 Dec 2010)
New Revision: 20354
Modified:
sandbox/trunk/examples/fileupload-demo/src/main/webapp/WEB-INF/web.xml
Log:
RF-9501
Modified: sandbox/trunk/examples/fileupload-demo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- sandbox/trunk/examples/fileupload-demo/src/main/webapp/WEB-INF/web.xml 2010-12-03 14:25:07 UTC (rev 20353)
+++ sandbox/trunk/examples/fileupload-demo/src/main/webapp/WEB-INF/web.xml 2010-12-03 14:29:01 UTC (rev 20354)
@@ -39,7 +39,7 @@
<display-name></display-name>
<description></description>
<context-param>
- <param-name>maxRequestSize</param-name>
+ <param-name>org.richfaces.fileUpload.maxRequestSize</param-name>
<param-value>268435456</param-value>
</context-param>
<context-param>
14 years, 1 month