JBoss Rich Faces SVN: r20292 - sandbox/trunk/examples/dnd-demo/src/main/webapp/examples.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-02 05:35:22 -0500 (Thu, 02 Dec 2010)
New Revision: 20292
Modified:
sandbox/trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml
Log:
Modified: sandbox/trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml
===================================================================
--- sandbox/trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml 2010-12-02 10:28:49 UTC (rev 20291)
+++ sandbox/trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml 2010-12-02 10:35:22 UTC (rev 20292)
@@ -52,11 +52,10 @@
<h:body>
<h:form>
- <dnd:dragIndicator id="ind" styleClass="rf-ind" acceptClass="rf-ind-acpt" rejectClass="rf-ind-rejt" />
+ <dnd:dragIndicator id="ind"/>
<table>
<tr>
-
<td><a4j:outputPanel id="drg1" layout="block" styleClass="draggable">
<h:outputText value="#{dataBean.dragValue1}"/>
<dnd:dragBehavior event="mouseover" type="drg1" dragValue="#{dataBean.dragValue1}"/>
14 years
JBoss Rich Faces SVN: r20291 - sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-02 05:28:49 -0500 (Thu, 02 Dec 2010)
New Revision: 20291
Modified:
sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/indicator.ecss
Log:
remove unn styles
Modified: sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/indicator.ecss
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/indicator.ecss 2010-12-02 10:24:14 UTC (rev 20290)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/indicator.ecss 2010-12-02 10:28:49 UTC (rev 20291)
@@ -1,30 +1,15 @@
.rf-ind{
- height:50px;
- width:50px;
- border:1px dotted red;
- background-color:blue
}
.rf-ind-acpt{
- height:50px;
- width:50px;
- border:1px dotted red;
- background-color:green;
}
.rf-ind-rejt{
- height:50px;
- width:50px;
- border:1px dotted green;
- background-color:red;
}
.rf-drp-hvr{
}
-.rf-drp-hvr{
-}
-
.rf-drp-hlight{
}
14 years
JBoss Rich Faces SVN: r20290 - sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-02 05:24:14 -0500 (Thu, 02 Dec 2010)
New Revision: 20290
Modified:
sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js
Log:
clear jQuery draggable classes
Modified: sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js
===================================================================
--- sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js 2010-12-02 10:15:11 UTC (rev 20289)
+++ sandbox/trunk/ui/drag-drop/ui/src/main/resources/META-INF/resources/org.richfaces/dnd-draggable.js 2010-12-02 10:24:14 UTC (rev 20290)
@@ -53,6 +53,7 @@
ui.helper.addClass(indicator.draggingClass());
}
}
+ this.__clearDraggableCss(ui.helper);
},
dragStop: function(e, ui){
@@ -65,6 +66,13 @@
__isCustomDragIndicator: function() {
return this.dragElement.data("indicator");
+ },
+
+ __clearDraggableCss: function(element) {
+ if(element && element.removeClass) {
+ //draggable 'addClasses: false' doesn't work so clear jQuery style
+ element.removeClass("ui-draggable-dragging");
+ }
}
}
})());
14 years
JBoss Rich Faces SVN: r20289 - in trunk/examples/richfaces-showcase/src/main: java/org/richfaces/demo/calendar/model and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-12-02 05:15:11 -0500 (Thu, 02 Dec 2010)
New Revision: 20289
Added:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/calendar/model/
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/calendar/model/CalendarModel.java
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/calendar/model/CalendarModelItem.java
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/dataModel.xhtml
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/samples/dataModel-sample.xhtml
Modified:
trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/samples/clientStylingDisablement-sample.xhtml
Log:
https://jira.jboss.org/browse/RF-9834
Added: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/calendar/model/CalendarModel.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/calendar/model/CalendarModel.java (rev 0)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/calendar/model/CalendarModel.java 2010-12-02 10:15:11 UTC (rev 20289)
@@ -0,0 +1,54 @@
+package org.richfaces.demo.calendar.model;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import javax.faces.bean.ApplicationScoped;
+import javax.faces.bean.ManagedBean;
+
+import org.richfaces.model.CalendarDataModel;
+import org.richfaces.model.CalendarDataModelItem;
+
+@ManagedBean
+@ApplicationScoped
+public class CalendarModel implements CalendarDataModel {
+ private static final String WEEKEND_DAY_CLASS = "wdc";
+ private static final String BUSY_DAY_CLASS = "bdc";
+ private static final String BOUNDARY_DAY_CLASS = "rf-ca-boundary-dates";
+
+ private boolean checkBusyDay(Calendar calendar) {
+ return (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.TUESDAY || calendar.get(Calendar.DAY_OF_WEEK) == Calendar.THURSDAY);
+ }
+
+ private boolean checkWeekend(Calendar calendar) {
+ return (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY || calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY);
+ }
+
+ public CalendarDataModelItem[] getData(Date[] dateArray) {
+ CalendarDataModelItem[] modelItems = new CalendarModelItem[dateArray.length];
+ Calendar current = GregorianCalendar.getInstance();
+ Calendar today = GregorianCalendar.getInstance();
+ today.setTime(new Date());
+ for (int i = 0; i < dateArray.length; i++) {
+ current.setTime(dateArray[i]);
+ CalendarModelItem modelItem = new CalendarModelItem();
+ if (current.before(today)) {
+ modelItem.setEnabled(false);
+ modelItem.setStyleClass(BOUNDARY_DAY_CLASS);
+ } else if (checkBusyDay(current)){
+ modelItem.setEnabled(false);
+ modelItem.setStyleClass(BUSY_DAY_CLASS);
+ }else if (checkWeekend(current)){
+ modelItem.setEnabled(false);
+ modelItem.setStyleClass(WEEKEND_DAY_CLASS);
+ }else{
+ modelItem.setEnabled(true);
+ modelItem.setStyleClass("");
+ }
+ modelItems[i] = modelItem;
+ }
+
+ return modelItems;
+ }
+}
Added: trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/calendar/model/CalendarModelItem.java
===================================================================
--- trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/calendar/model/CalendarModelItem.java (rev 0)
+++ trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/calendar/model/CalendarModelItem.java 2010-12-02 10:15:11 UTC (rev 20289)
@@ -0,0 +1,25 @@
+package org.richfaces.demo.calendar.model;
+
+import org.richfaces.model.CalendarDataModelItem;
+
+public class CalendarModelItem implements CalendarDataModelItem{
+ private boolean enabled;
+ private String styleClass;
+
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public void setStyleClass(String styleClass) {
+ this.styleClass = styleClass;
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public String getStyleClass() {
+ return styleClass;
+ }
+}
Modified: trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-12-02 10:00:57 UTC (rev 20288)
+++ trunk/examples/richfaces-showcase/src/main/resources/org/richfaces/demo/data/common/navigation.xml 2010-12-02 10:15:11 UTC (rev 20289)
@@ -1,15 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
- <!--
- NOTES(TODO: move to some readme in future): id for sample should
- equals to xhtml page name with the sample the same for demo id - it
- should be equals to name of the folder where samples placed
- -->
+<!-- NOTES(TODO: move to some readme in future): id for sample should equals
+ to xhtml page name with the sample the same for demo id - it should be equals
+ to name of the folder where samples placed -->
<root>
<group>
<name>Ajax Action</name>
<demos>
<demo>
- <id>ajax</id>
+ <id>ajax</id>
<name>a4j:ajax</name>
<samples>
<sample>
@@ -174,21 +172,10 @@
</demo>
</demos>
</group>
- <!-- group>
- <name>Validation</name>
- <demos>
- <demo>
- <id>clientValidation</id>
- <name>Ajax/Client Validation</name>
- <samples>
- <sample>
- <id>ajaxValidation</id>
- <name>Simple Ajax Validation</name>
- </sample>
- </samples>
- </demo>
- </demos>
- </group-->
+ <!-- group> <name>Validation</name> <demos> <demo> <id>clientValidation</id>
+ <name>Ajax/Client Validation</name> <samples> <sample> <id>ajaxValidation</id>
+ <name>Simple Ajax Validation</name> </sample> </samples> </demo> </demos>
+ </group -->
<group>
<name>Data Iteration</name>
<demos>
@@ -215,14 +202,10 @@
<name>Data Table Styling</name>
<description>
<!-- TODO: rowClass should appears at this sample after completion -->
- <!--
- TODO: rowClasses should be used instead of jQuerry selectors
- after will works
- -->
- <!--
- TODO: onrowmouseover, onrowmouseout - should be used instead of
- jQuery selector
- -->
+ <!-- TODO: rowClasses should be used instead of jQuerry selectors
+ after will works -->
+ <!-- TODO: onrowmouseover, onrowmouseout - should be used instead
+ of jQuery selector -->
</description>
</sample>
<sample>
@@ -246,7 +229,7 @@
<sample>
<id>exTableSelection</id>
<name>ExtendedData Table Selection usage</name>
- </sample>
+ </sample>
</samples>
</demo>
<demo>
@@ -334,7 +317,7 @@
<sample>
<id>simple</id>
<name>Simple Toggle Panel</name>
- </sample>
+ </sample>
</samples>
</demo>
<demo>
@@ -346,18 +329,15 @@
<description>Simple Tab Panels</description>
<name>Simple Tab Panels</name>
</sample>
- <!-- sample>
- <id>headerCustomization</id>
- <description>Headers Customization</description>
- <name>Headers Customization</name>
- </sample-->
- <sample>
+ <!-- sample> <id>headerCustomization</id> <description>Headers Customization</description>
+ <name>Headers Customization</name> </sample -->
+ <sample>
<id>valueManagement</id>
<description>Selected Tab Management</description>
<name>Selected Tab Management</name>
- </sample>
+ </sample>
</samples>
- </demo>
+ </demo>
<demo>
<id>collapsiblePanel</id>
<name>rich:collapsiblePanel</name>
@@ -371,13 +351,13 @@
<demo>
<id>accordion</id>
<name>rich:accordion</name>
- <samples>
+ <samples>
<sample>
<id>simple</id>
<name>Simple Accordion</name>
</sample>
- </samples>
- </demo>
+ </samples>
+ </demo>
<demo>
<id>popup</id>
<name>rich:popupPanel</name>
@@ -415,13 +395,13 @@
<name>Simple tooltips</name>
</sample>
</samples>
- </demo>
+ </demo>
</demos>
</group>
<group>
<name>Menus</name>
<demos>
- <demo new="true">
+ <demo new="true">
<id>panelMenu</id>
<name>rich:panelMenu</name>
<samples>
@@ -431,7 +411,7 @@
</sample>
</samples>
</demo>
- <demo new="true">
+ <demo new="true">
<id>toolBar</id>
<name>rich:toolBar</name>
<samples>
@@ -449,7 +429,7 @@
</group>
<group>
<name>Inputs and Selects</name>
- <demos>
+ <demos>
<demo>
<id>autocomplete</id>
<name>rich:autocomplete</name>
@@ -457,14 +437,14 @@
<sample>
<id>cachedAjax</id>
<name>Autocomplete in Cached Ajax mode</name>
- </sample>
+ </sample>
<sample>
<id>clientFilter</id>
<name>Custom client filter</name>
- </sample>
+ </sample>
</samples>
</demo>
- <demo>
+ <demo new="true">
<id>calendar</id>
<name>rich:calendar</name>
<samples>
@@ -475,7 +455,11 @@
<sample new="true">
<id>clientStylingDisablement</id>
<name>Client Side Styling/Disablement</name>
- </sample>
+ </sample>
+ <sample new="true">
+ <id>dataModel</id>
+ <name>Data Model Support</name>
+ </sample>
</samples>
</demo>
<demo>
@@ -507,7 +491,7 @@
<name>Inplace Inputs samples</name>
</sample>
</samples>
- </demo>
+ </demo>
<demo>
<id>inplaceSelect</id>
<name>rich:inplaceSelect</name>
@@ -517,7 +501,7 @@
<name>Inplace Selects samples</name>
</sample>
</samples>
- </demo>
+ </demo>
<demo>
<id>select</id>
<name>rich:select</name>
@@ -527,8 +511,8 @@
<name>Selects samples</name>
</sample>
</samples>
- </demo>
- </demos>
+ </demo>
+ </demos>
</group>
<group>
<name>Misc Components/Features</name>
Added: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/dataModel.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/dataModel.xhtml (rev 0)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/dataModel.xhtml 2010-12-02 10:15:11 UTC (rev 20289)
@@ -0,0 +1,66 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition>
+ <p>Calendar may use a special Data Model to provide data for
+ element rendering. You can re-define the default Calendar Model using
+ the dataModel attribute pointed to the object that implements
+ CalendarDataModel interface.</p>
+ <p>In next simple example next rules applied using model:</p>
+ <ul>
+ <li>Weekend days are disabled (sunday and saturday) and uses bold
+ and italic text style.</li>
+ <li>Thuesday and Thursday are disabled also. (just RichFaces team
+ meeting days) So grayed out as busy days.</li>
+ <li>All the values in the past disabed and styled as boundary
+ dates.</li>
+ </ul>
+ <ui:include src="#{demoNavigator.sampleIncludeURI}" />
+ <ui:include src="/templates/includes/source-view.xhtml">
+ <ui:param name="src" value="#{demoNavigator.sampleIncludeURI}" />
+ <ui:param name="sourceType" value="xhtml" />
+ <ui:param name="openLabel" value="View Source" />
+ <ui:param name="hideLabel" value="Hide Source" />
+ </ui:include>
+ <ui:include src="/templates/includes/source-view.xhtml">
+ <ui:param name="src"
+ value="/WEB-INF/src/org/richfaces/demo/calendar/model/CalendarModel.java" />
+ <ui:param name="sourceType" value="java" />
+ <ui:param name="openLabel" value="View CalendarModel Source" />
+ <ui:param name="hideLabel" value="Hide CalendarModel Source" />
+ </ui:include>
+ <ui:include src="/templates/includes/source-view.xhtml">
+ <ui:param name="src"
+ value="/WEB-INF/src/org/richfaces/demo/calendar/model/CalendarModelItem.java" />
+ <ui:param name="sourceType" value="java" />
+ <ui:param name="openLabel" value="View CalendarModelItem Source" />
+ <ui:param name="hideLabel" value="Hide CalendarModelItem Source" />
+ </ui:include>
+ <p>Calendar may use a special Data Model to provide data for
+ element rendering. You can re-define the default Calendar Model using
+ the dataModel attribute pointed to the object that implements
+ <b>CalendarDataModel</b> interface.</p>
+ <p>CalendarDataModel has the following methods:</p>
+ <ul>
+ <li><b>CalendarDataModelItem[] getData(Date[])</b> is called every time
+ when components need the next block of CalendarDataItems. That may
+ happens when the calendar is rendered, or when you navigate to the
+ next/previous month or in any other case when the calendar is
+ rendered. This method is called in an Ajax mode when the calendar
+ renders a new page.</li>
+ </ul>
+ <p>CalendarDataModelItem provides the following methods:</p>
+ <ul>
+ <li><b>Boolean isEnabled()</b> returns "true" if date is "selectable" on
+ the calendar, the default implementation returns "true"</li>
+ <li><b>String getStyleClass()</b> returns "String" that is appended to a
+ style class for the date span. For example it may be "relevant
+ holiday" that means a class looks like "rich-cal-day relevant
+ holiday". The default implementation returns an empty string.</li>
+ </ul>
+</ui:composition>
+
+</html>
\ No newline at end of file
Modified: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/samples/clientStylingDisablement-sample.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/samples/clientStylingDisablement-sample.xhtml 2010-12-02 10:00:57 UTC (rev 20288)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/samples/clientStylingDisablement-sample.xhtml 2010-12-02 10:15:11 UTC (rev 20289)
@@ -34,5 +34,4 @@
</script>
<rich:calendar dayDisableFunction="disablementFunction"
dayClassFunction="disabledClassesProv" boundaryDatesMode="scroll" />
-
</ui:composition>
\ No newline at end of file
Added: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/samples/dataModel-sample.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/samples/dataModel-sample.xhtml (rev 0)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/calendar/samples/dataModel-sample.xhtml 2010-12-02 10:15:11 UTC (rev 20289)
@@ -0,0 +1,22 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+ <style>
+.bdc {
+ background-color: gray;
+}
+
+.wdc {
+ font-weight: bold;
+ font-style: italic;
+}
+</style>
+ <h:form>
+ <rich:calendar mode="ajax" boundaryDatesMode="scroll"
+ dataModel="#{calendarModel}" />
+ </h:form>
+</ui:composition>
\ No newline at end of file
14 years
JBoss Rich Faces SVN: r20288 - in sandbox/trunk/examples: dropdownmenu-demo and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-12-02 05:00:57 -0500 (Thu, 02 Dec 2010)
New Revision: 20288
Added:
sandbox/trunk/examples/dropdownmenu-demo/
sandbox/trunk/examples/dropdownmenu-demo/pom.xml
sandbox/trunk/examples/dropdownmenu-demo/src/
sandbox/trunk/examples/dropdownmenu-demo/src/main/
sandbox/trunk/examples/dropdownmenu-demo/src/main/java/
sandbox/trunk/examples/dropdownmenu-demo/src/main/java/org/
sandbox/trunk/examples/dropdownmenu-demo/src/main/java/org/richfaces/
sandbox/trunk/examples/dropdownmenu-demo/src/main/java/org/richfaces/demo/
sandbox/trunk/examples/dropdownmenu-demo/src/main/java/org/richfaces/demo/MenuBean.java
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/WEB-INF/
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/WEB-INF/lib/
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/WEB-INF/web.xml
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/examples/
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/copy.gif
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/create_doc.gif
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/ico1.gif
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/ico2.gif
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/input_bg.png
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/menu_item_bg.gif
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/menu_list_bg.gif
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/node.gif
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/open.gif
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/save.gif
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/save_all.gif
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/spacer.gif
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/index.xhtml
sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/indexWithToolBar.xhtml
Log:
RF-9676 :Dropdown menu component. Demo added.
Added: sandbox/trunk/examples/dropdownmenu-demo/pom.xml
===================================================================
--- sandbox/trunk/examples/dropdownmenu-demo/pom.xml (rev 0)
+++ sandbox/trunk/examples/dropdownmenu-demo/pom.xml 2010-12-02 10:00:57 UTC (rev 20288)
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <groupId>org.richfaces.examples</groupId>
+ <artifactId>richfaces-example-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.richfaces.examples</groupId>
+ <artifactId>dropdownmenu-demo</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <name>Richfaces Examples: Outputs</name>
+ <packaging>war</packaging>
+
+ <properties>
+ </properties>
+
+ <build>
+ <finalName>${project.artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.1-beta-1</version>
+ <configuration>
+ <webResources>
+ <resource>
+ <directory>${basedir}/src/main/java</directory>
+ <targetPath>/WEB-INF/src</targetPath>
+ </resource>
+ </webResources>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>jee6</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.1-alpha-1</version>
+ <configuration>
+ <webappDirectory>${project.build.directory}/${project.build.finalName}-jee6</webappDirectory>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>release</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>jee6</id>
+ <phase>package</phase>
+ <goals>
+ <goal>war</goal>
+ </goals>
+ <configuration>
+ <webappDirectory>${project.build.directory}/${project.build.finalName}-jee6</webappDirectory>
+ <classifier>jee6</classifier>
+ <packagingExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*</packagingExcludes>
+ <warSourceExcludes>WEB-INF/lib/jsf-api*,WEB-INF/lib/jsf-impl*</warSourceExcludes>
+ </configuration>
+ </execution>
+ </executions>
+ <configuration>
+ <webResources>
+ <resource>
+ <directory>${basedir}/src/main/java</directory>
+ <targetPath>/WEB-INF/src</targetPath>
+ </resource>
+ </webResources>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.ui.output</groupId>
+ <artifactId>richfaces-ui-output-ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.core</groupId>
+ <artifactId>richfaces-ui-core-ui</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sf.ehcache</groupId>
+ <artifactId>ehcache</artifactId>
+ </dependency>
+
+ <!-- Tests -->
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.10</version>
+ <classifier>jdk15</classifier>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
Added: sandbox/trunk/examples/dropdownmenu-demo/src/main/java/org/richfaces/demo/MenuBean.java
===================================================================
--- sandbox/trunk/examples/dropdownmenu-demo/src/main/java/org/richfaces/demo/MenuBean.java (rev 0)
+++ sandbox/trunk/examples/dropdownmenu-demo/src/main/java/org/richfaces/demo/MenuBean.java 2010-12-02 10:00:57 UTC (rev 20288)
@@ -0,0 +1,43 @@
+package org.richfaces.demo;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+
+@ManagedBean
+@SessionScoped
+public class MenuBean {
+ private String current;
+
+ public String getCurrent() {
+ return this.current;
+ }
+
+ public void setCurrent(String current) {
+ this.current = current;
+ }
+
+ public String doNew() {
+ this.current="New";
+ return null;
+ }
+ public String doOpen() {
+ this.current="Open";
+ return null;
+ }
+ public String doClose() {
+ this.current="Close";
+ return null;
+ }
+ public String doSave() {
+ this.current="Save";
+ return null;
+ }
+ public String doSaveAll() {
+ this.current="Save All";
+ return null;
+ }
+ public String doExit() {
+ this.current="Exit";
+ return null;
+ }
+}
Added: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/WEB-INF/web.xml 2010-12-02 10:00:57 UTC (rev 20288)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+
+ <display-name>Sample RichFaces 4 Application</display-name>
+
+ <!-- context-param>
+ <param-name>org.richfaces.skin</param-name>
+ <param-value>#{skinBean.skin}</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.enableControlSkinning</param-name>
+ <param-value>#{skinBean.enableElementsSkinning}</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.enableControlSkinningClasses</param-name>
+ <param-value>#{skinBean.enableClassesSkinning}</param-value>
+ </context-param -->
+
+
+ <context-param>
+ <param-name>javax.faces.PROJECT_STAGE</param-name>
+ <param-value>Development</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.SKIP_COMMENTS</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+ <welcome-file-list>
+ <welcome-file>faces/index.xhtml</welcome-file>
+ </welcome-file-list>
+ <session-config>
+ <session-timeout>30</session-timeout>
+ </session-config>
+</web-app>
\ No newline at end of file
Added: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/copy.gif
===================================================================
(Binary files differ)
Property changes on: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/copy.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/create_doc.gif
===================================================================
(Binary files differ)
Property changes on: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/create_doc.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/ico1.gif
===================================================================
(Binary files differ)
Property changes on: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/ico1.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/ico2.gif
===================================================================
(Binary files differ)
Property changes on: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/ico2.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/input_bg.png
===================================================================
(Binary files differ)
Property changes on: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/input_bg.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/menu_item_bg.gif
===================================================================
(Binary files differ)
Property changes on: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/menu_item_bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/menu_list_bg.gif
===================================================================
(Binary files differ)
Property changes on: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/menu_list_bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/node.gif
===================================================================
(Binary files differ)
Property changes on: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/node.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/open.gif
===================================================================
(Binary files differ)
Property changes on: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/open.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/save.gif
===================================================================
(Binary files differ)
Property changes on: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/save.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/save_all.gif
===================================================================
(Binary files differ)
Property changes on: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/save_all.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/spacer.gif
===================================================================
(Binary files differ)
Property changes on: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/images/spacer.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/index.xhtml
===================================================================
--- sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/index.xhtml (rev 0)
+++ sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/index.xhtml 2010-12-02 10:00:57 UTC (rev 20288)
@@ -0,0 +1,69 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ddm="http://richfaces.org/dropDownMenu"
+ xmlns:a4j="http://richfaces.org/a4j">
+ <h:head>
+ <title>Drop Down Menu</title>
+ <style>
+ .pic {
+ margin-bottom: -4px;
+ margin-right: 2px;
+ }
+ </style>
+ </h:head>
+ <h:body>
+ <h:form id="form">
+ <br />
+ <a4j:outputPanel ajaxRendered="true">
+ <h:outputText value="Current Selection: "></h:outputText>
+ <h:outputText style="font-weight:bold" value="#{menuBean.current}"></h:outputText>
+ </a4j:outputPanel>
+ <br />
+ <ddm:dropDownMenu disabled="false" mode="ajax" onshow="console.info('onshow event');">
+ <f:facet name="label">
+ <h:panelGroup>
+ <h:graphicImage value="images/copy.gif" styleClass="pic"/>
+ <h:outputText value="File"/>
+ </h:panelGroup>
+ </f:facet>
+ <f:facet name="labelDisabled">
+ <h:panelGroup>
+ <h:graphicImage value="images/copy.gif" styleClass="pic"/>
+ <h:outputText value="(disabled)File"/>
+ </h:panelGroup>
+ </f:facet>
+ <ddm:menuItem label="New" icon="images/create_doc.gif"
+ action="#{menuBean.doNew}">
+
+ </ddm:menuItem>
+ <ddm:menuItem label="Open" action="#{menuBean.doOpen}">
+ <f:facet name="icon">
+ <h:graphicImage value="images/open.gif" />
+ </f:facet>
+ </ddm:menuItem>
+ <ddm:menuGroup label="Save As..." disabled="true">
+ <ddm:menuItem label="Save" icon="images/save.gif" >
+ <f:facet name="icon">
+ <h:graphicImage value="images/save.gif" />
+ </f:facet>
+ </ddm:menuItem>
+ <ddm:menuItem label="Save All" icon="images/save_all.gif" ></ddm:menuItem>
+ </ddm:menuGroup>
+ <ddm:menuGroup label="Save As...">
+ <ddm:menuItem label="Save" icon="images/save.gif" />
+ <ddm:menuItem label="Save All" icon="images/save_all.gif" ></ddm:menuItem>
+ </ddm:menuGroup>
+ <ddm:menuItem label="Close" action="#{menuBean.doClose}"/>
+ <ddm:menuItem label="Close" disabled="true"/>
+ <ddm:menuSeparator id="menuSeparator11" />
+ <ddm:menuItem label="Exit" action="#{menuBean.doExit}"/>
+ <ddm:menuItem action="#{menuBean.doExit}">
+ ---EXIT--- <input type="text" />
+ </ddm:menuItem>
+ </ddm:dropDownMenu>
+ </h:form>
+ </h:body>
+</html>
\ No newline at end of file
Added: sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/indexWithToolBar.xhtml
===================================================================
--- sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/indexWithToolBar.xhtml (rev 0)
+++ sandbox/trunk/examples/dropdownmenu-demo/src/main/webapp/indexWithToolBar.xhtml 2010-12-02 10:00:57 UTC (rev 20288)
@@ -0,0 +1,65 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ddm="http://richfaces.org/dropDownMenu"
+ xmlns:tb="http://richfaces.org/toolBar">
+ <h:head>
+ <title>Drop Down Menu</title>
+ <style>
+ .pic {
+ margin-bottom: -4px;
+ margin-right: 2px;
+ }
+ </style>
+ </h:head>
+ <h:body>
+
+ <tb:toolBar height="45" itemSeparator="grid" contentStyle="color:red;">
+ <f:facet name="itemSeparator">
+ ||
+ </f:facet>
+ <tb:toolBarGroup itemSeparator="line" onitemclick="22">
+ <h:graphicImage value="/images/icons/create_doc.gif" styleClass="pic"/>
+ <a href="sdsd">link 1</a> Text
+ <a href="sdsd 2">link 2</a>
+ <h:graphicImage value="/images/icons/create_folder.gif" styleClass="pic" onclick="q1"/>
+ <h:graphicImage value="/images/icons/copy.gif" styleClass="pic"/>
+ <a href="sdsd">link 3</a> Text
+ <a href="sdsd 2">link 4</a>
+ </tb:toolBarGroup>
+ <tb:toolBarGroup itemSeparator="none">
+ <h:graphicImage value="/images/icons/save.gif" styleClass="pic" onclick="q2"/>
+ <h:graphicImage value="/images/icons/save.gif" styleClass="pic" onclick="q2"/>
+ <h:graphicImage value="/images/icons/save.gif" styleClass="pic" onclick="q2"/>
+ <h:graphicImage value="/images/icons/save.gif" styleClass="pic" onclick="q2"/>
+ </tb:toolBarGroup>
+ <tb:toolBarGroup itemSeparator="line">
+ <h:graphicImage value="/images/icons/save.gif" styleClass="pic" onclick="q2"/>
+ <h:graphicImage value="/images/icons/save.gif" styleClass="pic" onclick="q2"/>
+ </tb:toolBarGroup>
+
+ <tb:toolBarGroup location="right" itemSeparator="square">
+ <h:graphicImage value="/images/icons/find.gif" styleClass="pic"/>
+ <h:graphicImage value="/images/icons/filter.gif" styleClass="pic"/>
+ </tb:toolBarGroup>
+ </tb:toolBar>
+
+ <ddm:dropDownMenu value="File">
+ <ddm:menuItem value="New" icon="/images/icons/create_doc.gif">
+
+ </ddm:menuItem>
+ <ddm:menuItem value="Open" icon="/images/icons/open.gif" />
+ <ddm:menuGroup value="Save As...">
+ <ddm:menuItem value="Save" icon="/images/icons/save.gif" />
+ <ddm:menuItem value="Save All">
+
+ </ddm:menuItem>
+ </ddm:menuGroup>
+ <ddm:menuItem value="Close" />
+ <ddm:menuSeparator id="menuSeparator11" />
+ <ddm:menuItem value="Exit" />
+ </ddm:dropDownMenu>
+ </h:body>
+</html>
\ No newline at end of file
14 years
JBoss Rich Faces SVN: r20287 - in sandbox/trunk/ui: dropdown-menu and 16 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-12-02 04:59:09 -0500 (Thu, 02 Dec 2010)
New Revision: 20287
Added:
sandbox/trunk/ui/dropdown-menu/
sandbox/trunk/ui/dropdown-menu/pom.xml
sandbox/trunk/ui/dropdown-menu/ui/
sandbox/trunk/ui/dropdown-menu/ui/pom.xml
sandbox/trunk/ui/dropdown-menu/ui/src/
sandbox/trunk/ui/dropdown-menu/ui/src/main/
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/AbstractDropDownMenu.java
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/AbstractMenuGroup.java
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/AbstractMenuItem.java
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/AbstractMenuSeparator.java
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/MenuComponent.java
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/package-info.java
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/MenuSeparatorRendererBase.java
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/images/
sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/images/MenuNodeImage.java
sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/
sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/
sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/
sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/
sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/dropdownmenu.ecss
sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js
sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js
sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/richfaces/
sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties
sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/
sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/dropdownmenu.template.xml
sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/menugroup.template.xml
sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/menuitem.template.xml
sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/menuseparator.template.xml
Log:
RF-9676 : Dropdown menu component
Added: sandbox/trunk/ui/dropdown-menu/pom.xml
===================================================================
--- sandbox/trunk/ui/dropdown-menu/pom.xml (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/pom.xml 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the
+ copyright.txt in the distribution for a full listing of
+ individual contributors. This is free software; you can
+ redistribute it and/or modify it under the terms of the GNU
+ Lesser General Public License as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your
+ option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without
+ even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details. You should have received a copy of the GNU
+ Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St,
+ Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
+ http://www.fsf.org.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-root-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>../../parent/pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.richfaces.ui.output</groupId>
+ <artifactId>richfaces-ui-output-aggregator</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Richfaces UI Components: Output Aggregator</name>
+
+ <modules>
+ <module>ui</module>
+ </modules>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/trunk/ui/output</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/trunk/ui/output</developerConnection>
+ <url>http://fisheye.jboss.org/browse/richfaces</url>
+ </scm>
+</project>
\ No newline at end of file
Added: sandbox/trunk/ui/dropdown-menu/ui/pom.xml
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/pom.xml (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/pom.xml 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ JBoss, Home of Professional Open Source Copyright 2010, Red Hat,
+ Inc. and individual contributors by the @authors tag. See the
+ copyright.txt in the distribution for a full listing of
+ individual contributors. This is free software; you can
+ redistribute it and/or modify it under the terms of the GNU
+ Lesser General Public License as published by the Free Software
+ Foundation; either version 2.1 of the License, or (at your
+ option) any later version. This software is distributed in the
+ hope that it will be useful, but WITHOUT ANY WARRANTY; without
+ even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details. You should have received a copy of the GNU
+ Lesser General Public License along with this software; if not,
+ write to the Free Software Foundation, Inc., 51 Franklin St,
+ Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF site:
+ http://www.fsf.org.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-ui-parent</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <relativePath>../../parent/pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.richfaces.ui.output</groupId>
+ <artifactId>richfaces-ui-output-ui</artifactId>
+ <name>Richfaces UI Components: Output </name>
+ <packaging>jar</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <suppressionsLocation>${project.basedir}/richfaces-suppressions.xml</suppressionsLocation>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.common</groupId>
+ <artifactId>richfaces-ui-common-ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.core</groupId>
+ <artifactId>richfaces-ui-core-ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.output</groupId>
+ <artifactId>richfaces-ui-output-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>xmlunit</groupId>
+ <artifactId>xmlunit</artifactId>
+ <version>1.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/trunk/ui/output/panels/ui</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/trunk/ui/output/panels/ui</developerConnection>
+ <url>http://fisheye.jboss.org/browse/richfaces</url>
+ </scm>
+
+</project>
\ No newline at end of file
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/AbstractDropDownMenu.java
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/AbstractDropDownMenu.java (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/AbstractDropDownMenu.java 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,63 @@
+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.DropDownMenuRendererBase;
+
+@JsfComponent(family = AbstractDropDownMenu.COMPONENT_FAMILY, type = AbstractDropDownMenu.COMPONENT_TYPE,
+ renderer=@JsfRenderer(type = DropDownMenuRendererBase.RENDERER_TYPE),
+ tag = @Tag(name="dropDownMenu"),
+ attributes = {"events-props.xml", "core-props.xml", "i18n-props.xml"})
+public abstract class AbstractDropDownMenu extends UIComponentBase
+ implements MenuComponent {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.DropDownMenu";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.DropDownMenu";
+
+ @Attribute
+ public abstract String getShowEvent();
+
+ @Attribute
+ public abstract String getMode();
+
+ @Attribute
+ public abstract boolean isDisabled();
+
+ @Attribute(defaultValue = "800")
+ public abstract int getHideDelay();
+
+ @Attribute(defaultValue = "800")
+ public abstract int getShowDelay();
+
+ @Attribute(events = @EventName("groupshow"))
+ public abstract String getOngroupshow();
+
+ @Attribute(events = @EventName("grouphide"))
+ public abstract String getOngrouphide();
+
+ @Attribute(events = @EventName("show"))
+ public abstract String getOnshow();
+
+ @Attribute(events = @EventName("hide"))
+ public abstract String getOnhide();
+
+ public enum Facets {
+ LABEL("label"), LABEL_DISABLED("labelDisabled");
+
+ private String facetName;
+ private Facets(String name) {
+ this.facetName = name;
+ }
+
+ @Override
+ public String toString() {
+ return facetName;
+ }
+ }
+}
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/AbstractMenuGroup.java
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/AbstractMenuGroup.java (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/AbstractMenuGroup.java 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,66 @@
+package org.richfaces.component;
+
+import javax.faces.component.UIOutput;
+
+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.MenuGroupRendererBase;
+
+@JsfComponent(family = AbstractDropDownMenu.COMPONENT_FAMILY, type = AbstractMenuGroup.COMPONENT_TYPE,
+ renderer=@JsfRenderer(type = MenuGroupRendererBase.RENDERER_TYPE),
+ tag = @Tag(name="menuGroup"),
+ attributes = {"events-props.xml", "core-props.xml", "i18n-props.xml"})
+public abstract class AbstractMenuGroup extends UIOutput {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.MenuGroup";
+
+ @Attribute
+ public abstract boolean isDisabled();
+
+ @Attribute
+ public abstract String getIcon();
+
+ @Attribute
+ public abstract String getIconDisabled();
+
+ @Attribute
+ public abstract String getIconFolder();
+
+ @Attribute
+ public abstract String getIconFolderDisabled();
+
+ @Attribute
+ public abstract String getStyleClass();
+
+ @Attribute
+ public abstract String getStyle();
+
+ @Attribute(defaultValue = "0")
+ public abstract int getVerticalOffset();
+
+ @Attribute(defaultValue = "0")
+ public abstract int getHorizontalOffset();
+
+ @Attribute(events = @EventName("show"))
+ public abstract String getOnshow();
+
+ @Attribute(events = @EventName("hide"))
+ public abstract String getOnhide();
+
+ public enum Facets {
+ ICON("icon"), ICON_DISABLED("iconDisabled");
+
+ private String facetName;
+ private Facets(String name) {
+ this.facetName = name;
+ }
+
+ @Override
+ public String toString() {
+ return facetName;
+ }
+ }
+}
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/AbstractMenuItem.java
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/AbstractMenuItem.java (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/AbstractMenuItem.java 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,55 @@
+package org.richfaces.component;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.renderkit.html.MenuItemRendererBase;
+
+@JsfComponent(
+ family = AbstractDropDownMenu.COMPONENT_FAMILY,
+ type = AbstractMenuItem.COMPONENT_TYPE,
+ renderer=@JsfRenderer(type = MenuItemRendererBase.RENDERER_TYPE),
+ tag = @Tag(name="menuItem"),
+ attributes = {"events-props.xml", "core-props.xml", "i18n-props.xml"})
+public abstract class AbstractMenuItem extends AbstractActionComponent
+ implements MenuComponent {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.MenuItem";
+
+ @Attribute
+ public abstract String getMode();
+
+ @Attribute
+ public abstract Object getLabel();
+
+ @Attribute
+ public abstract String getIcon();
+
+ @Attribute
+ public abstract String getIconDisabled();
+
+ @Attribute
+ public abstract boolean isDisabled();
+
+ @Attribute
+ public abstract String getStyleClass();
+
+ @Attribute
+ public abstract String getStyle();
+
+ public enum Facets {
+ ICON("icon"), ICON_DISABLED("iconDisabled");
+
+ private String facetName;
+ private Facets(String name) {
+ this.facetName = name;
+ }
+
+ @Override
+ public String toString() {
+ return facetName;
+ }
+ }
+
+}
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/AbstractMenuSeparator.java
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/AbstractMenuSeparator.java (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/AbstractMenuSeparator.java 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,15 @@
+package org.richfaces.component;
+
+import javax.faces.component.UIComponentBase;
+
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.renderkit.html.MenuSeparatorRendererBase;
+
+@JsfComponent(family = AbstractDropDownMenu.COMPONENT_FAMILY, type = AbstractMenuSeparator.COMPONENT_TYPE,
+ renderer=@JsfRenderer(type = MenuSeparatorRendererBase.RENDERER_TYPE), tag = @Tag(name="menuSeparator"))
+public abstract class AbstractMenuSeparator extends UIComponentBase {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.MenuSeparator";
+}
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/MenuComponent.java
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/MenuComponent.java (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/MenuComponent.java 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,44 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.component;
+
+
+/**
+ * Interface which main menu must implements in order to menu components could works correctly.
+ * @author F. Antonov
+ *
+ */
+public interface MenuComponent {
+
+ /**
+ * Possible values for submit mode property.
+ */
+ public static final String MODE_AJAX = "ajax";
+ public static final String MODE_SERVER = "server";
+ public static final String MODE_CLIENT = "client";
+
+ /**
+ * Getter for submit mode property.
+ */
+ public String getMode();
+ public void setMode(String mode);
+}
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/package-info.java
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/package-info.java (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/component/package-info.java 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,23 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+(a)org.richfaces.cdk.annotations.TagLibrary(uri="http://richfaces.org/dropDownMenu", shortName="dropDownMenu")
+package org.richfaces.component;
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,101 @@
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.AbstractDropDownMenu;
+import org.richfaces.component.AbstractMenuGroup;
+import org.richfaces.component.AbstractMenuItem;
+import org.richfaces.component.AbstractMenuSeparator;
+import org.richfaces.renderkit.RenderKitUtils;
+import org.richfaces.renderkit.RenderKitUtils.ScriptHashVariableWrapper;
+import org.richfaces.renderkit.RendererBase;
+
+@ResourceDependencies({
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "jquery.position.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(name = "richfaces-event.js"),
+ @ResourceDependency(library = "org.richfaces", name = "popup.js"),
+ @ResourceDependency(library = "org.richfaces", name = "dropdownmenu.ecss", target="head"),
+ @ResourceDependency(library = "org.richfaces", name = "menu.js"),
+ @ResourceDependency(library = "org.richfaces", name = "popupList.js")})
+public abstract class DropDownMenuRendererBase extends RendererBase {
+
+ public static final String RENDERER_TYPE = "org.richfaces.DropDownMenuRenderer";
+
+ @Override
+ public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException {
+ AbstractDropDownMenu dropDownMenu = (AbstractDropDownMenu) component;
+
+ for (UIComponent child : dropDownMenu.getChildren()) {
+ if (child.isRendered() && (
+ child instanceof AbstractMenuGroup ||
+ child instanceof AbstractMenuItem ||
+ child instanceof AbstractMenuSeparator)) {
+
+ child.encodeAll(facesContext);
+ }
+ }
+ }
+
+ protected boolean isDisabled(UIComponent component) {
+ if (component instanceof AbstractDropDownMenu) {
+ return ((AbstractDropDownMenu) component).isDisabled();
+ }
+ return false;
+ }
+
+ protected UIComponent getLabelFacet(UIComponent component) {
+ UIComponent facet = null;
+ AbstractDropDownMenu ddmenu = (AbstractDropDownMenu) component;
+ if (ddmenu != null) {
+
+ if (ddmenu.isDisabled()) {
+ facet = ddmenu.getFacet(AbstractDropDownMenu.Facets.LABEL_DISABLED.toString());
+ } else {
+ facet = ddmenu.getFacet(AbstractDropDownMenu.Facets.LABEL.toString());
+ }
+ }
+ return facet;
+ }
+
+ public List<Map<String, Object>> getMenuGroups(FacesContext facesContext, UIComponent component) {
+ List<Map<String, Object>> results = new ArrayList<Map<String, Object>>();
+ List<AbstractMenuGroup> groups = new ArrayList<AbstractMenuGroup>();
+ getMenuGroups(component, groups);
+ for (AbstractMenuGroup group : groups) {
+ if (group.isRendered() && !group.isDisabled()) {
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("id", group.getClientId());
+ map.put("horizontalOffset", group.getHorizontalOffset());
+ map.put("verticalOffset", group.getVerticalOffset());
+ RenderKitUtils.addToScriptHash(map, "onhide", group.getOnhide(), null, ScriptHashVariableWrapper.eventHandler);
+ RenderKitUtils.addToScriptHash(map, "onshow", group.getOnshow(), null, ScriptHashVariableWrapper.eventHandler);
+ results.add(map);
+ }
+ }
+ return results;
+ }
+
+ private void getMenuGroups(UIComponent component, List<AbstractMenuGroup> list) {
+ if (component != null && list != null) {
+ for (UIComponent c : component.getChildren()) {
+ if (c instanceof AbstractMenuGroup) {
+ list.add((AbstractMenuGroup) c);
+ }
+ getMenuGroups(c, list);
+ }
+ }
+ }
+}
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/MenuGroupRendererBase.java 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,89 @@
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.AbstractDropDownMenu;
+import org.richfaces.component.AbstractMenuGroup;
+import org.richfaces.renderkit.RendererBase;
+
+public abstract class MenuGroupRendererBase extends RendererBase {
+
+ public static final String RENDERER_TYPE = "org.richfaces.MenuGroupRenderer";
+
+ @Override
+ public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException {
+
+ }
+
+ protected boolean isDisabled(UIComponent component) {
+ if (component instanceof AbstractMenuGroup) {
+ return ((AbstractMenuGroup) component).isDisabled();
+ }
+ return false;
+ }
+
+ @Override
+ public void renderChildren(FacesContext facesContext, UIComponent component) throws IOException {
+ AbstractMenuGroup menuGroup = (AbstractMenuGroup) component;
+
+ for (UIComponent child : menuGroup.getChildren()) {
+ if (child.isRendered()) {
+ child.encodeAll(facesContext);
+ }
+ }
+ }
+
+ protected UIComponent getIconFacet(UIComponent component) {
+ UIComponent facet = null;
+ AbstractMenuGroup menuGroup = (AbstractMenuGroup) component;
+ if (menuGroup != null) {
+
+ if (menuGroup.isDisabled()) {
+ facet = menuGroup.getFacet(AbstractMenuGroup.Facets.ICON_DISABLED.toString());
+ } else {
+ facet = menuGroup.getFacet(AbstractMenuGroup.Facets.ICON.toString());
+ }
+ }
+ return facet;
+ }
+
+ protected String getIconAttribute(UIComponent component) {
+ String icon = null;
+ AbstractMenuGroup menuGroup = (AbstractMenuGroup) component;
+ if (menuGroup != null) {
+
+ if (menuGroup.isDisabled()) {
+ icon = menuGroup.getIconDisabled();
+ } else {
+ icon = menuGroup.getIcon();
+ }
+ }
+ return icon;
+ }
+
+ protected String getStyleClass(UIComponent component, String styleDDMenu, String styleMenuGroup) {
+ UIComponent ddMenu = getDDMenu(component);
+ String styleClass = "";
+ if (ddMenu != null) {
+ if (ddMenu.getAttributes().get(styleDDMenu) != null) {
+ styleClass = ddMenu.getAttributes().get(styleDDMenu).toString();
+ }
+ }
+
+ return concatClasses(styleClass, component.getAttributes().get(styleMenuGroup));
+ }
+
+ protected UIComponent getDDMenu(UIComponent component) {
+ UIComponent parent = component.getParent();
+ while (parent != null) {
+ if (parent instanceof AbstractDropDownMenu) {
+ return parent;
+ }
+ parent = parent.getParent();
+ }
+ return null;
+ }
+}
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/MenuItemRendererBase.java 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,130 @@
+package org.richfaces.renderkit.html;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.AbstractDropDownMenu;
+import org.richfaces.component.AbstractMenuGroup;
+import org.richfaces.component.AbstractMenuItem;
+import org.richfaces.component.MenuComponent;
+import org.richfaces.renderkit.AjaxCommandRendererBase;
+
+public class MenuItemRendererBase extends AjaxCommandRendererBase {
+
+ public static final String RENDERER_TYPE = "org.richfaces.MenuItemRenderer";
+
+ protected boolean isDisabled(UIComponent component) {
+ if (component instanceof AbstractMenuItem) {
+ return ((AbstractMenuItem) component).isDisabled();
+ }
+ return false;
+ }
+
+ protected UIComponent getIconFacet(UIComponent component) {
+ UIComponent facet = null;
+ AbstractMenuItem menuItem = (AbstractMenuItem) component;
+ if (menuItem != null) {
+
+ if (menuItem.isDisabled()) {
+ facet = menuItem.getFacet(AbstractMenuItem.Facets.ICON_DISABLED.toString());
+ } else {
+ facet = menuItem.getFacet(AbstractMenuItem.Facets.ICON.toString());
+ }
+ }
+ return facet;
+ }
+
+ protected String getIconAttribute(UIComponent component) {
+ String icon = null;
+ AbstractMenuItem menuItem = (AbstractMenuItem) component;
+ if (menuItem != null) {
+
+ if (menuItem.isDisabled()) {
+ icon = menuItem.getIconDisabled();
+ } else {
+ icon = menuItem.getIcon();
+ }
+ }
+ return icon;
+ }
+
+ @Override
+ public void doDecode(FacesContext context, UIComponent component) {
+ AbstractMenuItem menuItem = (AbstractMenuItem) component;
+
+ if (menuItem != null) {
+ String mode = resolveSubmitMode(menuItem);
+ if (!MenuComponent.MODE_CLIENT.equalsIgnoreCase(mode)) {
+ super.doDecode(context, component);
+ }
+ }
+ }
+
+ protected String getOnClickFunction(UIComponent component) {
+ AbstractMenuItem menuItem = (AbstractMenuItem) component;
+ String subminMode = resolveSubmitMode(menuItem);
+ if (subminMode == null || MenuComponent.MODE_SERVER.equalsIgnoreCase(subminMode)) {
+ return "submit()";
+ } else if (MenuComponent.MODE_AJAX.equalsIgnoreCase(subminMode)) {
+ return getOnClick(FacesContext.getCurrentInstance(), menuItem);
+ } else if (menuItem.isDisabled()) {
+ return "";
+ } else if (MenuComponent.MODE_CLIENT.equalsIgnoreCase(subminMode)) {
+ return "";
+ }
+
+ return "";
+ }
+
+ protected String resolveSubmitMode(AbstractMenuItem menuItem) {
+ String submitMode = menuItem.getMode();
+ if (null != submitMode) {
+ return submitMode;
+ }
+ UIComponent parent = menuItem.getParent();
+ while (null != parent) {
+ if (parent instanceof MenuComponent) {
+ return ((MenuComponent) parent).getMode();
+ }
+ parent = parent.getParent();
+ }
+
+ return MenuComponent.MODE_SERVER;
+ }
+
+ protected String getStyleClass(UIComponent component, String ddMenuStyle, String menuGroupStyle, String menuItemStyle) {
+ UIComponent ddMenu = getDDMenu(component);
+ UIComponent menuGroup = getMenuGroup(component);
+ Object styleClass = null;
+ if (ddMenu != null && ddMenuStyle != null && ddMenuStyle.length() > 0) {
+ styleClass = ddMenu.getAttributes().get(ddMenuStyle);
+ }
+ if (menuGroup != null && menuGroupStyle != null && menuGroupStyle.length() > 0) {
+ styleClass = concatClasses(styleClass, menuGroup.getAttributes().get(menuGroupStyle));
+ }
+
+ return concatClasses(styleClass, component.getAttributes().get(menuItemStyle));
+ }
+
+ protected UIComponent getDDMenu(UIComponent component) {
+ UIComponent parent = component.getParent();
+ while (parent != null) {
+ if (parent instanceof AbstractDropDownMenu) {
+ return parent;
+ }
+ parent = parent.getParent();
+ }
+ return null;
+ }
+
+ protected UIComponent getMenuGroup(UIComponent component) {
+ UIComponent parent = component.getParent();
+ while (parent != null) {
+ if (parent instanceof AbstractMenuGroup) {
+ return parent;
+ }
+ parent = parent.getParent();
+ }
+ return null;
+ }
+}
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/MenuSeparatorRendererBase.java
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/MenuSeparatorRendererBase.java (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/MenuSeparatorRendererBase.java 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,10 @@
+package org.richfaces.renderkit.html;
+
+import org.richfaces.renderkit.RendererBase;
+
+
+public class MenuSeparatorRendererBase extends RendererBase {
+
+ public static final String RENDERER_TYPE = "org.richfaces.MenuSeparatorRenderer";
+
+}
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/images/MenuNodeImage.java
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/images/MenuNodeImage.java (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/java/org/richfaces/renderkit/html/images/MenuNodeImage.java 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,129 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+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.DynamicUserResource;
+import org.richfaces.resource.ImageType;
+import org.richfaces.resource.Java2DUserResource;
+import org.richfaces.resource.PostConstructResource;
+import org.richfaces.resource.StateHolderResource;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+
+@DynamicUserResource
+public class MenuNodeImage implements Java2DUserResource, StateHolderResource {
+
+ private static final Dimension DIMENSIONS = new Dimension(7, 14);
+
+ private Integer disabledColor;
+ private Integer generalColor;
+
+ public Integer getDisabledColor() {
+ return disabledColor;
+ }
+
+ public void setDisabledColor(Integer disabledColor) {
+ this.disabledColor = disabledColor;
+ }
+
+ public Integer getGeneralColor() {
+ return generalColor;
+ }
+
+ public void setGeneralColor(Integer generalColor) {
+ this.generalColor = generalColor;
+ }
+
+ public boolean isTransient() {
+ return false;
+ }
+
+ public void writeState(FacesContext context, DataOutput dataOutput) throws IOException {
+ dataOutput.writeInt(disabledColor);
+ dataOutput.writeInt(generalColor);
+ }
+ public void readState(FacesContext context, DataInput dataInput) throws IOException {
+ this.disabledColor = dataInput.readInt();
+ this.generalColor = dataInput.readInt();
+ }
+ public Map<String, String> getResponseHeaders() {
+ return null;
+ }
+ public Date getLastModified() {
+ return null;
+ }
+ public ImageType getImageType() {
+ return ImageType.GIF;
+ }
+ public Dimension getDimension() {
+ return DIMENSIONS;
+ }
+ public void paint(Graphics2D g2d) {
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+
+ g2d.setColor(new Color(getGeneralColor().intValue()));
+ drawTriangle(g2d, 2, 0);
+
+ g2d.setColor(new Color(getDisabledColor().intValue()));
+ drawTriangle(g2d, 2, DIMENSIONS.height / 2);
+ }
+
+ private void drawTriangle(Graphics2D g2d, int startPosX, int startPosY) {
+ int dTriangle = 6;
+ for (int i = 0; i < 4; i++) {
+ g2d.drawLine(startPosX + i, startPosY + i, startPosX + i, startPosY + dTriangle - i);
+ }
+ }
+
+ @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 = "generalTextColor";
+ String tmp = (String) skin.getParameter(context, skinParameter);
+ if (null == tmp || "".equals(tmp)) {
+ tmp = (String) defaultSkin.getParameter(context, skinParameter);
+ }
+
+ this.setGeneralColor(Color.decode(tmp == null ? "#4A75B5" : tmp).getRGB());
+
+ skinParameter = "tabDisabledTextColor";
+ tmp = (String) skin.getParameter(context, skinParameter);
+ if (null == tmp || "".equals(tmp)) {
+ tmp = (String) defaultSkin.getParameter(context, skinParameter);
+ }
+ this.setDisabledColor(Color.decode(tmp == null ? "#6A92CF" : tmp).getRGB());
+ }
+}
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/dropdownmenu.ecss
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/dropdownmenu.ecss (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/dropdownmenu.ecss 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,107 @@
+.rf-ddm-lbl, .rf-ddm-lbl-dis {
+ font-family:Arial, Verdana, sans-serif;
+ font-size:11px;
+ position:relative;
+}
+.rf-ddm-lbl-unsel {
+ border:0 solid transparent;
+ padding:3px 6px;
+}
+.rf-ddm-lbl, .rf-ddm-lbl-dis {
+ height:auto;
+ padding:2px 5px;
+ white-space:nowrap;
+ width:auto;
+}
+.rf-ddm-pos{
+ top:20px;
+ left:0;
+ position:absolute;
+}
+.rf-ddm-lbl-dec {
+ font-weight:bold;
+}
+.rf-ddm-lst {
+ border:1px solid; /*#bfbfc0*/ /*panelBorderColor*/
+ border-color: '#{richSkin.panelBorderColor}';
+ background-color: '#{richSkin.additionalBackgroundColor}'; /*#e7f2fb;/ /*additionalBackgroundColor*/
+ min-width:250px;
+ position:absolute;
+}
+.rf-ddm-sublst {
+ position:absolute;
+ top:-8px;
+ left:13px;
+}
+.rf-ddm-lst-bg {
+ border: 1px solid; /* #e7f2fb;*/ /*additionalBackgroundColor*/
+ border-color: '#{richSkin.additionalBackgroundColor}';
+ background-repeat: repeat-y;
+ background-position: left;
+ background-image: "url(#{resource['org.richfaces.images:menu_list_bg.gif']})"; /*from additionalBackgroundColor (left) to tabBackgroundColor (right)*/
+}
+
+.rf-ddm-itm {
+ padding : 1px 35px 1px 1px;
+ white-space : nowrap;
+ font-family : '#{richSkin.generalFamilyFont}'; /*verdana;*/ /*generalFamilyFont*/
+ font-size : '#{richSkin.generalSizeFont}'; /*12px;*/ /*generalSizeFont*/
+ position : relative;
+}
+.rf-ddm-itm-unsel {
+ border : 1px solid transparent;
+ padding : 1px 36px 2px 2px;
+}
+.rf-ddm-itm-sel {
+ border : 1px solid; /* #4a70ab;*/ /*headerBackgroundColor*/
+ border-color: '#{richSkin.headerBackgroundColor}';
+ cursor : pointer;
+ padding : 1px 36px 2px 2px;
+ background-color: '#{richSkin.tabBackgroundColor}';
+ background-repeat: repeat-x;
+ background-position: top;
+ background-image: "url(#{resource['org.richfaces.images:menu_item_bg.gif']})";
+ z-index:10;
+}
+.rf-ddm-itm-dis {
+ border : 1px solid transparent;
+ cursor : default;
+ color : '#{richSkin.tabDisabledTextColor}'; /*#839eca;*/ /*tabDisabledTextColor*/
+}
+.rf-ddm-itm-ic {
+ display:inline-block;
+ margin: 0 10px 0 0;
+ vertical-align:middle;
+}
+.rf-ddm-itm-lbl {
+ color : '#{richSkin.generalTextColor}'; /*#000000;*/ /*generalTextColor*/
+ display:inline-block;
+ text-decoration : none;
+ z-index:2;
+}
+.rf-ddm-sep {
+ font-size : 0px;
+ border-top: 1px solid; /* #bfbfc0;*/ /*panelBorderColor*/
+ border-top-color: '#{richSkin.panelBorderColor}';
+ margin : 2px 0px 2px 24px;
+}
+.rf-ddm-nd {
+ background-image: "url(#{resource['org.richfaces.renderkit.html.images.MenuNodeImage']})";
+ background-repeat: no-repeat;
+ background-position: top;
+ font-size: 1px;
+ width: 7px;
+ height: 7px;
+ top: 7px;
+ right: 6px;
+ position : absolute;
+}
+.rf-ddm-itm-dis .rf-ddm-nd {
+ background-position : bottom;
+}
+
+.rf-ddm-emptyIcon {
+ width: 16px;
+ height: 16px;
+ line-height: 16px;
+}
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/menu.js 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,214 @@
+(function($, rf) {
+ rf.ui = rf.ui || {};
+ var defaultPopupListOptions = {
+ showEvent: 'mouseover',
+ attachToBody: false,
+ positionOffset: [0, 0],
+ selectItemCss: "rf-ddm-itm-sel",
+ listCss: "rf-ddm-lst"
+ };
+ var defaultOptions = {
+ mode: 'server',
+ attachToBody: false,
+ positionOffset: [0, 0],
+ showDelay: 50,
+ hideDelay: 800,
+ verticalOffset: 10,
+ horisantalOffset: 10,
+ showEvent: 'mouseover',
+ direction: "AA",
+ jointPoint: "AA",
+ itemCss: "rf-ddm-itm",
+ selectItemCss: "rf-ddm-itm-sel",
+ unselectItemCss: "rf-ddm-itm-unsel",
+ disabledItemCss: "rf-ddm-itm-dis",
+ listCss: "rf-ddm-lst"
+
+ };
+
+ //constructor definition
+ rf.ui.Menu = function(componentId, options) {
+ this.id = componentId;
+ $super.constructor.call(this, componentId);
+ this.id = componentId;
+ this.groupList = new Array();
+ this.options = {};
+ $.extend(this.options, defaultOptions, options || {});
+ this.attachToDom(componentId);
+
+ //bindEventHandlers.call(this);
+ this.element = rf.getDomElement(this.id);
+
+ this.selectItemCss = this.options.selectItemCss;
+ this.unselectItemCss = this.options.unselectItemCss;
+
+ //menu items list
+ //this.target = 'dd_menu_id_label_container';
+ //popup for item menu list
+ var base = rf.getDomElement(this.id);
+ this.popup = $(rf.getDomElement(this.id + "_list"));
+ //this.initiatePopup(this.popup, base, this.options.showEvent);
+ //this.initiateMenu(this.popup, base, this.options.showEvent);
+ this.options.attachTo = this.id;
+ this.popupList = new RichFaces.ui.PopupList(this.id + "_list", this, this.options);
+ this.selectedGroup = null;
+ rf.Event.bindById(this.id, this.options.showEvent, $.proxy(this.showPopup, this), this);
+ rf.Event.bindById(this.id, 'mouseenter', $.proxy(this.__enterHandler, this), this);
+ rf.Event.bindById(this.id, "mouseleave", $.proxy(this.__leaveHandler, this), this);
+ rf.Event.bindById(this.id, "mouseover", $.proxy(this.__overHandler, this), this);
+ rf.Event.bindById(this.id, "blur", $.proxy(this.__blurHandler, this), this);
+ rf.Event.bindById(this.id, "focus", $.proxy(this.__focusHandler, this), this);
+ //this.popupList.show();
+ };
+
+ rf.BaseComponent.extend(rf.ui.Menu);
+
+ // define super class link
+ var $super = rf.ui.Menu.$super;
+ $.extend(rf.ui.Menu.prototype, (function() {
+ return {
+ name: "Menu",
+ initiateGroups: function(groupOptions) {
+
+ for (var i in groupOptions) {
+ var groupId = groupOptions[i].id;
+ var horizontalOffset = groupOptions[i].horizontalOffset;
+ var verticalOffset = groupOptions[i].verticalOffset;
+
+ var eventType = "mouseover";
+
+ if (null != groupId) {
+ var options = defaultPopupListOptions;
+ options.attachTo = groupId;
+ var base = rf.getDomElement(groupId);
+ //var popup=$("#"+groupId+" .rf-ddm-sublst:first");
+ var menu = this;
+ var popup = new RichFaces.ui.Popup(groupId + '_list', options);
+ this.groupList[groupId] = popup;
+
+ rf.Event.bindById(groupId, "mouseenter",
+ function(event) {
+ var id = event.target.id;
+ if (menu.groupList[id]) {
+ menu.invokeEvent("groupshow", rf.getDomElement(menu.id), null);
+ menu.invokeEvent("show", rf.getDomElement(id), null);
+ menu.groupList[id].popup.show();
+ }
+ },
+ this);
+ rf.Event.bindById(groupId, "mouseleave",
+ function(event) {
+ var id = event.target.id;
+ if (menu.groupList[id]) {
+ //this.invokeEvent("grouphide", rf.getDomElement(menu.id), null);
+ menu.invokeEvent("hide", rf.getDomElement(id), null);
+ menu.groupList[id].popup.hide();
+ }
+ });
+ }
+ }
+ },
+
+ submitForm: function(item) {
+ var form = this.__getParentForm(item);
+ if (this.options.mode == "server") {
+ console.info('server submit ' + item.attr('id'));
+ //rf.submitForm(form, {selectedMenuItem: item.id});
+ }
+ if (this.options.mode == "ajax") {
+ console.info('ajax submit');
+ //rf.ajax(item.id);
+ }
+ },
+
+ processItem: function(item) {
+ if (item && !this.isDisabled(item) && item.attr('id').search('group') == -1) {
+ this.hidePopup();
+ this.submitForm(item);
+ }
+ },
+
+ selectItem: function(item) {
+ if(item.attr('id') && !this.isDisabled(item)){
+ item.addClass(this.selectItemCss);
+ if(item.attr('id').search('group') != -1){
+ this.selectedGroup=item.attr('id');
+ } else {
+ this.selectedGroup = null;
+ }
+ }
+ },
+ unselectItem: function(item) {
+ var nextItem = this.popupList.nextSelectItem();
+ if (item.attr('id') && (nextItem.attr('id') != this.selectedGroup) && !this.isWithin(nextItem) ){
+ item.removeClass(this.selectItemCss);
+ item.addClass(this.unselectItemCss);
+ }
+
+ },
+ isDisabled: function(item){
+ return item.hasClass(this.options.disabledItemCss);
+ },
+ isWithin: function(item){
+ if (this.selectedGroup && item.parents().is('#'+this.selectedGroup)){
+ return true;
+ } else {
+ return false;
+ }
+ },
+
+ showPopup: function() {
+ this.invokeEvent("show", rf.getDomElement(this.id), null);
+ this.popupList.show();
+ },
+
+ hidePopup: function() {
+ for (var i in this.groupList) {
+ this.groupList[i].popup.hide();
+ }
+ this.invokeEvent("hide", rf.getDomElement(this.id), null);
+ this.popupList.hide();
+ },
+ ___showHandler: function() {
+ this.showTimeoutId = window.setTimeout($.proxy(function(){
+ this.showPopup();
+ }, this), this.options.showDelay)
+ },
+ __getParentForm: function(item) {
+ return item.parents("form")[0];
+ },
+ __enterHandler: function(e) {
+ // this.showPopup();
+ },
+ __leaveHandler: function(e) {
+ this.hideTimeoutId = window.setTimeout($.proxy(function(){
+ this.hidePopup();
+ }, this), this.options.hideDelay);
+ },
+ __overHandler: function(e) {
+ window.clearTimeout(this.hideTimeoutId);
+ },
+ __clickHandler: function(e) {
+ //this.showPopup();
+ },
+ __blurHandler: function(event) {
+// this.timeoutId = window.setTimeout($.proxy(function(){
+// this.onblur();
+// this.hidePopup();
+// }, this), this.hidePopup);
+
+ },
+ __focusHandler: function(event) {
+ //window.clearTimeout(this.timeoutId);
+
+ },
+ destroy: function() {
+ // clean up code here
+
+ // call parent's destroy method
+ $super.destroy.call(this);
+ }
+
+ };
+ })());
+})(jQuery, RichFaces)
\ No newline at end of file
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,220 @@
+(function($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.PopupList = function(id, listener, options) {
+ var mergedOptions = $.extend({},
+ defaultOptions, options);
+ $super.constructor.call(this, id, mergedOptions);
+ this.selectListener = listener;
+ this.selectItemCss = mergedOptions.selectItemCss;
+ this.scrollContainer = $(mergedOptions.scrollContainer);
+ this.itemCss = mergedOptions.itemCss;
+ this.listCss = mergedOptions.listCss;
+ this.index = -1;
+ this.id = id;
+
+ this.__updateItemsList();
+
+ //for (var i in this.items){
+ // rf.Event.bindById(this.items[i].id, "mouseenter", $.proxy(this.__onMouseOver, this), this );
+ // rf.Event.bindById(this.items[i].id, "click", $.proxy(this.__onClick, this), this );
+ //}
+ rf.Event.bindById(this.id, "mouseover", $.proxy(this.__onMouseOver, this), this );
+ rf.Event.bindById(this.id, "click", $.proxy(this.__onClick, this), this );
+
+ //this.popup.bind("mouseover", $.proxy(this.__onMouseOver, this));
+ //this.popup.bind("click", $.proxy(this.__onClick, this));
+
+
+ };
+
+ rf.ui.Popup.extend(rf.ui.PopupList);
+ var $super = rf.ui.PopupList.$super;
+
+ var defaultOptions = {
+ attachToBody: true,
+ positionType: "DROPDOWN",
+ positionOffset: [0, 20],
+ positionTo: "AA",
+ potiosionFrom: "AA"
+ };
+
+ $.extend(rf.ui.PopupList.prototype, (function() {
+
+ return {
+
+ name: "popupList",
+
+ processItem: function(item) {
+ if (this.selectListener.processItem && typeof this.selectListener.processItem == 'function') {
+ this.selectListener.processItem(item);
+ }
+ },
+
+ selectItem: function(item) {
+ if (this.selectListener.selectItem && typeof this.selectListener.selectItem == 'function') {
+ this.selectListener.selectItem(item);
+ } else {
+ item.addClass(this.selectItemCss);
+ }
+ this.__scrollToSelectedItem(this);
+ },
+
+ unselectItem: function(item) {
+ if (this.selectListener.unselectItem && typeof this.selectListener.unselectItem == 'function') {
+ this.selectListener.unselectItem(item);
+ } else {
+ item.removeClass(this.selectItemCss);
+ }
+ },
+
+ nextSelectItem: function() {
+ var item = this.items.eq(this.nextSelectItemIndex);
+ if (item){
+ return item;
+ }
+
+ },
+
+ currentSelectItem: function() {
+ if (this.items && this.index != -1) {
+ return this.items[this.index];
+ }
+ },
+
+ getSelectedItemIndex: function() {
+ return this.index;
+ },
+
+ getItemByIndex: function(i) {
+ if (i >= 0 && i <= this.items.length) {
+ return this.items[i];
+ }
+ },
+
+ resetItemsSelection: function() {
+ if (this.items) {
+ var popup = this;
+ this.items.each(function(i, item) {
+ popup.unselectItem($(item));
+ });
+ }
+ },
+
+ isPopupList: function(target) {
+ var parentId = target.parents("." + this.listCss).attr("id");
+ return (parentId && (parentId == this.getId()));
+ },
+
+ __updateItemsList: function() {
+ return (this.items = this.popup.find("." + this.itemCss));
+ },
+
+ __select: function(item) {
+ var index = this.items.index(item);
+ this.__selectByIndex(index);
+ },
+
+ __selectByIndex: function(index, isOffset) {
+ if (this.items.length == 0 || (!isOffset && this.index == index)) return;
+
+ var item;
+
+ if (this.index != -1) {
+ item = this.items.eq(this.index);
+ this.nextSelectItemIndex=index;
+ this.unselectItem(item);
+ }
+
+ if (index == undefined) {
+ this.index = -1;
+ return;
+ }
+
+ if (isOffset) {
+ this.index += index;
+ if (this.index < 0) {
+ this.index = this.items.length - 1;
+ } else if (this.index >= this.items.length) {
+ this.index = 0;
+ }
+ } else {
+ if (index < 0) {
+ index = 0;
+ } else if (index >= this.items.length) {
+ index = this.items.length - 1;
+ }
+ this.index = index;
+ }
+
+ item = this.items.eq(this.index);
+
+ this.selectItem(item);
+ },
+
+ __selectCurrent: function() {
+ var item;
+ if (this.items && this.index >= 0) {
+ item = this.items.eq(this.index);
+ this.processItem(item);
+ }
+ },
+
+ __selectPrev: function() {
+ this.__selectByIndex( - 1, true);
+ },
+
+ __selectNext: function() {
+ this.__selectByIndex(1, true);
+ },
+
+ __onMouseOver: function(e) {
+ var item = this.__getItem(e);
+ if (item) {
+ this.__select(item);
+ }
+ },
+
+ __onClick: function(e) {
+ console.info("e.target: "+$(e.target).attr('id')+"; e.currentTarget:"+$(e.currentTarget).attr('id'));
+ var item = this.__getItem(e);
+ //this.processItem($(item));
+ //this.__select(item);
+ },
+
+ __getItem: function(e) {
+ return $(e.target).closest("." + this.itemCss, e.currentTarget).get(0);
+ },
+
+ __getItems: function() {
+ return this.items;
+ },
+
+ __setItems: function(items) {
+ this.items = items;
+ },
+
+ __scrollToSelectedItem: function() {
+ if (this.scrollContainer && this.scrollContainer.lenght < 1) {
+ var offset = 0;
+
+ this.items.slice(0, this.index).each(function() {
+ offset += this.offsetHeight;
+ });
+
+ var parentContainer = this.scrollContainer;
+ if (offset < parentContainer.scrollTop()) {
+ parentContainer.scrollTop(offset);
+ } else {
+ offset += this.items.get(this.index).offsetHeight;
+ if (offset - parentContainer.scrollTop() > parentContainer.get(0).clientHeight) {
+ parentContainer.scrollTop(offset - parentContainer.innerHeight());
+ }
+ }
+ }
+ }
+ }
+ })());
+
+})(jQuery, window.RichFaces);
\ No newline at end of file
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/resources/META-INF/richfaces/resource-mappings.properties 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,5 @@
+org.richfaces.images\:menu_list_bg.gif=org.richfaces.renderkit.html.BaseGradient\
+ {width=22, height=3, baseColorParam=additionalBackgroundColor, gradientColorParam=tabBackgroundColor, horizontal=true}
+org.richfaces.images\:menu_item_bg.gif=org.richfaces.renderkit.html.BaseGradient\
+ {width=3, height=16, baseColorParam=additionalBackgroundColor, gradientColorParam=tabBackgroundColor}
+
\ No newline at end of file
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/dropdownmenu.template.xml
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/dropdownmenu.template.xml (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/dropdownmenu.template.xml 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,59 @@
+<?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.DropDownMenuRenderer</cdk:class>
+ <cdk:superclass>org.richfaces.renderkit.html.DropDownMenuRendererBase</cdk:superclass>
+ <cdk:component-family>org.richfaces.DropDownMenu</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.DropDownMenuRenderer</cdk:renderer-type>
+ <cdk:renders-children>true</cdk:renders-children>
+ </cc:interface>
+
+ <cc:implementation>
+ <cdk:object name="style" value="#{component.attributes['style']}" />
+ <cdk:object name="styleClass" value="#{not empty component.attributes['styleClass'] ? component.attributes['styleClass']:''}" />
+
+ <cdk:object name="label" value="#{getLabelFacet(component)}" type="javax.faces.component.UIComponent" />
+ <cdk:object name="isDisabled" type="boolean" value="#{isDisabled(component)}" />
+
+ <div id="#{clientId}" class="rf-ddm-lbl #{isDisabled ? 'rf-ddm-lbl-dis' : 'rf-ddm-lbl-unsel '+styleClass} " style="#{style}"
+ cdk:passThroughWithExclusions="">
+ <div class="#{isDisabled ? 'rf-ddm-lbl-dis' : 'rf-ddm-lbl-dec'}">
+
+ <c:choose>
+ <c:when test="#{label != null and label.isRendered()}">
+ <cdk:call expression="label.encodeAll(facesContext)" />
+ </c:when>
+ <c:when test="#{not empty component.attributes['label']}">
+ #{component.attributes['label']}
+ </c:when>
+ <c:otherwise>
+
+ </c:otherwise>
+ </c:choose>
+
+ </div>
+ <div class="rf-ddm-pos">
+ <div id="#{clientId}_list" class="rf-ddm-lst" style="display:none;">
+ <div class="rf-ddm-lst-bg">
+ <cdk:body />
+ </div>
+ </div>
+ </div>
+ <script type="text/javascript">
+ <cdk:scriptObject name="options">
+ <cdk:scriptOption attributes="hideDelay showDelay" />
+ <cdk:scriptOption attributes="onshow onhide ongroupshow ongrouphide" wrapper="eventHandler"/>
+ </cdk:scriptObject>
+
+ new RichFaces.ui.Menu("#{clientId}",#{toScriptArgs(options)}).initiateGroups(#{toScriptArgs(getMenuGroups(facesContext, component))});
+ </script>
+ </div>
+ </cc:implementation>
+
+</cdk:root>
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/menugroup.template.xml
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/menugroup.template.xml (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/menugroup.template.xml 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,73 @@
+<?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.MenuGroupRenderer</cdk:class>
+ <cdk:superclass>org.richfaces.renderkit.html.MenuGroupRendererBase</cdk:superclass>
+ <cdk:component-family>org.richfaces.DropDownMenu</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.MenuGroupRenderer</cdk:renderer-type>
+ <cdk:renders-children>true</cdk:renders-children>
+ </cc:interface>
+
+ <cc:implementation>
+ <cdk:object name="style" value="#{component.attributes['style']}" />
+ <cdk:object name="iconClass" value="#{component.attributes['iconClass']}" />
+ <cdk:object name="labelClass" value="#{component.attributes['labelClass']}" />
+ <cdk:object name="styleClass" type="java.lang.String" value="#{getStyleClass(component, 'groupClass', 'styleClass')}" />
+ <cdk:object name="selectedClass" type="java.lang.String" value="#{getStyleClass(component, 'selectedGroupClass', 'selectedClass')}" />
+ <cdk:object name="disabledClass" type="java.lang.String" value="#{getStyleClass(component, 'disabledGroupClass', 'disabledClass')}" />
+
+ <cdk:object name="isDisabled" type="boolean" value="#{isDisabled(component)}" />
+ <cdk:object name="iconFacet" value="#{getIconFacet(component)}" type="javax.faces.component.UIComponent" />
+ <cdk:object name="iconAttribute" value="#{getIconAttribute(component)}" type="java.lang.String" />
+
+ <cdk:object name="onmouseover" type="java.lang.String" value="this.className='rf-ddm-itm rf-ddm-itm-sel #{selectedClass}'" />
+ <cdk:object name="onmouseout" type="java.lang.String" value="this.className='rf-ddm-itm rf-ddm-itm-unsel'" />
+
+ <div id="#{clientId}_group" class="rf-ddm-itm #{isDisabled ? 'rf-ddm-itm-dis '+disabledClass : 'rf-ddm-itm-unsel '+styleClass}" style="#{style}"
+ onmouseover="#{isDisabled ? '' : onmouseover}"
+ onmouseout="#{isDisabled ? '' : onmouseout}"
+ cdk:passThroughWithExclusions="" >
+ <span class="rf-ddm-itm-ic #{iconClass}">
+ <c:choose>
+ <c:when test="iconFacet != null and iconFacet.isRendered()">
+ <cdk:call expression="iconFacet.encodeAll(facesContext)" />
+ </c:when>
+ <c:when test="#{not empty iconAttribute}">
+ <img width="16" height="16" src="#{iconAttribute}" alt="" />
+ </c:when>
+ <c:otherwise>
+ <div class="rf-ddm-emptyIcon"></div>
+ </c:otherwise>
+ </c:choose>
+ </span>
+
+ <c:choose>
+ <c:when test="#{not isDisabled}">
+ <span class="rf-ddm-itm-lbl #{labelClass}">#{component.attributes['label']}</span>
+ </c:when>
+ <c:otherwise>
+ #{component.attributes['label']}
+ </c:otherwise>
+ </c:choose>
+
+ <div class="rf-ddm-nd">
+ <c:choose>
+ <c:when test="#{not isDisabled}">
+ <div class="rf-ddm-lst rf-ddm-sublst" style="display:none;">
+ <div class="rf-ddm-lst-bg">
+ <cdk:call expression="renderChildren(facesContext, component)" />
+ </div>
+ </div>
+ </c:when>
+ </c:choose>
+ </div>
+ </div>
+ </cc:implementation>
+
+</cdk:root>
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/menuitem.template.xml
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/menuitem.template.xml (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/menuitem.template.xml 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,78 @@
+<?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.MenuItemRenderer</cdk:class>
+ <cdk:superclass>org.richfaces.renderkit.html.MenuItemRendererBase</cdk:superclass>
+ <cdk:component-family>org.richfaces.DropDownMenu</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.MenuItemRenderer</cdk:renderer-type>
+ <cdk:renders-children>true</cdk:renders-children>
+ </cc:interface>
+
+ <cc:implementation>
+ <cdk:object name="style" value="#{component.attributes['style']}" />
+ <cdk:object name="iconClass" type="java.lang.String" value="#{getStyleClass(component, '', 'iconClass', 'iconClass')}" />
+ <cdk:object name="labelClass" type="java.lang.String" value="#{getStyleClass(component, '', 'labelClass', 'labelClass')}" />
+ <cdk:object name="styleClass" type="java.lang.String" value="#{getStyleClass(component, 'itemClass', 'styleClass', 'styleClass')}" />
+ <cdk:object name="selectedClass" type="java.lang.String" value="#{getStyleClass(component, 'selectedItemClass', 'selectedClass', 'selectedClass')}" />
+ <cdk:object name="disabledClass" type="java.lang.String" value="#{getStyleClass(component, 'disabledItemClass', 'disabledClass', 'disabledClass')}" />
+
+ <cdk:object name="isDisabled" type="boolean" value="#{isDisabled(component)}" />
+ <cdk:object name="onmouseover" type="java.lang.String" value="this.className='rf-ddm-itm rf-ddm-itm-sel #{selectedClass}'" />
+ <cdk:object name="onmouseout" type="java.lang.String" value="this.className='rf-ddm-itm rf-ddm-itm-unsel #{styleClass}'" />
+
+ <cdk:object name="iconFacet" value="#{getIconFacet(component)}" type="javax.faces.component.UIComponent" />
+ <cdk:object name="iconAttribute" value="#{getIconAttribute(component)}" type="java.lang.String" />
+
+ <div id="#{clientId}" class="rf-ddm-itm #{isDisabled ? 'rf-ddm-itm-dis '+disabledClass : 'rf-ddm-itm-unsel '+styleClass}" style="#{style}"
+ onmouseover="#{isDisabled ? '' : onmouseover}"
+ onmouseout="#{isDisabled ? '' : onmouseout}"
+ onclick="#{getOnClickFunction(component)}"
+ cdk:passThroughWithExclusions="">
+ <span class="rf-ddm-itm-ic #{iconClass}">
+ <c:choose>
+ <c:when test="#{iconFacet != null and iconFacet.isRendered()}">
+ <cdk:call expression="iconFacet.encodeAll(facesContext)" />
+ </c:when>
+ <c:when test="#{not empty iconAttribute}">
+ <img width="16" height="16" src="#{iconAttribute}" alt="" />
+ </c:when>
+ <c:otherwise>
+ <div class="rf-ddm-emptyIcon"></div>
+ </c:otherwise>
+ </c:choose>
+ </span>
+
+ <c:choose>
+ <c:when test="#{not isDisabled}">
+ <span class="rf-ddm-itm-lbl #{labelClass}">
+ <c:choose>
+ <c:when test="#{not empty component.attributes['label']}">
+ #{component.attributes['label']}
+ </c:when>
+ <c:otherwise>
+ <cdk:call expression="renderChildren(facesContext, component);" />
+ </c:otherwise>
+ </c:choose>
+ </span>
+ </c:when>
+ <c:otherwise>
+ <c:choose>
+ <c:when test="#{not empty component.attributes['label']}">
+ #{component.attributes['label']}
+ </c:when>
+ <c:otherwise>
+ <cdk:call expression="renderChildren(facesContext, component);" />
+ </c:otherwise>
+ </c:choose>
+ </c:otherwise>
+ </c:choose>
+
+ </div>
+ </cc:implementation>
+</cdk:root>
Added: sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/menuseparator.template.xml
===================================================================
--- sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/menuseparator.template.xml (rev 0)
+++ sandbox/trunk/ui/dropdown-menu/ui/src/main/templates/menuseparator.template.xml 2010-12-02 09:59:09 UTC (rev 20287)
@@ -0,0 +1,21 @@
+<?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.MenuSeparatorRenderer</cdk:class>
+ <cdk:superclass>org.richfaces.renderkit.html.MenuSeparatorRendererBase</cdk:superclass>
+ <cdk:component-family>org.richfaces.DropDownMenu</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.MenuSeparatorRenderer</cdk:renderer-type>
+ <cdk:renders-children>true</cdk:renders-children>
+ </cc:interface>
+
+ <cc:implementation>
+ <div class="rf-ddm-sep"></div>
+ </cc:implementation>
+
+</cdk:root>
14 years
JBoss Rich Faces SVN: r20286 - sandbox/trunk/examples/dnd-demo/src/main/webapp/examples.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-02 04:28:43 -0500 (Thu, 02 Dec 2010)
New Revision: 20286
Modified:
sandbox/trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml
Log:
Modified: sandbox/trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml
===================================================================
--- sandbox/trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml 2010-12-02 09:27:06 UTC (rev 20285)
+++ sandbox/trunk/examples/dnd-demo/src/main/webapp/examples/dnd.xhtml 2010-12-02 09:28:43 UTC (rev 20286)
@@ -28,22 +28,22 @@
}
.rf-ind {
- height: 50px;
- width: 50px;
+ height: 20px;
+ width: 20px;
border: 1px dotted red;
background-color: blue
}
-.rf-ind-acp {
- height: 50px;
- width: 50px;
+.rf-ind-acpt {
+ height: 20px;
+ width: 20px;
border: 1px dotted red;
background-color: green;
}
-.rf-ind-rej {
- height: 50px;
- width: 50px;
+.rf-ind-rejt {
+ height: 20px;
+ width: 20px;
border: 1px dotted green;
background-color: red;
}
@@ -51,13 +51,15 @@
</h:head>
<h:body>
<h:form>
- <dnd:dragIndicator id="ind" styleClass="rf-ind" acceptClass="rf-ind-acp" rejectClass="rf-ind-rej" />
+
+ <dnd:dragIndicator id="ind" styleClass="rf-ind" acceptClass="rf-ind-acpt" rejectClass="rf-ind-rejt" />
<table>
<tr>
+
<td><a4j:outputPanel id="drg1" layout="block" styleClass="draggable">
<h:outputText value="#{dataBean.dragValue1}"/>
- <dnd:dragBehavior event="mouseover" type="drg1" dragIndicator="ind" dragValue="#{dataBean.dragValue1}"/>
+ <dnd:dragBehavior event="mouseover" type="drg1" dragValue="#{dataBean.dragValue1}"/>
</a4j:outputPanel></td>
<td><a4j:outputPanel id="drg2" layout="block" styleClass="draggable">
<h:outputText value="#{dataBean.dragValue2}"/>
14 years
JBoss Rich Faces SVN: r20285 - trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-12-02 04:27:06 -0500 (Thu, 02 Dec 2010)
New Revision: 20285
Modified:
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolBar.ecss
Log:
remove def height
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolBar.ecss
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolBar.ecss 2010-12-02 06:43:02 UTC (rev 20284)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/toolBar.ecss 2010-12-02 09:27:06 UTC (rev 20285)
@@ -11,7 +11,6 @@
background-repeat:repeat-x;
/*check gradient from headerGradientColor to headerBackgroundColor*/
background-image:url("#{resource['org.richfaces.renderkit.html.GradientA']}");
- height:36px;
width:100%;
}
14 years
JBoss Rich Faces SVN: r20284 - in modules/docs/trunk/Component_Reference: src/main/docbook/en-US and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: SeanRogers
Date: 2010-12-02 01:43:02 -0500 (Thu, 02 Dec 2010)
New Revision: 20284
Added:
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/extras/exam-Component_Reference-richtoolbar-Basic_usage.xml_sample
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/figu-Component_Reference-richtoolbar-disc.png
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/figu-Component_Reference-richtoolbar-grid.png
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/figu-Component_Reference-richtoolbar-line.png
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/figu-Component_Reference-richtoolbar-richtoolbar.png
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/figu-Component_Reference-richtoolbar-square.png
Modified:
modules/docs/trunk/Component_Reference/Component_Reference_chapters.txt
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/Component_Reference.xml
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Menus_and_toolbars.xml
modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Rich_inputs.xml
Log:
rich:toolbar draft
Modified: modules/docs/trunk/Component_Reference/Component_Reference_chapters.txt
===================================================================
--- modules/docs/trunk/Component_Reference/Component_Reference_chapters.txt 2010-12-02 00:50:34 UTC (rev 20283)
+++ modules/docs/trunk/Component_Reference/Component_Reference_chapters.txt 2010-12-02 06:43:02 UTC (rev 20284)
@@ -77,8 +77,8 @@
-- rich:dataTable
-- rich:extendedDataTable
-- rich:list
--x Table filtering
--x Table sorting
+-- Table filtering
+-- Table sorting
x chap-Component_Reference-Trees
xx rich:changeExpandListener
Modified: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/Component_Reference.xml
===================================================================
--- modules/docs/trunk/Component_Reference/src/main/docbook/en-US/Component_Reference.xml 2010-12-02 00:50:34 UTC (rev 20283)
+++ modules/docs/trunk/Component_Reference/src/main/docbook/en-US/Component_Reference.xml 2010-12-02 06:43:02 UTC (rev 20284)
@@ -9,25 +9,25 @@
<xi:include href="chap-Component_Reference-Introduction.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Component_Reference-Common_Ajax_attributes.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Component_Reference-Common_features.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <part id="part-Component_Reference-a4j_tag_library">
- <title>a4j tag library</title>
+ <part id="part-Component_Reference-Ajax_control_components">
+ <title>Ajax control components</title>
<xi:include href="chap-Component_Reference-Actions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Component_Reference-Resources.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Component_Reference-Containers.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Component_Reference-Validation.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Component_Reference-Processing_management.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</part>
- <part id="part-Component_Reference-rich_tag_library">
- <title>rich tag library</title>
+ <part id="part-Component_Reference-User_interface_components">
+ <title>User interface components</title>
<xi:include href="chap-Component_Reference-Rich_inputs.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Component_Reference-Panels_and_containers.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="chap-Component_Reference-Tables_and_grids.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<!--
<xi:include href="chap-Component_Reference-Trees.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ -->
<xi:include href="chap-Component_Reference-Menus_and_toolbars.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- -->
- <xi:include href="chap-Component_Reference-Output_and_messages.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <!--
+ <xi:include href="chap-Component_Reference-Output_and_messages.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <!--
<xi:include href="chap-Component_Reference-Drag_and_drop.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-->
<xi:include href="chap-Component_Reference-Layout_and_appearance.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
Modified: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Menus_and_toolbars.xml
===================================================================
--- modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Menus_and_toolbars.xml 2010-12-02 00:50:34 UTC (rev 20283)
+++ modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Menus_and_toolbars.xml 2010-12-02 06:43:02 UTC (rev 20284)
@@ -3,44 +3,77 @@
]>
<chapter id="chap-Component_Reference-Menus_and_toolbars">
<title>Menus and toolbars</title>
+ <!-- In development notification -->
+ <important>
+ <title>Documentation in development</title>
+ <para>
+ Some concepts covered in this chapter may refer to the previous version of <productname>Richfaces</productname>, version 3.3.3. This chapter is scheduled for review to ensure all information is up to date.
+ </para>
+ </important>
<para>
- Incomplete
+ Read this chapter for details on menu and toolbar components.
</para>
+
+ <!-- TODO not in M5 -->
+ <!--<rich:contextMenu>-->
+ <!--
<section id="sect-Component_Reference-Menus_and_toolbars-richcontextMenu">
<title><sgmltag><rich:contextMenu></sgmltag></title>
<para>
Incomplete
</para>
</section>
+ -->
+ <!--<rich:dropDownMenu>-->
+ <!--
<section id="sect-Component_Reference-Menus_and_toolbars-richdropDownMenu">
<title><sgmltag><rich:dropDownMenu></sgmltag></title>
<para>
Incomplete
</para>
</section>
+ -->
+
+ <!--
+ <section id="sect-Component_Reference-Menus_and_toolbars-Menu_sub-components">
+ <title>Menu sub-components</title>
+ -->
- <section id="sect-Component_Reference-Menus_and_toolbars-richmenuGroup">
- <title><sgmltag><rich:menuGroup></sgmltag></title>
- <para>
- Incomplete
- </para>
- </section>
+ <!--<rich:menuGroup>-->
+ <!--
+ <section id="sect-Component_Reference-Menus_and_toolbars-richmenuGroup">
+ <title><sgmltag><rich:menuGroup></sgmltag></title>
+ <para>
+ Incomplete
+ </para>
+ </section>
+ -->
- <section id="sect-Component_Reference-Menus_and_toolbars-richmenuItem">
- <title><sgmltag><rich:menuItem></sgmltag></title>
- <para>
- Incomplete
- </para>
+ <!--<rich:menuItem>-->
+ <!--
+ <section id="sect-Component_Reference-Menus_and_toolbars-richmenuItem">
+ <title><sgmltag><rich:menuItem></sgmltag></title>
+ <para>
+ Incomplete
+ </para>
+ </section>
+ -->
+ <!--<rich:menuSeparator>-->
+ <!--
+ <section id="sect-Component_Reference-Menus_and_toolbars-richmenuSeparator">
+ <title><sgmltag><rich:menuSeparator></sgmltag></title>
+ <para>
+ Incomplete
+ </para>
+ </section>
+
</section>
-
- <section id="sect-Component_Reference-Menus_and_toolbars-richmenuSeparator">
- <title><sgmltag><rich:menuSeparator></sgmltag></title>
- <para>
- Incomplete
- </para>
- </section>
-
+ -->
+
+ <!-- TODO not in M5 -->
+ <!--<rich:panelMenu>-->
+ <!--
<section id="sect-Component_Reference-Menus_and_toolbars-richpanelMenu">
<title><sgmltag><rich:panelMenu></sgmltag></title>
<itemizedlist>
@@ -99,118 +132,294 @@
</para>
</listitem>
</itemizedlist>
- </section>
+ -->
- <section id="sect-Component_Reference-Menus_and_toolbars-richpanelMenuGroup">
- <title><sgmltag><rich:panelMenuGroup></sgmltag></title>
- <para>
- The <classname><rich:panelMenuGroup></classname> component defines a group of <classname><rich:panelMenuItem></classname> components inside a <classname><rich:panelMenu></classname>.
- </para>
- <para>
- If the <code>expandMode</code> is unspecified, the submission behavior for the group is inherited from the parent <classname><rich:panelMenu></classname>. Otherwise, the <code>expandMode</code> setting is used instead of the parent's behavior.
- </para>
- <para>
- Icons for the menu group can be chosen from a set of standard icons. There are three attributes that relate to the different menu states that the icon represents: <code>iconExpanded</code>, <code>iconCollapsed</code>, and <code>iconDisabled</code>. The standard icons are shown in <xref linkend="figu-Component_Reference-richpanelMenuGroup-Standard_icons" />.
- </para>
- <figure id="figu-Component_Reference-richpanelMenuGroup-Standard_icons">
- <title><sgmltag><Standard icons></sgmltag></title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/figu-Component_Reference-richpanelMenuGroup-Standard_icons.png" format="PNG" />
- </imageobject>
- </mediaobject>
- </figure>
- <para>
- Alternatively, a path can be defined that points to an image file to use as an icon.
- </para>
- <example id="exam-Component_Reference-richpanelMenuGroup-Using_custom_icons">
- <title>Using custom icons</title>
+ <!--<rich:panelMenuGroup>-->
+ <!--
+ <section id="sect-Component_Reference-Menus_and_toolbars-richpanelMenuGroup">
+ <title><sgmltag><rich:panelMenuGroup></sgmltag></title>
+ <para>
+ The <classname><rich:panelMenuGroup></classname> component defines a group of <classname><rich:panelMenuItem></classname> components inside a <classname><rich:panelMenu></classname>.
+ </para>
+ <para>
+ If the <code>expandMode</code> is unspecified, the submission behavior for the group is inherited from the parent <classname><rich:panelMenu></classname>. Otherwise, the <code>expandMode</code> setting is used instead of the parent's behavior.
+ </para>
+ <para>
+ Icons for the menu group can be chosen from a set of standard icons. There are three attributes that relate to the different menu states that the icon represents: <code>iconExpanded</code>, <code>iconCollapsed</code>, and <code>iconDisabled</code>. The standard icons are shown in <xref linkend="figu-Component_Reference-richpanelMenuGroup-Standard_icons" />.
+ </para>
+ <figure id="figu-Component_Reference-richpanelMenuGroup-Standard_icons">
+ <title><sgmltag><Standard icons></sgmltag></title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Component_Reference-richpanelMenuGroup-Standard_icons.png" format="PNG" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ Alternatively, a path can be defined that points to an image file to use as an icon.
+ </para>
+ <example id="exam-Component_Reference-richpanelMenuGroup-Using_custom_icons">
+ <title>Using custom icons</title>
<programlisting language="XML" role="XML">
<rich:panelMenu>
<rich:PanelMenuGroup label="Group 1" iconExpanded="\images\img1.png" iconCollapsed="\images\img2.png">>
- <!--Nested menu components-->
+ <!- -Nested menu components- ->
</rich:panelMenuGroup>
</rich:panelMenu>
</programlisting>
- </example>
- </section>
-
- <section id="sect-Component_Reference-Menus_and_toolbars-richpanelMenuItem">
- <title><sgmltag><rich:panelMenuItem></sgmltag></title>
- <itemizedlist>
- <listitem>
- <para>
- <parameter>component-type</parameter>: <classname>org.richfaces.PanelMenuItem</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- <parameter>component-class</parameter>: <classname>org.richfaces.component.html.HtmlPanelMenuItem</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- <parameter>component-family</parameter>: <classname>org.richfaces.PanelMenuItem</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- <parameter>renderer-type</parameter>: <classname>org.richfaces.PanelMenuItemRenderer</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- <parameter>tag-class</parameter>: <classname>org.richfaces.taglib.PanelMenuItemTag</classname>
- </para>
- </listitem>
- </itemizedlist>
- <para>
- The <classname><rich:panelMenuItem></classname> component represents a single item inside a <classname><rich:panelMenuGroup></classname> component, which is in turn part of a <classname><rich:panelMenu></classname> component.
- </para>
- <para>
- If the <code>mode</code> is unspecified, the submission behavior for the item is inherited from the parent <classname><rich:panelMenu></classname>. Otherwise, the <code>mode</code> setting is used instead of the parent's behavior.
- </para>
- <para>
- Icons for menu items can be chosen from a set of standard icons. There are two attributes that relate to the different menu states that the icon represents: <code>icon</code> and <code>iconDisabled</code>. The standard icons are shown in <xref linkend="figu-Component_Reference-Basic_column_example-Basic_column_example" />.
- </para>
- <figure id="figu-Component_Reference-richpanelMenuItem-Standard_icons">
- <title>Standard icons</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/figu-Component_Reference-richpanelMenuItem-Standard_icons.png" format="PNG" />
- </imageobject>
- </mediaobject>
- </figure>
- <para>
- Alternatively, a path can be defined that points to an image file to use as an icon.
- </para>
- <example id="exam-Component_Reference-richpanelMenuItem-Using_custom_icons">
- <title>Using custom icons</title>
+ </example>
+ </section>
+ -->
+
+ <!--<rich:panelMenuItem>-->
+ <!--
+ <section id="sect-Component_Reference-Menus_and_toolbars-richpanelMenuItem">
+ <title><sgmltag><rich:panelMenuItem></sgmltag></title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <parameter>component-type</parameter>: <classname>org.richfaces.PanelMenuItem</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>component-class</parameter>: <classname>org.richfaces.component.html.HtmlPanelMenuItem</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>component-family</parameter>: <classname>org.richfaces.PanelMenuItem</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>renderer-type</parameter>: <classname>org.richfaces.PanelMenuItemRenderer</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>tag-class</parameter>: <classname>org.richfaces.taglib.PanelMenuItemTag</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ The <classname><rich:panelMenuItem></classname> component represents a single item inside a <classname><rich:panelMenuGroup></classname> component, which is in turn part of a <classname><rich:panelMenu></classname> component.
+ </para>
+ <para>
+ If the <code>mode</code> is unspecified, the submission behavior for the item is inherited from the parent <classname><rich:panelMenu></classname>. Otherwise, the <code>mode</code> setting is used instead of the parent's behavior.
+ </para>
+ <para>
+ Icons for menu items can be chosen from a set of standard icons. There are two attributes that relate to the different menu states that the icon represents: <code>icon</code> and <code>iconDisabled</code>. The standard icons are shown in <xref linkend="figu-Component_Reference-Basic_column_example-Basic_column_example" />.
+ </para>
+ <figure id="figu-Component_Reference-richpanelMenuItem-Standard_icons">
+ <title>Standard icons</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Component_Reference-richpanelMenuItem-Standard_icons.png" format="PNG" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+ <para>
+ Alternatively, a path can be defined that points to an image file to use as an icon.
+ </para>
+ <example id="exam-Component_Reference-richpanelMenuItem-Using_custom_icons">
+ <title>Using custom icons</title>
<programlisting language="XML" role="XML">
<rich:panelMenu>
...
- <rich:panelMenuItem value="Item 1.1" icon="\images\img1.png" iconDisabled="\images\img2.png" />
+ <rich:panelMenuItem value="Item 1.1" icon="\images\img1.png" iconDisabled="\images\img2.png" />
...
</rich:panelMenu>
</programlisting>
- </example>
+ </example>
+ </section>
+
</section>
+ -->
- <section id="sect-Component_Reference-Menus_and_toolbars-richtoolBar">
- <title><sgmltag><rich:toolBar></sgmltag></title>
+ <!--<rich:toolBar>-->
+ <section id="sect-Component_Reference-Menus_and_toolbars-richtoolbar">
+ <title><sgmltag><rich:toolbar></sgmltag></title>
<para>
- Incomplete
+ The <sgmltag><rich:toolbar></sgmltag> component is a horizontal toolbar. Any JavaServer Faces (<acronym>JSF</acronym>) component can be added to the toolbar.
</para>
+ <figure id="figu-Component_Reference-richtoolbar-richtoolbar">
+ <title><sgmltag><rich:toolbar></sgmltag></title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Component_Reference-richtoolbar-richtoolbar.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ <para>
+ A <sgmltag><rich:toolbar></sgmltag> component with a label, hyperlinks, item separators, and a text box.
+ </para>
+ </textobject>
+ </mediaobject>
+ </figure>
+
+ <section id="sect-Component_Reference-richtoolbar-Basic_usage">
+ <title>Basic usage</title>
+ <para>
+ The <sgmltag><rich:toolbar></sgmltag> component does not require any attributes to be defined for basic usage. Add child components to the <sgmltag><rich:toolbar></sgmltag> component to have them appear on the toolbar when rendered.
+ </para>
+ <example id="exam-Component_Reference-richtoolbar-Basic_usage">
+ <title>Basic usage</title>
+ <programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Component_Reference-richtoolbar-Basic_usage.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+ </example>
+ </section>
+
+ <section id="sect-Component_Reference-richtoolbar-Appearance">
+ <title>Appearance</title>
+ <para>
+ Set the width and height of the toolbar using the common <varname>width</varname> and <varname>height</varname> attributes.
+ </para>
+ <para>
+ Items on the toolbar can be separated by a graphical item separator. Use the <varname>itemSeparator</varname> attribute to specify one of the standard separator styles:
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <literal>none</literal>, the default appearance, does not show any item separators.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>disc</literal> shows a small circular disc to separate items:
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Component_Reference-richtoolbar-disc.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ A small circular disc to separate items.
+ </textobject>
+ </inlinemediaobject>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>grid</literal> shows a grid pattern to separate items:
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Component_Reference-richtoolbar-grid.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ A grid pattern to separate items.
+ </textobject>
+ </inlinemediaobject>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>line</literal> shows a vertical line to separate items:
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Component_Reference-richtoolbar-line.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ A vertical line to separate items.
+ </textobject>
+ </inlinemediaobject>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>square</literal> shows a small square to separate items:
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="images/figu-Component_Reference-richtoolbar-square.png" format="PNG" />
+ </imageobject>
+ <textobject>
+ A small square to separate items.
+ </textobject>
+ </inlinemediaobject>
+ </para>
+ </listitem>
+ </itemizedlist>
+ <para>
+ Alternatively, use the <varname>itemSeparator</varname> attribute to specify a URL to an image. The image is then used as an item separator. The appearance of the item separator can be additionally customized by using the <literal>itemSeparator</literal> facet.
+ </para>
+ </section>
+
+ <section id="sect-Component_Reference-richtoolbar-Grouping_items">
+ <title>Grouping items</title>
+ <para>
+ Group together multiple items on the toolbar by using the <sgmltag><rich:toolbarGroup></sgmltag> child component. Refer to <xref linkend="sect-Component_Reference-Menus_and_toolbars-richtoolbarGroup" /> for full details on the <sgmltag><rich:toolbarGroup></sgmltag> component.
+ </para>
+ </section>
+
+ <section id="sect-Component_Reference-richtoolbar-Reference_data">
+ <title>Reference data</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <parameter>component-type</parameter>: <classname>org.richfaces.Toolbar</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>component-class</parameter>: <classname>org.richfaces.component.html.HtmlToolbar</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>component-family</parameter>: <classname>org.richfaces.Toolbar</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>renderer-type</parameter>: <classname>org.richfaces.ToolbarRenderer</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>tag-class</parameter>: <classname>org.richfaces.taglib.ToolbarTag</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </section>
+
+ <!--<rich:toolbarGroup>-->
+ <section id="sect-Component_Reference-Menus_and_toolbars-richtoolbarGroup">
+ <title><sgmltag><rich:toolbarGroup></sgmltag></title>
+ <para>
+ The <sgmltag><rich:toolbarGroup></sgmltag> component is a child component of the <sgmltag><rich:toolbar></sgmltag> component. The <sgmltag><rich:toolbarGroup></sgmltag> component is used to group a number of items together on a toolbar.
+ </para>
+
+ <section id="sect-Component_Reference-richtoolbarGroup-Reference_data">
+ <title>Reference data</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <parameter>component-type</parameter>: <classname>org.richfaces.ToolbarGroup</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>component-class</parameter>: <classname>org.richfaces.component.html.HtmlToolbarGroup</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>component-family</parameter>: <classname>org.richfaces.ToolbarGroup</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>renderer-type</parameter>: <classname>org.richfaces.ToolbarGroupRenderer</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>tag-class</parameter>: <classname>org.richfaces.taglib.ToolbarGroupTag</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </section>
+ </section>
+
</section>
-
- <section id="sect-Component_Reference-Menus_and_toolbars-richtoolBarGroup">
- <title><sgmltag><rich:toolBarGroup></sgmltag></title>
- <para>
- Incomplete
- </para>
- </section>
</chapter>
Modified: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Rich_inputs.xml
===================================================================
--- modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Rich_inputs.xml 2010-12-02 00:50:34 UTC (rev 20283)
+++ modules/docs/trunk/Component_Reference/src/main/docbook/en-US/chap-Component_Reference-Rich_inputs.xml 2010-12-02 06:43:02 UTC (rev 20284)
@@ -141,58 +141,59 @@
</listitem>
</itemizedlist>
</section>
- </section>
-
- <!-- TODO not in M4 -->
- <!--<rich:autocompleteBehavior>-->
- <!--
- <section id="sect-Component_Reference-Rich_inputs-richautocompleteBehavior">
- <title><sgmltag><rich:autocompleteBehavior></sgmltag></title>
- <para>
- The <sgmltag><rich:autocompleteBehavior></sgmltag> behavior is an auto-completing list of input suggestions that can be attached to other components.
- </para>
- <para>
- Use the <sgmltag><rich:autocomplete></sgmltag> component for a standard auto-completing combo-box control. Refer to <xref linkend="sect-Component_Reference-Rich_inputs-richautocomplete" /> for full details on the <sgmltag><rich:autocomplete></sgmltag> component.
- </para>
- <section id="sect-Component_Reference-richautocompleteBehavior-Basic_usage">
- <title>Basic usage</title>
+ <!-- TODO not in M4 -->
+ <!--<rich:autocompleteBehavior>-->
+ <!--
+ <section id="sect-Component_Reference-Rich_inputs-richautocompleteBehavior">
+ <title><sgmltag><rich:autocompleteBehavior></sgmltag></title>
<para>
- Attach the <sgmltag><rich:autocompleteBehavior></sgmltag> behavior as a sub-element to another component to provide auto-complete suggestions for that component. Suggestions shown in the auto-complete list can be specified using the <varname>autocompleteMethod</varname> attribute, which points to a collection of suggestions. <xref linkend="exam-Component_Reference-richautocompleteBehavior-Defining_suggestion_values" /> demonstrates a <sgmltag><rich:autocompleteBehavior></sgmltag> behavior attached to a standard JSF <sgmltag><h:inputText></sgmltag> component.
+ The <sgmltag><rich:autocompleteBehavior></sgmltag> behavior is an auto-completing list of input suggestions that can be attached to other components.
</para>
- <example id="exam-Component_Reference-richautocompleteBehavior-Defining_suggestion_values">
- <title>Defining suggestion values</title>
- <programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Component_Reference-richautocompleteBehavior-Defining_suggestion_values.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
- </example>
- </section>
+ <para>
+ Use the <sgmltag><rich:autocomplete></sgmltag> component for a standard auto-completing combo-box control. Refer to <xref linkend="sect-Component_Reference-Rich_inputs-richautocomplete" /> for full details on the <sgmltag><rich:autocomplete></sgmltag> component.
+ </para>
- <section id="sect-Component_Reference-richautocompleteBehavior-Reference_data">
- <title>Reference data</title>
- <itemizedlist>
- <listitem>
- <para>
- <parameter>component-type</parameter>: <classname>org.richfaces.autocompleteBehavior</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- <parameter>component-class</parameter>: <classname>org.richfaces.component.html.HtmlAutocompleteBehavior</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- <parameter>component-family</parameter>: <classname>org.richfaces.autocompleteBehavior</classname>
- </para>
- </listitem>
- <listitem>
- <para>
- <parameter>tag-class</parameter>: <classname>org.richfaces.taglib.autocompleteBehaviorTag</classname>
- </para>
- </listitem>
- </itemizedlist>
+ <section id="sect-Component_Reference-richautocompleteBehavior-Basic_usage">
+ <title>Basic usage</title>
+ <para>
+ Attach the <sgmltag><rich:autocompleteBehavior></sgmltag> behavior as a sub-element to another component to provide auto-complete suggestions for that component. Suggestions shown in the auto-complete list can be specified using the <varname>autocompleteMethod</varname> attribute, which points to a collection of suggestions. <xref linkend="exam-Component_Reference-richautocompleteBehavior-Defining_suggestion_values" /> demonstrates a <sgmltag><rich:autocompleteBehavior></sgmltag> behavior attached to a standard JSF <sgmltag><h:inputText></sgmltag> component.
+ </para>
+ <example id="exam-Component_Reference-richautocompleteBehavior-Defining_suggestion_values">
+ <title>Defining suggestion values</title>
+ <programlisting language="XML" role="XML"><xi:include parse="text" href="extras/exam-Component_Reference-richautocompleteBehavior-Defining_suggestion_values.xml_sample" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+ </example>
+ </section>
+
+ <section id="sect-Component_Reference-richautocompleteBehavior-Reference_data">
+ <title>Reference data</title>
+ <itemizedlist>
+ <listitem>
+ <para>
+ <parameter>component-type</parameter>: <classname>org.richfaces.autocompleteBehavior</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>component-class</parameter>: <classname>org.richfaces.component.html.HtmlAutocompleteBehavior</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>component-family</parameter>: <classname>org.richfaces.autocompleteBehavior</classname>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <parameter>tag-class</parameter>: <classname>org.richfaces.taglib.autocompleteBehaviorTag</classname>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </section>
</section>
+ -->
+
</section>
- -->
<!-- <rich:calendar> -->
<section id="sect-Component_Reference-Rich_inputs-richcalendar">
Added: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/extras/exam-Component_Reference-richtoolbar-Basic_usage.xml_sample
===================================================================
--- modules/docs/trunk/Component_Reference/src/main/docbook/en-US/extras/exam-Component_Reference-richtoolbar-Basic_usage.xml_sample (rev 0)
+++ modules/docs/trunk/Component_Reference/src/main/docbook/en-US/extras/exam-Component_Reference-richtoolbar-Basic_usage.xml_sample 2010-12-02 06:43:02 UTC (rev 20284)
@@ -0,0 +1,5 @@
+<rich:toolbar>
+ <h:commandLink value="News" />
+ <h:commandLink value="Reviews" />
+ <h:commandLink value="Galleries" />
+</rich:toolbar>
Added: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/figu-Component_Reference-richtoolbar-disc.png
===================================================================
(Binary files differ)
Property changes on: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/figu-Component_Reference-richtoolbar-disc.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/figu-Component_Reference-richtoolbar-grid.png
===================================================================
(Binary files differ)
Property changes on: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/figu-Component_Reference-richtoolbar-grid.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/figu-Component_Reference-richtoolbar-line.png
===================================================================
(Binary files differ)
Property changes on: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/figu-Component_Reference-richtoolbar-line.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/figu-Component_Reference-richtoolbar-richtoolbar.png
===================================================================
(Binary files differ)
Property changes on: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/figu-Component_Reference-richtoolbar-richtoolbar.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/figu-Component_Reference-richtoolbar-square.png
===================================================================
(Binary files differ)
Property changes on: modules/docs/trunk/Component_Reference/src/main/docbook/en-US/images/figu-Component_Reference-richtoolbar-square.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
14 years
JBoss Rich Faces SVN: r20283 - in branches/RF-8742-1: core/api/src/main/java/org/richfaces/javascript and 20 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-12-01 19:50:34 -0500 (Wed, 01 Dec 2010)
New Revision: 20283
Added:
branches/RF-8742-1/core/api/src/main/java/org/richfaces/javascript/
branches/RF-8742-1/core/api/src/main/java/org/richfaces/javascript/JavaScriptService.java
branches/RF-8742-1/core/impl/src/main/java/org/richfaces/component/UIResource.java
branches/RF-8742-1/core/impl/src/main/java/org/richfaces/component/UIScripts.java
branches/RF-8742-1/core/impl/src/main/java/org/richfaces/component/UITransient.java
branches/RF-8742-1/core/impl/src/main/java/org/richfaces/javascript/
branches/RF-8742-1/core/impl/src/main/java/org/richfaces/javascript/JavaScriptServiceImpl.java
branches/RF-8742-1/core/impl/src/main/java/org/richfaces/renderkit/html/ResourceRenderer.java
branches/RF-8742-1/core/impl/src/main/java/org/richfaces/renderkit/html/ScriptsRenderer.java
branches/RF-8742-1/core/impl/src/test/java/org/richfaces/component/Bean.java
branches/RF-8742-1/core/impl/src/test/java/org/richfaces/component/UIViewResourceTest.java
branches/RF-8742-1/core/impl/src/test/java/org/richfaces/javascript/JavaScriptServiceTest.java
branches/RF-8742-1/core/impl/src/test/resources/org/richfaces/component/
branches/RF-8742-1/core/impl/src/test/resources/org/richfaces/component/faces-config.xml
Removed:
branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/javascript/JavaScriptService.java
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/UIResource.java
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/UIScripts.java
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/UITransient.java
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/javascript/JavaScriptServiceImpl.java
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ScriptsRenderer.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/UIViewResourceTest.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/JavaScriptServiceTest.java
branches/RF-8742-1/ui/validator/ui/src/test/resources/org/richfaces/component/faces-config.xml
Modified:
branches/RF-8742-1/core/impl/src/main/java/org/richfaces/application/DefaultModule.java
branches/RF-8742-1/core/impl/src/main/java/org/richfaces/renderkit/html/ResourceLibraryRenderer.java
branches/RF-8742-1/core/impl/src/main/resources/META-INF/components.faces-config.xml
branches/RF-8742-1/core/impl/src/main/resources/META-INF/resource-library.faces-config.xml
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/application/ValidatorModule.java
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/AjaxOnlyScript.java
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientAndAjaxScript.java
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientOnlyScript.java
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientValidatorRenderer.java
branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/faces-config.xml
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/Bean.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererBuildScriptTest.java
Log:
RESOLVED - issue RF-9612: Create JSF 2.0 resource loading extension to dynamically add scripts and its dependencies.
https://jira.jboss.org/browse/RF-9612
Copied: branches/RF-8742-1/core/api/src/main/java/org/richfaces/javascript/JavaScriptService.java (from rev 20280, branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/javascript/JavaScriptService.java)
===================================================================
--- branches/RF-8742-1/core/api/src/main/java/org/richfaces/javascript/JavaScriptService.java (rev 0)
+++ branches/RF-8742-1/core/api/src/main/java/org/richfaces/javascript/JavaScriptService.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -0,0 +1,56 @@
+/*
+ * $Id$
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.javascript;
+
+import javax.faces.context.FacesContext;
+
+
+/**
+ * <p class="changed_added_4_0">
+ * This service stores JavaScript objects for deffered rendering, as described on
+ * http://community.jboss.org/wiki/RichFacesJavaScripthandling
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public interface JavaScriptService {
+
+ /**
+ * <p class="changed_added_4_0">Adds new script to render at the end of page. Is the same script already set to render ( lookup by equals() method ), no new object added.</p>
+ * @param facesContext TODO
+ * @param script
+ * @return actual object that will be rendered at the end of page.
+ */
+ <S> S addScript(FacesContext facesContext, S script);
+
+ /**
+ * <p class="changed_added_4_0">This method adds script that has to be executed in page.onready event listener, as required by jQuery components.</p>
+ * @param facesContext TODO
+ * @param script
+ * @param <S>
+ * @return
+ */
+ <S> S addPageReadyScript(FacesContext facesContext, S script);
+}
Property changes on: branches/RF-8742-1/core/api/src/main/java/org/richfaces/javascript/JavaScriptService.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/RF-8742-1/core/impl/src/main/java/org/richfaces/application/DefaultModule.java
===================================================================
--- branches/RF-8742-1/core/impl/src/main/java/org/richfaces/application/DefaultModule.java 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/core/impl/src/main/java/org/richfaces/application/DefaultModule.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -5,6 +5,8 @@
import org.richfaces.application.push.PushContextFactory;
import org.richfaces.application.push.impl.jms.PushContextFactoryImpl;
import org.richfaces.cache.Cache;
+import org.richfaces.javascript.JavaScriptService;
+import org.richfaces.javascript.JavaScriptServiceImpl;
import org.richfaces.l10n.BundleLoader;
import org.richfaces.renderkit.AjaxDataSerializer;
import org.richfaces.renderkit.AjaxDataSerializerImpl;
@@ -28,6 +30,8 @@
factory.setInstance(MessageFactory.class, new MessageFactoryImpl(new BundleLoader()));
factory.setInstance(ResourceLibraryFactory.class, new ResourceLibraryFactoryImpl());
factory.setInstance(PushContextFactory.class, ServiceLoader.loadService(PushContextFactory.class, PushContextFactoryImpl.class));
+ factory.setInstance(JavaScriptService.class, new JavaScriptServiceImpl());
+
}
}
Copied: branches/RF-8742-1/core/impl/src/main/java/org/richfaces/component/UIResource.java (from rev 20280, branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/UIResource.java)
===================================================================
--- branches/RF-8742-1/core/impl/src/main/java/org/richfaces/component/UIResource.java (rev 0)
+++ branches/RF-8742-1/core/impl/src/main/java/org/richfaces/component/UIResource.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -0,0 +1,125 @@
+/*
+ * $Id$
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import javax.faces.application.ResourceHandler;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.context.FacesContext;
+import javax.faces.render.Renderer;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class UIResource extends UITransient {
+
+ private final String name;
+ private final String library;
+
+ public UIResource(UIComponent parent,String name, String library) {
+ this.name = name;
+ this.library = library;
+ setParent(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.UITransient#hasAttribute(java.lang.Object)
+ */
+ @Override
+ protected boolean hasAttribute(Object key) {
+ if("name".equals(key)){
+ return null != getName();
+ } else if ("library".equals(key)) {
+ return null != getLibrary();
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.UITransient#setAttribute(java.lang.String, java.lang.Object)
+ */
+ @Override
+ protected Object setAttribute(String key, Object value) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.component.UITransient#getAttribute(java.lang.Object)
+ */
+ @Override
+ protected Object getAttribute(Object key) {
+ if("name".equals(key)){
+ return getName();
+ } else if ("library".equals(key)) {
+ return getLibrary();
+ }
+ return null;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the library
+ */
+ public String getLibrary() {
+ return library;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.UIComponent#getFamily()
+ */
+ @Override
+ public String getFamily() {
+ return UIOutput.COMPONENT_FAMILY;
+ }
+
+ @Override
+ public String getRendererType() {
+ return getRendererType(getFacesContext());
+ }
+
+ public String getRendererType(FacesContext context) {
+ ResourceHandler resourceHandler = context.getApplication().getResourceHandler();
+ return resourceHandler.getRendererTypeForResourceName(getName());
+ }
+
+ @Override
+ protected Renderer getRenderer(FacesContext context) {
+ String rendererType = getRendererType(context);
+ Renderer result = null;
+ if (rendererType != null) {
+ result = context.getRenderKit().getRenderer(getFamily(), rendererType);
+ }
+ return result;
+ }
+}
Property changes on: branches/RF-8742-1/core/impl/src/main/java/org/richfaces/component/UIResource.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: branches/RF-8742-1/core/impl/src/main/java/org/richfaces/component/UIScripts.java (from rev 20280, branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/UIScripts.java)
===================================================================
--- branches/RF-8742-1/core/impl/src/main/java/org/richfaces/component/UIScripts.java (rev 0)
+++ branches/RF-8742-1/core/impl/src/main/java/org/richfaces/component/UIScripts.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -0,0 +1,102 @@
+/*
+ * $Id$
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import java.util.Collection;
+import java.util.List;
+
+import com.google.common.collect.Lists;
+
+/**
+ * <p class="changed_added_4_0">
+ * This component user to render Client Validator scripts. Any ClientValidatorBehavior that requires additional scripts
+ * should put them to this component, associated with "form" target in view resources.
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class UIScripts extends UITransient {
+
+
+ public static final String COMPONENT_TYPE = "org.richfaces.Scripts";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.Script";
+
+ private final List<Object> scripts = Lists.newArrayList();
+
+ private final List<Object> pageReadyScripts = Lists.newArrayList();
+
+ private String target = "form";
+
+ public Collection<Object> getScripts() {
+ return scripts;
+ }
+
+ /**
+ * <p class="changed_added_4_0"></p>
+ * @return the pageReadyScripts
+ */
+ public Collection<Object> getPageReadyScripts() {
+ return this.pageReadyScripts;
+ }
+
+
+ @Override
+ public String getFamily() {
+ return UIScripts.COMPONENT_FAMILY;
+ }
+
+ public void setTarget(String target) {
+ this.target = target;
+ }
+
+ public String getTarget() {
+ return target;
+ }
+
+ @Override
+ protected boolean hasAttribute(Object key) {
+ return "target".equals(key);
+ }
+
+ @Override
+ protected Object setAttribute(String key, Object value) {
+ if ("target".equals(key)) {
+ String oldTarget = getTarget();
+ setTarget((String) value);
+ return oldTarget;
+ }
+ return null;
+ }
+
+ @Override
+ protected Object getAttribute(Object key) {
+ if("target".equals(key)){
+ return getTarget();
+ }
+ return null;
+ }
+
+}
Property changes on: branches/RF-8742-1/core/impl/src/main/java/org/richfaces/component/UIScripts.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: branches/RF-8742-1/core/impl/src/main/java/org/richfaces/component/UITransient.java (from rev 20280, branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/UITransient.java)
===================================================================
--- branches/RF-8742-1/core/impl/src/main/java/org/richfaces/component/UITransient.java (rev 0)
+++ branches/RF-8742-1/core/impl/src/main/java/org/richfaces/component/UITransient.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -0,0 +1,385 @@
+package org.richfaces.component;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UINamingContainer;
+import javax.faces.component.UniqueIdVendor;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+import javax.faces.render.Renderer;
+
+import org.richfaces.renderkit.html.ScriptsRenderer;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterators;
+
+public abstract class UITransient extends UIComponent {
+
+ private String id;
+
+ private UIComponent parent;
+
+ private final Map<String, Object> attributesMap = new AttributesMap();
+
+
+ private String clientId;
+
+ public UITransient() {
+ super();
+ }
+
+
+ public Object saveState(FacesContext context) {
+ // This is transient component
+ return null;
+ }
+
+ public void restoreState(FacesContext context, Object state) {
+ // Do nothing, this component never saved
+
+ }
+
+ public boolean isTransient() {
+ return true;
+ }
+
+ public void setTransient(boolean newTransientValue) {
+
+ }
+
+ @Override
+ public Map<String, Object> getAttributes() {
+ return attributesMap;
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public ValueBinding getValueBinding(String name) {
+ return null;
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void setValueBinding(String name, ValueBinding binding) {
+ // do nothing
+
+ }
+
+ @Override
+ public ValueExpression getValueExpression(String name) {
+ return null;
+ }
+
+ @Override
+ public void setValueExpression(String name, ValueExpression binding) {
+ // do nothing
+ }
+
+ @Override
+ public String getClientId(FacesContext context) {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ // if the clientId is not yet set
+ if (this.clientId == null) {
+ UIComponent namingContainerAncestor = this.getNamingContainer();
+ String parentId = null;
+
+ // give the parent the opportunity to first
+ // grab a unique clientId
+ if (namingContainerAncestor != null) {
+ parentId = namingContainerAncestor.getContainerClientId(context);
+ }
+
+ // now resolve our own client id
+ String clientId = getId();
+ if (clientId == null) {
+ if (null != namingContainerAncestor && namingContainerAncestor instanceof UniqueIdVendor) {
+ clientId = ((UniqueIdVendor) namingContainerAncestor).createUniqueId(context, null);
+ } else {
+ clientId = context.getViewRoot().createUniqueId();
+ }
+ setId(clientId);
+ }
+ if (parentId != null) {
+ StringBuilder idBuilder = new StringBuilder(parentId.length() + 1 + clientId.length());
+ clientId = idBuilder.append(parentId).append(UINamingContainer.getSeparatorChar(context))
+ .append(clientId).toString();
+ }
+
+ // allow the renderer to convert the clientId
+ Renderer renderer = this.getRenderer(context);
+ if (renderer != null) {
+ this.clientId = renderer.convertClientId(context, clientId);
+ } else {
+ this.clientId = clientId;
+ }
+ }
+ return this.clientId;
+ }
+
+ @Override
+ public String getId() {
+ return this.id;
+ }
+
+ @Override
+ public void setId(String id) {
+ this.id = id;
+ this.clientId = null;
+ }
+
+ @Override
+ public UIComponent getParent() {
+ return this.parent;
+ }
+
+ @Override
+ public void setParent(UIComponent parent) {
+ this.parent = parent;
+ }
+
+ @Override
+ public boolean isRendered() {
+ return true;
+ }
+
+ @Override
+ public void setRendered(boolean rendered) {
+ // always rendered
+ }
+
+ @Override
+ public String getRendererType() {
+ return ScriptsRenderer.RENDERER_TYPE;
+ }
+
+ @Override
+ public void setRendererType(String rendererType) {
+ // do nothing
+
+ }
+
+ @Override
+ public boolean getRendersChildren() {
+ return false;
+ }
+
+ @Override
+ public List<UIComponent> getChildren() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public int getChildCount() {
+ return 0;
+ }
+
+ @Override
+ public UIComponent findComponent(String expr) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Map<String, UIComponent> getFacets() {
+ return Collections.emptyMap();
+ }
+
+ @Override
+ public UIComponent getFacet(String name) {
+ return null;
+ }
+
+ @Override
+ public Iterator<UIComponent> getFacetsAndChildren() {
+ return Iterators.emptyIterator();
+ }
+
+ @Override
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ // Do nothing
+ }
+
+ @Override
+ public void decode(FacesContext context) {
+ // Do nothing
+ }
+
+ @Override
+ public void encodeBegin(FacesContext context) throws IOException {
+ Renderer renderer = getRenderer(context);
+ if(null != renderer){
+ renderer.encodeBegin(context, this);
+ }
+ }
+
+ @Override
+ public void encodeChildren(FacesContext context) throws IOException {
+ Renderer renderer = getRenderer(context);
+ if(null != renderer){
+ renderer.encodeChildren(context, this);
+ }
+ }
+
+ @Override
+ public void encodeEnd(FacesContext context) throws IOException {
+ Renderer renderer = getRenderer(context);
+ if(null != renderer){
+ renderer.encodeEnd(context, this);
+ }
+ }
+
+ @Override
+ protected void addFacesListener(FacesListener listener) {
+ }
+
+ @Override
+ protected FacesListener[] getFacesListeners(Class clazz) {
+ return new FacesListener[0];
+ }
+
+ @Override
+ protected void removeFacesListener(FacesListener listener) {
+ }
+
+ @Override
+ public void queueEvent(FacesEvent event) {
+ if (null != getParent()) {
+ getParent().queueEvent(event);
+ }
+
+ }
+
+ @Override
+ public void processRestoreState(FacesContext context, Object state) {
+ // Do nothing, this component does not have state.
+
+ }
+
+ @Override
+ public void processDecodes(FacesContext context) {
+ // Do nothing
+
+ }
+
+ @Override
+ public void processValidators(FacesContext context) {
+ // Do nothing
+
+ }
+
+ @Override
+ public void processUpdates(FacesContext context) {
+ // Do nothing
+ }
+
+ @Override
+ public Object processSaveState(FacesContext context) {
+ // Should never be used
+ return null;
+ }
+
+ @Override
+ protected FacesContext getFacesContext() {
+ return FacesContext.getCurrentInstance();
+ }
+
+ @Override
+ protected Renderer getRenderer(FacesContext context) {
+ String rendererType = getRendererType();
+ Renderer result = null;
+ if (rendererType != null) {
+ result = context.getRenderKit().getRenderer(getFamily(), rendererType);
+ }
+ return result;
+ }
+
+ final class AttributesMap implements Map<String, Object> {
+
+ public void clear() {
+ // do nothing
+
+ }
+
+ public boolean containsKey(Object key) {
+
+ return "target".equals(key)||"id".equals(key)||"clientId".equals(key)||hasAttribute(key);
+ }
+
+ public boolean containsValue(Object value) {
+ return false;
+ }
+
+ public Set<java.util.Map.Entry<String, Object>> entrySet() {
+ return Collections.emptySet();
+ }
+
+ public Object get(Object key) {
+ if ("id".equals(key)) {
+ return getId();
+ } else if ("clientId".equals(key)) {
+ return getClientId();
+ } else {
+ return getAttribute(key);
+ }
+ }
+
+ public boolean isEmpty() {
+ return false;
+ }
+
+ public Set<String> keySet() {
+ return ImmutableSet.of("target","id","clientId");
+ }
+
+ public Object put(String key, Object value) {
+ if ("id".equals(key)) {
+ String id = getId();
+ setId((String) value);
+ return id;
+ } else {
+ return setAttribute(key, value);
+ }
+ }
+
+ public void putAll(Map<? extends String, ? extends Object> m) {
+
+
+ }
+
+ public Object remove(Object key) {
+ return null;
+ }
+
+ public int size() {
+ return 3;
+ }
+
+ public Collection<Object> values() {
+ return ImmutableList.<Object>of(getId(),getClientId());
+ }
+ }
+
+ protected abstract boolean hasAttribute(Object key);
+
+
+ protected abstract Object setAttribute(String key, Object value);
+
+
+ protected abstract Object getAttribute(Object key);
+
+}
\ No newline at end of file
Property changes on: branches/RF-8742-1/core/impl/src/main/java/org/richfaces/component/UITransient.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: branches/RF-8742-1/core/impl/src/main/java/org/richfaces/javascript/JavaScriptServiceImpl.java (from rev 20280, branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/javascript/JavaScriptServiceImpl.java)
===================================================================
--- branches/RF-8742-1/core/impl/src/main/java/org/richfaces/javascript/JavaScriptServiceImpl.java (rev 0)
+++ branches/RF-8742-1/core/impl/src/main/java/org/richfaces/javascript/JavaScriptServiceImpl.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -0,0 +1,115 @@
+/*
+ * $Id$
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.javascript;
+
+import java.util.Collection;
+import java.util.List;
+
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.component.UIScripts;
+
+/**
+ * <p class="changed_added_4_0">
+ * </p>
+ *
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class JavaScriptServiceImpl implements JavaScriptService {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.javascript.JavaScriptService#addScript(org.ajax4jsf.javascript.ScriptString)
+ */
+ public <S> S addScript(FacesContext facesContext, S script) {
+ UIScripts scriptResource = getOrCreateScriptResource(facesContext);
+
+ return addOrFind(scriptResource.getScripts(), script);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.richfaces.javascript.JavaScriptService#addPageReadyScript(org.ajax4jsf.javascript.ScriptString)
+ */
+ public <S> S addPageReadyScript(FacesContext facesContext, S script) {
+ UIScripts scriptResource = getOrCreateScriptResource(facesContext);
+
+ return addOrFind(scriptResource.getPageReadyScripts(), script);
+ }
+
+ @SuppressWarnings("unchecked")
+ private <S> S addOrFind(Collection<Object> collection, S script) {
+ for (Object object : collection) {
+ if (script.equals(object)) {
+ return (S) object;
+ }
+ }
+ collection.add(script);
+ return script;
+ }
+
+ /**
+ * <p class="changed_added_4_0">
+ * This method looks for {@link UIScripts} component in view resource. If such resource not found, it creates a new
+ * instance and stores it in {@link UIViewRoot} view resource with default target.
+ * </p>
+ *
+ * @param facesContext
+ * @return
+ */
+ UIScripts getOrCreateScriptResource(FacesContext facesContext) {
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+ if (null == viewRoot) {
+ throw new FacesException("View is not created");
+ }
+ List<UIComponent> componentResources = viewRoot.getComponentResources(facesContext, "form");
+ UIScripts scriptResource = findScriptResource(componentResources);
+ if (null == scriptResource) {
+ componentResources = viewRoot.getComponentResources(facesContext, "body");
+ scriptResource = findScriptResource(componentResources);
+ if (null == scriptResource) {
+ scriptResource = (UIScripts) facesContext.getApplication().createComponent(UIScripts.COMPONENT_TYPE);
+ viewRoot.addComponentResource(facesContext, scriptResource);
+ }
+ }
+ return scriptResource;
+ }
+
+ private UIScripts findScriptResource(List<UIComponent> componentResources) {
+ for (UIComponent uiComponent : componentResources) {
+ if (uiComponent instanceof UIScripts) {
+ UIScripts script = (UIScripts) uiComponent;
+ return script;
+ }
+ }
+ return null;
+ }
+
+}
Property changes on: branches/RF-8742-1/core/impl/src/main/java/org/richfaces/javascript/JavaScriptServiceImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/RF-8742-1/core/impl/src/main/java/org/richfaces/renderkit/html/ResourceLibraryRenderer.java
===================================================================
--- branches/RF-8742-1/core/impl/src/main/java/org/richfaces/renderkit/html/ResourceLibraryRenderer.java 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/core/impl/src/main/java/org/richfaces/renderkit/html/ResourceLibraryRenderer.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -24,11 +24,8 @@
import java.io.IOException;
import java.util.Map;
-import javax.faces.application.Application;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIOutput;
import javax.faces.context.FacesContext;
-import javax.faces.render.Renderer;
import org.richfaces.application.ServiceTracker;
import org.richfaces.log.Logger;
@@ -43,7 +40,7 @@
* @author Nick Belaevski
*
*/
-public class ResourceLibraryRenderer extends Renderer {
+public class ResourceLibraryRenderer extends ResourceRenderer {
public static final String RENDERER_TYPE = "org.richfaces.renderkit.ResourceLibraryRenderer";
@@ -92,22 +89,9 @@
return;
}
- Application application = context.getApplication();
- UIComponent resourceComponent = null;
for (ResourceKey resourceKey: resourceLibrary.getResources()) {
- String rendererType = application.getResourceHandler().getRendererTypeForResourceName(resourceKey.getResourceName());
-
- if (resourceComponent == null) {
- resourceComponent = application.createComponent(UIOutput.COMPONENT_TYPE);
- resourceComponent.setTransient(true);
- component.getChildren().add(resourceComponent);
- }
-
- resourceComponent.setRendererType(rendererType);
- setupResourceAttributes(resourceComponent, resourceKey);
-
- resourceComponent.encodeAll(context);
+ encodeResource(component, context, resourceKey);
}
}
Added: branches/RF-8742-1/core/impl/src/main/java/org/richfaces/renderkit/html/ResourceRenderer.java
===================================================================
--- branches/RF-8742-1/core/impl/src/main/java/org/richfaces/renderkit/html/ResourceRenderer.java (rev 0)
+++ branches/RF-8742-1/core/impl/src/main/java/org/richfaces/renderkit/html/ResourceRenderer.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -0,0 +1,36 @@
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.render.Renderer;
+
+import org.richfaces.component.UIResource;
+import org.richfaces.resource.ResourceKey;
+import org.richfaces.resource.ResourceLibrary;
+
+public abstract class ResourceRenderer extends Renderer {
+
+ public ResourceRenderer() {
+ super();
+ }
+
+ protected void encodeDependentResources(FacesContext context, UIComponent component, Collection<Object> scripts) throws IOException {
+ for (Object script : scripts) {
+ if (script instanceof ResourceLibrary) {
+ ResourceLibrary library = (ResourceLibrary) script;
+ for( ResourceKey resource :library.getResources()){
+ encodeResource(component, context, resource);
+ }
+ }
+ }
+ }
+
+ protected void encodeResource(UIComponent component, FacesContext context, ResourceKey resource) throws IOException {
+ UIResource resourceComponent = new UIResource(component,resource.getResourceName(),resource.getLibraryName());
+ resourceComponent.encodeAll(context);
+ }
+
+}
\ No newline at end of file
Property changes on: branches/RF-8742-1/core/impl/src/main/java/org/richfaces/renderkit/html/ResourceRenderer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: branches/RF-8742-1/core/impl/src/main/java/org/richfaces/renderkit/html/ScriptsRenderer.java (from rev 20280, branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ScriptsRenderer.java)
===================================================================
--- branches/RF-8742-1/core/impl/src/main/java/org/richfaces/renderkit/html/ScriptsRenderer.java (rev 0)
+++ branches/RF-8742-1/core/impl/src/main/java/org/richfaces/renderkit/html/ScriptsRenderer.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -0,0 +1,59 @@
+/**
+ *
+ */
+package org.richfaces.renderkit.html;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.ajax4jsf.javascript.ScriptUtils;
+import org.richfaces.component.UIScripts;
+import org.richfaces.resource.ResourceKey;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class ScriptsRenderer extends ResourceRenderer {
+
+ public static final String RENDERER_TYPE = "org.richfaces.renderer.ScriptsRenderer";
+ private static final String TEXT_JAVASCRIPT = "text/javascript";
+ private static final String SRC = "src";
+ private static final String TYPE = "type";
+ private static final String SCRIPT = "script";
+ private static final ResourceKey JQUERY = ResourceKey.create("jquery.js",null);
+
+ @Override
+ public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
+ UIScripts validatorScript = (UIScripts) component;
+ ResponseWriter responseWriter = context.getResponseWriter();
+ // TODO - change behavior for AJAX requests.
+ Collection<Object> scripts = validatorScript.getScripts();
+ encodeDependentResources(context, component, scripts);
+ Collection<Object> pageReadyScripts = validatorScript.getPageReadyScripts();
+ if(!pageReadyScripts.isEmpty()){
+ encodeResource(component, context, JQUERY);
+ encodeDependentResources(context, component, pageReadyScripts);
+ }
+ responseWriter.startElement(SCRIPT, null);
+ responseWriter.writeAttribute(TYPE, TEXT_JAVASCRIPT, null);
+ for (Object script : scripts) {
+ ScriptUtils.writeToStream(responseWriter, script);
+ responseWriter.writeText("\n",null);
+ }
+ if(!pageReadyScripts.isEmpty()){
+ responseWriter.writeText("$(document).ready(function() {\n",null);
+ for (Object script : pageReadyScripts) {
+ ScriptUtils.writeToStream(responseWriter, script);
+ responseWriter.writeText("\n",null);
+ }
+ responseWriter.writeText("});\n",null);
+ }
+ responseWriter.endElement(SCRIPT);
+ }
+
+}
Property changes on: branches/RF-8742-1/core/impl/src/main/java/org/richfaces/renderkit/html/ScriptsRenderer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: branches/RF-8742-1/core/impl/src/main/resources/META-INF/components.faces-config.xml
===================================================================
--- branches/RF-8742-1/core/impl/src/main/resources/META-INF/components.faces-config.xml 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/core/impl/src/main/resources/META-INF/components.faces-config.xml 2010-12-02 00:50:34 UTC (rev 20283)
@@ -1,21 +1,28 @@
<?xml version="1.0"?>
-<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- version="2.0">
-
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0">
<factory>
- <partial-view-context-factory>org.richfaces.context.PartialViewContextFactoryImpl</partial-view-context-factory>
+ <partial-view-context-factory>org.richfaces.context.PartialViewContextFactoryImpl
+ </partial-view-context-factory>
</factory>
-
+
<application>
<system-event-listener>
- <system-event-listener-class>org.richfaces.context.PartialViewContextAjaxOutputTracker</system-event-listener-class>
- <system-event-class>javax.faces.event.PreRemoveFromViewEvent</system-event-class>
+ <system-event-listener-class>org.richfaces.context.PartialViewContextAjaxOutputTracker
+ </system-event-listener-class>
+ <system-event-class>javax.faces.event.PreRemoveFromViewEvent
+ </system-event-class>
</system-event-listener>
<system-event-listener>
- <system-event-listener-class>org.richfaces.context.PartialViewContextAjaxOutputTracker</system-event-listener-class>
- <system-event-class>javax.faces.event.PostAddToViewEvent</system-event-class>
+ <system-event-listener-class>org.richfaces.context.PartialViewContextAjaxOutputTracker
+ </system-event-listener-class>
+ <system-event-class>javax.faces.event.PostAddToViewEvent
+ </system-event-class>
</system-event-listener>
</application>
+ <component>
+ <component-type>org.richfaces.Scripts</component-type>
+ <component-class>org.richfaces.component.UIScripts</component-class>
+ </component>
</faces-config>
Modified: branches/RF-8742-1/core/impl/src/main/resources/META-INF/resource-library.faces-config.xml
===================================================================
--- branches/RF-8742-1/core/impl/src/main/resources/META-INF/resource-library.faces-config.xml 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/core/impl/src/main/resources/META-INF/resource-library.faces-config.xml 2010-12-02 00:50:34 UTC (rev 20283)
@@ -1,14 +1,22 @@
<?xml version="1.0"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
- version="2.0">
- <name>richfaces</name>
+ version="2.0">
+ <name>richfaces</name>
- <render-kit>
- <renderer>
- <component-family>javax.faces.Output</component-family>
- <renderer-type>org.richfaces.renderkit.ResourceLibraryRenderer</renderer-type>
- <renderer-class>org.richfaces.renderkit.html.ResourceLibraryRenderer</renderer-class>
- </renderer>
- </render-kit>
+ <render-kit>
+ <renderer>
+ <component-family>org.richfaces.Script</component-family>
+ <renderer-type>org.richfaces.renderer.ScriptsRenderer</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.ScriptsRenderer
+ </renderer-class>
+ </renderer>
+ <renderer>
+ <component-family>javax.faces.Output</component-family>
+ <renderer-type>org.richfaces.renderkit.ResourceLibraryRenderer
+ </renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.ResourceLibraryRenderer
+ </renderer-class>
+ </renderer>
+ </render-kit>
</faces-config>
Copied: branches/RF-8742-1/core/impl/src/test/java/org/richfaces/component/Bean.java (from rev 20280, branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/Bean.java)
===================================================================
--- branches/RF-8742-1/core/impl/src/test/java/org/richfaces/component/Bean.java (rev 0)
+++ branches/RF-8742-1/core/impl/src/test/java/org/richfaces/component/Bean.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -0,0 +1,72 @@
+/**
+ *
+ */
+package org.richfaces.component;
+
+import java.util.Collections;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.javascript.JSLiteral;
+import org.richfaces.application.ServiceTracker;
+import org.richfaces.javascript.JavaScriptService;
+import org.richfaces.resource.ResourceKey;
+import org.richfaces.resource.ResourceLibrary;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class Bean {
+
+ private static final class TestScript extends JSLiteral implements ResourceLibrary {
+
+ public TestScript() {
+ super(TEST_SCRIPT);
+ }
+
+ public Iterable<ResourceKey> getResources() {
+ return Collections.singleton(TEST_RESOURCE);
+ }
+
+ }
+
+ public static final String TEST_SCRIPT_NAME = "test_script";
+
+ public static final String FOO_BAR = "foo.bar";
+
+ public static final String FOO = "foo";
+
+ public static final String FOO_VALUE = "fooValue";
+
+ public static final String TEST_SCRIPT = "function " + FOO + "(id){alert(id);}";
+
+ private static final ResourceKey TEST_RESOURCE = ResourceKey.create(TEST_SCRIPT_NAME + ".js",FOO_BAR);
+
+ private static final ResourceLibrary SCRIPT = new TestScript();
+
+ private String value=FOO_VALUE;
+
+ /**
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * @param value the value to set
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String action() {
+ JavaScriptService javaScriptService = ServiceTracker.getService(JavaScriptService.class);
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ javaScriptService.addPageReadyScript(facesContext, SCRIPT);
+ return null;
+ }
+
+
+}
Property changes on: branches/RF-8742-1/core/impl/src/test/java/org/richfaces/component/Bean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Copied: branches/RF-8742-1/core/impl/src/test/java/org/richfaces/component/UIViewResourceTest.java (from rev 20280, branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/UIViewResourceTest.java)
===================================================================
--- branches/RF-8742-1/core/impl/src/test/java/org/richfaces/component/UIViewResourceTest.java (rev 0)
+++ branches/RF-8742-1/core/impl/src/test/java/org/richfaces/component/UIViewResourceTest.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -0,0 +1,68 @@
+package org.richfaces.component;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.net.MalformedURLException;
+
+import org.jboss.test.faces.FacesEnvironment;
+import org.jboss.test.faces.FacesEnvironment.FacesRequest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+
+/**
+ * Test for dynamic add/remove {@link UIScripts} as view resource.
+ * @author asmirnov
+ *
+ */
+public class UIViewResourceTest {
+
+ private FacesEnvironment environment;
+
+
+ @Before
+ public void setUp() {
+ environment = FacesEnvironment.createEnvironment().withContent("/test.xhtml",
+ "<html xmlns=\"http://www.w3.org/1999/xhtml\"\n" +
+ " xmlns:ui=\"http://java.sun.com/jsf/facelets\"\n" +
+ " xmlns:h=\"http://java.sun.com/jsf/html\">"+
+ "<h:form id=\"helloForm\" >"+
+ " <h:inputText id=\"input\" value=\"#{test.value}\" />\n" +
+ " <h:commandButton id=\"command\" value=\"Ok\" action=\"#{test.action}\"/>\n" +
+ "</h:form>\n" +
+ "</html>").
+ withResource(FacesEnvironment.FACES_CONFIG_XML, "org/richfaces/component/faces-config.xml").
+ start();
+ }
+
+ @After
+ public void thearDown() throws Exception{
+ environment.release();
+ environment = null;
+ }
+
+ @Test
+ public void testRequest() throws Exception {
+ FacesRequest request = environment.createFacesRequest("http://localhost/test.jsf?foo=bar");
+ assertNotNull(request.execute());
+ String contentAsString = request.getConnection().getContentAsString();
+ assertFalse(contentAsString.contains(Bean.TEST_SCRIPT));
+ FacesRequest request2 = submit(request).submit();
+ request2.execute();
+ String content2 = request2.getConnection().getContentAsString();
+ assertFalse(content2.contains(Bean.TEST_SCRIPT));
+ }
+
+ private FacesRequest submit(FacesRequest request) throws MalformedURLException {
+ FacesRequest request2 = request.submit().withParameter("helloForm:input", "BAZ").withParameter("helloForm:command", "Ok");
+ request2.execute();
+ String content2 = request2.getConnection().getContentAsString();
+ assertTrue(content2.contains(Bean.TEST_SCRIPT));
+ return request2;
+ }
+
+
+}
Property changes on: branches/RF-8742-1/core/impl/src/test/java/org/richfaces/component/UIViewResourceTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Copied: branches/RF-8742-1/core/impl/src/test/java/org/richfaces/javascript/JavaScriptServiceTest.java (from rev 20280, branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/JavaScriptServiceTest.java)
===================================================================
--- branches/RF-8742-1/core/impl/src/test/java/org/richfaces/javascript/JavaScriptServiceTest.java (rev 0)
+++ branches/RF-8742-1/core/impl/src/test/java/org/richfaces/javascript/JavaScriptServiceTest.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -0,0 +1,133 @@
+/*
+ * $Id$
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.javascript;
+
+
+import static org.junit.Assert.*;
+
+import java.util.Collection;
+
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+
+import org.jboss.test.faces.mock.Environment;
+import org.jboss.test.faces.mock.Environment.Feature;
+import org.jboss.test.faces.mock.Mock;
+import org.jboss.test.faces.mock.MockController;
+import org.jboss.test.faces.mock.MockFacesEnvironment;
+import org.jboss.test.faces.mock.MockTestRunner;
+import org.jboss.test.faces.mock.Stub;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.richfaces.application.ServicesFactory;
+import org.richfaces.component.UIScripts;
+import org.richfaces.resource.ResourceKey;
+
+import com.google.common.collect.Iterables;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+(a)RunWith(MockTestRunner.class)
+public class JavaScriptServiceTest {
+
+ static final ResourceKey FOO_RESOURCE = ResourceKey.create("foo","org.rf");
+
+
+ protected UIScripts scriptResource;
+
+ protected JavaScriptServiceImpl serviceImpl;
+
+ @Mock()
+ @Environment({ Feature.APPLICATION, Feature.RENDER_KIT, Feature.EL_CONTEXT })
+ protected MockFacesEnvironment environment;
+ protected MockController controller;
+ @Mock
+ protected ValueExpression expression;
+ @Stub
+ protected ServicesFactory factory;
+
+
+ @After
+ public void tearDown() throws Exception {
+ controller.release();
+ }
+ @Before
+ public void setUpResource(){
+ serviceImpl = new JavaScriptServiceImpl(){
+ @Override
+ UIScripts getOrCreateScriptResource(FacesContext facesContext) {
+ return scriptResource;
+ }
+ };
+ scriptResource = new UIScripts();
+ }
+
+ @After
+ public void cleanUpResource(){
+ scriptResource = null;
+ }
+
+
+ @Test
+ public void testAddOrFindScript() {
+ Object script = createScript("foo bar");
+ Object script2 = serviceImpl.addScript(environment.getFacesContext(),script);
+ Collection<Object> scripts = scriptResource.getScripts();
+ assertEquals(1, scripts.size());
+ assertSame(script,Iterables.getOnlyElement(scripts));
+ }
+
+ @Test
+ public void testAddOrFindScript2() {
+ Object script = createScript("foo bar");
+ serviceImpl.addScript(environment.getFacesContext(),script);
+ Object script2 = createScript("fooz baz bar");
+ Object script3 = serviceImpl.addScript(environment.getFacesContext(),script2);
+ Collection<Object> scripts = scriptResource.getScripts();
+ assertEquals(2, scripts.size());
+ assertSame(script2,script3);
+ }
+
+ @Test
+ public void testAddOrFindScript3() {
+ Object script = createScript("foo bar");
+ serviceImpl.addScript(environment.getFacesContext(),script);
+ Object script2 = createScript("foo bar");
+ Object script3 = serviceImpl.addScript(environment.getFacesContext(),script2);
+ Collection<Object> scripts = scriptResource.getScripts();
+ assertEquals(1, scripts.size());
+ assertSame(script,script3);
+ }
+
+
+ private Object createScript(String content){
+ return content;
+ }
+
+}
Property changes on: branches/RF-8742-1/core/impl/src/test/java/org/richfaces/javascript/JavaScriptServiceTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: branches/RF-8742-1/core/impl/src/test/resources/org/richfaces/component/faces-config.xml (from rev 20280, branches/RF-8742-1/ui/validator/ui/src/test/resources/org/richfaces/component/faces-config.xml)
===================================================================
--- branches/RF-8742-1/core/impl/src/test/resources/org/richfaces/component/faces-config.xml (rev 0)
+++ branches/RF-8742-1/core/impl/src/test/resources/org/richfaces/component/faces-config.xml 2010-12-02 00:50:34 UTC (rev 20283)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config version="2.0" metadata-complete="false" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:cdk="http://jboss.org/schema/richfaces/cdk/extensions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<managed-bean>
+ <managed-bean-name>test</managed-bean-name>
+ <managed-bean-class>org.richfaces.component.Bean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+</managed-bean>
+</faces-config>
\ No newline at end of file
Property changes on: branches/RF-8742-1/core/impl/src/test/resources/org/richfaces/component/faces-config.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Deleted: branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/javascript/JavaScriptService.java
===================================================================
--- branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/javascript/JavaScriptService.java 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/javascript/JavaScriptService.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -1,56 +0,0 @@
-/*
- * $Id$
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.javascript;
-
-import javax.faces.context.FacesContext;
-
-
-/**
- * <p class="changed_added_4_0">
- * This service stores JavaScript objects for deffered rendering, as described on
- * http://community.jboss.org/wiki/RichFacesJavaScripthandling
- * </p>
- *
- * @author asmirnov(a)exadel.com
- *
- */
-public interface JavaScriptService {
-
- /**
- * <p class="changed_added_4_0">Adds new script to render at the end of page. Is the same script already set to render ( lookup by equals() method ), no new object added.</p>
- * @param facesContext TODO
- * @param script
- * @return actual object that will be rendered at the end of page.
- */
- <S> S addScript(FacesContext facesContext, S script);
-
- /**
- * <p class="changed_added_4_0">This method adds script that has to be executed in page.onready event listener, as required by jQuery components.</p>
- * @param facesContext TODO
- * @param script
- * @param <S>
- * @return
- */
- <S> S addPageReadyScript(FacesContext facesContext, S script);
-}
Modified: branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/application/ValidatorModule.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/application/ValidatorModule.java 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/application/ValidatorModule.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -66,7 +66,6 @@
configureBeanValidators(factory);
factory.setInstance(FacesConverterService.class, new ConverterServiceImpl());
factory.setInstance(FacesValidatorService.class, new FacesValidatorServiceImpl());
- factory.setInstance(JavaScriptService.class, new JavaScriptServiceImpl());
ClientScriptServiceImpl clientScriptService = createClientScriptService();
factory.setInstance(ClientScriptService.class, clientScriptService);
}
Deleted: branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/UIResource.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/UIResource.java 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/UIResource.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -1,125 +0,0 @@
-/*
- * $Id$
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import javax.faces.application.ResourceHandler;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIOutput;
-import javax.faces.context.FacesContext;
-import javax.faces.render.Renderer;
-
-/**
- * <p class="changed_added_4_0"></p>
- * @author asmirnov(a)exadel.com
- *
- */
-public class UIResource extends UITransient {
-
- private final String name;
- private final String library;
-
- public UIResource(UIComponent parent,String name, String library) {
- this.name = name;
- this.library = library;
- setParent(parent);
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.component.UITransient#hasAttribute(java.lang.Object)
- */
- @Override
- protected boolean hasAttribute(Object key) {
- if("name".equals(key)){
- return null != getName();
- } else if ("library".equals(key)) {
- return null != getLibrary();
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.component.UITransient#setAttribute(java.lang.String, java.lang.Object)
- */
- @Override
- protected Object setAttribute(String key, Object value) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.component.UITransient#getAttribute(java.lang.Object)
- */
- @Override
- protected Object getAttribute(Object key) {
- if("name".equals(key)){
- return getName();
- } else if ("library".equals(key)) {
- return getLibrary();
- }
- return null;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the library
- */
- public String getLibrary() {
- return library;
- }
-
- /* (non-Javadoc)
- * @see javax.faces.component.UIComponent#getFamily()
- */
- @Override
- public String getFamily() {
- return UIOutput.COMPONENT_FAMILY;
- }
-
- @Override
- public String getRendererType() {
- return getRendererType(getFacesContext());
- }
-
- public String getRendererType(FacesContext context) {
- ResourceHandler resourceHandler = context.getApplication().getResourceHandler();
- return resourceHandler.getRendererTypeForResourceName(getName());
- }
-
- @Override
- protected Renderer getRenderer(FacesContext context) {
- String rendererType = getRendererType(context);
- Renderer result = null;
- if (rendererType != null) {
- result = context.getRenderKit().getRenderer(getFamily(), rendererType);
- }
- return result;
- }
-}
Deleted: branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/UIScripts.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/UIScripts.java 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/UIScripts.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -1,110 +0,0 @@
-/*
- * $Id$
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-
-import org.richfaces.renderkit.html.ComponentValidatorScript;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-
-/**
- * <p class="changed_added_4_0">
- * This component user to render Client Validator scripts. Any ClientValidatorBehavior that requires additional scripts
- * should put them to this component, associated with "form" target in view resources.
- * </p>
- *
- * @author asmirnov(a)exadel.com
- *
- */
-public class UIScripts extends UITransient {
-
-
- public static final String COMPONENT_TYPE = "org.richfaces.Scripts";
-
- private final List<Object> scripts = Lists.newArrayList();
-
- private final List<Object> pageReadyScripts = Lists.newArrayList();
-
- private String target = "form";
-
- public static final String COMPONENT_FAMILY = "org.richfaces.Script";
-
- public Collection<Object> getScripts() {
- return scripts;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the pageReadyScripts
- */
- public Collection<Object> getPageReadyScripts() {
- return this.pageReadyScripts;
- }
-
-
- @Override
- public String getFamily() {
- return UIScripts.COMPONENT_FAMILY;
- }
-
- public void setTarget(String target) {
- this.target = target;
- }
-
- public String getTarget() {
- return target;
- }
-
- @Override
- protected boolean hasAttribute(Object key) {
- return "target".equals(key);
- }
-
- @Override
- protected Object setAttribute(String key, Object value) {
- if ("target".equals(key)) {
- String oldTarget = getTarget();
- setTarget((String) value);
- return oldTarget;
- }
- return null;
- }
-
- @Override
- protected Object getAttribute(Object key) {
- if("target".equals(key)){
- return getTarget();
- }
- return null;
- }
-
-}
Deleted: branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/UITransient.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/UITransient.java 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/UITransient.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -1,386 +0,0 @@
-package org.richfaces.component;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.el.ValueExpression;
-import javax.faces.component.NamingContainer;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UINamingContainer;
-import javax.faces.component.UniqueIdVendor;
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-import javax.faces.render.Renderer;
-
-import org.richfaces.renderkit.html.ScriptsRenderer;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterators;
-
-public abstract class UITransient extends UIComponent {
-
- private String id;
-
- private UIComponent parent;
-
- private final Map<String, Object> attributesMap = new AttributesMap();
-
-
- private String clientId;
-
- public UITransient() {
- super();
- }
-
-
- public Object saveState(FacesContext context) {
- // This is transient component
- return null;
- }
-
- public void restoreState(FacesContext context, Object state) {
- // Do nothing, this component never saved
-
- }
-
- public boolean isTransient() {
- return true;
- }
-
- public void setTransient(boolean newTransientValue) {
-
- }
-
- @Override
- public Map<String, Object> getAttributes() {
- return attributesMap;
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public ValueBinding getValueBinding(String name) {
- return null;
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void setValueBinding(String name, ValueBinding binding) {
- // do nothing
-
- }
-
- @Override
- public ValueExpression getValueExpression(String name) {
- return null;
- }
-
- @Override
- public void setValueExpression(String name, ValueExpression binding) {
- // do nothing
- }
-
- @Override
- public String getClientId(FacesContext context) {
- if (context == null) {
- throw new NullPointerException();
- }
-
- // if the clientId is not yet set
- if (this.clientId == null) {
- UIComponent namingContainerAncestor = this.getNamingContainer();
- String parentId = null;
-
- // give the parent the opportunity to first
- // grab a unique clientId
- if (namingContainerAncestor != null) {
- parentId = namingContainerAncestor.getContainerClientId(context);
- }
-
- // now resolve our own client id
- String clientId = getId();
- if (clientId == null) {
- if (null != namingContainerAncestor && namingContainerAncestor instanceof UniqueIdVendor) {
- clientId = ((UniqueIdVendor) namingContainerAncestor).createUniqueId(context, null);
- } else {
- clientId = context.getViewRoot().createUniqueId();
- }
- setId(clientId);
- }
- if (parentId != null) {
- StringBuilder idBuilder = new StringBuilder(parentId.length() + 1 + clientId.length());
- clientId = idBuilder.append(parentId).append(UINamingContainer.getSeparatorChar(context))
- .append(clientId).toString();
- }
-
- // allow the renderer to convert the clientId
- Renderer renderer = this.getRenderer(context);
- if (renderer != null) {
- this.clientId = renderer.convertClientId(context, clientId);
- } else {
- this.clientId = clientId;
- }
- }
- return this.clientId;
- }
-
- @Override
- public String getId() {
- return this.id;
- }
-
- @Override
- public void setId(String id) {
- this.id = id;
- this.clientId = null;
- }
-
- @Override
- public UIComponent getParent() {
- return this.parent;
- }
-
- @Override
- public void setParent(UIComponent parent) {
- this.parent = parent;
- }
-
- @Override
- public boolean isRendered() {
- return true;
- }
-
- @Override
- public void setRendered(boolean rendered) {
- // always rendered
- }
-
- @Override
- public String getRendererType() {
- return ScriptsRenderer.RENDERER_TYPE;
- }
-
- @Override
- public void setRendererType(String rendererType) {
- // do nothing
-
- }
-
- @Override
- public boolean getRendersChildren() {
- return false;
- }
-
- @Override
- public List<UIComponent> getChildren() {
- return Collections.emptyList();
- }
-
- @Override
- public int getChildCount() {
- return 0;
- }
-
- @Override
- public UIComponent findComponent(String expr) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Map<String, UIComponent> getFacets() {
- return Collections.emptyMap();
- }
-
- @Override
- public UIComponent getFacet(String name) {
- return null;
- }
-
- @Override
- public Iterator<UIComponent> getFacetsAndChildren() {
- return Iterators.emptyIterator();
- }
-
- @Override
- public void broadcast(FacesEvent event) throws AbortProcessingException {
- // Do nothing
- }
-
- @Override
- public void decode(FacesContext context) {
- // Do nothing
- }
-
- @Override
- public void encodeBegin(FacesContext context) throws IOException {
- Renderer renderer = getRenderer(context);
- if(null != renderer){
- renderer.encodeBegin(context, this);
- }
- }
-
- @Override
- public void encodeChildren(FacesContext context) throws IOException {
- Renderer renderer = getRenderer(context);
- if(null != renderer){
- renderer.encodeChildren(context, this);
- }
- }
-
- @Override
- public void encodeEnd(FacesContext context) throws IOException {
- Renderer renderer = getRenderer(context);
- if(null != renderer){
- renderer.encodeEnd(context, this);
- }
- }
-
- @Override
- protected void addFacesListener(FacesListener listener) {
- }
-
- @Override
- protected FacesListener[] getFacesListeners(Class clazz) {
- return new FacesListener[0];
- }
-
- @Override
- protected void removeFacesListener(FacesListener listener) {
- }
-
- @Override
- public void queueEvent(FacesEvent event) {
- if (null != getParent()) {
- getParent().queueEvent(event);
- }
-
- }
-
- @Override
- public void processRestoreState(FacesContext context, Object state) {
- // Do nothing, this component does not have state.
-
- }
-
- @Override
- public void processDecodes(FacesContext context) {
- // Do nothing
-
- }
-
- @Override
- public void processValidators(FacesContext context) {
- // Do nothing
-
- }
-
- @Override
- public void processUpdates(FacesContext context) {
- // Do nothing
- }
-
- @Override
- public Object processSaveState(FacesContext context) {
- // Should never be used
- return null;
- }
-
- @Override
- protected FacesContext getFacesContext() {
- return FacesContext.getCurrentInstance();
- }
-
- @Override
- protected Renderer getRenderer(FacesContext context) {
- String rendererType = getRendererType();
- Renderer result = null;
- if (rendererType != null) {
- result = context.getRenderKit().getRenderer(getFamily(), rendererType);
- }
- return result;
- }
-
- final class AttributesMap implements Map<String, Object> {
-
- public void clear() {
- // do nothing
-
- }
-
- public boolean containsKey(Object key) {
-
- return "target".equals(key)||"id".equals(key)||"clientId".equals(key)||hasAttribute(key);
- }
-
- public boolean containsValue(Object value) {
- return false;
- }
-
- public Set<java.util.Map.Entry<String, Object>> entrySet() {
- return Collections.emptySet();
- }
-
- public Object get(Object key) {
- if ("id".equals(key)) {
- return getId();
- } else if ("clientId".equals(key)) {
- return getClientId();
- } else {
- return getAttribute(key);
- }
- }
-
- public boolean isEmpty() {
- return false;
- }
-
- public Set<String> keySet() {
- return ImmutableSet.of("target","id","clientId");
- }
-
- public Object put(String key, Object value) {
- if ("id".equals(key)) {
- String id = getId();
- setId((String) value);
- return id;
- } else {
- return setAttribute(key, value);
- }
- }
-
- public void putAll(Map<? extends String, ? extends Object> m) {
-
-
- }
-
- public Object remove(Object key) {
- return null;
- }
-
- public int size() {
- return 3;
- }
-
- public Collection<Object> values() {
- return ImmutableList.<Object>of(getId(),getClientId());
- }
- }
-
- protected abstract boolean hasAttribute(Object key);
-
-
- protected abstract Object setAttribute(String key, Object value);
-
-
- protected abstract Object getAttribute(Object key);
-
-}
\ No newline at end of file
Deleted: branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/javascript/JavaScriptServiceImpl.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/javascript/JavaScriptServiceImpl.java 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/javascript/JavaScriptServiceImpl.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -1,112 +0,0 @@
-/*
- * $Id$
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.javascript;
-
-import java.util.Collection;
-import java.util.List;
-
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.component.UIScripts;
-import org.richfaces.renderkit.html.NoSuchComponentException;
-
-/**
- * <p class="changed_added_4_0"></p>
- * @author asmirnov(a)exadel.com
- *
- */
-public class JavaScriptServiceImpl implements JavaScriptService {
-
- /* (non-Javadoc)
- * @see org.richfaces.javascript.JavaScriptService#addScript(org.ajax4jsf.javascript.ScriptString)
- */
- public <S> S addScript(FacesContext facesContext, S script) {
- UIScripts scriptResource = getOrCreateScriptResource(facesContext);
-
- return addOrFind(scriptResource.getScripts(),script);
- }
-
- /* (non-Javadoc)
- * @see org.richfaces.javascript.JavaScriptService#addPageReadyScript(org.ajax4jsf.javascript.ScriptString)
- */
- public <S> S addPageReadyScript(FacesContext facesContext, S script) {
- UIScripts scriptResource = getOrCreateScriptResource(facesContext);
-
- return addOrFind(scriptResource.getPageReadyScripts(),script);
- }
-
-
- @SuppressWarnings("unchecked")
- private <S> S addOrFind(Collection<Object> collection,S script){
- for (Object object : collection) {
- if(script.equals(object)){
- return (S) object;
- }
- }
- collection.add(script);
- return script;
- }
- /**
- * <p class="changed_added_4_0">
- * This method looks for {@link UIScripts} component in view resource. If such resource not found, it
- * creates a new instance and stores it in {@link UIViewRoot} view resource with default target.
- * </p>
- *
- * @param facesContext
- * @return
- */
- UIScripts getOrCreateScriptResource(FacesContext facesContext) {
- UIViewRoot viewRoot = facesContext.getViewRoot();
- if (null == viewRoot) {
- throw new FacesException("View is not created");
- }
- List<UIComponent> componentResources = viewRoot.getComponentResources(facesContext, "form");
- try {
- return findScriptResource(componentResources);
- } catch (NoSuchComponentException e) {
- componentResources = viewRoot.getComponentResources(facesContext, "body");
- try {
- return findScriptResource(componentResources);
- } catch (NoSuchComponentException e1) {
- UIScripts component =
- (UIScripts) facesContext.getApplication().createComponent(UIScripts.COMPONENT_TYPE);
- viewRoot.addComponentResource(facesContext, component);
- return component;
- }
- }
- }
- private UIScripts findScriptResource(List<UIComponent> componentResources) throws NoSuchComponentException {
- for (UIComponent uiComponent : componentResources) {
- if (uiComponent instanceof UIScripts) {
- UIScripts script = (UIScripts) uiComponent;
- return script;
- }
- }
- throw new NoSuchComponentException();
- }
-
-}
Modified: branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/AjaxOnlyScript.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/AjaxOnlyScript.java 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/AjaxOnlyScript.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -2,13 +2,13 @@
import java.util.Collections;
-import javax.faces.context.FacesContext;
-
import org.richfaces.resource.ResourceKey;
public class AjaxOnlyScript extends ValidatorScriptBase {
+ public static final Iterable<ResourceKey> AJAX_LIBRARIES=Collections.singleton(ResourceKey.create("ajax.reslib", "org.richfaces"));
+
private final String ajaxScript;
public AjaxOnlyScript(String ajaxScript) {
@@ -18,7 +18,7 @@
}
public Iterable<ResourceKey> getResources() {
- return Collections.emptySet();
+ return AJAX_LIBRARIES;
}
@Override
Modified: branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientAndAjaxScript.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientAndAjaxScript.java 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientAndAjaxScript.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -3,8 +3,11 @@
import java.util.Collection;
import org.richfaces.javascript.ScriptWithDependencies;
+import org.richfaces.resource.ResourceKey;
+import com.google.common.collect.Iterables;
+
public class ClientAndAjaxScript extends ClientOnlyScript{
@@ -18,6 +21,11 @@
}
+ @Override
+ public Iterable<ResourceKey> getResources() {
+ return Iterables.concat(AjaxOnlyScript.AJAX_LIBRARIES,super.getResources());
+ }
+
protected void finishValidation(StringBuilder body) {
// AJAX callback
body.append("if(!").append(DISABLE_AJAX).append("){\n");
Modified: branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientOnlyScript.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientOnlyScript.java 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientOnlyScript.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -9,7 +9,7 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
-public class ClientOnlyScript extends ValidatorScriptBase{
+public class ClientOnlyScript extends ValidatorScriptBase {
protected final ScriptWithDependencies converter;
protected final Collection<? extends ScriptWithDependencies> validators;
Modified: branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientValidatorRenderer.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientValidatorRenderer.java 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ClientValidatorRenderer.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -10,7 +10,6 @@
import javax.faces.component.ActionSource;
import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
import javax.faces.component.behavior.ClientBehavior;
import javax.faces.component.behavior.ClientBehaviorContext;
import javax.faces.context.FacesContext;
@@ -21,14 +20,13 @@
import org.ajax4jsf.javascript.JSReference;
import org.ajax4jsf.javascript.ScriptUtils;
import org.richfaces.application.ServiceTracker;
-import org.richfaces.component.UIScripts;
import org.richfaces.component.behavior.ClientValidatorBehavior;
import org.richfaces.component.behavior.ConverterNotFoundException;
import org.richfaces.javascript.ClientScriptService;
import org.richfaces.javascript.JavaScriptService;
import org.richfaces.javascript.LibraryFunction;
-import org.richfaces.javascript.ScriptWithDependencies;
import org.richfaces.javascript.ScriptNotFoundException;
+import org.richfaces.javascript.ScriptWithDependencies;
import org.richfaces.validator.ConverterDescriptor;
import org.richfaces.validator.FacesObjectDescriptor;
import org.richfaces.validator.ValidatorDescriptor;
Deleted: branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ScriptsRenderer.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ScriptsRenderer.java 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ScriptsRenderer.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -1,78 +0,0 @@
-/**
- *
- */
-package org.richfaces.renderkit.html;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.render.Renderer;
-
-import org.ajax4jsf.javascript.ScriptUtils;
-import org.richfaces.component.UIResource;
-import org.richfaces.component.UIScripts;
-import org.richfaces.resource.ResourceKey;
-import org.richfaces.resource.ResourceLibrary;
-
-/**
- * @author asmirnov
- *
- */
-public class ScriptsRenderer extends Renderer {
-
- public static final String RENDERER_TYPE = "org.richfaces.renderer.ScriptsRenderer";
- private static final String TEXT_JAVASCRIPT = "text/javascript";
- private static final String SRC = "src";
- private static final String TYPE = "type";
- private static final String SCRIPT = "script";
- private static final ResourceKey JQUERY = ResourceKey.create("jquery.js",null);
-
- @Override
- public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
- UIScripts validatorScript = (UIScripts) component;
- ResponseWriter responseWriter = context.getResponseWriter();
- // TODO - change behavior for AJAX requests.
- Collection<Object> scripts = validatorScript.getScripts();
- encodeDependentResources(context, component, scripts);
- Collection<Object> pageReadyScripts = validatorScript.getPageReadyScripts();
- if(!pageReadyScripts.isEmpty()){
- encodeResource(component, context, JQUERY);
- encodeDependentResources(context, component, pageReadyScripts);
- }
- responseWriter.startElement(SCRIPT, null);
- responseWriter.writeAttribute(TYPE, TEXT_JAVASCRIPT, null);
- for (Object script : scripts) {
- ScriptUtils.writeToStream(responseWriter, script);
- responseWriter.writeText("\n",null);
- }
- if(!pageReadyScripts.isEmpty()){
- responseWriter.writeText("$(document).ready(function() {\n",null);
- for (Object script : pageReadyScripts) {
- ScriptUtils.writeToStream(responseWriter, script);
- responseWriter.writeText("\n",null);
- }
- responseWriter.writeText("});\n",null);
- }
- responseWriter.endElement(SCRIPT);
- }
-
- private void encodeDependentResources(FacesContext context, UIComponent component, Collection<Object> scripts) throws IOException {
- for (Object script : scripts) {
- if (script instanceof ResourceLibrary) {
- ResourceLibrary library = (ResourceLibrary) script;
- for( ResourceKey resource :library.getResources()){
- encodeResource(component, context, resource);
- }
- }
- }
- }
-
- private void encodeResource(UIComponent component,FacesContext context, ResourceKey resource) throws IOException {
- UIResource resourceComponent = new UIResource(component,resource.getResourceName(),resource.getLibraryName());
- resourceComponent.encodeAll(context);
- }
-
-}
Modified: branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/faces-config.xml
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/faces-config.xml 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/faces-config.xml 2010-12-02 00:50:34 UTC (rev 20283)
@@ -1,19 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="2.0" metadata-complete="false" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:cdk="http://jboss.org/schema/richfaces/cdk/extensions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-<component>
- <component-type>org.richfaces.Scripts</component-type>
- <component-class>org.richfaces.component.UIScripts</component-class>
-</component>
<behavior>
<behavior-id>org.richfaces.behavior.ClientValidator</behavior-id>
<behavior-class>org.richfaces.component.behavior.ClientValidatorImpl</behavior-class>
</behavior>
<render-kit>
- <renderer>
- <component-family>org.richfaces.Script</component-family>
- <renderer-type>org.richfaces.renderer.ScriptsRenderer</renderer-type>
- <renderer-class>org.richfaces.renderkit.html.ScriptsRenderer</renderer-class>
- </renderer>
<client-behavior-renderer>
<client-behavior-renderer-type>org.richfaces.ClientValidatorRenderer</client-behavior-renderer-type>
<client-behavior-renderer-class>org.richfaces.renderkit.html.ClientValidatorRenderer</client-behavior-renderer-class>
Modified: branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/Bean.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/Bean.java 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/Bean.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -1,69 +1,9 @@
-/**
- *
- */
package org.richfaces.component;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-
-import javax.faces.context.FacesContext;
-
-import org.richfaces.application.ServiceTracker;
-import org.richfaces.javascript.JavaScriptService;
-import org.richfaces.renderkit.html.ComponentValidatorScript;
-import org.richfaces.resource.ResourceKey;
-
-/**
- * @author asmirnov
- *
- */
public class Bean {
- public static final String TEST_SCRIPT_NAME = "test_script";
-
- public static final String FOO_BAR = "foo.bar";
-
- public static final String FOO = "foo";
-
public static final String FOO_VALUE = "fooValue";
-
- public static final String TEST_SCRIPT = "function " + FOO + "(id){alert(id);}";
-
- private static final ResourceKey TEST_RESOURCE = ResourceKey.create(TEST_SCRIPT_NAME + ".js",FOO_BAR);
- private static final ComponentValidatorScript SCRIPT = new ComponentValidatorScript() {
-
- public String toScript() {
- return TEST_SCRIPT;
- }
-
- public void appendScript(Appendable target) throws IOException {
- target.append(TEST_SCRIPT);
- }
-
- public void appendScriptToStringBuilder(StringBuilder stringBuilder) {
- try {
- appendScript(stringBuilder);
- } catch (IOException e) {
- //ignore
- }
- }
-
- public Collection<ResourceKey> getResources() {
- return Collections.singleton(TEST_RESOURCE);
- }
-
- public String getName() {
- return FOO;
- }
-
- public String createCallScript(String clientId,String sourceId) {
- return FOO+"("+clientId+")";
- }
-
- };
-
private String value=FOO_VALUE;
/**
@@ -72,20 +12,11 @@
public String getValue() {
return value;
}
-
/**
* @param value the value to set
*/
public void setValue(String value) {
this.value = value;
}
-
- public String action() {
- JavaScriptService javaScriptService = ServiceTracker.getService(JavaScriptService.class);
- FacesContext facesContext = FacesContext.getCurrentInstance();
- javaScriptService.addPageReadyScript(facesContext, SCRIPT);
- return null;
- }
-
}
Deleted: branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/UIViewResourceTest.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/UIViewResourceTest.java 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/UIViewResourceTest.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -1,70 +0,0 @@
-package org.richfaces.component;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.net.MalformedURLException;
-
-import org.jboss.test.faces.FacesEnvironment;
-import org.jboss.test.faces.FacesEnvironment.FacesRequest;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-
-/**
- * Test for dynamic add/remove {@link UIScripts} as view resource.
- * @author asmirnov
- *
- */
-public class UIViewResourceTest {
-
- private FacesEnvironment environment;
-
-
- @Before
- public void setUp() {
- environment = FacesEnvironment.createEnvironment().withContent("/test.xhtml",
- "<html xmlns=\"http://www.w3.org/1999/xhtml\"\n" +
- " xmlns:ui=\"http://java.sun.com/jsf/facelets\"\n" +
- " xmlns:h=\"http://java.sun.com/jsf/html\">"+
- "<h:form id=\"helloForm\" >"+
- " <h:inputText id=\"input\" value=\"#{test.value}\" />\n" +
- " <h:commandButton id=\"command\" value=\"Ok\" action=\"#{test.action}\"/>\n" +
- "</h:form>\n" +
- "</html>").
- withResource(FacesEnvironment.FACES_CONFIG_XML, "org/richfaces/component/WEB-INF/faces-config.xml").
- start();
- }
-
- @After
- public void thearDown() throws Exception{
- environment.release();
- environment = null;
- }
-
- @Test
- public void testRequest() throws Exception {
- FacesRequest request = environment.createFacesRequest("http://localhost/test.jsf?foo=bar");
- assertNotNull(request.execute());
- String contentAsString = request.getConnection().getContentAsString();
- assertFalse(contentAsString.contains(Bean.TEST_SCRIPT));
- FacesRequest request2 = submit(request).submit();
- request2.execute();
- String content2 = request2.getConnection().getContentAsString();
- assertFalse(content2.contains(Bean.TEST_SCRIPT));
- }
-
- private FacesRequest submit(FacesRequest request) throws MalformedURLException {
- FacesRequest request2 = request.submit().withParameter("helloForm:input", "BAZ").withParameter("helloForm:command", "Ok");
- request2.execute();
- String content2 = request2.getConnection().getContentAsString();
- assertTrue(content2.contains(Bean.TEST_SCRIPT));
- assertTrue(content2.contains(Bean.TEST_SCRIPT_NAME));
- assertTrue(content2.contains(Bean.FOO_BAR));
- return request2;
- }
-
-
-}
Deleted: branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/JavaScriptServiceTest.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/JavaScriptServiceTest.java 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/JavaScriptServiceTest.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -1,129 +0,0 @@
-/*
- * $Id$
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.javascript;
-
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-
-import org.jboss.test.faces.mock.Environment;
-import org.jboss.test.faces.mock.Mock;
-import org.jboss.test.faces.mock.MockController;
-import org.jboss.test.faces.mock.MockFacesEnvironment;
-import org.jboss.test.faces.mock.MockTestRunner;
-import org.jboss.test.faces.mock.Environment.Feature;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.richfaces.ValidatorTestBase;
-import org.richfaces.component.UIScripts;
-import org.richfaces.renderkit.html.ClientOnlyScript;
-import org.richfaces.renderkit.html.ComponentValidatorScript;
-import org.richfaces.resource.ResourceKey;
-
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
-/**
- * <p class="changed_added_4_0"></p>
- * @author asmirnov(a)exadel.com
- *
- */
-(a)RunWith(MockTestRunner.class)
-public class JavaScriptServiceTest extends ValidatorTestBase {
-
- static final ResourceKey FOO_RESOURCE = ResourceKey.create("foo","org.rf");
-
-
- private UIScripts scriptResource;
-
- private JavaScriptServiceImpl serviceImpl;
-
- @Before
- public void setUpResource(){
- serviceImpl = new JavaScriptServiceImpl(){
- @Override
- UIScripts getOrCreateScriptResource(FacesContext facesContext) {
- return scriptResource;
- }
- };
- scriptResource = new UIScripts();
- }
-
- @After
- public void cleanUpResource(){
- scriptResource = null;
- }
-
-
- @Test
- public void testAddOrFindScript() {
- ComponentValidatorScript validatorScript = createValidatorScript("foo", "bar");
- ComponentValidatorScript validatorScript2 = serviceImpl.addScript(environment.getFacesContext(),validatorScript);
- Collection<Object> scripts = scriptResource.getScripts();
- assertEquals(1, scripts.size());
- assertSame(validatorScript,Iterables.getOnlyElement(scripts));
- }
-
- @Test
- public void testAddOrFindScript2() {
- ComponentValidatorScript validatorScript = createValidatorScript("foo", "bar");
- serviceImpl.addScript(environment.getFacesContext(),validatorScript);
- ComponentValidatorScript validatorScript2 = createValidatorScript("fooz", "baz","bar");
- ComponentValidatorScript validatorScript3 = serviceImpl.addScript(environment.getFacesContext(),validatorScript2);
- Collection<Object> scripts = scriptResource.getScripts();
- assertEquals(2, scripts.size());
- assertSame(validatorScript2,validatorScript3);
- }
-
- @Test
- public void testAddOrFindScript3() {
- ComponentValidatorScript validatorScript = createValidatorScript("foo", "bar");
- serviceImpl.addScript(environment.getFacesContext(),validatorScript);
- ComponentValidatorScript validatorScript2 = createValidatorScript("foo", "bar");
- ComponentValidatorScript validatorScript3 = serviceImpl.addScript(environment.getFacesContext(),validatorScript2);
- Collection<Object> scripts = scriptResource.getScripts();
- assertEquals(1, scripts.size());
- assertSame(validatorScript,validatorScript3);
- }
-
- private ScriptWithDependencies createLibraryScript(final String name) {
- return new Script(name);
- }
-
- private ComponentValidatorScript createValidatorScript(String converter, String ...validators){
- ArrayList<ScriptWithDependencies> validatorScripts = Lists.newArrayList();
- for (String validatorName : validators) {
- validatorScripts.add(createLibraryScript(validatorName));
- }
- return new ClientOnlyScript(createLibraryScript(converter), validatorScripts);
- }
-
-}
Modified: branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererBuildScriptTest.java
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererBuildScriptTest.java 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererBuildScriptTest.java 2010-12-02 00:50:34 UTC (rev 20283)
@@ -3,12 +3,8 @@
import static org.easymock.EasyMock.*;
import static org.junit.Assert.*;
-import java.util.List;
-
-import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
import javax.faces.component.behavior.ClientBehaviorContext;
-import javax.faces.context.FacesContext;
import org.jboss.test.faces.mock.Mock;
import org.jboss.test.faces.mock.MockTestRunner;
@@ -17,13 +13,9 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.richfaces.application.ServiceTracker;
-import org.richfaces.component.UIScripts;
import org.richfaces.component.behavior.ClientValidatorBehavior;
-import org.richfaces.javascript.ClientScriptService;
import org.richfaces.javascript.JavaScriptService;
-import com.google.common.collect.Lists;
-
@RunWith(MockTestRunner.class)
public class RendererBuildScriptTest extends RendererTestBase {
Deleted: branches/RF-8742-1/ui/validator/ui/src/test/resources/org/richfaces/component/faces-config.xml
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/test/resources/org/richfaces/component/faces-config.xml 2010-12-01 20:22:27 UTC (rev 20282)
+++ branches/RF-8742-1/ui/validator/ui/src/test/resources/org/richfaces/component/faces-config.xml 2010-12-02 00:50:34 UTC (rev 20283)
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<faces-config version="2.0" metadata-complete="false" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:cdk="http://jboss.org/schema/richfaces/cdk/extensions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-<managed-bean>
- <managed-bean-name>test</managed-bean-name>
- <managed-bean-class>org.richfaces.component.Bean</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
-</managed-bean>
-</faces-config>
\ No newline at end of file
14 years