JBoss Rich Faces SVN: r18621 - in trunk: core/commons/api/src/main/java/org/richfaces/renderkit and 14 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-08-13 10:12:36 -0400 (Fri, 13 Aug 2010)
New Revision: 18621
Added:
trunk/examples/output-demo/src/main/webapp/examples/accordion.xhtml
trunk/examples/output-demo/src/main/webapp/examples/accordion/
trunk/examples/output-demo/src/main/webapp/examples/togglePanel/
trunk/examples/output-demo/src/main/webapp/qunit/accordion.xhtml
trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-qunit.js
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractAccordion.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelTitledItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordion.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordionItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanelTitledItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss
Modified:
trunk/core/commons/api/pom.xml
trunk/core/commons/api/src/main/java/org/richfaces/renderkit/RenderKitUtils.java
trunk/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml
trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-toggle-panel-qunit.js
trunk/examples/output-demo/src/main/webapp/templates/template.xhtml
trunk/ui/output/api/pom.xml
trunk/ui/output/ui/pom.xml
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlDivPanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanel.java
trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanelItem.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java
trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/TogglePanelTagHandler.java
trunk/ui/output/ui/src/main/resources/META-INF/MANIFEST.MF
trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
trunk/ui/output/ui/src/test/resources/panelTest.xhtml
trunk/ui/output/ui/src/test/resources/popupPanelTest.xhtml
Log:
RF-8747 Panelbar component
Modified: trunk/core/commons/api/pom.xml
===================================================================
--- trunk/core/commons/api/pom.xml 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/core/commons/api/pom.xml 2010-08-13 14:12:36 UTC (rev 18621)
@@ -34,6 +34,11 @@
<!-- Runtime Dependencies -->
<!-- JSF2 api version set by bom/richface-parent -->
<dependency>
+ <groupId>com.sun.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>2.0.2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
<groupId>${jsf2.api.groupid}</groupId>
<artifactId>${jsf2.api.artifactid}</artifactId>
<scope>provided</scope>
Modified: trunk/core/commons/api/src/main/java/org/richfaces/renderkit/RenderKitUtils.java
===================================================================
--- trunk/core/commons/api/src/main/java/org/richfaces/renderkit/RenderKitUtils.java 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/core/commons/api/src/main/java/org/richfaces/renderkit/RenderKitUtils.java 2010-08-13 14:12:36 UTC (rev 18621)
@@ -404,6 +404,24 @@
return new Attributes();
}
+ public static Attributes attributes(Enum<?> ... attrs) {
+ Attributes res = new Attributes();
+ for (Enum<?> attr : attrs) {
+ res.generic(attr.toString(), attr.toString());
+ }
+
+ return res;
+ }
+
+ public static Attributes attributes(String ... attrs) {
+ Attributes res = new Attributes();
+ for (String attr : attrs) {
+ res.generic(attr, attr);
+ }
+
+ return res;
+ }
+
@SuppressWarnings("serial")
public static final class Attributes extends TreeSet<ComponentAttribute> {
Modified: trunk/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-08-13 14:12:36 UTC (rev 18621)
@@ -30,6 +30,10 @@
<from-outcome>togglePanel/mixed</from-outcome>
<to-view-id>/examples/togglePanel-mixed.xhtml</to-view-id>
</navigation-case>
+ <navigation-case>
+ <from-outcome>accordion</from-outcome>
+ <to-view-id>/examples/accordion.xhtml</to-view-id>
+ </navigation-case>
<!-- QUnit -->
<navigation-case>
@@ -40,5 +44,9 @@
<from-outcome>qunit/togglePanelItem</from-outcome>
<to-view-id>/qunit/togglePanelItem.xhtml</to-view-id>
</navigation-case>
+ <navigation-case>
+ <from-outcome>qunit/accordion</from-outcome>
+ <to-view-id>/qunit/accordion.xhtml</to-view-id>
+ </navigation-case>
</navigation-rule>
</faces-config>
Added: trunk/examples/output-demo/src/main/webapp/examples/accordion.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/examples/accordion.xhtml (rev 0)
+++ trunk/examples/output-demo/src/main/webapp/examples/accordion.xhtml 2010-08-13 14:12:36 UTC (rev 18621)
@@ -0,0 +1,28 @@
+<!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"
+ xmlns:pn="http://richfaces.org/output">
+
+<body>
+<ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="title">Accordion Example</ui:define>
+ <ui:define name="body_head">Accordion Example</ui:define>
+
+ <ui:define name="body">
+ <p>Page</p>
+
+ <h:form id="f" style="border:blue solid thin;">
+ <pn:accordion>
+ <pn:accordionItem header="label 1">content 1</pn:accordionItem>
+ <pn:accordionItem header="label 2">content 2</pn:accordionItem>
+ <pn:accordionItem header="label 3">content 3</pn:accordionItem>
+ </pn:accordion>
+ </h:form>
+ </ui:define>
+</ui:composition>
+</body>
+</html>
+
Added: trunk/examples/output-demo/src/main/webapp/qunit/accordion.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/qunit/accordion.xhtml (rev 0)
+++ trunk/examples/output-demo/src/main/webapp/qunit/accordion.xhtml 2010-08-13 14:12:36 UTC (rev 18621)
@@ -0,0 +1,90 @@
+<!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"
+ xmlns:pn="http://richfaces.org/output">
+
+<body>
+<ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="scripts">
+ <h:outputScript name="qunit/qunit.js" />
+ <h:outputScript name="qunit/richfaces-qunit.js" />
+
+ <!--<h:outputScript name="richfaces-event.js" />-->
+ <!--<h:outputScript name="richfaces-base-component.js" />-->
+ <!--<h:outputScript name="richfaces.js" />-->
+ <!--<h:outputScript name="TogglePanel.js" />-->
+ <!--<h:outputScript name="TogglePanelItem.js" />-->
+ <!--<h:outputScript name="TogglePanelTitledItem.js" />-->
+ <!--<h:outputScript name="AccordionItem.js" />-->
+ <!--<h:outputScript name="Accordion.js" />-->
+
+ <h:outputStylesheet name="qunit/qunit.css" />
+ </ui:define>
+
+ <ui:define name="title">Accordion Example</ui:define>
+ <ui:define name="body_head">Accordion Example</ui:define>
+
+ <ui:define name="body">
+ <p>Page</p>
+
+ <h:form id="f" style="border:blue solid thin;">
+ <pn:accordion id="panel" style="padding: 0px; height: 400px; width: 500px;" switchType="ajax">
+ <pn:accordionItem header="label 1">content 1</pn:accordionItem>
+ <pn:accordionItem header="label 2">content 2</pn:accordionItem>
+ <pn:accordionItem header="label 3">content 3</pn:accordionItem>
+ </pn:accordion>
+ </h:form>
+
+<!-- <h:form id="f" style="border:blue solid thin;">
+ <div id="f:panel" style="padding: 0px; height: 400px; width: 500px;" class="rich-panelbar rich-panelbar-b">
+ <input type="hidden" id="f:panel-value" />
+ <div id="f:name1" class="rich-panelbar rich-panelbar-interior ">
+ <div id="f:name1-header" class="rich-panelbar-header">label 1</div>
+ <div id="f:name1-content" style="display: block; width: 100%; overflow: auto;"
+ class="rich-panelbar-content-exterior">
+ content 1
+ </div>
+ </div>
+ <div id="f:name2" class="rich-panelbar rich-panelbar-interior ">
+ <div id="f:name2-header" class="rich-panelbar-header">label 2</div>
+ <div id="f:name2-content" style="display: none; width: 100%; overflow: auto;"
+ class="rich-panelbar-content-exterior">
+ content 2
+ </div>
+ </div>
+ <div id="f:name3" class="rich-panelbar rich-panelbar-interior ">
+ <div id="f:name3-header" class="rich-panelbar-header ">label 3</div>
+ <div id="f:name3-content" style="display: none; width: 100%; overflow: auto;"
+ class="rich-panelbar-content-exterior">
+ content 3
+ </div>
+ </div>
+ <script type="text/javascript">
+ new RichFaces.ui.Accordion("f:panel",{
+ "items":[
+ new RichFaces.ui.AccordionItem("f:name1",{"togglePanelId":"f:panel","switchMode":"client","name":"name1"} ),
+ new RichFaces.ui.AccordionItem("f:name2",{"togglePanelId":"f:panel","switchMode":"client","name":"name2"} ),
+ new RichFaces.ui.AccordionItem("f:name3",{"togglePanelId":"f:panel","switchMode":"client","name":"name3"} )] ,
+ "ajax":{"status":"null","incId":"1"} ,
+ "activeItem":"name1",
+ "isKeepHeight": false} )
+ </script>
+ </div>
+ </h:form>-->
+
+ <p>Result</p>
+ <div>
+ <ol id="qunit-tests"></ol>
+
+ <div id="testDiv" style="margin-top:10px; border:1px solid #a0a0a0">Main Test Div</div>
+
+ </div>
+ <h:outputScript name="tests/richfaces-accordion-qunit.js" />
+ </ui:define>
+</ui:composition>
+</body>
+</html>
+
Added: trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-qunit.js
===================================================================
--- trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-qunit.js (rev 0)
+++ trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-qunit.js 2010-08-13 14:12:36 UTC (rev 18621)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+RichFaces.QUnit.run(function() {
+ module("richfaces-accordion");
+
+ var ACCORDION_ID = "f:panel";
+
+ test("RichFaces.ui.Accordion test constructor", function () {
+ var c = RichFaces.$(ACCORDION_ID);
+
+ ok(c instanceof RichFaces.ui.Accordion, "inctance of RichFaces.ui.Accordion");
+ equals(c.id, ACCORDION_ID, "id");
+
+ equals(c.getItems().length, 3, "getItems().length");
+ });
+
+ test("RichFaces.ui.Accordion test public api", function () {
+ var c = RichFaces.$(ACCORDION_ID);
+
+ var PUBLIC_API = [/* ... */];
+
+ for (i in PUBLIC_API) {
+ var funcName = PUBLIC_API[i];
+ ok(c[funcName], funcName + "present in component")
+ // TODO check other functions + check is it function
+ }
+ });
+
+ test("RichFaces.ui.Accordion test events", function () {
+
+ });
+});
Modified: trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-toggle-panel-qunit.js
===================================================================
--- trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-toggle-panel-qunit.js 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-toggle-panel-qunit.js 2010-08-13 14:12:36 UTC (rev 18621)
@@ -19,7 +19,6 @@
ok(c instanceof RichFaces.ui.TogglePanel, "inctance of RichFaces.ui.TogglePanel");
equals(c.componentId, undefined, "componentId shouldn't be here, we must use id form component base");
equals(c.id, TOGGLE_PANEL_ID, "id");
- equals(c.switchMode, "client", "switchMode");
equals(c.activeItem, "name1", "activeItem");
equals(c.items.length, 3, "items");
Modified: trunk/examples/output-demo/src/main/webapp/templates/template.xhtml
===================================================================
--- trunk/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-08-13 14:12:36 UTC (rev 18621)
@@ -30,16 +30,28 @@
<h:form id="nav">
<p>Examples</p>
<ul>
- <li><h:commandLink value="togglePanel" action="togglePanel" /></li>
- <li><h:commandLink value="togglePanel Ajax" action="togglePanel/ajax" /></li>
- <li><h:commandLink value="togglePanel Client" action="togglePanel/client" /></li>
- <li><h:commandLink value="togglePanel Server" action="togglePanel/server" /></li>
- <li><h:commandLink value="togglePanel Mixed" action="togglePanel/mixed" /></li>
+ <li>
+ <p>Toggle Panel</p>
+ <ul>
+ <li><h:commandLink value="togglePanel" action="togglePanel" /></li>
+ <li><h:commandLink value="togglePanel Ajax" action="togglePanel/ajax" /></li>
+ <li><h:commandLink value="togglePanel Client" action="togglePanel/client" /></li>
+ <li><h:commandLink value="togglePanel Server" action="togglePanel/server" /></li>
+ <li><h:commandLink value="togglePanel Mixed" action="togglePanel/mixed" /></li>
+ </ul>
+ </li>
+ <li>
+ <p>Accordion</p>
+ <ul>
+ <li><h:commandLink value="accordion" action="accordion" /></li>
+ </ul>
+ </li>
</ul>
<p>QUnit</p>
<ul>
<li><h:commandLink value="togglePanel" action="qunit/togglePanel" /></li>
<li><h:commandLink value="togglePanelItem" action="qunit/togglePanelItem" /></li>
+ <li><h:commandLink value="accordion" action="qunit/accordion" /></li>
</ul>
</h:form>
</td>
Modified: trunk/ui/output/api/pom.xml
===================================================================
--- trunk/ui/output/api/pom.xml 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/ui/output/api/pom.xml 2010-08-13 14:12:36 UTC (rev 18621)
@@ -43,6 +43,7 @@
<dependency>
<groupId>org.richfaces.ui.common</groupId>
<artifactId>richfaces-ui-common-api</artifactId>
+ <version>${org.richfaces.commons.version}</version>
</dependency>
<!-- JSF with dependencies -->
Modified: trunk/ui/output/ui/pom.xml
===================================================================
--- trunk/ui/output/ui/pom.xml 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/ui/output/ui/pom.xml 2010-08-13 14:12:36 UTC (rev 18621)
@@ -56,6 +56,7 @@
<dependency>
<groupId>org.richfaces.ui.common</groupId>
<artifactId>richfaces-ui-common-ui</artifactId>
+ <version>${org.richfaces.commons.version}</version>
</dependency>
<dependency>
<!-- todo remove this dependency -->
Added: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractAccordion.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractAccordion.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractAccordion.java 2010-08-13 14:12:36 UTC (rev 18621)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-05
+ */
+public abstract class AbstractAccordion extends UITogglePanel {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.Accordion";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.Accordion";
+
+ protected AbstractAccordion() {
+ setRendererType("org.richfaces.Accordion");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+
+
+}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-08-13 14:12:36 UTC (rev 18621)
@@ -327,7 +327,7 @@
} catch (Exception e) {
caught = e;
//message = MessageFactory.getMessage(context, UPDATE_MESSAGE_ID,
- // MessageFactory.getLabel(context, this));
+ // MessageFactory.getHeader(context, this));
setValid(false);
}
@@ -501,7 +501,7 @@
return getItemByIndex(getRenderedChildren().size() - 1);
}
- private int getChildIndex(String name) {
+ public int getChildIndex(String name) {
if (name == null) {
throw new IllegalArgumentException("Name is required parameter.");
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java 2010-08-13 14:12:36 UTC (rev 18621)
@@ -54,6 +54,10 @@
return (AbstractTogglePanel) super.getParent();
}
+ public boolean isActive() {
+ return getParent().isActiveItem(this);
+ }
+
@Override
public Renderer getRenderer(FacesContext context) {
return super.getRenderer(context);
@@ -89,7 +93,7 @@
return "<div id=\"" + getClientId() + "\" style=\"display: none\" ></div>";
}
- private static void hidePanelItem(UIComponent item) {
+ protected static void hidePanelItem(UIComponent item) {
//TODO nick - attributes shouldn't be overwritten
item.getAttributes().put(RendererUtils.HTML.STYLE_ATTRIBUTE, "display:none");
}
Added: trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTogglePanelTitledItem.java 2010-08-13 14:12:36 UTC (rev 18621)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import java.io.IOException;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-05
+ */
+public abstract class AbstractTogglePanelTitledItem extends UITogglePanelItem {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.TogglePanelTitledItem";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.TogglePanelTitledItem";
+
+ protected AbstractTogglePanelTitledItem() {
+ setRendererType("org.richfaces.TogglePanelTitledItem");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public abstract boolean isDisabled();
+
+ public abstract String getHeader();
+
+ @Override
+ public String getName() {
+ return (String) getStateHelper().eval(PropertyKeys.name, getId());
+ }
+
+ @Override
+ public void encodeAll(FacesContext context) throws IOException {
+ if (!isRendered()) {
+ return;
+ }
+
+ encodeBegin(context);
+ if (getRendersChildren()) {
+ encodeChildren(context);
+ } else if (this.getChildCount() > 0) {
+ for (UIComponent kid : getChildren()) {
+ kid.encodeAll(context);
+ }
+ }
+
+ encodeEnd(context);
+ }
+}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanel.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanel.java 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanel.java 2010-08-13 14:12:36 UTC (rev 18621)
@@ -26,10 +26,11 @@
/**
* @author akolonitsky
+ * @since 2010-08-13
*/
public class UITogglePanel extends AbstractTogglePanel {
- private enum PropertyKeys {
+ public enum PropertyKeys {
switchType,
bypassUpdates,
limitToList,
@@ -73,7 +74,7 @@
}
public String getStatus() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.status));
+ return (String) getStateHelper().eval(PropertyKeys.status);
}
public void setStatus(String status) {
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java 2010-08-13 14:12:36 UTC (rev 18621)
@@ -22,26 +22,27 @@
package org.richfaces.component;
+
+
/**
* @author akolonitsky
+ * @since 2010-08-13
*/
public class UITogglePanelItem extends AbstractTogglePanelItem {
- private enum PropertyKeys {
+ public enum PropertyKeys {
name,
switchType
}
- @Override
public String getName() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.name));
+ return (String) getStateHelper().eval(PropertyKeys.name);
}
public void setName(String name) {
getStateHelper().put(PropertyKeys.name, name);
}
- @Override
public SwitchType getSwitchType() {
return (SwitchType) getStateHelper().eval(PropertyKeys.switchType, getParent().getSwitchType());
}
@@ -49,4 +50,6 @@
public void setSwitchType(SwitchType switchType) {
getStateHelper().put(PropertyKeys.switchType, switchType);
}
+
+
}
Added: trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelTitledItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelTitledItem.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/UITogglePanelTitledItem.java 2010-08-13 14:12:36 UTC (rev 18621)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-13
+ */
+public class UITogglePanelTitledItem extends AbstractTogglePanelTitledItem {
+
+ public enum PropertyKeys {
+ disabled,
+ header
+ }
+
+ public boolean isDisabled() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.disabled)));
+ }
+
+ public void setDisabled(boolean disabled) {
+ getStateHelper().put(PropertyKeys.disabled, disabled);
+ }
+
+ public String getHeader() {
+ return (String) getStateHelper().eval(PropertyKeys.header);
+ }
+
+ public void setHeader(String header) {
+ getStateHelper().put(PropertyKeys.header, header);
+ }
+
+
+}
Added: trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordion.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordion.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordion.java 2010-08-13 14:12:36 UTC (rev 18621)
@@ -0,0 +1,245 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component.html;
+
+import org.richfaces.component.AbstractAccordion;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-13
+ */
+public class HtmlAccordion extends AbstractAccordion implements ClientBehaviorHolder {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.Accordion";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.Accordion";
+
+ private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
+ "itemchange",
+ "beforeitemchange",
+ "click",
+ "dblclick",
+ "mousedown",
+ "mousemove",
+ "mouseout",
+ "mouseover",
+ "mouseup"
+ ));
+
+
+ public enum PropertyKeys {
+ itemHeaderClassActive,
+ itemHeaderClassDisabled,
+ itemHeaderClassInactive,
+ itemContentClass,
+ itemHeaderClass,
+ onitemchange,
+ onbeforeitemchange,
+ lang,
+ title,
+ style,
+ styleClass,
+ dir,
+ onclick,
+ ondblclick,
+ onmousedown,
+ onmousemove,
+ onmouseout,
+ onmouseover,
+ onmouseup
+ }
+
+ public HtmlAccordion() {
+ setRendererType("org.richfaces.Accordion");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public String getItemHeaderClassActive() {
+ return (String) getStateHelper().eval(PropertyKeys.itemHeaderClassActive);
+ }
+
+ public void setItemHeaderClassActive(String itemHeaderClassActive) {
+ getStateHelper().put(PropertyKeys.itemHeaderClassActive, itemHeaderClassActive);
+ }
+
+ public String getItemHeaderClassDisabled() {
+ return (String) getStateHelper().eval(PropertyKeys.itemHeaderClassDisabled);
+ }
+
+ public void setItemHeaderClassDisabled(String itemHeaderClassDisabled) {
+ getStateHelper().put(PropertyKeys.itemHeaderClassDisabled, itemHeaderClassDisabled);
+ }
+
+ public String getItemHeaderClassInactive() {
+ return (String) getStateHelper().eval(PropertyKeys.itemHeaderClassInactive);
+ }
+
+ public void setItemHeaderClassInactive(String itemHeaderClassInactive) {
+ getStateHelper().put(PropertyKeys.itemHeaderClassInactive, itemHeaderClassInactive);
+ }
+
+ public String getItemContentClass() {
+ return (String) getStateHelper().eval(PropertyKeys.itemContentClass);
+ }
+
+ public void setItemContentClass(String itemContentClass) {
+ getStateHelper().put(PropertyKeys.itemContentClass, itemContentClass);
+ }
+
+ public String getItemHeaderClass() {
+ return (String) getStateHelper().eval(PropertyKeys.itemHeaderClass);
+ }
+
+ public void setItemHeaderClass(String itemHeaderClass) {
+ getStateHelper().put(PropertyKeys.itemHeaderClass, itemHeaderClass);
+ }
+
+ public String getOnitemchange() {
+ return (String) getStateHelper().eval(PropertyKeys.onitemchange);
+ }
+
+ public void setOnitemchange(String onitemchange) {
+ getStateHelper().put(PropertyKeys.onitemchange, onitemchange);
+ }
+
+ public String getOnbeforeitemchange() {
+ return (String) getStateHelper().eval(PropertyKeys.onbeforeitemchange);
+ }
+
+ public void setOnbeforeitemchange(String onbeforeitemchange) {
+ getStateHelper().put(PropertyKeys.onbeforeitemchange, onbeforeitemchange);
+ }
+
+ public String getLang() {
+ return (String) getStateHelper().eval(PropertyKeys.lang);
+ }
+
+ public void setLang(String lang) {
+ getStateHelper().put(PropertyKeys.lang, lang);
+ }
+
+ public String getTitle() {
+ return (String) getStateHelper().eval(PropertyKeys.title);
+ }
+
+ public void setTitle(String title) {
+ getStateHelper().put(PropertyKeys.title, title);
+ }
+
+ public String getStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.style);
+ }
+
+ public void setStyle(String style) {
+ getStateHelper().put(PropertyKeys.style, style);
+ }
+
+ public String getStyleClass() {
+ return (String) getStateHelper().eval(PropertyKeys.styleClass);
+ }
+
+ public void setStyleClass(String styleClass) {
+ getStateHelper().put(PropertyKeys.styleClass, styleClass);
+ }
+
+ public String getDir() {
+ return (String) getStateHelper().eval(PropertyKeys.dir);
+ }
+
+ public void setDir(String dir) {
+ getStateHelper().put(PropertyKeys.dir, dir);
+ }
+
+ public String getOnclick() {
+ return (String) getStateHelper().eval(PropertyKeys.onclick);
+ }
+
+ public void setOnclick(String onclick) {
+ getStateHelper().put(PropertyKeys.onclick, onclick);
+ }
+
+ public String getOndblclick() {
+ return (String) getStateHelper().eval(PropertyKeys.ondblclick);
+ }
+
+ public void setOndblclick(String ondblclick) {
+ getStateHelper().put(PropertyKeys.ondblclick, ondblclick);
+ }
+
+ public String getOnmousedown() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousedown);
+ }
+
+ public void setOnmousedown(String onmousedown) {
+ getStateHelper().put(PropertyKeys.onmousedown, onmousedown);
+ }
+
+ public String getOnmousemove() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousemove);
+ }
+
+ public void setOnmousemove(String onmousemove) {
+ getStateHelper().put(PropertyKeys.onmousemove, onmousemove);
+ }
+
+ public String getOnmouseout() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseout);
+ }
+
+ public void setOnmouseout(String onmouseout) {
+ getStateHelper().put(PropertyKeys.onmouseout, onmouseout);
+ }
+
+ public String getOnmouseover() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseover);
+ }
+
+ public void setOnmouseover(String onmouseover) {
+ getStateHelper().put(PropertyKeys.onmouseover, onmouseover);
+ }
+
+ public String getOnmouseup() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseup);
+ }
+
+ public void setOnmouseup(String onmouseup) {
+ getStateHelper().put(PropertyKeys.onmouseup, onmouseup);
+ }
+
+
+
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
+ }
+}
+
Added: trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordionItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordionItem.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlAccordionItem.java 2010-08-13 14:12:36 UTC (rev 18621)
@@ -0,0 +1,304 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component.html;
+
+import org.richfaces.component.UITogglePanelTitledItem;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-13
+ */
+public class HtmlAccordionItem extends UITogglePanelTitledItem implements ClientBehaviorHolder {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.TogglePanelTitledItem";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.TogglePanelTitledItem";
+
+ private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
+ "headerclick",
+ "headerdblclick",
+ "headermousedown",
+ "headermousemove",
+ "headermouseup",
+ "enter",
+ "leave",
+ "click",
+ "dblclick",
+ "mousedown",
+ "mousemove",
+ "mouseout",
+ "mouseover",
+ "mouseup"
+ ));
+
+
+ public enum PropertyKeys {
+ headerClassActive,
+ headerClassDisabled,
+ headerClassInactive,
+ headerClass,
+ headerStyle,
+ contentClass,
+ onheaderclick,
+ onheaderdblclick,
+ onheadermousedown,
+ onheadermousemove,
+ onheadermouseup,
+ onenter,
+ onleave,
+ lang,
+ title,
+ style,
+ styleClass,
+ dir,
+ onclick,
+ ondblclick,
+ onmousedown,
+ onmousemove,
+ onmouseout,
+ onmouseover,
+ onmouseup
+ }
+
+ public HtmlAccordionItem() {
+ setRendererType("org.richfaces.AccordionItem");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public String getHeaderClassActive() {
+ return (String) getStateHelper().eval(PropertyKeys.headerClassActive);
+ }
+
+ public void setHeaderClassActive(String headerClassActive) {
+ getStateHelper().put(PropertyKeys.headerClassActive, headerClassActive);
+ }
+
+ public String getHeaderClassDisabled() {
+ return (String) getStateHelper().eval(PropertyKeys.headerClassDisabled);
+ }
+
+ public void setHeaderClassDisabled(String headerClassDisabled) {
+ getStateHelper().put(PropertyKeys.headerClassDisabled, headerClassDisabled);
+ }
+
+ public String getHeaderClassInactive() {
+ return (String) getStateHelper().eval(PropertyKeys.headerClassInactive);
+ }
+
+ public void setHeaderClassInactive(String headerClassInactive) {
+ getStateHelper().put(PropertyKeys.headerClassInactive, headerClassInactive);
+ }
+
+ public String getHeaderClass() {
+ return (String) getStateHelper().eval(PropertyKeys.headerClass);
+ }
+
+ public void setHeaderClass(String headerClass) {
+ getStateHelper().put(PropertyKeys.headerClass, headerClass);
+ }
+
+ public String getHeaderStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.headerStyle);
+ }
+
+ public void setHeaderStyle(String headerStyle) {
+ getStateHelper().put(PropertyKeys.headerStyle, headerStyle);
+ }
+
+ public String getContentClass() {
+ return (String) getStateHelper().eval(PropertyKeys.contentClass);
+ }
+
+ public void setContentClass(String contentClass) {
+ getStateHelper().put(PropertyKeys.contentClass, contentClass);
+ }
+
+ public String getOnheaderclick() {
+ return (String) getStateHelper().eval(PropertyKeys.onheaderclick);
+ }
+
+ public void setOnheaderclick(String onheaderclick) {
+ getStateHelper().put(PropertyKeys.onheaderclick, onheaderclick);
+ }
+
+ public String getOnheaderdblclick() {
+ return (String) getStateHelper().eval(PropertyKeys.onheaderdblclick);
+ }
+
+ public void setOnheaderdblclick(String onheaderdblclick) {
+ getStateHelper().put(PropertyKeys.onheaderdblclick, onheaderdblclick);
+ }
+
+ public String getOnheadermousedown() {
+ return (String) getStateHelper().eval(PropertyKeys.onheadermousedown);
+ }
+
+ public void setOnheadermousedown(String onheadermousedown) {
+ getStateHelper().put(PropertyKeys.onheadermousedown, onheadermousedown);
+ }
+
+ public String getOnheadermousemove() {
+ return (String) getStateHelper().eval(PropertyKeys.onheadermousemove);
+ }
+
+ public void setOnheadermousemove(String onheadermousemove) {
+ getStateHelper().put(PropertyKeys.onheadermousemove, onheadermousemove);
+ }
+
+ public String getOnheadermouseup() {
+ return (String) getStateHelper().eval(PropertyKeys.onheadermouseup);
+ }
+
+ public void setOnheadermouseup(String onheadermouseup) {
+ getStateHelper().put(PropertyKeys.onheadermouseup, onheadermouseup);
+ }
+
+ public String getOnenter() {
+ return (String) getStateHelper().eval(PropertyKeys.onenter);
+ }
+
+ public void setOnenter(String onenter) {
+ getStateHelper().put(PropertyKeys.onenter, onenter);
+ }
+
+ public String getOnleave() {
+ return (String) getStateHelper().eval(PropertyKeys.onleave);
+ }
+
+ public void setOnleave(String onleave) {
+ getStateHelper().put(PropertyKeys.onleave, onleave);
+ }
+
+ public String getLang() {
+ return (String) getStateHelper().eval(PropertyKeys.lang);
+ }
+
+ public void setLang(String lang) {
+ getStateHelper().put(PropertyKeys.lang, lang);
+ }
+
+ public String getTitle() {
+ return (String) getStateHelper().eval(PropertyKeys.title);
+ }
+
+ public void setTitle(String title) {
+ getStateHelper().put(PropertyKeys.title, title);
+ }
+
+ public String getStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.style);
+ }
+
+ public void setStyle(String style) {
+ getStateHelper().put(PropertyKeys.style, style);
+ }
+
+ public String getStyleClass() {
+ return (String) getStateHelper().eval(PropertyKeys.styleClass);
+ }
+
+ public void setStyleClass(String styleClass) {
+ getStateHelper().put(PropertyKeys.styleClass, styleClass);
+ }
+
+ public String getDir() {
+ return (String) getStateHelper().eval(PropertyKeys.dir);
+ }
+
+ public void setDir(String dir) {
+ getStateHelper().put(PropertyKeys.dir, dir);
+ }
+
+ public String getOnclick() {
+ return (String) getStateHelper().eval(PropertyKeys.onclick);
+ }
+
+ public void setOnclick(String onclick) {
+ getStateHelper().put(PropertyKeys.onclick, onclick);
+ }
+
+ public String getOndblclick() {
+ return (String) getStateHelper().eval(PropertyKeys.ondblclick);
+ }
+
+ public void setOndblclick(String ondblclick) {
+ getStateHelper().put(PropertyKeys.ondblclick, ondblclick);
+ }
+
+ public String getOnmousedown() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousedown);
+ }
+
+ public void setOnmousedown(String onmousedown) {
+ getStateHelper().put(PropertyKeys.onmousedown, onmousedown);
+ }
+
+ public String getOnmousemove() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousemove);
+ }
+
+ public void setOnmousemove(String onmousemove) {
+ getStateHelper().put(PropertyKeys.onmousemove, onmousemove);
+ }
+
+ public String getOnmouseout() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseout);
+ }
+
+ public void setOnmouseout(String onmouseout) {
+ getStateHelper().put(PropertyKeys.onmouseout, onmouseout);
+ }
+
+ public String getOnmouseover() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseover);
+ }
+
+ public void setOnmouseover(String onmouseover) {
+ getStateHelper().put(PropertyKeys.onmouseover, onmouseover);
+ }
+
+ public String getOnmouseup() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseup);
+ }
+
+ public void setOnmouseup(String onmouseup) {
+ getStateHelper().put(PropertyKeys.onmouseup, onmouseup);
+ }
+
+
+
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
+ }
+}
+
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlDivPanel.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlDivPanel.java 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlDivPanel.java 2010-08-13 14:12:36 UTC (rev 18621)
@@ -22,28 +22,47 @@
package org.richfaces.component.html;
-
import org.richfaces.component.AbstractDivPanel;
+import javax.faces.component.behavior.ClientBehaviorHolder;
-public class HtmlDivPanel extends AbstractDivPanel {
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+/**
+ * @author akolonitsky
+ * @since 2010-08-13
+ */
+public class HtmlDivPanel extends AbstractDivPanel implements ClientBehaviorHolder {
+
public static final String COMPONENT_TYPE = "org.richfaces.DivPanel";
public static final String COMPONENT_FAMILY = "org.richfaces.DivPanel";
- private enum PropertyKeys {
+ private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
+ "click",
+ "dblclick",
+ "mousedown",
+ "mousemove",
+ "mouseout",
+ "mouseover",
+ "mouseup"
+ ));
+
+
+ public enum PropertyKeys {
lang,
+ title,
+ style,
+ styleClass,
+ dir,
onclick,
ondblclick,
onmousedown,
onmousemove,
onmouseout,
onmouseover,
- onmouseup,
- title,
- style,
- styleClass,
- dir
+ onmouseup
}
public HtmlDivPanel() {
@@ -56,15 +75,47 @@
}
public String getLang() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.lang));
+ return (String) getStateHelper().eval(PropertyKeys.lang);
}
public void setLang(String lang) {
getStateHelper().put(PropertyKeys.lang, lang);
}
+ public String getTitle() {
+ return (String) getStateHelper().eval(PropertyKeys.title);
+ }
+
+ public void setTitle(String title) {
+ getStateHelper().put(PropertyKeys.title, title);
+ }
+
+ public String getStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.style);
+ }
+
+ public void setStyle(String style) {
+ getStateHelper().put(PropertyKeys.style, style);
+ }
+
+ public String getStyleClass() {
+ return (String) getStateHelper().eval(PropertyKeys.styleClass);
+ }
+
+ public void setStyleClass(String styleClass) {
+ getStateHelper().put(PropertyKeys.styleClass, styleClass);
+ }
+
+ public String getDir() {
+ return (String) getStateHelper().eval(PropertyKeys.dir);
+ }
+
+ public void setDir(String dir) {
+ getStateHelper().put(PropertyKeys.dir, dir);
+ }
+
public String getOnclick() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onclick));
+ return (String) getStateHelper().eval(PropertyKeys.onclick);
}
public void setOnclick(String onclick) {
@@ -72,7 +123,7 @@
}
public String getOndblclick() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.ondblclick));
+ return (String) getStateHelper().eval(PropertyKeys.ondblclick);
}
public void setOndblclick(String ondblclick) {
@@ -80,7 +131,7 @@
}
public String getOnmousedown() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onmousedown));
+ return (String) getStateHelper().eval(PropertyKeys.onmousedown);
}
public void setOnmousedown(String onmousedown) {
@@ -88,7 +139,7 @@
}
public String getOnmousemove() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onmousemove));
+ return (String) getStateHelper().eval(PropertyKeys.onmousemove);
}
public void setOnmousemove(String onmousemove) {
@@ -96,7 +147,7 @@
}
public String getOnmouseout() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onmouseout));
+ return (String) getStateHelper().eval(PropertyKeys.onmouseout);
}
public void setOnmouseout(String onmouseout) {
@@ -104,7 +155,7 @@
}
public String getOnmouseover() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onmouseover));
+ return (String) getStateHelper().eval(PropertyKeys.onmouseover);
}
public void setOnmouseover(String onmouseover) {
@@ -112,45 +163,18 @@
}
public String getOnmouseup() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onmouseup));
+ return (String) getStateHelper().eval(PropertyKeys.onmouseup);
}
public void setOnmouseup(String onmouseup) {
getStateHelper().put(PropertyKeys.onmouseup, onmouseup);
}
- public String getTitle() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.title));
- }
- public void setTitle(String title) {
- getStateHelper().put(PropertyKeys.title, title);
- }
- public String getStyle() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.style));
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
}
-
- public void setStyle(String style) {
- getStateHelper().put(PropertyKeys.style, style);
- }
-
- public String getStyleClass() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.styleClass));
- }
-
- public void setStyleClass(String styleClass) {
- getStateHelper().put(PropertyKeys.styleClass, styleClass);
- }
-
- public String getDir() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.dir));
- }
-
- public void setDir(String dir) {
- getStateHelper().put(PropertyKeys.dir, dir);
- }
-
-
}
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanel.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanel.java 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanel.java 2010-08-13 14:12:36 UTC (rev 18621)
@@ -23,49 +23,50 @@
package org.richfaces.component.html;
import org.richfaces.component.UITogglePanel;
-
import javax.faces.component.behavior.ClientBehaviorHolder;
+
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-// TODO nick - no behaviors support! check Push renderer to implement
+/**
+ * @author akolonitsky
+ * @since 2010-08-13
+ */
public class HtmlTogglePanel extends UITogglePanel implements ClientBehaviorHolder {
- // todo Html prefix
public static final String COMPONENT_TYPE = "org.richfaces.TogglePanel";
public static final String COMPONENT_FAMILY = "org.richfaces.TogglePanel";
private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
+ "itemchange",
+ "beforeitemchange",
"click",
"dblclick",
"mousedown",
"mousemove",
"mouseout",
"mouseover",
- "mouseup",
- "complete",
- "beforedomupdate"
+ "mouseup"
));
- private enum PropertyKeys {
+
+ public enum PropertyKeys {
+ onitemchange,
+ onbeforeitemchange,
lang,
+ title,
+ style,
+ styleClass,
+ dir,
onclick,
ondblclick,
onmousedown,
onmousemove,
onmouseout,
onmouseover,
- onmouseup,
- title,
- style,
- styleClass,
- dir,
- oncomplete,
- onbeforedomupdate,
- onitemchange,
- onitemchanged
+ onmouseup
}
public HtmlTogglePanel() {
@@ -77,16 +78,64 @@
return COMPONENT_FAMILY;
}
+ public String getOnitemchange() {
+ return (String) getStateHelper().eval(PropertyKeys.onitemchange);
+ }
+
+ public void setOnitemchange(String onitemchange) {
+ getStateHelper().put(PropertyKeys.onitemchange, onitemchange);
+ }
+
+ public String getOnbeforeitemchange() {
+ return (String) getStateHelper().eval(PropertyKeys.onbeforeitemchange);
+ }
+
+ public void setOnbeforeitemchange(String onbeforeitemchange) {
+ getStateHelper().put(PropertyKeys.onbeforeitemchange, onbeforeitemchange);
+ }
+
public String getLang() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.lang));
+ return (String) getStateHelper().eval(PropertyKeys.lang);
}
public void setLang(String lang) {
getStateHelper().put(PropertyKeys.lang, lang);
}
+ public String getTitle() {
+ return (String) getStateHelper().eval(PropertyKeys.title);
+ }
+
+ public void setTitle(String title) {
+ getStateHelper().put(PropertyKeys.title, title);
+ }
+
+ public String getStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.style);
+ }
+
+ public void setStyle(String style) {
+ getStateHelper().put(PropertyKeys.style, style);
+ }
+
+ public String getStyleClass() {
+ return (String) getStateHelper().eval(PropertyKeys.styleClass);
+ }
+
+ public void setStyleClass(String styleClass) {
+ getStateHelper().put(PropertyKeys.styleClass, styleClass);
+ }
+
+ public String getDir() {
+ return (String) getStateHelper().eval(PropertyKeys.dir);
+ }
+
+ public void setDir(String dir) {
+ getStateHelper().put(PropertyKeys.dir, dir);
+ }
+
public String getOnclick() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onclick));
+ return (String) getStateHelper().eval(PropertyKeys.onclick);
}
public void setOnclick(String onclick) {
@@ -94,7 +143,7 @@
}
public String getOndblclick() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.ondblclick));
+ return (String) getStateHelper().eval(PropertyKeys.ondblclick);
}
public void setOndblclick(String ondblclick) {
@@ -102,7 +151,7 @@
}
public String getOnmousedown() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onmousedown));
+ return (String) getStateHelper().eval(PropertyKeys.onmousedown);
}
public void setOnmousedown(String onmousedown) {
@@ -110,7 +159,7 @@
}
public String getOnmousemove() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onmousemove));
+ return (String) getStateHelper().eval(PropertyKeys.onmousemove);
}
public void setOnmousemove(String onmousemove) {
@@ -118,7 +167,7 @@
}
public String getOnmouseout() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onmouseout));
+ return (String) getStateHelper().eval(PropertyKeys.onmouseout);
}
public void setOnmouseout(String onmouseout) {
@@ -126,7 +175,7 @@
}
public String getOnmouseover() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onmouseover));
+ return (String) getStateHelper().eval(PropertyKeys.onmouseover);
}
public void setOnmouseover(String onmouseover) {
@@ -134,79 +183,18 @@
}
public String getOnmouseup() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onmouseup));
+ return (String) getStateHelper().eval(PropertyKeys.onmouseup);
}
public void setOnmouseup(String onmouseup) {
getStateHelper().put(PropertyKeys.onmouseup, onmouseup);
}
- public String getTitle() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.title));
- }
- public void setTitle(String title) {
- getStateHelper().put(PropertyKeys.title, title);
- }
- public String getStyle() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.style));
- }
-
- public void setStyle(String style) {
- getStateHelper().put(PropertyKeys.style, style);
- }
-
- public String getStyleClass() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.styleClass));
- }
-
- public void setStyleClass(String styleClass) {
- getStateHelper().put(PropertyKeys.styleClass, styleClass);
- }
-
- public String getDir() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.dir));
- }
-
- public void setDir(String dir) {
- getStateHelper().put(PropertyKeys.dir, dir);
- }
-
- public String getOncomplete() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.oncomplete));
- }
-
- public void setOncomplete(String oncomplete) {
- getStateHelper().put(PropertyKeys.oncomplete, oncomplete);
- }
-
- public String getOnbeforedomupdate() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onbeforedomupdate));
- }
-
- public void setOnbeforedomupdate(String onbeforedomupdate) {
- getStateHelper().put(PropertyKeys.onbeforedomupdate, onbeforedomupdate);
- }
-
- public String getOnitemchange() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onitemchange));
- }
-
- public void setOnitemchange(String onitemchange) {
- getStateHelper().put(PropertyKeys.onitemchange, onitemchange);
- }
-
- public String getOnitemchanged() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onitemchanged));
- }
-
- public void setOnitemchanged(String onitemchanged) {
- getStateHelper().put(PropertyKeys.onitemchanged, onitemchanged);
- }
-
@Override
public Collection<String> getEventNames() {
return EVENT_NAMES;
}
}
+
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanelItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanelItem.java 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanelItem.java 2010-08-13 14:12:36 UTC (rev 18621)
@@ -23,13 +23,16 @@
package org.richfaces.component.html;
import org.richfaces.component.UITogglePanelItem;
+import javax.faces.component.behavior.ClientBehaviorHolder;
-import javax.faces.component.behavior.ClientBehaviorHolder;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-// TODO nick - no behaviors support!
+/**
+ * @author akolonitsky
+ * @since 2010-08-13
+ */
public class HtmlTogglePanelItem extends UITogglePanelItem implements ClientBehaviorHolder {
public static final String COMPONENT_TYPE = "org.richfaces.TogglePanelItem";
@@ -37,6 +40,8 @@
public static final String COMPONENT_FAMILY = "org.richfaces.TogglePanelItem";
private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
+ "enter",
+ "leave",
"click",
"dblclick",
"mousedown",
@@ -46,21 +51,22 @@
"mouseup"
));
- private enum PropertyKeys {
+
+ public enum PropertyKeys {
+ onenter,
+ onleave,
lang,
+ title,
+ style,
+ styleClass,
+ dir,
onclick,
ondblclick,
onmousedown,
onmousemove,
onmouseout,
onmouseover,
- onmouseup,
- title,
- style,
- styleClass,
- dir,
- onenter,
- onleave
+ onmouseup
}
public HtmlTogglePanelItem() {
@@ -72,16 +78,64 @@
return COMPONENT_FAMILY;
}
+ public String getOnenter() {
+ return (String) getStateHelper().eval(PropertyKeys.onenter);
+ }
+
+ public void setOnenter(String onenter) {
+ getStateHelper().put(PropertyKeys.onenter, onenter);
+ }
+
+ public String getOnleave() {
+ return (String) getStateHelper().eval(PropertyKeys.onleave);
+ }
+
+ public void setOnleave(String onleave) {
+ getStateHelper().put(PropertyKeys.onleave, onleave);
+ }
+
public String getLang() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.lang));
+ return (String) getStateHelper().eval(PropertyKeys.lang);
}
public void setLang(String lang) {
getStateHelper().put(PropertyKeys.lang, lang);
}
+ public String getTitle() {
+ return (String) getStateHelper().eval(PropertyKeys.title);
+ }
+
+ public void setTitle(String title) {
+ getStateHelper().put(PropertyKeys.title, title);
+ }
+
+ public String getStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.style);
+ }
+
+ public void setStyle(String style) {
+ getStateHelper().put(PropertyKeys.style, style);
+ }
+
+ public String getStyleClass() {
+ return (String) getStateHelper().eval(PropertyKeys.styleClass);
+ }
+
+ public void setStyleClass(String styleClass) {
+ getStateHelper().put(PropertyKeys.styleClass, styleClass);
+ }
+
+ public String getDir() {
+ return (String) getStateHelper().eval(PropertyKeys.dir);
+ }
+
+ public void setDir(String dir) {
+ getStateHelper().put(PropertyKeys.dir, dir);
+ }
+
public String getOnclick() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onclick));
+ return (String) getStateHelper().eval(PropertyKeys.onclick);
}
public void setOnclick(String onclick) {
@@ -89,7 +143,7 @@
}
public String getOndblclick() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.ondblclick));
+ return (String) getStateHelper().eval(PropertyKeys.ondblclick);
}
public void setOndblclick(String ondblclick) {
@@ -97,7 +151,7 @@
}
public String getOnmousedown() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onmousedown));
+ return (String) getStateHelper().eval(PropertyKeys.onmousedown);
}
public void setOnmousedown(String onmousedown) {
@@ -105,7 +159,7 @@
}
public String getOnmousemove() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onmousemove));
+ return (String) getStateHelper().eval(PropertyKeys.onmousemove);
}
public void setOnmousemove(String onmousemove) {
@@ -113,7 +167,7 @@
}
public String getOnmouseout() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onmouseout));
+ return (String) getStateHelper().eval(PropertyKeys.onmouseout);
}
public void setOnmouseout(String onmouseout) {
@@ -121,7 +175,7 @@
}
public String getOnmouseover() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onmouseover));
+ return (String) getStateHelper().eval(PropertyKeys.onmouseover);
}
public void setOnmouseover(String onmouseover) {
@@ -129,61 +183,15 @@
}
public String getOnmouseup() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onmouseup));
+ return (String) getStateHelper().eval(PropertyKeys.onmouseup);
}
public void setOnmouseup(String onmouseup) {
getStateHelper().put(PropertyKeys.onmouseup, onmouseup);
}
- public String getTitle() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.title));
- }
- public void setTitle(String title) {
- getStateHelper().put(PropertyKeys.title, title);
- }
- public String getStyle() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.style));
- }
-
- public void setStyle(String style) {
- getStateHelper().put(PropertyKeys.style, style);
- }
-
- public String getStyleClass() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.styleClass));
- }
-
- public void setStyleClass(String styleClass) {
- getStateHelper().put(PropertyKeys.styleClass, styleClass);
- }
-
- public String getDir() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.dir));
- }
-
- public void setDir(String dir) {
- getStateHelper().put(PropertyKeys.dir, dir);
- }
-
- public String getOnenter() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onenter));
- }
-
- public void setOnenter(String onenter) {
- getStateHelper().put(PropertyKeys.onenter, onenter);
- }
-
- public String getOnleave() {
- return String.valueOf(getStateHelper().eval(PropertyKeys.onleave));
- }
-
- public void setOnleave(String onleave) {
- getStateHelper().put(PropertyKeys.onleave, onleave);
- }
-
@Override
public Collection<String> getEventNames() {
return EVENT_NAMES;
Added: trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanelTitledItem.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanelTitledItem.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanelTitledItem.java 2010-08-13 14:12:36 UTC (rev 18621)
@@ -0,0 +1,304 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component.html;
+
+import org.richfaces.component.UITogglePanelTitledItem;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-13
+ */
+public class HtmlTogglePanelTitledItem extends UITogglePanelTitledItem implements ClientBehaviorHolder {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.TogglePanelTitledItem";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.TogglePanelTitledItem";
+
+ private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
+ "headerclick",
+ "headerdblclick",
+ "headermousedown",
+ "headermousemove",
+ "headermouseup",
+ "enter",
+ "leave",
+ "click",
+ "dblclick",
+ "mousedown",
+ "mousemove",
+ "mouseout",
+ "mouseover",
+ "mouseup"
+ ));
+
+
+ public enum PropertyKeys {
+ headerClassActive,
+ headerClassDisabled,
+ headerClassInactive,
+ headerClass,
+ headerStyle,
+ contentClass,
+ onheaderclick,
+ onheaderdblclick,
+ onheadermousedown,
+ onheadermousemove,
+ onheadermouseup,
+ onenter,
+ onleave,
+ lang,
+ title,
+ style,
+ styleClass,
+ dir,
+ onclick,
+ ondblclick,
+ onmousedown,
+ onmousemove,
+ onmouseout,
+ onmouseover,
+ onmouseup
+ }
+
+ public HtmlTogglePanelTitledItem() {
+ setRendererType("org.richfaces.TogglePanelTitledItem");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public String getHeaderClassActive() {
+ return (String) getStateHelper().eval(PropertyKeys.headerClassActive);
+ }
+
+ public void setHeaderClassActive(String headerClassActive) {
+ getStateHelper().put(PropertyKeys.headerClassActive, headerClassActive);
+ }
+
+ public String getHeaderClassDisabled() {
+ return (String) getStateHelper().eval(PropertyKeys.headerClassDisabled);
+ }
+
+ public void setHeaderClassDisabled(String headerClassDisabled) {
+ getStateHelper().put(PropertyKeys.headerClassDisabled, headerClassDisabled);
+ }
+
+ public String getHeaderClassInactive() {
+ return (String) getStateHelper().eval(PropertyKeys.headerClassInactive);
+ }
+
+ public void setHeaderClassInactive(String headerClassInactive) {
+ getStateHelper().put(PropertyKeys.headerClassInactive, headerClassInactive);
+ }
+
+ public String getHeaderClass() {
+ return (String) getStateHelper().eval(PropertyKeys.headerClass);
+ }
+
+ public void setHeaderClass(String headerClass) {
+ getStateHelper().put(PropertyKeys.headerClass, headerClass);
+ }
+
+ public String getHeaderStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.headerStyle);
+ }
+
+ public void setHeaderStyle(String headerStyle) {
+ getStateHelper().put(PropertyKeys.headerStyle, headerStyle);
+ }
+
+ public String getContentClass() {
+ return (String) getStateHelper().eval(PropertyKeys.contentClass);
+ }
+
+ public void setContentClass(String contentClass) {
+ getStateHelper().put(PropertyKeys.contentClass, contentClass);
+ }
+
+ public String getOnheaderclick() {
+ return (String) getStateHelper().eval(PropertyKeys.onheaderclick);
+ }
+
+ public void setOnheaderclick(String onheaderclick) {
+ getStateHelper().put(PropertyKeys.onheaderclick, onheaderclick);
+ }
+
+ public String getOnheaderdblclick() {
+ return (String) getStateHelper().eval(PropertyKeys.onheaderdblclick);
+ }
+
+ public void setOnheaderdblclick(String onheaderdblclick) {
+ getStateHelper().put(PropertyKeys.onheaderdblclick, onheaderdblclick);
+ }
+
+ public String getOnheadermousedown() {
+ return (String) getStateHelper().eval(PropertyKeys.onheadermousedown);
+ }
+
+ public void setOnheadermousedown(String onheadermousedown) {
+ getStateHelper().put(PropertyKeys.onheadermousedown, onheadermousedown);
+ }
+
+ public String getOnheadermousemove() {
+ return (String) getStateHelper().eval(PropertyKeys.onheadermousemove);
+ }
+
+ public void setOnheadermousemove(String onheadermousemove) {
+ getStateHelper().put(PropertyKeys.onheadermousemove, onheadermousemove);
+ }
+
+ public String getOnheadermouseup() {
+ return (String) getStateHelper().eval(PropertyKeys.onheadermouseup);
+ }
+
+ public void setOnheadermouseup(String onheadermouseup) {
+ getStateHelper().put(PropertyKeys.onheadermouseup, onheadermouseup);
+ }
+
+ public String getOnenter() {
+ return (String) getStateHelper().eval(PropertyKeys.onenter);
+ }
+
+ public void setOnenter(String onenter) {
+ getStateHelper().put(PropertyKeys.onenter, onenter);
+ }
+
+ public String getOnleave() {
+ return (String) getStateHelper().eval(PropertyKeys.onleave);
+ }
+
+ public void setOnleave(String onleave) {
+ getStateHelper().put(PropertyKeys.onleave, onleave);
+ }
+
+ public String getLang() {
+ return (String) getStateHelper().eval(PropertyKeys.lang);
+ }
+
+ public void setLang(String lang) {
+ getStateHelper().put(PropertyKeys.lang, lang);
+ }
+
+ public String getTitle() {
+ return (String) getStateHelper().eval(PropertyKeys.title);
+ }
+
+ public void setTitle(String title) {
+ getStateHelper().put(PropertyKeys.title, title);
+ }
+
+ public String getStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.style);
+ }
+
+ public void setStyle(String style) {
+ getStateHelper().put(PropertyKeys.style, style);
+ }
+
+ public String getStyleClass() {
+ return (String) getStateHelper().eval(PropertyKeys.styleClass);
+ }
+
+ public void setStyleClass(String styleClass) {
+ getStateHelper().put(PropertyKeys.styleClass, styleClass);
+ }
+
+ public String getDir() {
+ return (String) getStateHelper().eval(PropertyKeys.dir);
+ }
+
+ public void setDir(String dir) {
+ getStateHelper().put(PropertyKeys.dir, dir);
+ }
+
+ public String getOnclick() {
+ return (String) getStateHelper().eval(PropertyKeys.onclick);
+ }
+
+ public void setOnclick(String onclick) {
+ getStateHelper().put(PropertyKeys.onclick, onclick);
+ }
+
+ public String getOndblclick() {
+ return (String) getStateHelper().eval(PropertyKeys.ondblclick);
+ }
+
+ public void setOndblclick(String ondblclick) {
+ getStateHelper().put(PropertyKeys.ondblclick, ondblclick);
+ }
+
+ public String getOnmousedown() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousedown);
+ }
+
+ public void setOnmousedown(String onmousedown) {
+ getStateHelper().put(PropertyKeys.onmousedown, onmousedown);
+ }
+
+ public String getOnmousemove() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousemove);
+ }
+
+ public void setOnmousemove(String onmousemove) {
+ getStateHelper().put(PropertyKeys.onmousemove, onmousemove);
+ }
+
+ public String getOnmouseout() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseout);
+ }
+
+ public void setOnmouseout(String onmouseout) {
+ getStateHelper().put(PropertyKeys.onmouseout, onmouseout);
+ }
+
+ public String getOnmouseover() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseover);
+ }
+
+ public void setOnmouseover(String onmouseover) {
+ getStateHelper().put(PropertyKeys.onmouseover, onmouseover);
+ }
+
+ public String getOnmouseup() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseup);
+ }
+
+ public void setOnmouseup(String onmouseup) {
+ getStateHelper().put(PropertyKeys.onmouseup, onmouseup);
+ }
+
+
+
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
+ }
+}
+
Added: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionItemRenderer.java 2010-08-13 14:12:36 UTC (rev 18621)
@@ -0,0 +1,165 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit.html;
+
+import org.ajax4jsf.javascript.JSObject;
+import org.ajax4jsf.renderkit.RendererUtils;
+import org.richfaces.component.AbstractTogglePanelItem;
+import org.richfaces.component.AbstractTogglePanelTitledItem;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+
+/**
+ *
+ * <div id="clientId" class="rf-aci">
+ * <div id="clientId:header" class="rf-aci-h">
+ * <div class="rf-aci-h-inactive">Level 1</div>
+ * <div class="rf-aci-h-active" >Level 1</div>
+ * <div class="rf-aci-h-disabled">Level 1</div>
+ * </div>
+ * <div id="clientId:content" class="rf-aci-c">
+ * Content will be here.
+ * </div>
+ * </div>
+ *
+ * @author akolonitsky
+ * @since 2010-08-05
+ */
+@ResourceDependencies({ // TODO review
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces-event.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library = "org.richfaces", name = "TogglePanelItem.js"),
+ @ResourceDependency(library = "org.richfaces", name = "AccordionItem.js")
+ })
+public class AccordionItemRenderer extends TogglePanelItemRenderer {
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ super.doEncodeBegin(writer, context, component);
+
+ encodeHeader(context, component, writer);
+
+ encodeContentBegin(component, writer);
+ }
+
+ @Override
+ protected String getStyleClass(UIComponent component) {
+ return "rf-aci " + attributeAsString(component, "styleClass");
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ encodeContentEnd(component, writer);
+
+ super.doEncodeEnd(writer, context, component); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ @Override
+ protected void writeJavaScript(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ // todo how to call method from parent of parent class?
+
+ Object script = getScriptObject(context, component);
+ if (script != null) {
+ writer.startElement(RendererUtils.HTML.SCRIPT_ELEM, component);
+ writer.writeAttribute(RendererUtils.HTML.TYPE_ATTR, "text/javascript", "type");
+ writer.writeText(script, null);
+ writer.endElement(RendererUtils.HTML.SCRIPT_ELEM);
+ }
+ }
+
+ private void encodeContentBegin(UIComponent component, ResponseWriter writer) throws IOException {
+ writer.startElement("div", component);
+ writer.writeAttribute("class", "rf-aci-c " + attributeAsString(component, "contentClass"), null);
+ writer.writeAttribute("id", component.getClientId() + ":content", null);
+
+ if (!((AbstractTogglePanelItem) component).isActive()) {
+ writer.writeAttribute("style", "display: none", null);
+ }
+ }
+
+ private void encodeContentEnd(UIComponent component, ResponseWriter responseWriter) throws IOException {
+ responseWriter.endElement("div");
+ }
+
+ private void encodeHeader(FacesContext facesContext, UIComponent component, ResponseWriter responseWriter) throws IOException {
+
+ responseWriter.startElement("div", component);
+ responseWriter.writeAttribute("class", "rf-aci-h " + attributeAsString(component, "contentClass"), null);
+ responseWriter.writeAttribute("id", component.getClientId() + ":header", null);
+
+ AbstractTogglePanelTitledItem titledItem = (AbstractTogglePanelTitledItem) component;
+ boolean isActive = titledItem.isActive();
+ boolean isDisabled = titledItem.isDisabled();
+ encodeHeader(facesContext, component, responseWriter, "inactive", !isActive && !isDisabled);
+ encodeHeader(facesContext, component, responseWriter, "active", isActive && !isDisabled);
+ encodeHeader(facesContext, component, responseWriter, "disable", isDisabled);
+
+ responseWriter.endElement("div");
+ }
+
+ private void encodeHeader(FacesContext facesContext, UIComponent component, ResponseWriter writer,
+ String state, Boolean isDisplay) throws IOException {
+
+ writer.startElement("div", component);
+
+ if (!isDisplay) {
+ writer.writeAttribute("style", "display : none", null);
+ }
+
+ String name = "headerClass" + capitalize(state);
+ writer.writeAttribute("class", "rf-aci-h-" + state + " " + attributeAsString(component, name), name);
+
+
+ UIComponent headerFacet = component.getFacet("header");
+ if (headerFacet != null && headerFacet.isRendered()) {
+ headerFacet.encodeAll(facesContext);
+ } else {
+ Object headerText = component.getAttributes().get("header");
+ if (headerText != null && !headerText.equals("")) {
+ writer.writeText(headerText, null);
+ }
+ }
+
+ writer.endElement("div");
+ }
+
+ @Override
+ protected JSObject getScriptObject(FacesContext context, UIComponent component) {
+ return new JSObject("RichFaces.ui.AccordionItem", component.getClientId(),
+ getScriptObjectOptions(context, component));
+ }
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return AbstractTogglePanelTitledItem.class;
+ }
+}
+
Added: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java (rev 0)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/AccordionRenderer.java 2010-08-13 14:12:36 UTC (rev 18621)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.renderkit.html;
+
+import org.ajax4jsf.javascript.JSObject;
+import org.ajax4jsf.renderkit.RendererUtils;
+import org.richfaces.component.AbstractAccordion;
+
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * @author akolonitsky
+ * @since 2010-08-05
+ */
+@ResourceDependencies( { // TODO review
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library = "org.richfaces", name = "accordion.ecss"),
+ @ResourceDependency(library = "org.richfaces", name = "TogglePanel.js"),
+ @ResourceDependency(library = "org.richfaces", name = "Accordion.js") })
+public class AccordionRenderer extends TogglePanelRenderer {
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ super.doEncodeBegin(writer, context, component);
+
+ writeJavaScript(writer, context, component);
+ }
+
+ @Override
+ protected String getStyleClass(UIComponent component) {
+ return "rf-ac" + attributeAsString(component, "styleClass");
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ writer.endElement(RendererUtils.HTML.DIV_ELEM);
+ }
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return AbstractAccordion.class;
+ }
+
+ @Override
+ protected JSObject getScriptObject(FacesContext context, UIComponent component) {
+ return new JSObject("RichFaces.ui.Accordion",
+ component.getClientId(), getScriptObjectOptions(context, component));
+ }
+
+ @Override
+ protected Map<String, Object> getScriptObjectOptions(FacesContext context, UIComponent component) {
+ Map<String, Object> options = super.getScriptObjectOptions(context, component);
+ options.remove("items");
+
+ return options;
+ }
+}
+
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-08-13 14:12:36 UTC (rev 18621)
@@ -22,17 +22,20 @@
package org.richfaces.renderkit.html;
-import java.io.IOException;
-import java.util.Map;
+import org.ajax4jsf.renderkit.RendererBase;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.richfaces.component.AbstractDivPanel;
+import org.richfaces.renderkit.RenderKitUtils;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+import java.util.Map;
-import org.ajax4jsf.renderkit.RendererBase;
-import org.ajax4jsf.renderkit.RendererUtils;
-import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.AbstractDivPanel;
+import static org.richfaces.component.html.HtmlDivPanel.PropertyKeys.*;
+import static org.richfaces.renderkit.RenderKitUtils.attributes;
+import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
/**
* @author akolonitsky
@@ -40,30 +43,48 @@
*/
public class DivPanelRenderer extends RendererBase {
- public static final String[] ATTRIBUTES = new String[] {
- "lang",
- "onclick",
- "ondblclick",
- "onmousedown",
- "onmousemove",
- "onmouseout",
- "onmouseover",
- "onmouseup",
- "title",
- "style",
- "styleClass",
- "dir",
- };
+ private static final RenderKitUtils.Attributes PASS_THROUGH_ATTRIBUTES0 = attributes(
+ lang,
+ onclick,
+ ondblclick,
+ onmousedown,
+ onmousemove,
+ onmouseout,
+ onmouseover,
+ onmouseup,
+ title,
+ style,
+ dir
+ );
+ protected static String attributeAsString(UIComponent comp, String attr) {
+ Object o = comp.getAttributes().get(attr);
+ return o == null ? "" : o.toString();
+ }
+
+ /**
+ * Capitalize the first character of the given string.
+ *
+ * @param string String to capitalize.
+ * @return Capitalized string.
+ * @throws IllegalArgumentException String is <kk>null</kk> or empty.
+ */
+ protected static String capitalize(final String string) {
+ return Character.toUpperCase(string.charAt(0)) + string.substring(1);
+ }
+
@Override
protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
super.doEncodeBegin(writer, context, component);
writer.startElement(HTML.DIV_ELEM, component);
writer.writeAttribute("id", component.getClientId(context), "clientId");
+ writer.writeAttribute("class", getStyleClass(component), null);
+ renderPassThroughAttributes(context, component, PASS_THROUGH_ATTRIBUTES0);
+ }
- RendererUtils.getInstance()
- .encodeAttributesFromArray(context, component, ATTRIBUTES);
+ protected String getStyleClass(UIComponent component) {
+ return attributeAsString(component, "styleClass");
}
@Override
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelItemRenderer.java 2010-08-13 14:12:36 UTC (rev 18621)
@@ -22,19 +22,19 @@
package org.richfaces.renderkit.html;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.component.AbstractTogglePanel;
+import org.richfaces.component.AbstractTogglePanelItem;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
-import org.ajax4jsf.javascript.JSObject;
-import org.richfaces.component.AbstractTogglePanelItem;
-
/**
* @author akolonitsky
* @since -4712-01-01
@@ -73,6 +73,10 @@
options.put("togglePanelId", panelItem.getParent().getClientId());
options.put("switchMode", panelItem.getSwitchType());
+ AbstractTogglePanelItem item = (AbstractTogglePanelItem) component;
+ AbstractTogglePanel panel = item.getParent();
+ options.put("index", panel.getChildIndex(item.getName()));
+
TogglePanelRenderer.addEventOption(context, component, options, LEAVE);
TogglePanelRenderer.addEventOption(context, component, options, ENTER);
Modified: trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/TogglePanelTagHandler.java
===================================================================
--- trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/TogglePanelTagHandler.java 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/ui/output/ui/src/main/java/org/richfaces/view/facelets/html/TogglePanelTagHandler.java 2010-08-13 14:12:36 UTC (rev 18621)
@@ -22,6 +22,11 @@
package org.richfaces.view.facelets.html;
+import org.richfaces.component.AbstractTogglePanel;
+
+import org.richfaces.event.MethodExpressionItemChangeListener;
+import org.richfaces.event.ItemChangeEvent;
+
import javax.faces.view.facelets.ComponentConfig;
import javax.faces.view.facelets.ComponentHandler;
import javax.faces.view.facelets.FaceletContext;
@@ -31,14 +36,9 @@
import javax.faces.view.facelets.MetadataTarget;
import javax.faces.view.facelets.TagAttribute;
-import org.richfaces.component.AbstractTogglePanel;
-import org.richfaces.event.ItemChangeEvent;
-import org.richfaces.event.MethodExpressionItemChangeListener;
-
/**
* @author akolonitsky
- * @version 1.0
- * @since -4712-01-01
+ * @since 2010-08-13
*/
public class TogglePanelTagHandler extends ComponentHandler {
Modified: trunk/ui/output/ui/src/main/resources/META-INF/MANIFEST.MF
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/MANIFEST.MF 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/ui/output/ui/src/main/resources/META-INF/MANIFEST.MF 2010-08-13 14:12:36 UTC (rev 18621)
@@ -1,3 +1,6 @@
Manifest-Version: 1.0
-Class-Path:
+Archiver-Version: Plexus Archiver
+Created-By: Apache Maven
+Built-By: akolonitsky
+Build-Jdk: 1.6.0_07
Modified: trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-08-13 14:12:36 UTC (rev 18621)
@@ -11,46 +11,86 @@
</behavior>
<component>
- <component-type>org.richfaces.DivPanel</component-type>
- <component-class>org.richfaces.component.html.HtmlDivPanel</component-class>
+ <component-type>org.richfaces.TogglePanel</component-type>
+ <component-class>org.richfaces.component.html.HtmlTogglePanel</component-class>
<property>
<description></description>
- <property-name>lang</property-name>
- <property-class>java.lang.String</property-class>
+ <property-name>switchType</property-name>
+ <property-class>org.richfaces.component.SwitchType</property-class>
</property>
<property>
<description></description>
- <property-name>onclick</property-name>
+ <property-name>activeItem</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
<description></description>
- <property-name>ondblclick</property-name>
- <property-class>java.lang.String</property-class>
+ <property-name>bypassUpdates</property-name>
+ <property-class>boolean</property-class>
</property>
<property>
<description></description>
- <property-name>onmousedown</property-name>
+ <property-name>limitToList</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>data</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>status</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
<description></description>
- <property-name>onmousemove</property-name>
+ <property-name>execute</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>render</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>immediate</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>itemChangeListener</property-name>
+ <property-class>javax.el.MethodExpression</property-class>
+ </property>
+ <property>
+ <description>Long long text</description>
+ <property-name>id</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
+ <description>binding description</description>
+ <property-name>binding</property-name>
+ <property-class>javax.faces.component.UIComponent</property-class>
+ </property>
+ <property>
+ <description>I don't know maybe some thing strange</description>
+ <property-name>rendered</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
<description></description>
- <property-name>onmouseout</property-name>
+ <property-name>onitemchange</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
<description></description>
- <property-name>onmouseover</property-name>
+ <property-name>onbeforeitemchange</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
<description></description>
- <property-name>onmouseup</property-name>
+ <property-name>lang</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
@@ -74,67 +114,87 @@
<property-class>java.lang.String</property-class>
</property>
<property>
- <description>Long long text</description>
- <property-name>id</property-name>
+ <description></description>
+ <property-name>onclick</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
- <description>binding description</description>
- <property-name>binding</property-name>
- <property-class>javax.faces.component.UIComponent</property-class>
+ <description></description>
+ <property-name>ondblclick</property-name>
+ <property-class>java.lang.String</property-class>
</property>
<property>
- <description>I don't know maybe some thing strange</description>
- <property-name>rendered</property-name>
- <property-class>boolean</property-class>
+ <description></description>
+ <property-name>onmousedown</property-name>
+ <property-class>java.lang.String</property-class>
</property>
-
- </component>
- <component>
- <component-type>org.richfaces.TogglePanel</component-type>
- <component-class>org.richfaces.component.html.HtmlTogglePanel</component-class>
<property>
<description></description>
- <property-name>lang</property-name>
+ <property-name>onmousemove</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
<description></description>
- <property-name>onclick</property-name>
+ <property-name>onmouseout</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
<description></description>
- <property-name>ondblclick</property-name>
+ <property-name>onmouseover</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
<description></description>
- <property-name>onmousedown</property-name>
+ <property-name>onmouseup</property-name>
<property-class>java.lang.String</property-class>
</property>
+
+ </component>
+ <component>
+ <component-type>org.richfaces.TogglePanelItem</component-type>
+ <component-class>org.richfaces.component.html.HtmlTogglePanelItem</component-class>
<property>
<description></description>
- <property-name>onmousemove</property-name>
+ <property-name>name</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
<description></description>
- <property-name>onmouseout</property-name>
+ <property-name>switchType</property-name>
+ <property-class>org.richfaces.component.SwitchType</property-class>
+ </property>
+ <property>
+ <description>Long long text</description>
+ <property-name>id</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
+ <description>binding description</description>
+ <property-name>binding</property-name>
+ <property-class>javax.faces.component.UIComponent</property-class>
+ </property>
+ <property>
+ <description>I don't know maybe some thing strange</description>
+ <property-name>rendered</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
<description></description>
- <property-name>onmouseover</property-name>
+ <property-name>onenter</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
<description></description>
- <property-name>onmouseup</property-name>
+ <property-name>onleave</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
<description></description>
+ <property-name>lang</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
<property-name>title</property-name>
<property-class>java.lang.String</property-class>
</property>
@@ -154,40 +214,45 @@
<property-class>java.lang.String</property-class>
</property>
<property>
- <description>Long long text</description>
- <property-name>id</property-name>
+ <description></description>
+ <property-name>onclick</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
- <description>binding description</description>
- <property-name>binding</property-name>
- <property-class>javax.faces.component.UIComponent</property-class>
+ <description></description>
+ <property-name>ondblclick</property-name>
+ <property-class>java.lang.String</property-class>
</property>
<property>
- <description>I don't know maybe some thing strange</description>
- <property-name>rendered</property-name>
- <property-class>boolean</property-class>
+ <description></description>
+ <property-name>onmousedown</property-name>
+ <property-class>java.lang.String</property-class>
</property>
<property>
<description></description>
- <property-name>oncomplete</property-name>
+ <property-name>onmousemove</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
<description></description>
- <property-name>onbeforedomupdate</property-name>
+ <property-name>onmouseout</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
<description></description>
- <property-name>onitemchange</property-name>
+ <property-name>onmouseover</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
<description></description>
- <property-name>onitemchanged</property-name>
+ <property-name>onmouseup</property-name>
<property-class>java.lang.String</property-class>
</property>
+
+ </component>
+ <component>
+ <component-type>org.richfaces.Accordion</component-type>
+ <component-class>org.richfaces.component.html.HtmlAccordion</component-class>
<property>
<description></description>
<property-name>switchType</property-name>
@@ -238,18 +303,83 @@
<property-name>itemChangeListener</property-name>
<property-class>javax.el.MethodExpression</property-class>
</property>
-
- </component>
- <component>
- <component-type>org.richfaces.TogglePanelItem</component-type>
- <component-class>org.richfaces.component.html.HtmlTogglePanelItem</component-class>
<property>
+ <description>Long long text</description>
+ <property-name>id</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description>binding description</description>
+ <property-name>binding</property-name>
+ <property-class>javax.faces.component.UIComponent</property-class>
+ </property>
+ <property>
+ <description>I don't know maybe some thing strange</description>
+ <property-name>rendered</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
<description></description>
+ <property-name>itemHeaderClassActive</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>itemHeaderClassDisabled</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>itemHeaderClassInactive</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>itemContentClass</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>itemHeaderClass</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onitemchange</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onbeforeitemchange</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
<property-name>lang</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
<description></description>
+ <property-name>title</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>style</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>styleClass</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>dir</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
<property-name>onclick</property-name>
<property-class>java.lang.String</property-class>
</property>
@@ -283,25 +413,30 @@
<property-name>onmouseup</property-name>
<property-class>java.lang.String</property-class>
</property>
+
+ </component>
+ <component>
+ <component-type>org.richfaces.TogglePanelTitledItem</component-type>
+ <component-class>org.richfaces.component.html.HtmlAccordionItem</component-class>
<property>
<description></description>
- <property-name>title</property-name>
- <property-class>java.lang.String</property-class>
+ <property-name>disabled</property-name>
+ <property-class>boolean</property-class>
</property>
<property>
<description></description>
- <property-name>style</property-name>
+ <property-name>label</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
<description></description>
- <property-name>styleClass</property-name>
+ <property-name>name</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
<description></description>
- <property-name>dir</property-name>
- <property-class>java.lang.String</property-class>
+ <property-name>switchType</property-name>
+ <property-class>org.richfaces.component.SwitchType</property-class>
</property>
<property>
<description>Long long text</description>
@@ -320,16 +455,61 @@
</property>
<property>
<description></description>
- <property-name>name</property-name>
+ <property-name>headerClassActive</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
<description></description>
- <property-name>switchType</property-name>
- <property-class>org.richfaces.component.SwitchType</property-class>
+ <property-name>headerClassDisabled</property-name>
+ <property-class>java.lang.String</property-class>
</property>
<property>
<description></description>
+ <property-name>headerClassInactive</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>headerClass</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>headerStyle</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>contentClass</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onheaderclick</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onheaderdblclick</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onheadermousedown</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onheadermousemove</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onheadermouseup</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
<property-name>onenter</property-name>
<property-class>java.lang.String</property-class>
</property>
@@ -338,18 +518,72 @@
<property-name>onleave</property-name>
<property-class>java.lang.String</property-class>
</property>
+ <property>
+ <description></description>
+ <property-name>lang</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>title</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>style</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>styleClass</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>dir</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onclick</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>ondblclick</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmousedown</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmousemove</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmouseout</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmouseover</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>onmouseup</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
</component>
-
<render-kit>
<render-kit-id>HTML_BASIC</render-kit-id>
<renderer>
- <component-family>org.richfaces.DivPanel</component-family>
- <renderer-type>org.richfaces.DivPanel</renderer-type>
- <renderer-class>org.richfaces.renderkit.html.DivPanelRenderer</renderer-class>
- </renderer>
- <renderer>
<component-family>org.richfaces.TogglePanel</component-family>
<renderer-type>org.richfaces.TogglePanel</renderer-type>
<renderer-class>org.richfaces.renderkit.html.TogglePanelRenderer</renderer-class>
@@ -359,13 +593,38 @@
<renderer-type>org.richfaces.TogglePanelItem</renderer-type>
<renderer-class>org.richfaces.renderkit.html.TogglePanelItemRenderer</renderer-class>
</renderer>
-
+ <renderer>
+ <component-family>org.richfaces.Accordion</component-family>
+ <renderer-type>org.richfaces.Accordion</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.AccordionRenderer</renderer-class>
+ </renderer>
+ <renderer>
+ <component-family>org.richfaces.TogglePanelTitledItem</component-family>
+ <renderer-type>org.richfaces.AccordionItem</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.AccordionItemRenderer</renderer-class>
+ </renderer>
+ <renderer>
+ <component-family>org.richfaces.Panel</component-family>
+ <renderer-type>org.richfaces.PanelRenderer</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.PanelRenderer</renderer-class>
+ <renderer-extension>
+ <cdk:renders-children>false</cdk:renders-children>
+ </renderer-extension>
+ </renderer>
+ <renderer>
+ <component-family>org.richfaces.PopupPanel</component-family>
+ <renderer-type>org.richfaces.PopupPanelRenderer</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.PopupPanelRenderer</renderer-class>
+ <renderer-extension>
+ <cdk:renders-children>false</cdk:renders-children>
+ </renderer-extension>
+ </renderer>
</render-kit>
<faces-config-extension>
<cdk:taglib>
- <cdk:shortName></cdk:shortName>
- <cdk:uri></cdk:uri>
+ <cdk:shortName>output</cdk:shortName>
+ <cdk:uri>http://richfaces.org/output</cdk:uri>
</cdk:taglib>
</faces-config-extension>
</faces-config>
Modified: trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-08-13 14:12:36 UTC (rev 18621)
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
- http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
- version="2.0" id="pn">
- <namespace>http://richfaces.org/panels</namespace>
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd" version="2.0" id="output">
+ <namespace>http://richfaces.org/output</namespace>
+
<tag>
<tag-name>toggleControl</tag-name>
<behavior>
@@ -14,99 +14,125 @@
</behavior>
</tag>
<tag>
- <tag-name>divPanel</tag-name>
+ <tag-name>panel</tag-name>
<component>
- <component-type>org.richfaces.DivPanel</component-type>
- <renderer-type>org.richfaces.DivPanel</renderer-type>
+ <component-type>org.richfaces.Panel</component-type>
+ <renderer-type>org.richfaces.PanelRenderer</renderer-type>
</component>
+ </tag>
+ <tag>
+ <tag-name>popupPanel</tag-name>
+ <component>
+ <component-type>org.richfaces.PopupPanel</component-type>
+ <renderer-type>org.richfaces.PopupPanelRenderer</renderer-type>
+ </component>
+ </tag>
+
+ <tag>
+ <tag-name>togglePanel</tag-name>
+ <component>
+ <component-type>org.richfaces.TogglePanel</component-type>
+ <renderer-type>org.richfaces.TogglePanel</renderer-type>
+ <handler-class>org.richfaces.view.facelets.html.TogglePanelTagHandler</handler-class>
+ </component>
<attribute>
<description></description>
- <name>lang</name>
- <type>java.lang.String</type>
+ <name>switchType</name>
+ <type>org.richfaces.component.SwitchType</type>
</attribute>
<attribute>
<description></description>
- <name>onclick</name>
+ <name>activeItem</name>
<type>java.lang.String</type>
</attribute>
<attribute>
<description></description>
- <name>ondblclick</name>
- <type>java.lang.String</type>
+ <name>bypassUpdates</name>
+ <type>boolean</type>
</attribute>
<attribute>
<description></description>
- <name>onmousedown</name>
- <type>java.lang.String</type>
+ <name>limitToList</name>
+ <type>boolean</type>
</attribute>
<attribute>
<description></description>
- <name>onmousemove</name>
- <type>java.lang.String</type>
+ <name>data</name>
+ <type>java.lang.Object</type>
</attribute>
<attribute>
<description></description>
- <name>onmouseout</name>
+ <name>status</name>
<type>java.lang.String</type>
</attribute>
<attribute>
<description></description>
- <name>onmouseover</name>
- <type>java.lang.String</type>
+ <name>execute</name>
+ <type>java.lang.Object</type>
</attribute>
<attribute>
<description></description>
- <name>onmouseup</name>
- <type>java.lang.String</type>
+ <name>render</name>
+ <type>java.lang.Object</type>
</attribute>
<attribute>
<description></description>
- <name>title</name>
+ <name>immediate</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>itemChangeListener</name>
+ <type>javax.el.MethodExpression</type>
+ </attribute>
+ <attribute>
+ <description>Long long text</description>
+ <name>id</name>
<type>java.lang.String</type>
</attribute>
<attribute>
+ <description>binding description</description>
+ <name>binding</name>
+ <type>javax.faces.component.UIComponent</type>
+ </attribute>
+ <attribute>
+ <description>I don't know maybe some thing strange</description>
+ <name>rendered</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
<description></description>
- <name>style</name>
+ <name>onitemchange</name>
<type>java.lang.String</type>
</attribute>
<attribute>
<description></description>
- <name>styleClass</name>
+ <name>onbeforeitemchange</name>
<type>java.lang.String</type>
</attribute>
<attribute>
<description></description>
- <name>dir</name>
+ <name>lang</name>
<type>java.lang.String</type>
</attribute>
<attribute>
- <description>Long long text</description>
- <name>id</name>
+ <description></description>
+ <name>title</name>
<type>java.lang.String</type>
</attribute>
<attribute>
- <description>binding description</description>
- <name>binding</name>
- <type>javax.faces.component.UIComponent</type>
+ <description></description>
+ <name>style</name>
+ <type>java.lang.String</type>
</attribute>
<attribute>
- <description>I don't know maybe some thing strange</description>
- <name>rendered</name>
- <type>boolean</type>
+ <description></description>
+ <name>styleClass</name>
+ <type>java.lang.String</type>
</attribute>
-
- </tag>
-
- <tag>
- <tag-name>togglePanel</tag-name>
- <component>
- <component-type>org.richfaces.TogglePanel</component-type>
- <renderer-type>org.richfaces.TogglePanel</renderer-type>
- <handler-class>org.richfaces.view.facelets.html.TogglePanelTagHandler</handler-class>
- </component>
<attribute>
<description></description>
- <name>lang</name>
+ <name>dir</name>
<type>java.lang.String</type>
</attribute>
<attribute>
@@ -144,25 +170,61 @@
<name>onmouseup</name>
<type>java.lang.String</type>
</attribute>
+
+ </tag>
+ <tag>
+ <description>
+ Register a ItemChangeListener instance on the UIComponent
+ associated with the closest parent UIComponent custom
+ action.
+ </description>
+ <tag-name>itemChangeListener</tag-name>
+ <handler-class>org.richfaces.view.facelets.html.ItemChangeListenerHandler</handler-class>
<attribute>
- <description></description>
- <name>title</name>
+ <description>
+ Fully qualified Java class name of a
+ ItemChangeListener to be created and registered.
+ </description>
+ <name>type</name>
<type>java.lang.String</type>
</attribute>
<attribute>
- <description></description>
- <name>style</name>
+ <description>
+ Value binding expression that evaluates to an object that
+ implements org.richfaces.event.ItemChangeListener.
+ </description>
+ <name>binding</name>
+ <required>false</required>
+ <type>org.richfaces.event.ItemChangeListener</type>
+ </attribute>
+ <attribute>
+ <description>
+ <p class="changed_added_2_0">If present, this attribute refers
+ to the value of one of the exposed attached objects within the
+ composite component inside of which this tag is nested.</p>
+ </description>
+ <name>for</name>
+ <required>false</required>
<type>java.lang.String</type>
</attribute>
+ </tag>
+
+ <tag>
+ <tag-name>togglePanelItem</tag-name>
+ <component>
+ <component-type>org.richfaces.TogglePanelItem</component-type>
+ <renderer-type>org.richfaces.TogglePanelItem</renderer-type>
+
+ </component>
<attribute>
<description></description>
- <name>styleClass</name>
+ <name>name</name>
<type>java.lang.String</type>
</attribute>
<attribute>
<description></description>
- <name>dir</name>
- <type>java.lang.String</type>
+ <name>switchType</name>
+ <type>org.richfaces.component.SwitchType</type>
</attribute>
<attribute>
<description>Long long text</description>
@@ -181,26 +243,86 @@
</attribute>
<attribute>
<description></description>
- <name>oncomplete</name>
+ <name>onenter</name>
<type>java.lang.String</type>
</attribute>
<attribute>
<description></description>
- <name>onbeforedomupdate</name>
+ <name>onleave</name>
<type>java.lang.String</type>
</attribute>
<attribute>
<description></description>
- <name>onitemchange</name>
+ <name>lang</name>
<type>java.lang.String</type>
</attribute>
<attribute>
<description></description>
- <name>onitemchanged</name>
+ <name>title</name>
<type>java.lang.String</type>
</attribute>
<attribute>
<description></description>
+ <name>style</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>styleClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>dir</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>ondblclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousedown</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousemove</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseout</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseover</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseup</name>
+ <type>java.lang.String</type>
+ </attribute>
+
+ </tag>
+
+ <tag>
+ <tag-name>accordion</tag-name>
+ <component>
+ <component-type>org.richfaces.Accordion</component-type>
+ <renderer-type>org.richfaces.Accordion</renderer-type>
+
+ </component>
+ <attribute>
+ <description></description>
<name>switchType</name>
<type>org.richfaces.component.SwitchType</type>
</attribute>
@@ -249,58 +371,83 @@
<name>itemChangeListener</name>
<type>javax.el.MethodExpression</type>
</attribute>
-
- </tag>
- <tag>
- <description>
- Register a ItemChangeListener instance on the UIComponent
- associated with the closest parent UIComponent custom
- action.
- </description>
- <tag-name>itemChangeListener</tag-name>
- <handler-class>org.richfaces.view.facelets.html.ItemChangeListenerHandler</handler-class>
<attribute>
- <description>
- Fully qualified Java class name of a
- ItemChangeListener to be created and registered.
- </description>
- <name>type</name>
+ <description>Long long text</description>
+ <name>id</name>
<type>java.lang.String</type>
</attribute>
<attribute>
- <description>
- Value binding expression that evaluates to an object that
- implements org.richfaces.event.ItemChangeListener.
- </description>
+ <description>binding description</description>
<name>binding</name>
- <required>false</required>
- <type>org.richfaces.event.ItemChangeListener</type>
+ <type>javax.faces.component.UIComponent</type>
</attribute>
<attribute>
- <description>
- <p class="changed_added_2_0">If present, this attribute refers
- to the value of one of the exposed attached objects within the
- composite component inside of which this tag is nested.</p> </description>
- <name>for</name>
- <required>false</required>
+ <description>I don't know maybe some thing strange</description>
+ <name>rendered</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>itemHeaderClassActive</name>
<type>java.lang.String</type>
</attribute>
- </tag>
-
- <tag>
- <tag-name>togglePanelItem</tag-name>
- <component>
- <component-type>org.richfaces.TogglePanelItem</component-type>
- <renderer-type>org.richfaces.TogglePanelItem</renderer-type>
-
- </component>
<attribute>
<description></description>
+ <name>itemHeaderClassDisabled</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>itemHeaderClassInactive</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>itemContentClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>itemHeaderClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onitemchange</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onbeforeitemchange</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
<name>lang</name>
<type>java.lang.String</type>
</attribute>
<attribute>
<description></description>
+ <name>title</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>style</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>styleClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>dir</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
<name>onclick</name>
<type>java.lang.String</type>
</attribute>
@@ -334,25 +481,35 @@
<name>onmouseup</name>
<type>java.lang.String</type>
</attribute>
+
+ </tag>
+
+ <tag>
+ <tag-name>accordionItem</tag-name>
+ <component>
+ <component-type>org.richfaces.TogglePanelTitledItem</component-type>
+ <renderer-type>org.richfaces.AccordionItem</renderer-type>
+
+ </component>
<attribute>
<description></description>
- <name>title</name>
- <type>java.lang.String</type>
+ <name>disabled</name>
+ <type>boolean</type>
</attribute>
<attribute>
<description></description>
- <name>style</name>
+ <name>header</name>
<type>java.lang.String</type>
</attribute>
<attribute>
<description></description>
- <name>styleClass</name>
+ <name>name</name>
<type>java.lang.String</type>
</attribute>
<attribute>
<description></description>
- <name>dir</name>
- <type>java.lang.String</type>
+ <name>switchType</name>
+ <type>org.richfaces.component.SwitchType</type>
</attribute>
<attribute>
<description>Long long text</description>
@@ -371,17 +528,61 @@
</attribute>
<attribute>
<description></description>
- <name>name</name>
- <required>true</required>
+ <name>headerClassActive</name>
<type>java.lang.String</type>
</attribute>
<attribute>
<description></description>
- <name>switchType</name>
- <type>org.richfaces.component.SwitchType</type>
+ <name>headerClassDisabled</name>
+ <type>java.lang.String</type>
</attribute>
<attribute>
<description></description>
+ <name>headerClassInactive</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>headerClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>headerStyle</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>contentClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onheaderclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onheaderdblclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onheadermousedown</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onheadermousemove</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onheadermouseup</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
<name>onenter</name>
<type>java.lang.String</type>
</attribute>
@@ -390,23 +591,68 @@
<name>onleave</name>
<type>java.lang.String</type>
</attribute>
+ <attribute>
+ <description></description>
+ <name>lang</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>title</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>style</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>styleClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>dir</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>ondblclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousedown</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousemove</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseout</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseover</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseup</name>
+ <type>java.lang.String</type>
+ </attribute>
</tag>
- <tag>
- <tag-name>panel</tag-name>
- <component>
- <component-type>org.richfaces.Panel</component-type>
- <renderer-type>org.richfaces.PanelRenderer</renderer-type>
- </component>
- </tag>
-
- <tag>
- <tag-name>popupPanel</tag-name>
- <component>
- <component-type>org.richfaces.PopupPanel</component-type>
- <renderer-type>org.richfaces.PopupPanelRenderer</renderer-type>
- </component>
- </tag>
</facelet-taglib>
Added: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Accordion.js 2010-08-13 14:12:36 UTC (rev 18621)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.Accordion = rf.ui.TogglePanel.extendClass({
+ // class name
+ name:"Accordion",
+
+ /**
+ * @class Accordion
+ * @name Accordion
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ rf.ui.TogglePanel.call(this, componentId, options);
+ this.items = [];
+
+ this.isKeepHeight = options["isKeepHeight"] || false
+ },
+
+ /***************************** Public Methods ****************************************************************/
+
+ getHeight : function (recalculate) {
+ if (recalculate || !this.__height) {
+ this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
+ }
+
+ return this.__height;
+ },
+
+ getInnerHeight : function (recalculate) {
+ if (recalculate || !this.__innerHeight) {
+ this.__innerHeight = $(rf.getDomElement(this.id)).innerHeight(true)
+ }
+
+ return this.__innerHeight;
+ },
+
+ /***************************** Private Methods ********************************************************/
+
+
+ destroy: function () {
+ rf.Event.unbindById(this.id, "." + this.namespace);
+
+ this.$super.destroy.call(this);
+ }
+ });
+})(jQuery, RichFaces);
Added: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/AccordionItem.js 2010-08-13 14:12:36 UTC (rev 18621)
@@ -0,0 +1,126 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.AccordionItem = rf.ui.TogglePanelItem.extendClass({
+ // class name
+ name:"AccordionItem",
+
+ /**
+ * @class AccordionItem
+ * @name AccordionItem
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ rf.ui.TogglePanelItem.call(this, componentId, options);
+ this.index = options["index"];
+ this.getTogglePanel().getItems()[this.index] = this;
+
+ rf.Event.bindById(this.id + ":header", "click", this.__onHeaderClick, this)
+ },
+
+ /***************************** Public Methods ****************************************************************/
+
+ __onHeaderClick : function (comp) {
+ this.getTogglePanel().switchToItem(this.getName());
+ },
+
+ /**
+ * @return {DOMElement}
+ * */
+ __header : function () {
+ return rf.getDomElement(this.id + ":header");
+ },
+
+ /**
+ * @return {DOMElement}
+ * */
+ __content : function () {
+ return rf.getDomElement(this.id + ":content");
+ },
+
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __enter : function () {
+ var parentPanel = this.getTogglePanel();
+ if (parentPanel.isKeepHeight) {
+ var h = parentPanel.getInnerHeight();
+
+ var items = parentPanel.getItems();
+ for (var i = 0; i < items.length; i++) {
+ h -= items[i].getHeight();
+ }
+
+ $(this.__content()).height(h);
+ }
+
+ this.__content().style.display = "block";
+
+
+ return this.__fireEnter();
+ },
+
+ getHeight : function (recalculate) {
+ if (recalculate || !this.__height) {
+ this.__height = $(rf.getDomElement(this.id)).outerHeight(true)
+ }
+
+ return this.__height;
+ },
+
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __leave : function () {
+ var continueProcess = this.__fireLeave();
+ if (!continueProcess) {
+ return false;
+ }
+
+ this.__content().style.display = "none";
+ return true;
+ },
+
+ /***************************** Private Methods ********************************************************/
+
+
+ destroy: function () {
+ var parent = this.getTogglePanel();
+ delete parent.getItems()[this.index];
+
+ rf.Event.unbindById(this.id, "."+this.namespace);
+
+ this.$super.destroy.call(this);
+ }
+ });
+})(jQuery, RichFaces);
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanel.js 2010-08-13 14:12:36 UTC (rev 18621)
@@ -158,7 +158,7 @@
init : function (componentId, options) {
// call constructor of parent class
- this.$super.constructor.call(this, componentId);
+ rf.BaseComponent.call(this, componentId);
this.attachToDom(componentId);
this.options = options;
Modified: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/TogglePanelItem.js 2010-08-13 14:12:36 UTC (rev 18621)
@@ -31,8 +31,8 @@
init : function (componentId, options) {
// call constructor of parent class
- this.$super.constructor.call(this, componentId);
- this.$super.attachToDom.call(this, componentId);
+ rf.BaseComponent.call(this, componentId);
+ this.attachToDom(componentId);
this.options = options;
this.name = this.options.name;
Added: trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss
===================================================================
--- trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss (rev 0)
+++ trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/accordion.ecss 2010-08-13 14:12:36 UTC (rev 18621)
@@ -0,0 +1,26 @@
+.rf-ac {
+ width: 300px; /*visible width*/
+ border: 1px solid #a6a6a6; /*panelBorderColor*/
+ border-bottom: 0px;
+ background: #FFFFFF; /*generalBackgroundColor*/
+}
+
+.rf-aci-h {
+ border-bottom: 1px solid #a6a6a6; /*panelBorderColor*/
+ background: url(images/bg_header.png) /*from headerGradientColor to headerBackgroundColor, picture height 20px*/ repeat-x top left #C0D1E7 /*headerBackgroundColor*/;
+ position: relative;
+ padding: 8px 10px 7px 10px;
+ font-weight: bold /*headerWeightFont*/;
+ color: #000000 /*headerTextColor*/;
+ font-family: verdana /*headerFamilyFont*/;
+ font-size: 11px /*headerSizeFont*/;
+ cursor: pointer;
+}
+
+.rf-aci-c {
+ border-bottom: 1px solid #a6a6a6 /*panelBorderColor*/;
+ height: 100px /*visible modal panel height minus header height*/;
+ position: relative;
+ overflow: auto;
+ overflow-x: hidden;
+}
\ No newline at end of file
Modified: trunk/ui/output/ui/src/test/resources/panelTest.xhtml
===================================================================
--- trunk/ui/output/ui/src/test/resources/panelTest.xhtml 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/ui/output/ui/src/test/resources/panelTest.xhtml 2010-08-13 14:12:36 UTC (rev 18621)
@@ -5,7 +5,7 @@
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:panel="http://richfaces.org/panels"
+ xmlns:panel="http://richfaces.org/output"
xmlns:rich="http://richfaces.org/rich">
<!--
JBoss, Home of Professional Open Source
Modified: trunk/ui/output/ui/src/test/resources/popupPanelTest.xhtml
===================================================================
--- trunk/ui/output/ui/src/test/resources/popupPanelTest.xhtml 2010-08-13 14:10:24 UTC (rev 18620)
+++ trunk/ui/output/ui/src/test/resources/popupPanelTest.xhtml 2010-08-13 14:12:36 UTC (rev 18621)
@@ -5,7 +5,7 @@
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:rich="http://richfaces.org/panels">
+ xmlns:rich="http://richfaces.org/output">
<h:head>
<title>Richfaces ExtendedDataTable Test</title>
15 years, 9 months
JBoss Rich Faces SVN: r18620 - in branches/RF-9040_build_updated_m2: bom and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2010-08-13 10:10:24 -0400 (Fri, 13 Aug 2010)
New Revision: 18620
Modified:
branches/RF-9040_build_updated_m2/bom/pom.xml
branches/RF-9040_build_updated_m2/pom.xml
branches/RF-9040_build_updated_m2/ui/dist/pom.xml
branches/RF-9040_build_updated_m2/ui/iteration/pom.xml
branches/RF-9040_build_updated_m2/ui/misc/pom.xml
branches/RF-9040_build_updated_m2/ui/output/pom.xml
branches/RF-9040_build_updated_m2/ui/pom.xml
Log:
RF-9052 release-plugin not needed in every module after refactor
Modified: branches/RF-9040_build_updated_m2/bom/pom.xml
===================================================================
--- branches/RF-9040_build_updated_m2/bom/pom.xml 2010-08-13 13:56:18 UTC (rev 18619)
+++ branches/RF-9040_build_updated_m2/bom/pom.xml 2010-08-13 14:10:24 UTC (rev 18620)
@@ -283,16 +283,6 @@
</profile>
</profiles>
- <build>
- <plugins>
- <!-- For the release this bom pom -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-
<scm>
<connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/trunk/build/bom</connection>
<developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/trunk/build/bom</developerConnection>
Modified: branches/RF-9040_build_updated_m2/pom.xml
===================================================================
--- branches/RF-9040_build_updated_m2/pom.xml 2010-08-13 13:56:18 UTC (rev 18619)
+++ branches/RF-9040_build_updated_m2/pom.xml 2010-08-13 14:10:24 UTC (rev 18620)
@@ -5,9 +5,9 @@
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-parent</artifactId>
- <version>5</version>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-parent</artifactId>
+ <version>10-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -30,6 +30,16 @@
<module>examples</module>
<!--<module>docs</module>-->
</modules>
+
+ <build>
+ <plugins>
+ <!-- To trigger the release -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
<profiles>
<profile>
Modified: branches/RF-9040_build_updated_m2/ui/dist/pom.xml
===================================================================
--- branches/RF-9040_build_updated_m2/ui/dist/pom.xml 2010-08-13 13:56:18 UTC (rev 18619)
+++ branches/RF-9040_build_updated_m2/ui/dist/pom.xml 2010-08-13 14:10:24 UTC (rev 18620)
@@ -38,32 +38,8 @@
</modules>
<build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <configuration>
- <!--
- The dist requires clean install for prepare
- -->
- <preparationGoals>clean install</preparationGoals>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <configuration>
- <!--
- The dist requires clean install for prepare
- -->
- <preparationGoals>clean install</preparationGoals>
- </configuration>
- </plugin>
- <plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
Modified: branches/RF-9040_build_updated_m2/ui/iteration/pom.xml
===================================================================
--- branches/RF-9040_build_updated_m2/ui/iteration/pom.xml 2010-08-13 13:56:18 UTC (rev 18619)
+++ branches/RF-9040_build_updated_m2/ui/iteration/pom.xml 2010-08-13 14:10:24 UTC (rev 18620)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.richfaces</groupId>
<artifactId>richfaces-parent</artifactId>
- <version>9</version>
+ <version>10-SNAPSHOT</version>
</parent>
<groupId>org.richfaces.ui.iteration</groupId>
@@ -39,35 +39,6 @@
<module>ui</module>
</modules>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <configuration>
- <!--
- The dist requires clean install for prepare
- -->
- <preparationGoals>clean install</preparationGoals>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <configuration>
- <!--
- The dist requires clean install for prepare
- -->
- <preparationGoals>clean install</preparationGoals>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
<scm>
<connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/trunk/ui/iteration</connection>
<developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/trunk/ui/iteration</developerConnection>
Modified: branches/RF-9040_build_updated_m2/ui/misc/pom.xml
===================================================================
--- branches/RF-9040_build_updated_m2/ui/misc/pom.xml 2010-08-13 13:56:18 UTC (rev 18619)
+++ branches/RF-9040_build_updated_m2/ui/misc/pom.xml 2010-08-13 14:10:24 UTC (rev 18620)
@@ -27,7 +27,7 @@
<parent>
<groupId>org.richfaces</groupId>
<artifactId>richfaces-parent</artifactId>
- <version>9</version>
+ <version>10-SNAPSHOT</version>
</parent>
<groupId>org.richfaces.ui.misc</groupId>
@@ -40,33 +40,6 @@
<module>ui</module>
</modules>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <configuration>
- <!--
- The dist requires clean install for prepare
- -->
- <preparationGoals>clean install</preparationGoals>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <configuration>
- <!-- The dist requires clean install for prepare -->
- <preparationGoals>clean install</preparationGoals>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
<scm>
<connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/trunk/ui/misc</connection>
<developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/trunk/ui/misc</developerConnection>
Modified: branches/RF-9040_build_updated_m2/ui/output/pom.xml
===================================================================
--- branches/RF-9040_build_updated_m2/ui/output/pom.xml 2010-08-13 13:56:18 UTC (rev 18619)
+++ branches/RF-9040_build_updated_m2/ui/output/pom.xml 2010-08-13 14:10:24 UTC (rev 18620)
@@ -25,7 +25,7 @@
<parent>
<groupId>org.richfaces</groupId>
<artifactId>richfaces-parent</artifactId>
- <version>9</version>
+ <version>10-SNAPSHOT</version>
</parent>
<groupId>org.richfaces.ui.output</groupId>
@@ -39,31 +39,6 @@
<module>ui</module>
</modules>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <configuration>
- <!-- The dist requires clean install for prepare -->
- <preparationGoals>clean install</preparationGoals>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <configuration>
- <!-- The dist requires clean install for prepare -->
- <preparationGoals>clean install</preparationGoals>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
<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>
Modified: branches/RF-9040_build_updated_m2/ui/pom.xml
===================================================================
--- branches/RF-9040_build_updated_m2/ui/pom.xml 2010-08-13 13:56:18 UTC (rev 18619)
+++ branches/RF-9040_build_updated_m2/ui/pom.xml 2010-08-13 14:10:24 UTC (rev 18620)
@@ -32,7 +32,7 @@
</parent>
<groupId>org.richfaces.ui</groupId>
- <artifactId>ui-aggregator</artifactId>
+ <artifactId>richfaces-ui-aggregator</artifactId>
<version>4.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>RichFaces UI: Aggregator</name>
15 years, 9 months
JBoss Rich Faces SVN: r18619 - in sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk: faces and 8 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-08-13 09:56:18 -0400 (Fri, 13 Aug 2010)
New Revision: 18619
Added:
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/util/
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/util/ResourceUtil.java
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/ResourceProcessor.java
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/CSSResourceProcessor.java
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/CharResourceProcessor.java
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/JavaScriptResourceProcessor.java
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/MavenLogErrorReporter.java
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/ResourceWriterImpl.java
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/ThroughputResourceProcessor.java
Removed:
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/ResourceUtil.java
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/ResourceWriterImpl.java
Modified:
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/FileNameMapper.java
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/ProcessMojo.java
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/faces/ResourceELResolver.java
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/naming/FileNameMapperImpl.java
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/handler/impl/DynamicResourceWrapper.java
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/handler/impl/StaticResourceHandler.java
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/handler/impl/VFSResource.java
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/scan/impl/StaticResourcesScanner.java
sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/task/ResourceTaskFactoryImpl.java
Log:
Maven resources plugin:
- bug fixing
- resource compression
Modified: sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/FileNameMapper.java
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/FileNameMapper.java 2010-08-13 13:44:52 UTC (rev 18618)
+++ sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/FileNameMapper.java 2010-08-13 13:56:18 UTC (rev 18619)
@@ -21,7 +21,6 @@
*/
package org.richfaces.cdk;
-import javax.faces.application.Resource;
/**
* @author Nick Belaevski
@@ -29,6 +28,6 @@
*/
public interface FileNameMapper {
- public String createName(Resource resource);
+ public String createName(String resourcePath);
}
Modified: sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/ProcessMojo.java
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/ProcessMojo.java 2010-08-13 13:44:52 UTC (rev 18618)
+++ sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/ProcessMojo.java 2010-08-13 13:56:18 UTC (rev 18619)
@@ -31,6 +31,7 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -54,13 +55,16 @@
import org.richfaces.cdk.concurrent.CountingExecutorCompletionService;
import org.richfaces.cdk.faces.FacesImpl;
import org.richfaces.cdk.naming.FileNameMapperImpl;
-import org.richfaces.cdk.resource.ResourceUtil;
-import org.richfaces.cdk.resource.ResourceWriterImpl;
import org.richfaces.cdk.resource.handler.impl.DynamicResourceHandler;
import org.richfaces.cdk.resource.handler.impl.StaticResourceHandler;
import org.richfaces.cdk.resource.scan.ResourcesScanner;
import org.richfaces.cdk.resource.scan.impl.DynamicResourcesScanner;
import org.richfaces.cdk.resource.scan.impl.StaticResourcesScanner;
+import org.richfaces.cdk.resource.util.ResourceUtil;
+import org.richfaces.cdk.resource.writer.ResourceProcessor;
+import org.richfaces.cdk.resource.writer.impl.CSSResourceProcessor;
+import org.richfaces.cdk.resource.writer.impl.JavaScriptResourceProcessor;
+import org.richfaces.cdk.resource.writer.impl.ResourceWriterImpl;
import org.richfaces.cdk.task.ResourceTaskFactoryImpl;
import org.richfaces.cdk.util.MoreConstraints;
import org.richfaces.cdk.util.MorePredicates;
@@ -162,6 +166,10 @@
private Collection<ResourceKey> foundResources = Sets.newHashSet();
+ private Collection<ResourceProcessor> resourceProcessors = Arrays.<ResourceProcessor>asList(
+ new JavaScriptResourceProcessor(getLog()),
+ new CSSResourceProcessor());
+
// TODO executor parameters
private static ExecutorService createExecutorService() {
return Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
@@ -221,30 +229,24 @@
return fromUrls(Collections.singletonList(resolveWebRoot()));
}
- protected ClassLoader createProjectClassLoader(MavenProject project, boolean useCCL) {
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-
+ protected URL[] getProjectClasspath() {
try {
List<String> classpath = Constraints.constrainedList(Lists.<String>newArrayList(), MoreConstraints.cast(String.class));
classpath.addAll((List<String>) project.getCompileClasspathElements());
classpath.add(project.getBuild().getOutputDirectory());
URL[] urlClasspath = filter(transform(classpath, filePathToURL), notNull()).toArray(EMPTY_URL_ARRAY);
- if (useCCL) {
- classLoader = new URLClassLoader(urlClasspath, classLoader);
- } else {
- classLoader = new URLClassLoader(urlClasspath);
- }
+ return urlClasspath;
} catch (DependencyResolutionRequiredException e) {
getLog().error("Dependencies not resolved ", e);
}
- return classLoader;
+ return new URL[0];
}
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
- ClassLoader cCL = Thread.currentThread().getContextClassLoader();
+ ClassLoader contextCL = Thread.currentThread().getContextClassLoader();
Faces faces = null;
ExecutorService executorService = null;
@@ -252,7 +254,8 @@
Collection<VFSRoot> cpResources = null;
try {
- ClassLoader projectCL = createProjectClassLoader(project, true);
+ URL[] projectCP = getProjectClasspath();
+ ClassLoader projectCL = new URLClassLoader(projectCP, contextCL);
Thread.currentThread().setContextClassLoader(projectCL);
webResources = getWebrootVfs();
@@ -276,7 +279,7 @@
faces = new FacesImpl(null, new FileNameMapperImpl(Maps.fromProperties(fileNameMappings)), resourceHandler);
faces.start();
- ResourceWriterImpl resourceWriter = new ResourceWriterImpl(resourceOutputDir, resourceMappingDir);
+ ResourceWriterImpl resourceWriter = new ResourceWriterImpl(resourceOutputDir, resourceMappingDir, resourceProcessors);
ResourceTaskFactoryImpl taskFactory = new ResourceTaskFactoryImpl(faces);
taskFactory.setResourceWriter(resourceWriter);
@@ -320,7 +323,7 @@
}
if (webResources != null) {
- for (VFSRoot vfsRoot : cpResources) {
+ for (VFSRoot vfsRoot : webResources) {
try {
vfsRoot.close();
} catch (IOException e) {
@@ -337,7 +340,7 @@
if (faces != null) {
faces.stop();
}
- Thread.currentThread().setContextClassLoader(cCL);
+ Thread.currentThread().setContextClassLoader(contextCL);
}
}
}
Modified: sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/faces/ResourceELResolver.java
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/faces/ResourceELResolver.java 2010-08-13 13:44:52 UTC (rev 18618)
+++ sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/faces/ResourceELResolver.java 2010-08-13 13:56:18 UTC (rev 18619)
@@ -37,9 +37,6 @@
import javax.faces.application.ResourceHandler;
import javax.faces.context.FacesContext;
-import org.richfaces.application.ServiceTracker;
-import org.richfaces.cdk.FileNameMapper;
-
import com.google.common.collect.Lists;
/**
@@ -92,10 +89,6 @@
return SLASH_JOINER.join(resultPathSegments);
}
- private FileNameMapper getFileNameMapper() {
- return ServiceTracker.getService(FileNameMapper.class);
- }
-
public Object getValue(ELContext context, Object base, Object property) {
checkBaseAndProperty(base, property);
@@ -116,13 +109,11 @@
context.setPropertyResolved(true);
if (resource != null) {
- FileNameMapper fileNameMapper = getFileNameMapper();
-
- String requestPath = fileNameMapper.createName(resource);
+ String requestPath = resource.getRequestPath();
FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class);
Resource contextResource = CurrentResourceContext.getInstance(facesContext).getResource();
if (contextResource != null) {
- requestPath = relativize(requestPath, fileNameMapper.createName(contextResource));
+ requestPath = relativize(requestPath, contextResource.getRequestPath());
}
return requestPath;
Modified: sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/naming/FileNameMapperImpl.java
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/naming/FileNameMapperImpl.java 2010-08-13 13:44:52 UTC (rev 18618)
+++ sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/naming/FileNameMapperImpl.java 2010-08-13 13:56:18 UTC (rev 18619)
@@ -27,8 +27,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import javax.faces.application.Resource;
-
import org.richfaces.cdk.FileNameMapper;
import com.google.common.collect.Lists;
@@ -80,25 +78,20 @@
return result;
}
- //TODO implement counter remapping
- private String remapName(String name) {
- if (name == null) {
- return name;
+ @Override
+ public String createName(String resourcePath) {
+ if (resourcePath == null) {
+ return resourcePath;
}
for (Mapping mapping : fileNameMappings) {
- Matcher matcher = mapping.getPattern().matcher(name);
+ Matcher matcher = mapping.getPattern().matcher(resourcePath);
if (matcher.find()) {
return matcher.replaceAll(mapping.getReplacement());
}
}
- return name;
- }
-
- @Override
- public String createName(Resource resource) {
- return remapName(resource.getRequestPath());
+ return resourcePath;
}
}
Deleted: sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/ResourceUtil.java
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/ResourceUtil.java 2010-08-13 13:44:52 UTC (rev 18618)
+++ sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/ResourceUtil.java 2010-08-13 13:56:18 UTC (rev 18619)
@@ -1,147 +0,0 @@
-/*
- * 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.cdk.resource;
-
-import static org.richfaces.cdk.strings.Constants.DOT_JOINER;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.richfaces.cdk.vfs.VFSRoot;
-import org.richfaces.cdk.vfs.VirtualFile;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Ordering;
-import com.google.common.primitives.Ints;
-
-/**
- * @author Nick Belaevski
- *
- */
-public final class ResourceUtil {
-
- private static final String CLASSPATH_RESOURCES_LOCATION = "META-INF/resources";
-
- private static final String WEB_RESOURCES_LOCATION = "resources";
-
- private static final Pattern LIBRARY_VERSION_PATTERN = Pattern.compile("^(\\d+)(_\\d+)+");
-
- private static final Pattern RESOURCE_VERSION_PATTERN = Pattern.compile("^((?:\\d+)(?:_\\d+)+)[\\.]?(\\w+)?");
-
- public static final class VersionKey {
-
- static final Ordering<VersionKey> ORDERING = Ordering.from(new Comparator<VersionKey>() {
-
- @Override
- public int compare(VersionKey o1, VersionKey o2) {
- return Ints.lexicographicalComparator().compare(o1.versionVector, o2.versionVector);
- }
- }).nullsFirst();
-
- private String version;
-
- private int[] versionVector;
-
- private String extension;
-
- public VersionKey(String version, String extension) throws NumberFormatException {
- this.version = version;
- this.versionVector = parseVersionString(version);
- this.extension = extension;
- }
-
- private static int[] parseVersionString(String s) {
- String[] split = s.split("_");
- int[] result = new int[split.length];
- for (int i = 0; i < result.length; i++) {
- result[i] = Integer.parseInt(split[i]);
- }
- return result;
- }
-
- public String toString() {
- return DOT_JOINER.join(version, extension);
- }
- }
-
- private ResourceUtil() {}
-
- public static VirtualFile getLatestVersion(VirtualFile file, boolean library) {
- VersionKey latestVersionKey = null;
-
- Collection<VirtualFile> children = file.getChildren();
- for (VirtualFile child : children) {
- if (library && child.isDirectory()) {
- Matcher matcher = LIBRARY_VERSION_PATTERN.matcher(child.getName());
- if (matcher.matches()) {
- latestVersionKey = VersionKey.ORDERING.max(latestVersionKey, new VersionKey(child.getName(), null));
- }
- } else if (!library && child.isFile()) {
- Matcher matcher = RESOURCE_VERSION_PATTERN.matcher(child.getName());
- if (matcher.matches()) {
- latestVersionKey = VersionKey.ORDERING.max(latestVersionKey, new VersionKey(matcher.group(1), matcher.group(2)));
- }
- }
- }
-
- VirtualFile result;
-
- if (latestVersionKey != null) {
- result = file.getChild(latestVersionKey.toString());
- } else {
- result = file;
- }
-
- if (result != null && (library ^ result.isFile())) {
- return result;
- }
-
- return null;
- }
-
- private static Collection<VirtualFile> getExistingChildren(Iterable<VFSRoot> files, String path) throws URISyntaxException, IOException {
- Collection<VirtualFile> result = Lists.newArrayList();
-
- for (VirtualFile file: files) {
- VirtualFile child = file.getChild(path, true);
- if (child != null) {
- result.add(child);
- }
- }
-
- return result;
- }
-
- public static Collection<VirtualFile> getResourceRoots(Iterable<VFSRoot> cpRoots, Iterable<VFSRoot> webRoots) throws URISyntaxException, IOException {
- List<VirtualFile> result = Lists.newArrayList();
-
- result.addAll(getExistingChildren(cpRoots, CLASSPATH_RESOURCES_LOCATION));
- result.addAll(getExistingChildren(webRoots, WEB_RESOURCES_LOCATION));
-
- return result;
- }
-}
Deleted: sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/ResourceWriterImpl.java
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/ResourceWriterImpl.java 2010-08-13 13:44:52 UTC (rev 18618)
+++ sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/ResourceWriterImpl.java 2010-08-13 13:56:18 UTC (rev 18619)
@@ -1,145 +0,0 @@
-/*
- * 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.cdk.resource;
-
-import static org.richfaces.cdk.strings.Constants.COLON_JOINER;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.faces.application.Resource;
-
-import org.richfaces.application.ServiceTracker;
-import org.richfaces.cdk.FileNameMapper;
-import org.richfaces.cdk.ResourceWriter;
-import org.richfaces.resource.ResourceFactory;
-
-import com.google.common.base.Strings;
-import com.google.common.collect.Maps;
-import com.google.common.io.ByteStreams;
-
-/**
- * @author Nick Belaevski
- *
- */
-public class ResourceWriterImpl implements ResourceWriter {
-
- private File resourceContentsDir;
-
- private File resourceMappingDir;
-
- private Map<String, String> processedResources = Maps.newConcurrentMap();
-
- public ResourceWriterImpl(File resourceContentsDir, File resourceMappingDir) {
- this.resourceContentsDir = resourceContentsDir;
- this.resourceMappingDir = resourceMappingDir;
- resourceContentsDir.mkdirs();
- }
-
- private String getResourceQualifier(Resource resource) {
- return COLON_JOINER.join(resource.getLibraryName(), resource.getResourceName());
- }
-
- private FileNameMapper getFileNameMapper() {
- return ServiceTracker.getService(FileNameMapper.class);
- }
-
- private File getRoot(String rootName) {
- if (!Strings.isNullOrEmpty(rootName)) {
- return new File(resourceContentsDir, rootName);
- } else {
- return resourceContentsDir;
- }
- }
-
- private String addSkinPrefix(String s) {
- return "%skin%/" + s;
- }
-
- public void writeResource(String skinName, Resource resource) throws IOException {
- FileOutputStream fos = null;
- InputStream is = null;
- try {
- is = resource.getInputStream();
- String mappedName = getFileNameMapper().createName(resource);
- File outFile = new File(getRoot(skinName), mappedName);
- outFile.getParentFile().mkdirs();
- outFile.createNewFile();
-
- fos = new FileOutputStream(outFile);
- ByteStreams.copy(is, fos);
-
- if (!Strings.isNullOrEmpty(skinName)) {
- mappedName = addSkinPrefix(mappedName);
- }
-
- processedResources.put(getResourceQualifier(resource), mappedName);
- } finally {
- if (fos != null) {
- try {
- fos.close();
- } catch (IOException e) {
- // TODO: handle exception
- e.printStackTrace();
- }
- }
- if (is != null) {
- try {
- is.close();
- } catch (IOException e) {
- // TODO: handle exception
- e.printStackTrace();
- }
- }
- }
- }
-
- @Override
- public void writeProcessedResourceMappings() throws IOException {
- //TODO separate mappings file location
- FileOutputStream fos = null;
- try {
- File mappingsFile = new File(resourceMappingDir, ResourceFactory.STATIC_RESOURCE_MAPPINGS);
- mappingsFile.delete();
- mappingsFile.getParentFile().mkdirs();
- mappingsFile.createNewFile();
-
- fos = new FileOutputStream(mappingsFile);
- Properties properties = new Properties();
- properties.putAll(processedResources);
- properties.store(fos, null);
- } finally {
- try {
- if (fos != null) {
- fos.close();
- }
- } catch (IOException e) {
- // TODO: handle exception
- }
- }
- }
-
-}
Modified: sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/handler/impl/DynamicResourceWrapper.java
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/handler/impl/DynamicResourceWrapper.java 2010-08-13 13:44:52 UTC (rev 18618)
+++ sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/handler/impl/DynamicResourceWrapper.java 2010-08-13 13:56:18 UTC (rev 18619)
@@ -33,6 +33,9 @@
import javax.faces.application.Resource;
import javax.faces.context.FacesContext;
+import org.richfaces.application.ServiceTracker;
+import org.richfaces.cdk.FileNameMapper;
+import org.richfaces.resource.ResourceFactory;
import org.richfaces.resource.VersionedResource;
import com.google.common.base.Strings;
@@ -121,6 +124,10 @@
}
}
+ private FileNameMapper getFileNameMapper() {
+ return ServiceTracker.getService(FileNameMapper.class);
+ }
+
private String getVersion() {
String version = null;
if (resource instanceof VersionedResource) {
@@ -136,8 +143,9 @@
String resourceExtension = getResourceExtension();
String resourceName = DOT_JOINER.join(DASH_JOINER.join(mangledResourceName, getVersion()), resourceExtension);
-
- return SLASH_JOINER.join(mangledLibraryName, resourceName);
+ String resourcePath = SLASH_JOINER.join(mangledLibraryName, resourceName);
+
+ return ResourceFactory.SKINNED_RESOURCE_PREFIX + getFileNameMapper().createName(resourcePath);
}
@Override
Modified: sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/handler/impl/StaticResourceHandler.java
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/handler/impl/StaticResourceHandler.java 2010-08-13 13:44:52 UTC (rev 18618)
+++ sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/handler/impl/StaticResourceHandler.java 2010-08-13 13:56:18 UTC (rev 18619)
@@ -27,7 +27,7 @@
import javax.activation.MimetypesFileTypeMap;
import javax.faces.application.Resource;
-import org.richfaces.cdk.resource.ResourceUtil;
+import org.richfaces.cdk.resource.util.ResourceUtil;
import org.richfaces.cdk.vfs.VirtualFile;
import com.google.common.base.Strings;
Modified: sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/handler/impl/VFSResource.java
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/handler/impl/VFSResource.java 2010-08-13 13:44:52 UTC (rev 18618)
+++ sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/handler/impl/VFSResource.java 2010-08-13 13:56:18 UTC (rev 18619)
@@ -29,6 +29,8 @@
import javax.faces.application.Resource;
import javax.faces.context.FacesContext;
+import org.richfaces.application.ServiceTracker;
+import org.richfaces.cdk.FileNameMapper;
import org.richfaces.cdk.vfs.VirtualFile;
/**
@@ -51,6 +53,10 @@
this.relativePath = relativePath;
}
+ private FileNameMapper getFileNameMapper() {
+ return ServiceTracker.getService(FileNameMapper.class);
+ }
+
@Override
public InputStream getInputStream() throws IOException {
return file.getInputStream();
@@ -63,7 +69,7 @@
@Override
public String getRequestPath() {
- return relativePath;
+ return getFileNameMapper().createName(relativePath);
}
@Override
Modified: sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/scan/impl/StaticResourcesScanner.java
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/scan/impl/StaticResourcesScanner.java 2010-08-13 13:44:52 UTC (rev 18618)
+++ sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/scan/impl/StaticResourcesScanner.java 2010-08-13 13:56:18 UTC (rev 18619)
@@ -24,8 +24,8 @@
import java.util.Collection;
import org.richfaces.cdk.ResourceKey;
-import org.richfaces.cdk.resource.ResourceUtil;
import org.richfaces.cdk.resource.scan.ResourcesScanner;
+import org.richfaces.cdk.resource.util.ResourceUtil;
import org.richfaces.cdk.vfs.VirtualFile;
import com.google.common.collect.Sets;
Copied: sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/util/ResourceUtil.java (from rev 18609, sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/ResourceUtil.java)
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/util/ResourceUtil.java (rev 0)
+++ sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/util/ResourceUtil.java 2010-08-13 13:56:18 UTC (rev 18619)
@@ -0,0 +1,147 @@
+/*
+ * 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.cdk.resource.util;
+
+import static org.richfaces.cdk.strings.Constants.DOT_JOINER;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.richfaces.cdk.vfs.VFSRoot;
+import org.richfaces.cdk.vfs.VirtualFile;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Ordering;
+import com.google.common.primitives.Ints;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public final class ResourceUtil {
+
+ private static final String CLASSPATH_RESOURCES_LOCATION = "META-INF/resources";
+
+ private static final String WEB_RESOURCES_LOCATION = "resources";
+
+ private static final Pattern LIBRARY_VERSION_PATTERN = Pattern.compile("^(\\d+)(_\\d+)+");
+
+ private static final Pattern RESOURCE_VERSION_PATTERN = Pattern.compile("^((?:\\d+)(?:_\\d+)+)[\\.]?(\\w+)?");
+
+ public static final class VersionKey {
+
+ static final Ordering<VersionKey> ORDERING = Ordering.from(new Comparator<VersionKey>() {
+
+ @Override
+ public int compare(VersionKey o1, VersionKey o2) {
+ return Ints.lexicographicalComparator().compare(o1.versionVector, o2.versionVector);
+ }
+ }).nullsFirst();
+
+ private String version;
+
+ private int[] versionVector;
+
+ private String extension;
+
+ public VersionKey(String version, String extension) throws NumberFormatException {
+ this.version = version;
+ this.versionVector = parseVersionString(version);
+ this.extension = extension;
+ }
+
+ private static int[] parseVersionString(String s) {
+ String[] split = s.split("_");
+ int[] result = new int[split.length];
+ for (int i = 0; i < result.length; i++) {
+ result[i] = Integer.parseInt(split[i]);
+ }
+ return result;
+ }
+
+ public String toString() {
+ return DOT_JOINER.join(version, extension);
+ }
+ }
+
+ private ResourceUtil() {}
+
+ public static VirtualFile getLatestVersion(VirtualFile file, boolean library) {
+ VersionKey latestVersionKey = null;
+
+ Collection<VirtualFile> children = file.getChildren();
+ for (VirtualFile child : children) {
+ if (library && child.isDirectory()) {
+ Matcher matcher = LIBRARY_VERSION_PATTERN.matcher(child.getName());
+ if (matcher.matches()) {
+ latestVersionKey = VersionKey.ORDERING.max(latestVersionKey, new VersionKey(child.getName(), null));
+ }
+ } else if (!library && child.isFile()) {
+ Matcher matcher = RESOURCE_VERSION_PATTERN.matcher(child.getName());
+ if (matcher.matches()) {
+ latestVersionKey = VersionKey.ORDERING.max(latestVersionKey, new VersionKey(matcher.group(1), matcher.group(2)));
+ }
+ }
+ }
+
+ VirtualFile result;
+
+ if (latestVersionKey != null) {
+ result = file.getChild(latestVersionKey.toString());
+ } else {
+ result = file;
+ }
+
+ if (result != null && (library ^ result.isFile())) {
+ return result;
+ }
+
+ return null;
+ }
+
+ private static Collection<VirtualFile> getExistingChildren(Iterable<VFSRoot> files, String path) throws URISyntaxException, IOException {
+ Collection<VirtualFile> result = Lists.newArrayList();
+
+ for (VirtualFile file: files) {
+ VirtualFile child = file.getChild(path, true);
+ if (child != null) {
+ result.add(child);
+ }
+ }
+
+ return result;
+ }
+
+ public static Collection<VirtualFile> getResourceRoots(Iterable<VFSRoot> cpRoots, Iterable<VFSRoot> webRoots) throws URISyntaxException, IOException {
+ List<VirtualFile> result = Lists.newArrayList();
+
+ result.addAll(getExistingChildren(cpRoots, CLASSPATH_RESOURCES_LOCATION));
+ result.addAll(getExistingChildren(webRoots, WEB_RESOURCES_LOCATION));
+
+ return result;
+ }
+}
Added: sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/ResourceProcessor.java
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/ResourceProcessor.java (rev 0)
+++ sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/ResourceProcessor.java 2010-08-13 13:56:18 UTC (rev 18619)
@@ -0,0 +1,38 @@
+/*
+ * 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.cdk.resource.writer;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public interface ResourceProcessor {
+
+ public boolean isSupportedFile(String name);
+
+ public void process(String resourceName, InputStream in, OutputStream out) throws IOException;
+
+}
Added: sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/CSSResourceProcessor.java
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/CSSResourceProcessor.java (rev 0)
+++ sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/CSSResourceProcessor.java 2010-08-13 13:56:18 UTC (rev 18619)
@@ -0,0 +1,46 @@
+/*
+ * 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.cdk.resource.writer.impl;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+
+import com.yahoo.platform.yui.compressor.CssCompressor;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class CSSResourceProcessor extends CharResourceProcessor {
+
+ @Override
+ public boolean isSupportedFile(String name) {
+ return name.endsWith(".css");
+ }
+
+ @Override
+ protected void doActualProcess(String resourceName, Reader in, Writer out) throws IOException {
+ new CssCompressor(in).compress(out, 0);
+ }
+
+}
Added: sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/CharResourceProcessor.java
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/CharResourceProcessor.java (rev 0)
+++ sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/CharResourceProcessor.java 2010-08-13 13:56:18 UTC (rev 18619)
@@ -0,0 +1,62 @@
+/*
+ * 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.cdk.resource.writer.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.Writer;
+
+import org.richfaces.cdk.resource.writer.ResourceProcessor;
+
+import com.google.common.io.Closeables;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public abstract class CharResourceProcessor implements ResourceProcessor {
+
+ protected abstract void doActualProcess(String resourceName, Reader in, Writer out) throws IOException;
+
+ @Override
+ public void process(String resourceName, InputStream in, OutputStream out) throws IOException {
+
+ boolean threw = true;
+ Reader reader = new InputStreamReader(in);
+ try {
+ Writer writer = new OutputStreamWriter(out);
+ try {
+ doActualProcess(resourceName, reader, writer);
+ threw = false;
+ } finally {
+ Closeables.close(writer, threw);
+ }
+ } finally {
+ Closeables.close(reader, threw);
+ }
+ }
+
+}
Added: sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/JavaScriptResourceProcessor.java
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/JavaScriptResourceProcessor.java (rev 0)
+++ sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/JavaScriptResourceProcessor.java 2010-08-13 13:56:18 UTC (rev 18619)
@@ -0,0 +1,56 @@
+/*
+ * 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.cdk.resource.writer.impl;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+
+import org.apache.maven.plugin.logging.Log;
+
+import com.yahoo.platform.yui.compressor.JavaScriptCompressor;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class JavaScriptResourceProcessor extends CharResourceProcessor {
+
+ private Log log;
+
+ public JavaScriptResourceProcessor(Log log) {
+ super();
+ this.log = log;
+ }
+
+ @Override
+ public boolean isSupportedFile(String name) {
+ return name.endsWith(".js");
+ }
+
+ @Override
+ protected void doActualProcess(String resourceName, Reader in, Writer out) throws IOException {
+ MavenLogErrorReporter reporter = new MavenLogErrorReporter(log, resourceName);
+ new JavaScriptCompressor(in, reporter).compress(out, 0, true, true, false, false);
+ }
+
+}
Added: sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/MavenLogErrorReporter.java
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/MavenLogErrorReporter.java (rev 0)
+++ sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/MavenLogErrorReporter.java 2010-08-13 13:56:18 UTC (rev 18619)
@@ -0,0 +1,70 @@
+/*
+ * 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.cdk.resource.writer.impl;
+
+import java.text.MessageFormat;
+
+import org.apache.maven.plugin.logging.Log;
+import org.mozilla.javascript.ErrorReporter;
+import org.mozilla.javascript.EvaluatorException;
+
+import com.google.common.base.Strings;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+final class MavenLogErrorReporter implements ErrorReporter {
+
+ private String resourceName;
+
+ private Log log;
+
+ public MavenLogErrorReporter(Log log, String resourceName) {
+ super();
+ this.log = log;
+ this.resourceName = resourceName;
+ }
+
+ private String formatMessage(String message, String sourceName, int line, String lineSource, int lineOffset) {
+ String location = MessageFormat.format("{0} (line {1}, col {2})",
+ Strings.isNullOrEmpty(sourceName) ? resourceName : sourceName, lineSource, lineOffset);
+
+ return MessageFormat.format("{0}: {1}\n{2}", location, message, lineSource);
+ }
+
+ @Override
+ public void warning(String message, String sourceName, int line, String lineSource, int lineOffset) {
+ log.warn(formatMessage(message, sourceName, line, lineSource, lineOffset));
+ }
+
+ @Override
+ public EvaluatorException runtimeError(String message, String sourceName, int line, String lineSource, int lineOffset) {
+ return new EvaluatorException(message, sourceName, line, lineSource, lineOffset);
+ }
+
+ @Override
+ public void error(String message, String sourceName, int line, String lineSource, int lineOffset) {
+ log.error(formatMessage(message, sourceName, line, lineSource, lineOffset));
+ }
+}
\ No newline at end of file
Copied: sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/ResourceWriterImpl.java (from rev 18609, sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/ResourceWriterImpl.java)
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/ResourceWriterImpl.java (rev 0)
+++ sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/ResourceWriterImpl.java 2010-08-13 13:56:18 UTC (rev 18619)
@@ -0,0 +1,121 @@
+/*
+ * 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.cdk.resource.writer.impl;
+
+import static org.richfaces.cdk.strings.Constants.COLON_JOINER;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.faces.application.Resource;
+
+import org.richfaces.cdk.ResourceWriter;
+import org.richfaces.cdk.resource.writer.ResourceProcessor;
+import org.richfaces.cdk.strings.Constants;
+import org.richfaces.resource.ResourceFactory;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Maps;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class ResourceWriterImpl implements ResourceWriter {
+
+ private File resourceContentsDir;
+
+ private File resourceMappingDir;
+
+ private Map<String, String> processedResources = Maps.newConcurrentMap();
+
+ private Iterable<ResourceProcessor> resourceProcessors;
+
+ public ResourceWriterImpl(File resourceContentsDir, File resourceMappingDir, Iterable<ResourceProcessor> resourceProcessors) {
+ this.resourceContentsDir = resourceContentsDir;
+ this.resourceMappingDir = resourceMappingDir;
+ this.resourceProcessors = Iterables.concat(resourceProcessors, Collections.singleton(ThroughputResourceProcessor.INSTANCE));
+ resourceContentsDir.mkdirs();
+ }
+
+ private String getResourceQualifier(Resource resource) {
+ return COLON_JOINER.join(resource.getLibraryName(), resource.getResourceName());
+ }
+
+ private File createOutputFile(String path) throws IOException {
+ File outFile = new File(resourceContentsDir, path);
+ outFile.getParentFile().mkdirs();
+ outFile.createNewFile();
+
+ return outFile;
+ }
+
+ public void writeResource(String skinName, Resource resource) throws IOException {
+ String requestPath = resource.getRequestPath();
+ String requestPathWithSkin = requestPath;
+
+ if (requestPath.startsWith(ResourceFactory.SKINNED_RESOURCE_PREFIX)) {
+ requestPathWithSkin = Constants.SLASH_JOINER.join(skinName,
+ requestPath.substring(ResourceFactory.SKINNED_RESOURCE_PREFIX.length()));
+ }
+
+ for (ResourceProcessor resourceProcessor : resourceProcessors) {
+ if (resourceProcessor.isSupportedFile(requestPath)) {
+ File outFile = createOutputFile(requestPathWithSkin);
+ resourceProcessor.process(requestPathWithSkin, resource.getInputStream(), new FileOutputStream(outFile));
+ processedResources.put(getResourceQualifier(resource), requestPath);
+ return;
+ }
+ }
+ }
+
+ @Override
+ public void writeProcessedResourceMappings() throws IOException {
+ //TODO separate mappings file location
+ FileOutputStream fos = null;
+ try {
+ File mappingsFile = new File(resourceMappingDir, ResourceFactory.STATIC_RESOURCE_MAPPINGS);
+ //TODO merge properties
+ mappingsFile.delete();
+ mappingsFile.getParentFile().mkdirs();
+ mappingsFile.createNewFile();
+
+ fos = new FileOutputStream(mappingsFile);
+ Properties properties = new Properties();
+ properties.putAll(processedResources);
+ properties.store(fos, null);
+ } finally {
+ try {
+ if (fos != null) {
+ fos.close();
+ }
+ } catch (IOException e) {
+ // TODO: handle exception
+ }
+ }
+ }
+
+}
Added: sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/ThroughputResourceProcessor.java
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/ThroughputResourceProcessor.java (rev 0)
+++ sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/resource/writer/impl/ThroughputResourceProcessor.java 2010-08-13 13:56:18 UTC (rev 18619)
@@ -0,0 +1,58 @@
+/*
+ * 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.cdk.resource.writer.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.richfaces.cdk.resource.writer.ResourceProcessor;
+
+import com.google.common.io.ByteStreams;
+import com.google.common.io.Closeables;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+final class ThroughputResourceProcessor implements ResourceProcessor {
+
+ public static final ResourceProcessor INSTANCE = new ThroughputResourceProcessor();
+
+ private ThroughputResourceProcessor() {}
+
+ @Override
+ public boolean isSupportedFile(String name) {
+ return true;
+ }
+
+ @Override
+ public void process(String resourceName, InputStream in, OutputStream out) throws IOException {
+ try {
+ ByteStreams.copy(in, out);
+ } finally {
+ Closeables.close(in, true);
+ Closeables.close(out, true);
+ }
+ }
+
+}
Modified: sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/task/ResourceTaskFactoryImpl.java
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/task/ResourceTaskFactoryImpl.java 2010-08-13 13:44:52 UTC (rev 18618)
+++ sandbox/trunk/cdk/maven-resources-plugin/src/main/java/org/richfaces/cdk/task/ResourceTaskFactoryImpl.java 2010-08-13 13:56:18 UTC (rev 18619)
@@ -35,7 +35,7 @@
import org.richfaces.cdk.ResourceTaskFactory;
import org.richfaces.cdk.ResourceWriter;
import org.richfaces.cdk.faces.CurrentResourceContext;
-import org.richfaces.cdk.resource.handler.impl.DynamicResourceWrapper;
+import org.richfaces.resource.ResourceFactory;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
@@ -111,8 +111,7 @@
return;
}
- //TODO hack
- skinDependent = (resource instanceof DynamicResourceWrapper);
+ skinDependent = resource.getRequestPath().startsWith(ResourceFactory.SKINNED_RESOURCE_PREFIX);
} finally {
faces.setSkin(null);
faces.stopRequest();
15 years, 9 months
JBoss Rich Faces SVN: r18618 - in trunk/ui/input/ui/src/main: resources/META-INF/resources/org.richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-08-13 09:44:52 -0400 (Fri, 13 Aug 2010)
New Revision: 18618
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
Log:
add 'tab' support
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-08-13 12:54:58 UTC (rev 18617)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-08-13 13:44:52 UTC (rev 18618)
@@ -50,8 +50,6 @@
@ResourceDependency(library="org.richfaces", name = "inplaceInput.ecss") })
public class InplaceInputBaseRenderer extends RendererBase {
- public static final String OPTIONS_STATE = "state";
-
public static final String OPTIONS_EDIT_EVENT = "editEvent";
public static final String OPTIONS_EDIT_CONTAINER = "editContainer";
@@ -142,7 +140,6 @@
String clientId = inplaceInput.getClientId(facesContext);
Map<String, Object> options = new HashMap<String, Object>();
- options.put(OPTIONS_STATE, inplaceInput.getState());
options.put(OPTIONS_EDIT_EVENT, inplaceInput.getEditEvent());
options.put(OPTIONS_NONE_CSS, NONE_CSS);
options.put(OPTIONS_CHANGED_CSS, CHANGED_STATE_CSS);
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss 2010-08-13 12:54:58 UTC (rev 18617)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss 2010-08-13 13:44:52 UTC (rev 18618)
@@ -151,5 +151,5 @@
}
.rf-ii-none {
- display: none;
-}
\ No newline at end of file
+ clip:rect(0px,0px,0px,0px);
+}
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-08-13 12:54:58 UTC (rev 18617)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-08-13 13:44:52 UTC (rev 18618)
@@ -18,12 +18,13 @@
richfaces.Event.bind(this.element, this.editEvent, this.edit, this);
richfaces.Event.bind(this.input, "change", this.save, this);
richfaces.Event.bind(this.input, "blur", this.save, this);
-
+ richfaces.Event.bind(this.input, "focus", this.edit, this);
+
if(this.showControls) {
this.okbtn = $(document.getElementById(options.okbtn));
this.cancelbtn = $(document.getElementById(options.cancelbtn));
- richfaces.Event.bind(this.okbtn, "mousedown", this.saveBtnHandler, this);
- richfaces.Event.bind(this.cancelbtn, "mousedown", this.cancelBtnHandler, this);
+ richfaces.Event.bind(this.okbtn, "mousedown", this.__saveBtnHandler, this);
+ richfaces.Event.bind(this.cancelbtn, "mousedown", this.__cancelBtnHandler, this);
}
};
@@ -37,7 +38,7 @@
return {
name : "RichFaces.ui.InplaceInput",
-/****************** public methods *****************************************/
+/****************** public methods *****************************************/
edit: function() {
this.editContainer.removeClass(this.noneCss);
@@ -55,8 +56,10 @@
} else {
this.element.removeClass(this.changedCss);
}
-
- this.editContainer.addClass(this.noneCss);
+
+ if(!this.showControls) {
+ this.editContainer.addClass(this.noneCss);
+ }
},
cancel: function() {
@@ -73,12 +76,16 @@
getValue: function() {
return this.input.val();
},
-
- saveBtnHandler: function() {
- this.save(); return false;
+
+/****************** private methods *****************************************/
+
+ __saveBtnHandler: function() {
+ this.save();
+ this.editContainer.addClass(this.noneCss);
+ return false;
},
- cancelBtnHandler: function() {
+ __cancelBtnHandler: function() {
this.cancel(); return false;
}
}
15 years, 9 months
JBoss Rich Faces SVN: r18617 - in branches/RF-9040_build_updated_m2/ui: core/ui and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: jbalunas(a)redhat.com
Date: 2010-08-13 08:54:58 -0400 (Fri, 13 Aug 2010)
New Revision: 18617
Modified:
branches/RF-9040_build_updated_m2/ui/common/ui/pom.xml
branches/RF-9040_build_updated_m2/ui/core/ui/pom.xml
branches/RF-9040_build_updated_m2/ui/iteration/ui/pom.xml
branches/RF-9040_build_updated_m2/ui/misc/ui/pom.xml
branches/RF-9040_build_updated_m2/ui/output/ui/pom.xml
branches/RF-9040_build_updated_m2/ui/parent/pom.xml
Log:
RF-9040 readded cdk plugin to component builds
Modified: branches/RF-9040_build_updated_m2/ui/common/ui/pom.xml
===================================================================
--- branches/RF-9040_build_updated_m2/ui/common/ui/pom.xml 2010-08-13 12:40:20 UTC (rev 18616)
+++ branches/RF-9040_build_updated_m2/ui/common/ui/pom.xml 2010-08-13 12:54:58 UTC (rev 18617)
@@ -44,5 +44,4 @@
<artifactId>richfaces-ui-common-api</artifactId>
</dependency>
</dependencies>
-
</project>
\ No newline at end of file
Modified: branches/RF-9040_build_updated_m2/ui/core/ui/pom.xml
===================================================================
--- branches/RF-9040_build_updated_m2/ui/core/ui/pom.xml 2010-08-13 12:40:20 UTC (rev 18616)
+++ branches/RF-9040_build_updated_m2/ui/core/ui/pom.xml 2010-08-13 12:54:58 UTC (rev 18617)
@@ -1,27 +1,32 @@
-<!--
- 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.
+
+ <!--
+ 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/maven-v4_0_0.xsd">
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+>
<parent>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-ui-parent</artifactId>
<version>4.0.0-SNAPSHOT</version>
+ <relativePath>../../parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -32,11 +37,29 @@
<dependencies>
<dependency>
+ <groupId>org.richfaces.core</groupId>
+ <artifactId>richfaces-core-api</artifactId>
+ </dependency>
+ <dependency>
+ <!-- todo remove this dependency or move to test scope -->
+ <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>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
<scm>
<connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/trunk/ui/core/ui
</connection>
Modified: branches/RF-9040_build_updated_m2/ui/iteration/ui/pom.xml
===================================================================
--- branches/RF-9040_build_updated_m2/ui/iteration/ui/pom.xml 2010-08-13 12:40:20 UTC (rev 18616)
+++ branches/RF-9040_build_updated_m2/ui/iteration/ui/pom.xml 2010-08-13 12:54:58 UTC (rev 18617)
@@ -47,6 +47,15 @@
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
<scm>
<connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/trunk/ui/iteration/datas...</connection>
<developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/trunk/ui/iteration/datascro...</developerConnection>
Modified: branches/RF-9040_build_updated_m2/ui/misc/ui/pom.xml
===================================================================
--- branches/RF-9040_build_updated_m2/ui/misc/ui/pom.xml 2010-08-13 12:40:20 UTC (rev 18616)
+++ branches/RF-9040_build_updated_m2/ui/misc/ui/pom.xml 2010-08-13 12:54:58 UTC (rev 18617)
@@ -41,15 +41,6 @@
<groupId>org.richfaces.cdk</groupId>
<artifactId>maven-cdk-plugin</artifactId>
</plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- <version>1.0-beta-1</version>
- <configuration>
- <fail>false</fail>
- </configuration>
- </plugin>
</plugins>
</build>
Modified: branches/RF-9040_build_updated_m2/ui/output/ui/pom.xml
===================================================================
--- branches/RF-9040_build_updated_m2/ui/output/ui/pom.xml 2010-08-13 12:40:20 UTC (rev 18616)
+++ branches/RF-9040_build_updated_m2/ui/output/ui/pom.xml 2010-08-13 12:54:58 UTC (rev 18617)
@@ -34,6 +34,7 @@
<artifactId>richfaces-ui-output-ui</artifactId>
<name>Richfaces UI Components: Output UI</name>
<packaging>jar</packaging>
+
<build>
<plugins>
<plugin>
Modified: branches/RF-9040_build_updated_m2/ui/parent/pom.xml
===================================================================
--- branches/RF-9040_build_updated_m2/ui/parent/pom.xml 2010-08-13 12:40:20 UTC (rev 18616)
+++ branches/RF-9040_build_updated_m2/ui/parent/pom.xml 2010-08-13 12:54:58 UTC (rev 18617)
@@ -63,20 +63,6 @@
<groupId>org.richfaces.cdk</groupId>
<artifactId>maven-cdk-plugin</artifactId>
<version>${project.version}</version>
- <!--
- TODO Is this a problem because this parent is
- not specific to iteration?
- -->
- <configuration>
- <library>
- <prefix>org.richfaces</prefix>
- <taglib>
- <uri>http://richfaces.org/iteration</uri>
- <shortName>it</shortName>
- <displayName>Iteration components tags</displayName>
- </taglib>
- </library>
- </configuration>
<executions>
<execution>
<id>cdk-generate-sources</id>
15 years, 9 months
JBoss Rich Faces SVN: r18616 - trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-08-13 08:40:20 -0400 (Fri, 13 Aug 2010)
New Revision: 18616
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
Log:
JS api refactoring
Modified: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-08-13 11:46:22 UTC (rev 18615)
+++ trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-08-13 12:40:20 UTC (rev 18616)
@@ -9,22 +9,21 @@
this.changedCss = options.changedCss;
this.showControls = options.showControls;
-
this.element = $(document.getElementById(id));
this.editContainer = $(document.getElementById(options.editContainer));
this.input = $(document.getElementById(options.input));
this.label = $(document.getElementById(options.label));
this.initialValue = this.label.text();
- richfaces.Event.bind(this.element, this.editEvent, this.editState, this);
- richfaces.Event.bind(this.input, "change", this.changedState, this);
- richfaces.Event.bind(this.input, "blur", this.readyState, this);
+ richfaces.Event.bind(this.element, this.editEvent, this.edit, this);
+ richfaces.Event.bind(this.input, "change", this.save, this);
+ richfaces.Event.bind(this.input, "blur", this.save, this);
if(this.showControls) {
this.okbtn = $(document.getElementById(options.okbtn));
this.cancelbtn = $(document.getElementById(options.cancelbtn));
- richfaces.Event.bind(this.okbtn, "mousedown", this.clickOk, this);
- richfaces.Event.bind(this.cancelbtn, "mousedown", this.clickCancel, this);
+ richfaces.Event.bind(this.okbtn, "mousedown", this.saveBtnHandler, this);
+ richfaces.Event.bind(this.cancelbtn, "mousedown", this.cancelBtnHandler, this);
}
};
@@ -37,40 +36,15 @@
$.extend(richfaces.ui.InplaceInput.prototype, ( function () {
return {
name : "RichFaces.ui.InplaceInput",
-
- switchToState: function(state) {
- if(this.currentState != state) {
- var states = RichFaces.ui.InplaceInput;
- switch(state) {
- case states.READY: this.doReady(); break;
- case states.EDIT: this.doEdit(); break;
- case states.CHANGED: this.doChanged(); break;
- default:
- }
- this.currentState = state;
- }
- },
-
- editState: function(){
- this.switchToState(RichFaces.ui.InplaceInput.EDIT);
- },
-
- changedState: function(){
- this.switchToState(RichFaces.ui.InplaceInput.CHANGED);
- },
- readyState: function() {
- if(!this.showControls) {
- this.switchToState(RichFaces.ui.InplaceInput.READY);
- }
- },
-
- doEdit: function() {
+/****************** public methods *****************************************/
+
+ edit: function() {
this.editContainer.removeClass(this.noneCss);
this.input.focus();
},
-
- doChanged: function() {
+
+ save: function() {
var inputValue = this.input.val();
if(inputValue.length > 0) {
this.label.text(inputValue);
@@ -81,26 +55,34 @@
} else {
this.element.removeClass(this.changedCss);
}
+
+ this.editContainer.addClass(this.noneCss);
},
-
- doReady: function() {
+
+ cancel: function() {
+ var text = this.label.text();
+ this.input.val(text);
this.editContainer.addClass(this.noneCss);
},
- clickOk: function() {
- this.changedState();
- this.switchToState(RichFaces.ui.InplaceInput.READY);
- return false;
+ setValue: function (value) {
+ this.input.val(value);
+ this.save();
+ },
+
+ getValue: function() {
+ return this.input.val();
},
- clickCancel: function() {
- var text = this.label.text();
- this.input.val(text);
- this.switchToState(RichFaces.ui.InplaceInput.READY);
- return false;
+ saveBtnHandler: function() {
+ this.save(); return false;
+ },
+
+ cancelBtnHandler: function() {
+ this.cancel(); return false;
}
}
- })());
+ })());
})(jQuery, window.RichFaces);
15 years, 9 months
JBoss Rich Faces SVN: r18615 - trunk/examples/input-demo/src/main/webapp.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-08-13 07:46:22 -0400 (Fri, 13 Aug 2010)
New Revision: 18615
Modified:
trunk/examples/input-demo/src/main/webapp/inplaceInput.xhtml
Log:
add link to the DataGrid page
Modified: trunk/examples/input-demo/src/main/webapp/inplaceInput.xhtml
===================================================================
--- trunk/examples/input-demo/src/main/webapp/inplaceInput.xhtml 2010-08-13 11:40:30 UTC (rev 18614)
+++ trunk/examples/input-demo/src/main/webapp/inplaceInput.xhtml 2010-08-13 11:46:22 UTC (rev 18615)
@@ -12,7 +12,8 @@
<h:body>
<h:form id="form">
- <in:inplaceInput showControls="true" value="New York"/>
+ <in:inplaceInput showControls="false" value="New York"/>
+ <h:commandButton value="submit"/>
</h:form>
</h:body>
</html>
15 years, 9 months
JBoss Rich Faces SVN: r18614 - in trunk/examples/iteration-demo: src/main/webapp and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-08-13 07:40:30 -0400 (Fri, 13 Aug 2010)
New Revision: 18614
Modified:
trunk/examples/iteration-demo/pom.xml
trunk/examples/iteration-demo/src/main/webapp/dataTable.xhtml
Log:
add componentControl reference
Modified: trunk/examples/iteration-demo/pom.xml
===================================================================
--- trunk/examples/iteration-demo/pom.xml 2010-08-13 11:40:04 UTC (rev 18613)
+++ trunk/examples/iteration-demo/pom.xml 2010-08-13 11:40:30 UTC (rev 18614)
@@ -78,6 +78,10 @@
<groupId>org.richfaces.ui.iteration</groupId>
<artifactId>richfaces-ui-iteration-ui</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.misc</groupId>
+ <artifactId>richfaces-ui-misc-ui</artifactId>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
Modified: trunk/examples/iteration-demo/src/main/webapp/dataTable.xhtml
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/dataTable.xhtml 2010-08-13 11:40:04 UTC (rev 18613)
+++ trunk/examples/iteration-demo/src/main/webapp/dataTable.xhtml 2010-08-13 11:40:30 UTC (rev 18614)
@@ -4,7 +4,7 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:it="http://richfaces.org/iteration"
- xmlns:cc="http://richfaces.org/componentControl">
+ xmlns:misc="http://richfaces.org/misc">
<f:view contentType="text/html" />
<h:head>
@@ -13,18 +13,17 @@
<h:body>
<h:form id="form1">
- <it:dataScroller id="scroller1" for="richTable"
- page="#{dataBean.page}" maxPages="7"></it:dataScroller>
+ <it:dataScroller id="scroller1" for="richTable" page="#{dataBean.page}" maxPages="7"></it:dataScroller>
- <it:dataTable keepSaved="true" id="richTable" var="record"
- rowKeyVar="rowKey" value="#{dataBean.employeeList}" rows="20"
- sortMode="single">
+ <it:dataTable keepSaved="true" id="richTable" var="record" rowKeyVar="rowKey" value="#{dataBean.employeeList}" rows="20" sortMode="single">
<f:facet name="caption">
<h:outputText id="captioFacet1" value="Caption Facet" />
</f:facet>
+
<f:facet name="header">
<h:outputText value="header facet" />
</f:facet>
+
<it:column id="column_name" sortBy="#{record.name}"
sortIconAsc="resources/images/asc.gif"
sortIconDesc="resources/images/desc.gif"
@@ -82,8 +81,7 @@
</it:subTable -->
<f:facet name="footer">
- <it:dataScroller id="scroller3" for="richTable"
- page="#{dataBean.page}" maxPages="7"></it:dataScroller>
+ <it:dataScroller id="scroller3" for="richTable" page="#{dataBean.page}" maxPages="7"></it:dataScroller>
</f:facet>
</it:dataTable>
@@ -112,28 +110,28 @@
<h:commandButton value="next">
- <cc:componentControl event="click" target="form1:scroller1"
+ <misc:componentControl event="click" target="form1:scroller1"
operation="switchToPage">
<f:param value="fastforward" />
- </cc:componentControl>
+ </misc:componentControl>
</h:commandButton>
<h:commandButton value="previous">
- <cc:componentControl event="click" target="form1:scroller1"
+ <misc:componentControl event="click" target="form1:scroller1"
operation="previous" />
</h:commandButton>
<h:commandButton value="sort">
- <cc:componentControl event="click" target="form1:richTable"
+ <misc:componentControl event="click" target="form1:richTable"
operation="sort">
<f:param value="column_title" />
- </cc:componentControl>
+ </misc:componentControl>
</h:commandButton>
<h:commandButton value="unsort">
- <cc:componentControl event="click" target="form1:richTable"
+ <misc:componentControl event="click" target="form1:richTable"
operation="sort">
- </cc:componentControl>
+ </misc:componentControl>
</h:commandButton>
</h:form>
15 years, 9 months
JBoss Rich Faces SVN: r18613 - sandbox/trunk/cdk/maven-resources-plugin.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-08-13 07:40:04 -0400 (Fri, 13 Aug 2010)
New Revision: 18613
Modified:
sandbox/trunk/cdk/maven-resources-plugin/pom.xml
Log:
Updated pom for maven-resources-plugin
Modified: sandbox/trunk/cdk/maven-resources-plugin/pom.xml
===================================================================
--- sandbox/trunk/cdk/maven-resources-plugin/pom.xml 2010-08-13 11:33:47 UTC (rev 18612)
+++ sandbox/trunk/cdk/maven-resources-plugin/pom.xml 2010-08-13 11:40:04 UTC (rev 18613)
@@ -18,11 +18,6 @@
</properties>
<repositories>
- <repository>
- <id>reflections-repo</id>
- <name>Reflections Maven2 Repository</name>
- <url>http://reflections.googlecode.com/svn/repo</url>
- </repository>
</repositories>
<dependencies>
@@ -62,7 +57,7 @@
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
- <version>0.9.5-RC2</version>
+ <version>0.9.5-RC2_jboss-SP1</version>
<exclusions>
<exclusion>
<artifactId>google-collections</artifactId>
@@ -104,6 +99,11 @@
<artifactId>slf4j-simple</artifactId>
<version>1.5.8</version>
</dependency>
+ <dependency>
+ <groupId>com.yahoo.platform.yui</groupId>
+ <artifactId>yuicompressor</artifactId>
+ <version>2.3.6</version>
+ </dependency>
</dependencies>
<build>
15 years, 9 months
JBoss Rich Faces SVN: r18612 - in trunk/ui/iteration/ui/src: main/java/org/richfaces and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-08-13 07:33:47 -0400 (Fri, 13 Aug 2010)
New Revision: 18612
Added:
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstarctSubTableToggleControl.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumnGroup.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataTable.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractExtendedDataTable.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractSubTable.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java
trunk/ui/iteration/ui/src/main/resources/META-INF/org.richfaces.renderkit.html.images.ColumnHeaderGradientImage.resource
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datagrid.ecss
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.ecss
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/down_icon.gif
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.ecss
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/reorderMarker.gif
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/subtable-toggler.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/subtable.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/up_icon.gif
trunk/ui/iteration/ui/src/main/templates/toggle-control.template.xml
Removed:
trunk/ui/iteration/ui/src/main/config/
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIColumn.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIColumnGroup.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataGrid.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataScroller.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTable.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UISubTable.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UISubTableToggleControl.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/html/
trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DatascrollerTagHandler.java
trunk/ui/iteration/ui/src/main/resources/META-INF/dataTable.faces-config.xml
trunk/ui/iteration/ui/src/main/resources/META-INF/datascroller.taglib.xml
trunk/ui/iteration/ui/src/main/resources/META-INF/org.richfaces.renderkit.html.images.ColumnHeaderGradientImage
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datagrid.ecss
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datatable.ecss
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datatable.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/down_icon.gif
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/extendedDataTable.ecss
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/extendedDataTable.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/reorderMarker.gif
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/subtable-toggler.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/subtable.js
trunk/ui/iteration/ui/src/main/resources/META-INF/resources/up_icon.gif
trunk/ui/iteration/ui/src/main/resources/META-INF/tables.faces-config.xml
trunk/ui/iteration/ui/src/main/resources/META-INF/tables.taglib.xml
trunk/ui/iteration/ui/src/main/templates/org/
trunk/ui/iteration/ui/src/test/java/org/richfaces/component/UIDataTableBaseTest.java
Modified:
trunk/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DataTableDataIterator.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DataTableFixedChildrenIterator.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/event/DataTablePreRenderListener.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/package-info.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableToggleControlRendererBase.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataTableHandler.java
trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/SubTableHandler.java
Log:
migrate iteraation components to the CDK annotations
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/DataScrollerUtils.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -32,7 +32,7 @@
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
-import org.richfaces.component.UIDataScroller;
+import org.richfaces.component.AbstractDataScroller;
public final class DataScrollerUtils {
@@ -88,8 +88,8 @@
return parent;
}
- public static List<UIDataScroller> findDataScrollers(UIComponent dataTable) {
- List<UIDataScroller> datascrollers = new ArrayList<UIDataScroller>();
+ public static List<AbstractDataScroller> findDataScrollers(UIComponent dataTable) {
+ List<AbstractDataScroller> datascrollers = new ArrayList<AbstractDataScroller>();
Map<String, UIComponent> facets = dataTable.getFacets();
Set<Entry<String, UIComponent>> entries = facets.entrySet();
@@ -105,9 +105,9 @@
return datascrollers;
}
- protected static void findBelow(UIComponent component, List<UIDataScroller> result) {
- if ((component instanceof UIDataScroller) && component.isRendered()) {
- result.add((UIDataScroller) component);
+ protected static void findBelow(UIComponent component, List<AbstractDataScroller> result) {
+ if ((component instanceof AbstractDataScroller) && component.isRendered()) {
+ result.add((AbstractDataScroller) component);
} else {
for (UIComponent child : component.getChildren()) {
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstarctSubTableToggleControl.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstarctSubTableToggleControl.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstarctSubTableToggleControl.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.richfaces.component;
+
+import javax.faces.component.UIComponentBase;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
+@JsfComponent(
+ type = AbstarctSubTableToggleControl.COMPONENT_TYPE,
+ family = AbstarctSubTableToggleControl.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UISubTableToggleControl",
+ renderer = @JsfRenderer(type = "org.richfaces.SubTableRenderer"),
+ tag = @Tag( name = "subTableToggleControl")
+ )
+public abstract class AbstarctSubTableToggleControl extends UIComponentBase {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.SubTableToggleControl";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.SubTableToggleControl";
+
+ public static final String DEFAULT_EVENT = "onclick";
+
+ enum PropertyKeys {
+ forId
+ }
+
+ @Attribute
+ public abstract String getExpandLabel();
+
+ @Attribute
+ public abstract String getCollapseLabel();
+
+ @Attribute
+ public abstract String getExpandIcon();
+
+ @Attribute
+ public abstract String getCollapseIcon();
+
+ @Attribute(defaultValue = DEFAULT_EVENT)
+ public abstract String getEvent();
+
+ public String getFor() {
+ return (String)getStateHelper().eval(PropertyKeys.forId);
+ }
+
+ public void setFor(String forId) {
+ getStateHelper().put(PropertyKeys.forId, forId);
+ }
+}
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumn.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import java.util.Comparator;
+
+import javax.el.ValueExpression;
+
+import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.model.Filter;
+import org.richfaces.model.FilterField;
+import org.richfaces.model.SortField;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
+@JsfComponent(
+ type = AbstractColumn.COMPONENT_TYPE,
+ family = AbstractColumn.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UIColumn",
+ tag = @Tag(name="column")
+)
+public abstract class AbstractColumn extends javax.faces.component.UIColumn implements Column {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.Column";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.Column";
+
+
+ @Attribute
+ public abstract boolean isBreakRowBefore();
+
+ @Attribute(defaultValue="SortOrder.unsorted")
+ public abstract SortOrder getSortOrder();
+
+ @Attribute
+ public abstract Filter<?> getFilter();
+
+ @Attribute
+ public abstract Object getFilterValue();
+
+ @Attribute
+ public abstract Object getRowspan();
+
+ @Attribute
+ public abstract Object getColspan();
+
+ @Attribute
+ public abstract Comparator<?> getComparator();
+
+ public FilterField getFilterField() {
+ FilterField field = null;
+ Filter<?> filter = getFilter();
+ ValueExpression filterExpression = getValueExpression("filterExpression");
+ if (filter != null || filterExpression != null) {
+ field = new FilterField(filterExpression, filter, getFilterValue());
+ }
+ return field;
+ }
+
+ public SortField getSortField() {
+ SortField field = null;
+ SortOrder sortOrder = getSortOrder();
+ if (sortOrder != null && !SortOrder.unsorted.equals(sortOrder)) {
+ Comparator<?> comparator = getComparator();
+ ValueExpression sortBy = getValueExpression("sortBy");
+ if (comparator != null || sortBy != null) {
+ field = new SortField(sortBy, comparator, sortOrder);
+ }
+ }
+ return field;
+ }
+
+}
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumnGroup.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumnGroup.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractColumnGroup.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import java.util.Iterator;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIPanel;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.model.DataVisitor;
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.renderkit.RowHolderBase;
+
+@JsfComponent(
+ type = AbstractColumnGroup.COMPONENT_TYPE,
+ family = AbstractColumnGroup.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UIColumnGroup",
+ renderer = @JsfRenderer(type = "org.richfaces.ColumnGroupRenderer"),
+ tag = @Tag(name="columnGroup")
+)
+public abstract class AbstractColumnGroup extends UIPanel implements Row, Column {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.ColumnGroup";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.ColumnGroup";
+
+
+ public Iterator<UIComponent> columns() {
+ return new DataTableColumnsIterator(this);
+ }
+
+ public void setBreakBefore(boolean newBreakBefore) {
+ throw new IllegalStateException("Property 'breakBefore' for subtable is read-only");
+ }
+
+ public void setRowKey(FacesContext context, Object rowKey) {
+ // columnGroup doesn't have data model
+ }
+
+ public void walk(FacesContext context, DataVisitor visitor, Object argument) {
+ if (!(argument instanceof RowHolderBase)) {
+ return;
+ }
+
+ //TODO nick - implement in the proper way
+ visitor.process(context, null, argument);
+ }
+}
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataGrid.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -0,0 +1,203 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.visit.VisitCallback;
+import javax.faces.component.visit.VisitContext;
+import javax.faces.component.visit.VisitResult;
+import javax.faces.context.FacesContext;
+import javax.faces.event.PreRenderComponentEvent;
+
+import org.richfaces.cdk.annotations.Alias;
+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.cdk.annotations.TagType;
+import org.richfaces.context.ExtendedVisitContext;
+import org.richfaces.context.ExtendedVisitContextMode;
+import org.richfaces.log.RichfacesLogger;
+import org.richfaces.renderkit.MetaComponentRenderer;
+import org.slf4j.Logger;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
+@JsfComponent(
+ type = AbstractDataGrid.COMPONENT_TYPE,
+ family = AbstractDataGrid.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UIDataGrid",
+ renderer = @JsfRenderer(type = "org.richfaces.DataGridRenderer"),
+ tag = @Tag(name="dataGrid", handler="org.richfaces.taglib.DataGridHandler", type=TagType.Facelets)
+)
+public abstract class AbstractDataGrid extends UISequence implements Row, MetaComponentResolver, MetaComponentEncoder {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.DataGrid";
+
+ public static final String COMPONENT_FAMILY = UIDataTableBase.COMPONENT_FAMILY;
+
+ public static final String HEADER_FACET_NAME = "header";
+ public static final String FOOTER_FACET_NAME = "footer";
+ public static final String CAPTION_FACET_NAME = "caption";
+ public static final String NODATA_FACET_NAME = "noData";
+
+ public static final String HEADER = "header";
+ public static final String FOOTER = "footer";
+ public static final String BODY = "body";
+
+ private static final Logger RENDERKIT_LOG = RichfacesLogger.RENDERKIT.getLogger();
+
+ private static final Set<String> SUPPORTED_META_COMPONENTS = new HashSet<String>();
+
+ static {
+ SUPPORTED_META_COMPONENTS.add(HEADER);
+ SUPPORTED_META_COMPONENTS.add(FOOTER);
+ SUPPORTED_META_COMPONENTS.add(BODY);
+ }
+
+
+ enum PropertyKeys {
+ columns
+ }
+
+ @Attribute(aliases = @Alias(value="rows"))
+ public abstract int getElements();
+
+ public UIComponent getHeaderFacet() {
+ return getFacets().get(HEADER_FACET_NAME);
+ }
+
+ public UIComponent getFooterFacet() {
+ return getFacets().get(FOOTER_FACET_NAME);
+ }
+
+ public UIComponent getCaptionFacet() {
+ return getFacets().get(CAPTION_FACET_NAME);
+ }
+
+ public UIComponent getNoDataFacet() {
+ return getFacets().get(NODATA_FACET_NAME);
+ }
+
+ public int getColumns() {
+ int columns = (Integer)getStateHelper().eval(PropertyKeys.columns, 1);
+ return (columns < 1 ? 1 : columns);
+ }
+
+ public void setColumns(int count) {
+ getStateHelper().put(PropertyKeys.columns, count);
+ }
+
+ public Iterator<UIComponent> columns() {
+ //DataGrid doesn't work with column components
+ return null;
+ }
+
+ //TODO: copy from UIDataTableBase
+ public void encodeMetaComponent(FacesContext context, String metaComponentId) throws IOException {
+ context.getApplication().publishEvent(context, PreRenderComponentEvent.class, this);
+ MetaComponentRenderer renderer = (MetaComponentRenderer) getRenderer(context);
+ renderer.encodeMetaComponent(context, this, metaComponentId);
+ }
+
+ protected boolean visitFixedChildren(VisitContext visitContext, VisitCallback callback) {
+ if (visitContext instanceof ExtendedVisitContext) {
+ ExtendedVisitContext extendedVisitContext = (ExtendedVisitContext) visitContext;
+ if (extendedVisitContext.getVisitMode() == ExtendedVisitContextMode.RENDER) {
+ //TODO nick - call preEncodeBegin(...) and emit PreRenderEvent
+ VisitResult visitResult;
+
+ visitResult = extendedVisitContext.invokeMetaComponentVisitCallback(this, callback, HEADER);
+
+ if (visitResult == VisitResult.ACCEPT){
+ //TODO:
+ } else if (visitResult == VisitResult.COMPLETE) {
+ return true;
+ }
+
+ visitResult = extendedVisitContext.invokeMetaComponentVisitCallback(this, callback, FOOTER);
+
+ if (visitResult == VisitResult.ACCEPT) {
+ //TODO nick - visit footer?
+ } else if (visitResult == VisitResult.COMPLETE) {
+ return true;
+ }
+
+ if (visitResult == VisitResult.REJECT) {
+ return false;
+ }
+ }
+ }
+
+ return super.visitFixedChildren(visitContext, callback);
+ }
+
+ protected boolean visitDataChildren(VisitContext visitContext, final VisitCallback callback, boolean visitRows) {
+ if (visitContext instanceof ExtendedVisitContext && visitRows) {
+ ExtendedVisitContext extendedVisitContext = (ExtendedVisitContext) visitContext;
+
+ if (extendedVisitContext.getVisitMode() == ExtendedVisitContextMode.RENDER) {
+ //TODO nick - call preEncodeBegin(...) and emit PreRenderEvent
+ setRowKey(visitContext.getFacesContext(), null);
+
+ VisitResult result = extendedVisitContext.invokeMetaComponentVisitCallback(this, callback, BODY);
+
+ if (result == VisitResult.ACCEPT) {
+ //TODO nick - visit body?
+ } else {
+ return result == VisitResult.COMPLETE;
+ }
+ }
+ }
+
+ return super.visitDataChildren(visitContext, callback, visitRows);
+ }
+
+
+ public String resolveClientId(FacesContext facesContext, UIComponent contextComponent, String metaComponentId) {
+ if (SUPPORTED_META_COMPONENTS.contains(metaComponentId)) {
+ Object oldRowKey = getRowKey();
+
+ try {
+ setRowKey(facesContext, null);
+ return getClientId(facesContext) + MetaComponentResolver.META_COMPONENT_SEPARATOR_CHAR + metaComponentId;
+ } finally {
+ try {
+ setRowKey(facesContext, oldRowKey);
+ } catch (Exception e) {
+ RENDERKIT_LOG.error(e.getMessage(), e);
+ }
+ }
+ }
+
+ return null;
+ }
+}
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataScroller.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -0,0 +1,391 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIData;
+import javax.faces.component.UIInput;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+
+import org.ajax4jsf.component.IterationStateHolder;
+import org.ajax4jsf.renderkit.RendererUtils;
+import org.richfaces.DataScrollerUtils;
+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.cdk.annotations.TagType;
+import org.richfaces.component.util.MessageUtil;
+import org.richfaces.event.DataScrollerEvent;
+import org.richfaces.event.DataScrollerListener;
+import org.richfaces.event.DataScrollerSource;
+
+
+@JsfComponent(
+ type = AbstractDataScroller.COMPONENT_TYPE,
+ family = AbstractDataScroller.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UIDataScroller",
+ renderer = @JsfRenderer(type = "org.richfaces.DataScrollerRenderer"),
+ tag = @Tag(name="dataScroller", handler="org.richfaces.taglib.DataScrollerHandler", type=TagType.Facelets)
+)
+public abstract class AbstractDataScroller extends UIComponentBase implements DataScrollerSource, IterationStateHolder {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.DataScroller";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.DataScroller";
+
+ public static final String SCROLLER_STATE_ATTRIBUTE = COMPONENT_TYPE + ":page";
+
+ public static final String FIRST_FACET_NAME = "first";
+
+ public static final String LAST_FACET_NAME = "last";
+
+ public static final String FAST_FORWARD_FACET_NAME = "fastforward";
+
+ public static final String FAST_REWIND_FACET_NAME = "fastrewind";
+
+ public static final String FIRST_DISABLED_FACET_NAME = "first_disabled";
+
+ public static final String LAST_DISABLED_FACET_NAME = "last_disabled";
+
+ public static final String PAGEMODE_FULL = "full";
+
+ public static final String PAGEMODE_SHORT = "short";
+
+ private Integer page;
+
+ protected enum PropertyKeys {
+ boundaryControls, fastControls, fastStep, forComponent, inactiveStyle, selectStyle, inactiveStyleClass, selectStyleClass, scrollerListener, lastPageMode, maxPages, pageIndexVar, pagesVar, renderIfSinglePage, style, styleClass, stepControls
+ }
+
+ @Attribute
+ public abstract String getLastPageMode();
+
+ @Attribute(defaultValue="0")
+ public abstract int getFastStep();
+
+ @Attribute
+ public abstract String getForComponent();
+
+ @Attribute(defaultValue="10")
+ public abstract int getMaxPages();
+
+ @Attribute(defaultValue="show")
+ public abstract String getBoundaryControls();
+
+ @Attribute(defaultValue="show")
+ public abstract String getFastControls();
+
+ public void addScrollerListener(DataScrollerListener listener) {
+ addFacesListener(listener);
+ }
+
+ public DataScrollerListener[] getScrollerListeners() {
+ return (DataScrollerListener[]) getFacesListeners(DataScrollerListener.class);
+ }
+
+ public void removeScrollerListener(DataScrollerListener listener) {
+ removeFacesListener(listener);
+ }
+
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ if (event instanceof DataScrollerEvent) {
+ DataScrollerEvent dataScrollerEvent = (DataScrollerEvent) event;
+
+ updateModel(dataScrollerEvent.getPage());
+
+ FacesContext facesContext = getFacesContext();
+
+ UIComponent dataTable = getDataTable();
+
+ List<AbstractDataScroller> dataScrollers = DataScrollerUtils.findDataScrollers(dataTable);
+ for (AbstractDataScroller dataScroller : dataScrollers) {
+ facesContext.getPartialViewContext().getRenderIds().add(dataScroller.getClientId(facesContext));
+ }
+
+ String dataTableId = null;
+ if (dataTable instanceof MetaComponentResolver) {
+ dataTableId = ((MetaComponentResolver) dataTable).resolveClientId(facesContext, dataTable, "body");
+ }
+
+ if (dataTableId == null) {
+ dataTableId = dataTable.getClientId(facesContext);
+ }
+
+ facesContext.getPartialViewContext().getRenderIds().add(dataTableId);
+
+ //add datascroller to render
+ String dataScrollerId = getClientId(facesContext);
+ if(!facesContext.getPartialViewContext().getRenderIds().contains(dataScrollerId)) {
+ facesContext.getPartialViewContext().getRenderIds().add(dataScrollerId);
+ }
+
+ }
+
+ super.broadcast(event);
+ }
+
+ /**
+ * Finds the dataTable which id is mapped to the "for" property
+ *
+ * @return the dataTable component
+ */
+
+ public UIComponent getDataTable() {
+ String forAttribute = (String) getAttributes().get(PropertyKeys.forComponent.toString());
+ UIComponent forComp;
+
+ if (forAttribute == null) {
+ forComp = this;
+
+ while ((forComp = forComp.getParent()) != null) {
+ if (forComp instanceof UIData || forComp instanceof UIDataAdaptor) {
+ getStateHelper().put(PropertyKeys.forComponent, forComp.getId());
+ return forComp;
+ }
+ }
+ throw new FacesException("could not find dataTable for datascroller " + this.getId());
+
+ } else {
+ forComp = RendererUtils.getInstance().findComponentFor(this, forAttribute);
+ }
+
+ if (forComp == null) {
+ throw new IllegalArgumentException("could not find dataTable with id '" + forAttribute + "'");
+ } else if (!((forComp instanceof UIData) || (forComp instanceof UIDataAdaptor))) {
+
+ throw new IllegalArgumentException("component with id '" + forAttribute + "' must be of type "
+ + UIData.class.getName() + " or " + UIDataAdaptor.class + ", not type " + forComp.getClass().getName());
+ }
+
+ return forComp;
+ }
+
+ private int getFastStepOrDefault() {
+ return (Integer) getStateHelper().eval(PropertyKeys.fastStep, 1);
+ }
+
+ public int getPageForFacet(String facetName) {
+ if (facetName == null) {
+ throw new NullPointerException();
+ }
+
+ int newPage = 1;
+ int pageCount = getPageCount();
+
+ if (FIRST_FACET_NAME.equals(facetName)) {
+ newPage = 1;
+ } else if (LAST_FACET_NAME.equals(facetName)) {
+ newPage = pageCount > 0 ? pageCount : 1;
+ } else if (FAST_FORWARD_FACET_NAME.equals(facetName)) {
+ newPage = getPage() + getFastStepOrDefault();
+ } else if (FAST_REWIND_FACET_NAME.equals(facetName)) {
+ newPage = getPage() - getFastStepOrDefault();
+ } else {
+ try {
+ newPage = Integer.parseInt(facetName.toString());
+ } catch (NumberFormatException e) {
+ throw new FacesException(e.getLocalizedMessage(), e);
+ }
+ }
+
+ if (newPage >= 1 && newPage <= pageCount) {
+ return newPage;
+ } else {
+ return 0;
+ }
+ }
+
+ public int getPageCount(UIComponent data) {
+ int rowCount = getRowCount(data);
+ int rows = getRows(data);
+ return getPageCount(data, rowCount, rows);
+ }
+
+ public int getPageCount(UIComponent data, int rowCount, int rows) {
+ return DataScrollerUtils.getPageCount(data, rowCount, rows);
+ }
+
+ /** @return the page count of the uidata */
+ public int getPageCount() {
+ return getPageCount(getDataTable());
+ }
+
+ public int getRowCount(UIComponent data) {
+ return (Integer) data.getAttributes().get("rowCount");
+ }
+
+ /** @return int */
+ public int getRowCount() {
+ return getRowCount(getDataTable());
+ }
+
+ public int getRows(UIComponent data) {
+ return DataScrollerUtils.getRows(data);
+ }
+
+ // facet getter methods
+ public UIComponent getFirst() {
+ return getFacet(FIRST_FACET_NAME);
+ }
+
+ public UIComponent getLast() {
+ return getFacetByKey(LAST_FACET_NAME);
+ }
+
+ public UIComponent getFastForward() {
+ return getFacetByKey(FAST_FORWARD_FACET_NAME);
+ }
+
+ public UIComponent getFastRewind() {
+ return getFacetByKey(FAST_REWIND_FACET_NAME);
+ }
+
+ private UIComponent getFacetByKey(String key) {
+ return getFacet(key.toString());
+ }
+
+ private static boolean isRendered(UIComponent component) {
+ UIComponent c = component;
+ while (c != null) {
+ if (!c.isRendered()) {
+ return false;
+ }
+ c = c.getParent();
+ }
+
+ return true;
+ }
+
+ public void setPage(int newPage) {
+ this.page = newPage;
+ }
+
+ public int getPage() {
+
+ UIComponent dataTable = getDataTable();
+ Map<String, Object> attributes = dataTable.getAttributes();
+
+ FacesContext facesContext = getFacesContext();
+ Integer state = (Integer) attributes.get(dataTable.getClientId(facesContext) + SCROLLER_STATE_ATTRIBUTE);
+
+ if (state != null) {
+ return state;
+ }
+
+ if (this.page != null) {
+ return page;
+ }
+
+ ValueExpression ve = getValueExpression("page");
+ if (ve != null) {
+ try {
+ Integer pageObject = (Integer) ve.getValue(getFacesContext().getELContext());
+
+ if (pageObject != null) {
+ return pageObject;
+ }
+ } catch (ELException e) {
+ throw new FacesException(e);
+ }
+ }
+
+ return 1;
+ }
+
+ private void updateModel(int newPage) {
+
+ FacesContext facesContext = getFacesContext();
+ UIComponent dataTable = getDataTable();
+
+ if (isRendered(dataTable)) {
+ dataTable.getAttributes().put("first", (newPage - 1) * getRows(dataTable));
+ }
+
+ Map<String, Object> attributes = dataTable.getAttributes();
+ attributes.put(dataTable.getClientId(facesContext) + SCROLLER_STATE_ATTRIBUTE, newPage);
+
+ ValueExpression ve = getValueExpression("page");
+ if (ve != null) {
+ try {
+ ve.setValue(facesContext.getELContext(), newPage);
+ attributes.remove(dataTable.getClientId(facesContext) + SCROLLER_STATE_ATTRIBUTE);
+ } catch (ELException e) {
+ String messageStr = e.getMessage();
+ Throwable result = e.getCause();
+ while (null != result && result.getClass().isAssignableFrom(ELException.class)) {
+ messageStr = result.getMessage();
+ result = result.getCause();
+ }
+ FacesMessage message;
+ if (null == messageStr) {
+ message = MessageUtil.getMessage(facesContext, UIInput.UPDATE_MESSAGE_ID,
+ new Object[] {MessageUtil.getLabel(facesContext, this) });
+ } else {
+ message = new FacesMessage(FacesMessage.SEVERITY_ERROR, messageStr, messageStr);
+ }
+ facesContext.getExternalContext().log(message.getSummary(), result);
+ facesContext.addMessage(getClientId(facesContext), message);
+ facesContext.renderResponse();
+ } catch (IllegalArgumentException e) {
+ FacesMessage message = MessageUtil.getMessage(facesContext, UIInput.UPDATE_MESSAGE_ID,
+ new Object[] {MessageUtil.getLabel(facesContext, this) });
+ facesContext.getExternalContext().log(message.getSummary(), e);
+ facesContext.addMessage(getClientId(facesContext), message);
+ facesContext.renderResponse();
+ } catch (Exception e) {
+ FacesMessage message = MessageUtil.getMessage(facesContext, UIInput.UPDATE_MESSAGE_ID,
+ new Object[] {MessageUtil.getLabel(facesContext, this) });
+ facesContext.getExternalContext().log(message.getSummary(), e);
+ facesContext.addMessage(getClientId(facesContext), message);
+ facesContext.renderResponse();
+ }
+ }
+ }
+
+ public boolean isLocalPageSet() {
+ return page != null;
+ }
+
+ public void resetLocalPage() {
+ page = null;
+ }
+
+ public Object getIterationState() {
+ return this.page;
+ }
+
+ public void setIterationState(Object state) {
+ this.page = (Integer) state;
+ }
+}
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataTable.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataTable.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractDataTable.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import javax.faces.component.UIComponent;
+
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.cdk.annotations.TagType;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
+@JsfComponent(
+ type = AbstractDataTable.COMPONENT_TYPE,
+ family = AbstractDataTable.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UIDataTable",
+ renderer = @JsfRenderer(type = "org.richfaces.DataTableRenderer"),
+ tag = @Tag(name="dataTable", handler="org.richfaces.taglib.DataTableHandler", type=TagType.Facelets)
+)
+public abstract class AbstractDataTable extends UIDataTableBase {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.DataTable";
+
+ public static final String COMPONENT_FAMILY = UIDataTableBase.COMPONENT_FAMILY;
+
+ public static final String CAPTION_FACET_NAME = "caption";
+
+
+ public UIComponent getCaption() {
+ return getFacets().get(CAPTION_FACET_NAME);
+ }
+
+}
+
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractExtendedDataTable.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractExtendedDataTable.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractExtendedDataTable.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -0,0 +1,190 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.component.visit.VisitCallback;
+import javax.faces.component.visit.VisitContext;
+import javax.faces.component.visit.VisitResult;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.cdk.annotations.JsfComponent;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.cdk.annotations.Tag;
+import org.richfaces.context.ExtendedVisitContext;
+import org.richfaces.context.ExtendedVisitContextMode;
+import org.richfaces.log.RichfacesLogger;
+import org.slf4j.Logger;
+
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+
+
+@JsfComponent(
+ type = AbstractExtendedDataTable.COMPONENT_TYPE,
+ family = AbstractExtendedDataTable.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UIExtendedDataTable",
+ renderer = @JsfRenderer(type = "org.richfaces.ExtendedDataTableRenderer"),
+ tag = @Tag(name = "extendedDataTable")
+)
+public abstract class AbstractExtendedDataTable extends UIDataTableBase implements MetaComponentResolver, MetaComponentEncoder {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.ExtendedDataTable";
+
+ public static final String COMPONENT_FAMILY = UIDataTableBase.COMPONENT_FAMILY;
+
+ public static final String SCROLL = "scroll";
+
+ public static final String SUBMITTED_CLIENT_FIRST = "submittedClientFirst";
+
+ public static final String OLD_CLIENT_FIRST = "oldClientFirst";
+
+ private static final Logger RENDERKIT_LOG = RichfacesLogger.RENDERKIT.getLogger();
+
+ protected enum PropertyKeys {
+ clientFirst, clientRows
+ }
+
+ public String resolveClientId(FacesContext facesContext, UIComponent contextComponent, String metaComponentId) {
+ if (SCROLL.equals(metaComponentId)) {
+ Object oldRowKey = getRowKey();
+
+ try {
+ setRowKey(facesContext, null);
+ return getClientId(facesContext) + MetaComponentResolver.META_COMPONENT_SEPARATOR_CHAR + metaComponentId;
+ } finally {
+ try {
+ setRowKey(facesContext, oldRowKey);
+ } catch (Exception e) {
+ RENDERKIT_LOG.error(e.getMessage(), e);
+ }
+ }
+ }
+
+ return super.resolveClientId(facesContext, contextComponent, metaComponentId);
+ }
+
+ public void encodeMetaComponent(FacesContext context, String metaComponentId) throws IOException {
+ if (SCROLL.equals(metaComponentId)) {
+ Map<String, Object> attributes = getAttributes();
+ Integer submittedClientFirst = (Integer) attributes.remove(SUBMITTED_CLIENT_FIRST);
+ if (submittedClientFirst != null) {
+ attributes.put(OLD_CLIENT_FIRST, getClientFirst());
+ setClientFirst(submittedClientFirst);
+ }
+ }
+
+ super.encodeMetaComponent(context, metaComponentId);
+ }
+
+ protected boolean visitDataChildren(VisitContext visitContext, final VisitCallback callback, boolean visitRows) {
+ if (visitContext instanceof ExtendedVisitContext && visitRows) {
+ ExtendedVisitContext extendedVisitContext = (ExtendedVisitContext) visitContext;
+
+ if (extendedVisitContext.getVisitMode() == ExtendedVisitContextMode.RENDER) {
+ //TODO nick - call preEncodeBegin(...) and emit PreRenderEvent
+ setRowKey(visitContext.getFacesContext(), null);
+
+ VisitResult result;
+
+ result = extendedVisitContext.invokeMetaComponentVisitCallback(this, callback, SCROLL);
+
+ if (result == VisitResult.ACCEPT) {
+ //TODO nick - visit scroll?
+ } else if (result == VisitResult.COMPLETE) {
+ return true;
+ }
+ }
+ }
+
+ return super.visitDataChildren(visitContext, callback, visitRows);
+ }
+
+ protected int getActualFirst() {
+ return getFirst() + getClientFirst();
+ }
+
+ protected int getActualRows() {
+ int rows = getClientRows();
+
+ if (rows > 0) {
+ int r = getRows();
+ if (r > 0 && r < rows) {
+ rows = r;
+ }
+ } else {
+ rows = getRows();
+ }
+
+ return rows;
+ }
+
+ public int getClientFirst() {
+ return (Integer) getStateHelper().eval(PropertyKeys.clientFirst, 0);
+ }
+
+ public void setClientFirst(int clientFirst) {
+ getStateHelper().put(PropertyKeys.clientFirst, clientFirst);
+ updateState();
+ }
+
+ public void setFirst(int first) {
+ super.setFirst(first);
+ setClientFirst(0);
+ }
+
+ public int getClientRows() {
+ return (Integer) getStateHelper().eval(PropertyKeys.clientRows, 0);
+ }
+
+ public void setClientRows(int clientRows) {
+ getStateHelper().put(PropertyKeys.clientRows, clientRows);
+
+ updateState();
+ }
+
+ public void setValueBinding(String name, javax.faces.el.ValueBinding binding) {
+ super.setValueBinding(name, binding);
+
+ //TODO nick - clientFirst?
+ if ("clientRows".equals(name)) {
+ updateState();
+ }
+ }
+
+ public void setValueExpression(String name, ValueExpression binding) {
+ super.setValueExpression(name, binding);
+
+ //TODO nick - clientFirst?
+ if ("clientRows".equals(name)) {
+ updateState();
+ }
+ }
+}
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractSubTable.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractSubTable.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/AbstractSubTable.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -0,0 +1,155 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.component;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+
+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.cdk.annotations.TagType;
+import org.richfaces.event.ToggleEvent;
+import org.richfaces.event.ToggleListener;
+
+
+/**
+ * @author Anton Belevich
+ *
+ */
+@JsfComponent(
+ type = AbstractSubTable.COMPONENT_TYPE,
+ family = AbstractSubTable.COMPONENT_FAMILY,
+ generate = "org.richfaces.component.UISubTable",
+ renderer = @JsfRenderer(type = "org.richfaces.SubTableRenderer"),
+ tag = @Tag(name = "subTable", handler = "org.richfaces.taglib.SubTableHandler", type = TagType.Facelets)
+)
+public abstract class AbstractSubTable extends UIDataTableBase implements Column, Expandable {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.SubTable";
+
+ public static final String COMPONENT_FAMILY = UIDataTableBase.COMPONENT_FAMILY;
+
+ public static final String MODE_AJAX = "ajax";
+
+ public static final String MODE_SERVER = "server";
+
+ public static final String MODE_CLIENT = "client";
+
+ public static final int EXPAND_STATE = 1;
+
+ public static final int COLLAPSE_STATE = 0;
+
+
+ enum PropertyKeys {
+ expanded
+ }
+
+ @Attribute(defaultValue = "true")
+ public abstract boolean isExpanded();
+
+ @Attribute(defaultValue = MODE_CLIENT)
+ public abstract String getExpandMode();
+
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ if (event instanceof ToggleEvent) {
+ ToggleEvent toggleEvent = (ToggleEvent) event;
+ boolean newValue = toggleEvent.isExpanded();
+ getStateHelper().put(PropertyKeys.expanded, newValue);
+
+ FacesContext facesContext = getFacesContext();
+ ELContext elContext = facesContext.getELContext();
+
+ ValueExpression valueExpression = getValueExpression(PropertyKeys.expanded.toString());
+ if (valueExpression != null && !valueExpression.isReadOnly(elContext)) {
+ valueExpression.setValue(elContext, newValue);
+ }
+
+ if(getFacesContext().getPartialViewContext().isAjaxRequest()) {
+ String render = resolveClientId(facesContext, this, BODY);
+
+ getFacesContext().getPartialViewContext().getRenderIds().add(render);
+
+ String togglerId = toggleEvent.getTogglerId();
+ if(togglerId != null) {
+ getFacesContext().getPartialViewContext().getRenderIds().add(togglerId);
+ }
+ }
+
+ }
+ super.broadcast(event);
+ }
+
+ public boolean isBreakBefore() {
+ return true;
+ }
+
+ public void setBreakBefore(boolean newBreakBefore) {
+ throw new IllegalStateException("Property 'breakBefore' for subtable is read-only");
+ }
+
+ public String getSortExpression() {
+ // SubTable is not sortable element.
+ return null;
+ }
+
+ public void setSortExpression(String sortExpression) {
+ throw new IllegalArgumentException("subtable is not sortable element");
+ }
+
+ public void addToggleListener(ToggleListener listener) {
+ addFacesListener(listener);
+ }
+
+ public void removeToggleListener(ToggleListener listener) {
+ removeFacesListener(listener);
+ }
+
+ public ToggleListener[] getToggleListeners() {
+ return (ToggleListener[]) getFacesListeners(ToggleListener.class);
+ }
+
+ public void setIterationState(Object stateObject) {
+ Object[] state = (Object[]) stateObject;
+ if (state != null) {
+ super.setIterationState(state[0]);
+ getStateHelper().put(PropertyKeys.expanded, state[1]);
+ } else {
+ super.setIterationState(null);
+ getStateHelper().put(PropertyKeys.expanded, null);
+ }
+ }
+
+ public Object getIterationState() {
+ Object [] state = new Object[2];
+ state[0] = super.getIterationState();
+ state[1] = getStateHelper().get(PropertyKeys.expanded);
+ return state;
+ }
+}
+
+
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DataTableDataIterator.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DataTableDataIterator.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DataTableDataIterator.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -43,7 +43,7 @@
UIComponent nextColumn = null;
while (nextColumn == null && childrenIterator.hasNext()) {
UIComponent child = childrenIterator.next();
- if ((child instanceof UIColumn) || (child instanceof Column)) {
+ if ((child instanceof AbstractColumn) || (child instanceof Column)) {
nextColumn = child;
}
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DataTableFixedChildrenIterator.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DataTableFixedChildrenIterator.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/DataTableFixedChildrenIterator.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -47,7 +47,7 @@
Iterator<UIComponent> childrenIterator = getChildrenIterator();
while (next == null && childrenIterator.hasNext()) {
UIComponent child = childrenIterator.next();
- if ((child instanceof UIColumn) && child.isRendered()) {
+ if ((child instanceof AbstractColumn) && child.isRendered()) {
currentColumnIterator = getChildFacetIterator(child);
next = nextItem();
}
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIColumn.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIColumn.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIColumn.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,102 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import java.util.Comparator;
-
-import javax.el.ValueExpression;
-
-import org.richfaces.model.Filter;
-import org.richfaces.model.FilterField;
-import org.richfaces.model.SortField;
-
-public class UIColumn extends javax.faces.component.UIColumn implements Column {
-
- protected enum PropertyKeys {
- filter, filterValue, comparator, sortOrder, breakRowBefore
- }
-
- public void setBreakRowBefore(boolean breakRowBefore) {
- getStateHelper().put(PropertyKeys.breakRowBefore, breakRowBefore);
- }
-
- public boolean getBreakRowBefore() {
- return (Boolean) getStateHelper().eval(PropertyKeys.breakRowBefore, false);
- }
-
- public void setSortOrder(SortOrder sortOrder) {
- getStateHelper().put(PropertyKeys.sortOrder, sortOrder);
- }
-
- public SortOrder getSortOrder() {
- return (SortOrder) getStateHelper().eval(PropertyKeys.sortOrder, SortOrder.unsorted);
- }
-
- public void setFilter(Filter<?> filter) {
- getStateHelper().put(PropertyKeys.filter, filter);
- }
-
- public Filter<?> getFilter() {
- return (Filter<?>) getStateHelper().eval(PropertyKeys.filter);
- }
-
- public void setFilterValue(Object filterValue) {
- getStateHelper().put(PropertyKeys.filterValue, filterValue);
- }
-
- public Object getFilterValue() {
- return getStateHelper().eval(PropertyKeys.filterValue);
- }
-
- public void setComparator(Comparator<?> comparator) {
- getStateHelper().put(PropertyKeys.comparator, comparator);
- }
-
- public Comparator<?> getComparator() {
- return (Comparator<?>) getStateHelper().eval(PropertyKeys.comparator);
- }
-
- public FilterField getFilterField() {
- FilterField field = null;
- Filter<?> filter = getFilter();
- ValueExpression filterExpression = getValueExpression("filterExpression");
- if (filter != null || filterExpression != null) {
- field = new FilterField(filterExpression, filter, getFilterValue());
- }
- return field;
- }
-
- public SortField getSortField() {
- SortField field = null;
- SortOrder sortOrder = getSortOrder();
- if (sortOrder != null && !SortOrder.unsorted.equals(sortOrder)) {
- Comparator<?> comparator = getComparator();
- ValueExpression sortBy = getValueExpression("sortBy");
- if (comparator != null || sortBy != null) {
- field = new SortField(sortBy, comparator, sortOrder);
- }
- }
- return field;
- }
-
-}
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIColumnGroup.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIColumnGroup.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIColumnGroup.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import java.util.Iterator;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIPanel;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.model.DataVisitor;
-import org.richfaces.renderkit.RowHolderBase;
-
-public abstract class UIColumnGroup extends UIPanel implements Row, Column {
-
- public Iterator<UIComponent> columns() {
- return new DataTableColumnsIterator(this);
- }
-
- public void setBreakBefore(boolean newBreakBefore) {
- throw new IllegalStateException("Property 'breakBefore' for subtable is read-only");
- }
-
- public void setRowKey(FacesContext context, Object rowKey) {
- // columnGroup doesn't have data model
- }
-
- public void walk(FacesContext context, DataVisitor visitor, Object argument) {
- if (!(argument instanceof RowHolderBase)) {
- return;
- }
-
- //TODO nick - implement in the proper way
- visitor.process(context, null, argument);
- }
-}
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataGrid.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataGrid.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataGrid.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,190 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.visit.VisitCallback;
-import javax.faces.component.visit.VisitContext;
-import javax.faces.component.visit.VisitResult;
-import javax.faces.context.FacesContext;
-import javax.faces.event.PreRenderComponentEvent;
-
-import org.richfaces.context.ExtendedVisitContext;
-import org.richfaces.context.ExtendedVisitContextMode;
-import org.richfaces.log.RichfacesLogger;
-import org.richfaces.renderkit.MetaComponentRenderer;
-import org.slf4j.Logger;
-
-/**
- * @author Anton Belevich
- *
- */
-public class UIDataGrid extends UISequence implements Row, MetaComponentResolver, MetaComponentEncoder {
-
- public static final String HEADER_FACET_NAME = "header";
- public static final String FOOTER_FACET_NAME = "footer";
- public static final String CAPTION_FACET_NAME = "caption";
- public static final String NODATA_FACET_NAME = "noData";
-
- public static final String HEADER = "header";
- public static final String FOOTER = "footer";
- public static final String BODY = "body";
-
- private static final Logger RENDERKIT_LOG = RichfacesLogger.RENDERKIT.getLogger();
-
- private static final Set<String> SUPPORTED_META_COMPONENTS = new HashSet<String>();
-
- static {
- SUPPORTED_META_COMPONENTS.add(HEADER);
- SUPPORTED_META_COMPONENTS.add(FOOTER);
- SUPPORTED_META_COMPONENTS.add(BODY);
- }
-
-
- enum PropertyKeys {
- columns, elements
- }
-
- public int getColumns() {
- int columns = (Integer)getStateHelper().eval(PropertyKeys.columns, 1);
- return (columns < 1 ? 1 : columns);
- }
-
- public void setColumns(int count) {
- getStateHelper().put(PropertyKeys.columns, count);
- }
-
- public int getElements() {
- return (Integer)getStateHelper().eval(PropertyKeys.elements);
- }
-
- public void setElements(int count) {
- getStateHelper().put(PropertyKeys.elements, count);
- }
-
- public Iterator<UIComponent> columns() {
- //DataGrid doesn't work with column components
- return null;
- }
-
- public UIComponent getHeaderFacet() {
- return getFacet(HEADER_FACET_NAME);
- }
-
- public UIComponent getFooterFacet() {
- return getFacet(FOOTER_FACET_NAME);
- }
-
- public UIComponent getCaptionFacet() {
- return getFacet(CAPTION_FACET_NAME);
- }
-
- public UIComponent getNoDataFacet() {
- return getFacet(NODATA_FACET_NAME);
- }
-
- //TODO: copy from UIDataTableBase
- public void encodeMetaComponent(FacesContext context, String metaComponentId) throws IOException {
- context.getApplication().publishEvent(context, PreRenderComponentEvent.class, this);
- MetaComponentRenderer renderer = (MetaComponentRenderer) getRenderer(context);
- renderer.encodeMetaComponent(context, this, metaComponentId);
- }
-
- protected boolean visitFixedChildren(VisitContext visitContext, VisitCallback callback) {
- if (visitContext instanceof ExtendedVisitContext) {
- ExtendedVisitContext extendedVisitContext = (ExtendedVisitContext) visitContext;
- if (extendedVisitContext.getVisitMode() == ExtendedVisitContextMode.RENDER) {
- //TODO nick - call preEncodeBegin(...) and emit PreRenderEvent
- VisitResult visitResult;
-
- visitResult = extendedVisitContext.invokeMetaComponentVisitCallback(this, callback, HEADER);
-
- if (visitResult == VisitResult.ACCEPT){
- //TODO:
- } else if (visitResult == VisitResult.COMPLETE) {
- return true;
- }
-
- visitResult = extendedVisitContext.invokeMetaComponentVisitCallback(this, callback, FOOTER);
-
- if (visitResult == VisitResult.ACCEPT) {
- //TODO nick - visit footer?
- } else if (visitResult == VisitResult.COMPLETE) {
- return true;
- }
-
- if (visitResult == VisitResult.REJECT) {
- return false;
- }
- }
- }
-
- return super.visitFixedChildren(visitContext, callback);
- }
-
- protected boolean visitDataChildren(VisitContext visitContext, final VisitCallback callback, boolean visitRows) {
- if (visitContext instanceof ExtendedVisitContext && visitRows) {
- ExtendedVisitContext extendedVisitContext = (ExtendedVisitContext) visitContext;
-
- if (extendedVisitContext.getVisitMode() == ExtendedVisitContextMode.RENDER) {
- //TODO nick - call preEncodeBegin(...) and emit PreRenderEvent
- setRowKey(visitContext.getFacesContext(), null);
-
- VisitResult result = extendedVisitContext.invokeMetaComponentVisitCallback(this, callback, BODY);
-
- if (result == VisitResult.ACCEPT) {
- //TODO nick - visit body?
- } else {
- return result == VisitResult.COMPLETE;
- }
- }
- }
-
- return super.visitDataChildren(visitContext, callback, visitRows);
- }
-
-
- public String resolveClientId(FacesContext facesContext, UIComponent contextComponent, String metaComponentId) {
- if (SUPPORTED_META_COMPONENTS.contains(metaComponentId)) {
- Object oldRowKey = getRowKey();
-
- try {
- setRowKey(facesContext, null);
- return getClientId(facesContext) + MetaComponentResolver.META_COMPONENT_SEPARATOR_CHAR + metaComponentId;
- } finally {
- try {
- setRowKey(facesContext, oldRowKey);
- } catch (Exception e) {
- RENDERKIT_LOG.error(e.getMessage(), e);
- }
- }
- }
-
- return null;
- }
-}
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataScroller.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataScroller.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataScroller.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,418 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.el.ELException;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIComponentBase;
-import javax.faces.component.UIData;
-import javax.faces.component.UIInput;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-
-import org.ajax4jsf.component.IterationStateHolder;
-import org.ajax4jsf.renderkit.RendererUtils;
-import org.richfaces.DataScrollerUtils;
-import org.richfaces.component.util.MessageUtil;
-import org.richfaces.event.DataScrollerEvent;
-import org.richfaces.event.DataScrollerListener;
-import org.richfaces.event.DataScrollerSource;
-
-public class UIDataScroller extends UIComponentBase implements DataScrollerSource, IterationStateHolder {
-
- public static final String COMPONENT_TYPE = "org.richfaces.DataScroller";
-
- public static final String COMPONENT_FAMILY = "org.richfaces.DataScroller";
-
- public static final String SCROLLER_STATE_ATTRIBUTE = COMPONENT_TYPE + ":page";
-
- public static final String FIRST_FACET_NAME = "first";
-
- public static final String LAST_FACET_NAME = "last";
-
- public static final String FAST_FORWARD_FACET_NAME = "fastforward";
-
- public static final String FAST_REWIND_FACET_NAME = "fastrewind";
-
- public static final String FIRST_DISABLED_FACET_NAME = "first_disabled";
-
- public static final String LAST_DISABLED_FACET_NAME = "last_disabled";
-
- public static final String PAGEMODE_FULL = "full";
-
- public static final String PAGEMODE_SHORT = "short";
-
- private static final int MAX_PAGES_DEFAULT = 10;
-
- private Integer page;
-
- protected enum PropertyKeys {
- boundaryControls, fastControls, fastStep, forComponent, inactiveStyle, selectStyle, inactiveStyleClass, selectStyleClass, scrollerListener, lastPageMode, maxPages, pageIndexVar, pagesVar, renderIfSinglePage, style, styleClass, stepControls
- }
-
- public String getLastPageMode() {
- return (String) getStateHelper().eval(PropertyKeys.lastPageMode);
- }
-
- public void setLastPageMode(String lastPageMode) {
- getStateHelper().put(PropertyKeys.lastPageMode, lastPageMode);
- }
-
- public int getFastStep() {
- return (Integer) getStateHelper().eval(PropertyKeys.fastStep, 0);
- }
-
- public void setFastStep(int fastStep) {
- getStateHelper().put(PropertyKeys.fastStep, fastStep);
- }
-
- public String getForComponent() {
- return (String) getStateHelper().eval(PropertyKeys.forComponent);
- }
-
- public void setForComponent(String forComponent) {
- getStateHelper().put(PropertyKeys.forComponent, forComponent);
- }
-
- public int getMaxPages() {
- return (Integer) getStateHelper().eval(PropertyKeys.maxPages, MAX_PAGES_DEFAULT);
- }
-
- public void setMaxPages(int maxPages) {
- getStateHelper().put(PropertyKeys.maxPages, maxPages);
- }
-
- public String getBoundaryControls() {
- return (String) getStateHelper().eval(PropertyKeys.boundaryControls, "show");
- }
-
- public void setBoundaryControls(String boundaryControls) {
- getStateHelper().put(PropertyKeys.boundaryControls, boundaryControls);
- }
-
- public String getFastControls() {
- return (String) getStateHelper().eval(PropertyKeys.fastControls, "show");
- }
-
- public void setFastControls(String fastControls) {
- getStateHelper().put(PropertyKeys.fastControls, fastControls);
- }
-
- public void addScrollerListener(DataScrollerListener listener) {
- addFacesListener(listener);
- }
-
- public DataScrollerListener[] getScrollerListeners() {
- return (DataScrollerListener[]) getFacesListeners(DataScrollerListener.class);
- }
-
- public void removeScrollerListener(DataScrollerListener listener) {
- removeFacesListener(listener);
- }
-
- public void broadcast(FacesEvent event) throws AbortProcessingException {
-
-
- if (event instanceof DataScrollerEvent) {
- DataScrollerEvent dataScrollerEvent = (DataScrollerEvent) event;
-
- updateModel(dataScrollerEvent.getPage());
-
- FacesContext facesContext = getFacesContext();
-
- UIComponent dataTable = getDataTable();
-
- List<UIDataScroller> dataScrollers = DataScrollerUtils.findDataScrollers(dataTable);
- for (UIDataScroller dataScroller : dataScrollers) {
- facesContext.getPartialViewContext().getRenderIds().add(dataScroller.getClientId(facesContext));
- }
-
- String dataTableId = null;
- if (dataTable instanceof MetaComponentResolver) {
- dataTableId = ((MetaComponentResolver) dataTable).resolveClientId(facesContext, dataTable, "body");
- }
-
- if (dataTableId == null) {
- dataTableId = dataTable.getClientId(facesContext);
- }
-
- facesContext.getPartialViewContext().getRenderIds().add(dataTableId);
-
- //add datascroller to render
- String dataScrollerId = getClientId(facesContext);
- if(!facesContext.getPartialViewContext().getRenderIds().contains(dataScrollerId)) {
- facesContext.getPartialViewContext().getRenderIds().add(dataScrollerId);
- }
-
- }
-
- super.broadcast(event);
- }
-
- /**
- * Finds the dataTable which id is mapped to the "for" property
- *
- * @return the dataTable component
- */
-
- public UIComponent getDataTable() {
- String forAttribute = (String) getAttributes().get(PropertyKeys.forComponent.toString());
- UIComponent forComp;
-
- if (forAttribute == null) {
- forComp = this;
-
- while ((forComp = forComp.getParent()) != null) {
- if (forComp instanceof UIData || forComp instanceof UIDataAdaptor) {
- getStateHelper().put(PropertyKeys.forComponent, forComp.getId());
- return forComp;
- }
- }
- throw new FacesException("could not find dataTable for datascroller " + this.getId());
-
- } else {
- forComp = RendererUtils.getInstance().findComponentFor(this, forAttribute);
- }
-
- if (forComp == null) {
- throw new IllegalArgumentException("could not find dataTable with id '" + forAttribute + "'");
- } else if (!((forComp instanceof UIData) || (forComp instanceof UIDataAdaptor))) {
-
- throw new IllegalArgumentException("component with id '" + forAttribute + "' must be of type "
- + UIData.class.getName() + " or " + UIDataAdaptor.class + ", not type " + forComp.getClass().getName());
- }
-
- return forComp;
- }
-
- private int getFastStepOrDefault() {
- return (Integer) getStateHelper().eval(PropertyKeys.fastStep, 1);
- }
-
- public int getPageForFacet(String facetName) {
- if (facetName == null) {
- throw new NullPointerException();
- }
-
- int newPage = 1;
- int pageCount = getPageCount();
-
- if (FIRST_FACET_NAME.equals(facetName)) {
- newPage = 1;
- } else if (LAST_FACET_NAME.equals(facetName)) {
- newPage = pageCount > 0 ? pageCount : 1;
- } else if (FAST_FORWARD_FACET_NAME.equals(facetName)) {
- newPage = getPage() + getFastStepOrDefault();
- } else if (FAST_REWIND_FACET_NAME.equals(facetName)) {
- newPage = getPage() - getFastStepOrDefault();
- } else {
- try {
- newPage = Integer.parseInt(facetName.toString());
- } catch (NumberFormatException e) {
- throw new FacesException(e.getLocalizedMessage(), e);
- }
- }
-
- if (newPage >= 1 && newPage <= pageCount) {
- return newPage;
- } else {
- return 0;
- }
- }
-
- public int getPageCount(UIComponent data) {
- int rowCount = getRowCount(data);
- int rows = getRows(data);
- return getPageCount(data, rowCount, rows);
- }
-
- public int getPageCount(UIComponent data, int rowCount, int rows) {
- return DataScrollerUtils.getPageCount(data, rowCount, rows);
- }
-
- /** @return the page count of the uidata */
- public int getPageCount() {
- return getPageCount(getDataTable());
- }
-
- public int getRowCount(UIComponent data) {
- return (Integer) data.getAttributes().get("rowCount");
- }
-
- /** @return int */
- public int getRowCount() {
- return getRowCount(getDataTable());
- }
-
- public int getRows(UIComponent data) {
- return DataScrollerUtils.getRows(data);
- }
-
- // facet getter methods
- public UIComponent getFirst() {
- return getFacet(FIRST_FACET_NAME);
- }
-
- public UIComponent getLast() {
- return getFacetByKey(LAST_FACET_NAME);
- }
-
- public UIComponent getFastForward() {
- return getFacetByKey(FAST_FORWARD_FACET_NAME);
- }
-
- public UIComponent getFastRewind() {
- return getFacetByKey(FAST_REWIND_FACET_NAME);
- }
-
- private UIComponent getFacetByKey(String key) {
- return getFacet(key.toString());
- }
-
- private static boolean isRendered(UIComponent component) {
- UIComponent c = component;
- while (c != null) {
- if (!c.isRendered()) {
- return false;
- }
- c = c.getParent();
- }
-
- return true;
- }
-
- public void setPage(int newPage) {
- this.page = newPage;
- }
-
- public int getPage() {
-
- UIComponent dataTable = getDataTable();
- Map<String, Object> attributes = dataTable.getAttributes();
-
- FacesContext facesContext = getFacesContext();
- Integer state = (Integer) attributes.get(dataTable.getClientId(facesContext) + SCROLLER_STATE_ATTRIBUTE);
-
- if (state != null) {
- return state;
- }
-
- if (this.page != null) {
- return page;
- }
-
- ValueExpression ve = getValueExpression("page");
- if (ve != null) {
- try {
- Integer pageObject = (Integer) ve.getValue(getFacesContext().getELContext());
-
- if (pageObject != null) {
- return pageObject;
- }
- } catch (ELException e) {
- throw new FacesException(e);
- }
- }
-
- return 1;
- }
-
- private void updateModel(int newPage) {
-
- FacesContext facesContext = getFacesContext();
- UIComponent dataTable = getDataTable();
-
- if (isRendered(dataTable)) {
- dataTable.getAttributes().put("first", (newPage - 1) * getRows(dataTable));
- }
-
- Map<String, Object> attributes = dataTable.getAttributes();
- attributes.put(dataTable.getClientId(facesContext) + SCROLLER_STATE_ATTRIBUTE, newPage);
-
- ValueExpression ve = getValueExpression("page");
- if (ve != null) {
- try {
- ve.setValue(facesContext.getELContext(), newPage);
- attributes.remove(dataTable.getClientId(facesContext) + SCROLLER_STATE_ATTRIBUTE);
- } catch (ELException e) {
- String messageStr = e.getMessage();
- Throwable result = e.getCause();
- while (null != result && result.getClass().isAssignableFrom(ELException.class)) {
- messageStr = result.getMessage();
- result = result.getCause();
- }
- FacesMessage message;
- if (null == messageStr) {
- message = MessageUtil.getMessage(facesContext, UIInput.UPDATE_MESSAGE_ID,
- new Object[] {MessageUtil.getLabel(facesContext, this) });
- } else {
- message = new FacesMessage(FacesMessage.SEVERITY_ERROR, messageStr, messageStr);
- }
- facesContext.getExternalContext().log(message.getSummary(), result);
- facesContext.addMessage(getClientId(facesContext), message);
- facesContext.renderResponse();
- } catch (IllegalArgumentException e) {
- FacesMessage message = MessageUtil.getMessage(facesContext, UIInput.UPDATE_MESSAGE_ID,
- new Object[] {MessageUtil.getLabel(facesContext, this) });
- facesContext.getExternalContext().log(message.getSummary(), e);
- facesContext.addMessage(getClientId(facesContext), message);
- facesContext.renderResponse();
- } catch (Exception e) {
- FacesMessage message = MessageUtil.getMessage(facesContext, UIInput.UPDATE_MESSAGE_ID,
- new Object[] {MessageUtil.getLabel(facesContext, this) });
- facesContext.getExternalContext().log(message.getSummary(), e);
- facesContext.addMessage(getClientId(facesContext), message);
- facesContext.renderResponse();
- }
- }
- }
-
- public boolean isLocalPageSet() {
- return page != null;
- }
-
- public void resetLocalPage() {
- page = null;
- }
-
- @Override
- public String getFamily() {
- return COMPONENT_FAMILY;
- }
-
- public Object getIterationState() {
- return this.page;
- }
-
-
- public void setIterationState(Object state) {
- this.page = (Integer) state;
- }
-}
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTable.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTable.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTable.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import javax.faces.component.UIComponent;
-
-/**
- * @author Anton Belevich
- *
- */
-
-public class UIDataTable extends UIDataTableBase {
-
- public UIComponent getCaption() {
- return getFacet("caption");
- }
-
-}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -44,6 +44,7 @@
import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.model.ExtendedDataModel;
import org.ajax4jsf.model.Range;
+import org.richfaces.cdk.annotations.Attribute;
import org.richfaces.context.ExtendedVisitContext;
import org.richfaces.context.ExtendedVisitContextMode;
import org.richfaces.event.FilteringEvent;
@@ -61,10 +62,20 @@
import org.richfaces.renderkit.MetaComponentRenderer;
import org.slf4j.Logger;
-public class UIDataTableBase extends UISequence implements Row, MetaComponentResolver, MetaComponentEncoder {
+public abstract class UIDataTableBase extends UISequence implements Row, MetaComponentResolver, MetaComponentEncoder {
+ public static final String COMPONENT_FAMILY = "org.richfaces.Data";
+
+ public static final String HEADER_FACET_NAME = "header";
+
+ public static final String FOOTER_FACET_NAME = "footer";
+
+ public static final String NODATA_FACET_NAME = "noData";
+
public static final String HEADER = "header";
+
public static final String FOOTER = "footer";
+
public static final String BODY = "body";
private static final Logger RENDERKIT_LOG = RichfacesLogger.RENDERKIT.getLogger();
@@ -78,9 +89,36 @@
}
protected enum PropertyKeys {
- filterVar, sortPriority, sortMode, first, rows, noDataLabel, selection
+ filterVar, sortPriority, sortMode, first, rows, noDataLabel, selection, header
}
+ public UIComponent getHeader() {
+ return getFacet(HEADER_FACET_NAME);
+ }
+
+ public UIComponent getFooter() {
+ return getFacet(FOOTER_FACET_NAME);
+ }
+
+ public UIComponent getNoData() {
+ return getFacet(NODATA_FACET_NAME);
+ }
+
+ @Attribute
+ public abstract String getNoDataLabel();
+
+ @Attribute
+ public abstract String getFilterVar();
+
+ @Attribute
+ public abstract Collection<Object> getSelection();
+
+ @Attribute
+ public abstract Collection<?> getSortPriority();
+
+ @Attribute
+ public abstract SortMode getSortMode();
+
public Iterator<UIComponent> columns() {
return new DataTableColumnsIterator(this);
}
@@ -93,26 +131,6 @@
return new DataTableDataIterator(this);
}
- public UIComponent getHeader() {
- return getFacet(HEADER);
- }
-
- public UIComponent getFooter() {
- return getFacet(FOOTER);
- }
-
- public UIComponent getNoData() {
- return getFacet("noData");
- }
-
- public String getNoDataLabel() {
- return (String)getStateHelper().eval(PropertyKeys.noDataLabel);
- }
-
- public void setNoDataLabel(String noDataLabel) {
- getStateHelper().put(PropertyKeys.noDataLabel, noDataLabel);
- }
-
public boolean isColumnFacetPresent(String facetName) {
Iterator<UIComponent> columns = columns();
boolean result = false;
@@ -157,8 +175,8 @@
Map<Object, SortField> sortFieldsMap = new LinkedHashMap<Object, SortField>();
for (Iterator<UIComponent> iterator = columns(); iterator.hasNext();) {
UIComponent component = iterator.next();
- if (component instanceof UIColumn && component.isRendered()) {
- UIColumn column = (UIColumn) component;
+ if (component instanceof AbstractColumn && component.isRendered()) {
+ AbstractColumn column = (AbstractColumn) component;
FilterField filterField = column.getFilterField();
if (filterField != null) {
filterFields.add(filterField);
@@ -205,40 +223,7 @@
setRowKey(faces, key);
restoreOrigValue(faces);
}
-
- public String getFilterVar() {
- return (String) getStateHelper().eval(PropertyKeys.filterVar);
- }
-
- public void setFilterVar(String filterVar) {
- getStateHelper().put(PropertyKeys.filterVar, filterVar);
- }
-
- @SuppressWarnings("unchecked")
- public Collection<Object> getSelection() {
- return (Collection<Object>) getStateHelper().eval(PropertyKeys.selection);
- }
-
- public void setSelection(Collection<Object> selection) {
- getStateHelper().put(PropertyKeys.selection, selection);
- }
-
- public Collection<?> getSortPriority() {
- return (Collection<?>) getStateHelper().eval(PropertyKeys.sortPriority);
- }
-
- public void setSortPriority(Collection<?> sortPriority) {
- getStateHelper().put(PropertyKeys.sortPriority, sortPriority);
- }
-
- public SortMode getSortMode() {
- return (SortMode) getStateHelper().eval(PropertyKeys.sortMode, SortMode.single);
- }
-
- public void setSortMode(SortMode sortMode) {
- getStateHelper().put(PropertyKeys.sortMode, sortMode);
- }
-
+
public String resolveClientId(FacesContext facesContext, UIComponent contextComponent, String metaComponentId) {
if (SUPPORTED_META_COMPONENTS.contains(metaComponentId)) {
Object oldRowKey = getRowKey();
@@ -327,7 +312,6 @@
removeFacesListener(listener);
}
-
public void addFilteringListener(FilteringListener listener) {
addFacesListener(listener);
}
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,175 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import java.io.IOException;
-import java.util.Map;
-
-import javax.el.ValueExpression;
-import javax.faces.component.UIComponent;
-import javax.faces.component.visit.VisitCallback;
-import javax.faces.component.visit.VisitContext;
-import javax.faces.component.visit.VisitResult;
-import javax.faces.context.FacesContext;
-
-import org.richfaces.context.ExtendedVisitContext;
-import org.richfaces.context.ExtendedVisitContextMode;
-import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
-
-
-/**
- * @author Konstantin Mishin
- *
- */
-public class UIExtendedDataTable extends UIDataTableBase implements MetaComponentResolver, MetaComponentEncoder {
-
- public static final String SCROLL = "scroll";
-
- public static final String SUBMITTED_CLIENT_FIRST = "submittedClientFirst";
-
- public static final String OLD_CLIENT_FIRST = "oldClientFirst";
-
- private static final Logger RENDERKIT_LOG = RichfacesLogger.RENDERKIT.getLogger();
-
- protected enum PropertyKeys {
- clientFirst, clientRows
- }
-
- public String resolveClientId(FacesContext facesContext, UIComponent contextComponent, String metaComponentId) {
- if (SCROLL.equals(metaComponentId)) {
- Object oldRowKey = getRowKey();
-
- try {
- setRowKey(facesContext, null);
- return getClientId(facesContext) + MetaComponentResolver.META_COMPONENT_SEPARATOR_CHAR + metaComponentId;
- } finally {
- try {
- setRowKey(facesContext, oldRowKey);
- } catch (Exception e) {
- RENDERKIT_LOG.error(e.getMessage(), e);
- }
- }
- }
-
- return super.resolveClientId(facesContext, contextComponent, metaComponentId);
- }
-
- public void encodeMetaComponent(FacesContext context, String metaComponentId) throws IOException {
- if (SCROLL.equals(metaComponentId)) {
- Map<String, Object> attributes = getAttributes();
- Integer submittedClientFirst = (Integer) attributes.remove(SUBMITTED_CLIENT_FIRST);
- if (submittedClientFirst != null) {
- attributes.put(OLD_CLIENT_FIRST, getClientFirst());
- setClientFirst(submittedClientFirst);
- }
- }
-
- super.encodeMetaComponent(context, metaComponentId);
- }
-
- protected boolean visitDataChildren(VisitContext visitContext, final VisitCallback callback, boolean visitRows) {
- if (visitContext instanceof ExtendedVisitContext && visitRows) {
- ExtendedVisitContext extendedVisitContext = (ExtendedVisitContext) visitContext;
-
- if (extendedVisitContext.getVisitMode() == ExtendedVisitContextMode.RENDER) {
- //TODO nick - call preEncodeBegin(...) and emit PreRenderEvent
- setRowKey(visitContext.getFacesContext(), null);
-
- VisitResult result;
-
- result = extendedVisitContext.invokeMetaComponentVisitCallback(this, callback, SCROLL);
-
- if (result == VisitResult.ACCEPT) {
- //TODO nick - visit scroll?
- } else if (result == VisitResult.COMPLETE) {
- return true;
- }
- }
- }
-
- return super.visitDataChildren(visitContext, callback, visitRows);
- }
-
- protected int getActualFirst() {
- return getFirst() + getClientFirst();
- }
-
- protected int getActualRows() {
- int rows = getClientRows();
-
- if (rows > 0) {
- int r = getRows();
- if (r > 0 && r < rows) {
- rows = r;
- }
- } else {
- rows = getRows();
- }
-
- return rows;
- }
-
- public int getClientFirst() {
- return (Integer) getStateHelper().eval(PropertyKeys.clientFirst, 0);
- }
-
- public void setClientFirst(int clientFirst) {
- getStateHelper().put(PropertyKeys.clientFirst, clientFirst);
-
- updateState();
- }
-
- public void setFirst(int first) {
- super.setFirst(first);
- setClientFirst(0);
- }
-
- public int getClientRows() {
- return (Integer) getStateHelper().eval(PropertyKeys.clientRows, 0);
- }
-
- public void setClientRows(int clientRows) {
- getStateHelper().put(PropertyKeys.clientRows, clientRows);
-
- updateState();
- }
-
- public void setValueBinding(String name, javax.faces.el.ValueBinding binding) {
- super.setValueBinding(name, binding);
-
- //TODO nick - clientFirst?
- if ("clientRows".equals(name)) {
- updateState();
- }
- }
-
- public void setValueExpression(String name, ValueExpression binding) {
- super.setValueExpression(name, binding);
-
- //TODO nick - clientFirst?
- if ("clientRows".equals(name)) {
- updateState();
- }
- }
-}
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UISubTable.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UISubTable.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UISubTable.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,148 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import javax.el.ELContext;
-import javax.el.ValueExpression;
-import javax.faces.application.ResourceDependency;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-
-import org.richfaces.event.ToggleEvent;
-import org.richfaces.event.ToggleListener;
-
-
-@ResourceDependency(name = "subtable.js")
-public class UISubTable extends UIDataTableBase implements Column, Expandable {
-
- public static final String MODE_AJAX = "ajax";
-
- public static final String MODE_SERVER = "server";
-
- public static final String MODE_CLIENT = "client";
-
- public static final int EXPAND_STATE = 1;
-
- public static final int COLLAPSE_STATE = 0;
-
-
- enum PropertyKeys {
- expandMode, expanded, toggleExpression
- }
-
-
- public void broadcast(FacesEvent event) throws AbortProcessingException {
- if (event instanceof ToggleEvent) {
- ToggleEvent toggleEvent = (ToggleEvent) event;
- boolean newValue = toggleEvent.isExpanded();
- getStateHelper().put(PropertyKeys.expanded, newValue);
-
- FacesContext facesContext = getFacesContext();
- ELContext elContext = facesContext.getELContext();
-
- ValueExpression valueExpression = getValueExpression(PropertyKeys.expanded.toString());
- if (valueExpression != null && !valueExpression.isReadOnly(elContext)) {
- valueExpression.setValue(elContext, newValue);
- }
-
- if(getFacesContext().getPartialViewContext().isAjaxRequest()) {
- String render = resolveClientId(facesContext, this, BODY);
-
- getFacesContext().getPartialViewContext().getRenderIds().add(render);
-
- String togglerId = toggleEvent.getTogglerId();
- if(togglerId != null) {
- getFacesContext().getPartialViewContext().getRenderIds().add(togglerId);
- }
- }
-
- }
- super.broadcast(event);
- }
-
- public boolean isExpanded() {
- return (Boolean) getStateHelper().eval(PropertyKeys.expanded, true);
- }
-
- public void setExpanded(boolean expanded) {
- getStateHelper().put(PropertyKeys.expanded, expanded);
- }
-
- public boolean isBreakBefore() {
- return true;
- }
-
- public void setBreakBefore(boolean newBreakBefore) {
- throw new IllegalStateException("Property 'breakBefore' for subtable is read-only");
- }
-
- public String getSortExpression() {
- // SubTable is not sortable element.
- return null;
- }
-
- public void setSortExpression(String sortExpression) {
- throw new IllegalArgumentException("subtable is not sortable element");
- }
-
- public void addToggleListener(ToggleListener listener) {
- addFacesListener(listener);
- }
-
- public void removeToggleListener(ToggleListener listener) {
- removeFacesListener(listener);
- }
-
- public ToggleListener[] getToggleListeners() {
- return (ToggleListener[]) getFacesListeners(ToggleListener.class);
- }
-
- public String getExpandMode() {
- return (String) getStateHelper().eval(PropertyKeys.expandMode, MODE_CLIENT);
- }
-
- public void setExpandMode(String expandMode) {
- getStateHelper().put(PropertyKeys.expandMode, expandMode);
- }
-
- public void setIterationState(Object stateObject) {
- Object[] state = (Object[]) stateObject;
- if (state != null) {
- super.setIterationState(state[0]);
- getStateHelper().put(PropertyKeys.expanded, state[1]);
- } else {
- super.setIterationState(null);
- getStateHelper().put(PropertyKeys.expanded, null);
- }
- }
-
- public Object getIterationState() {
- Object [] state = new Object[2];
- state[0] = super.getIterationState();
- state[1] = getStateHelper().get(PropertyKeys.expanded);
- return state;
- }
-}
-
-
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UISubTableToggleControl.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UISubTableToggleControl.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/component/UISubTableToggleControl.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,92 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.richfaces.component;
-
-import javax.faces.component.UIComponentBase;
-
-/**
- * @author Anton Belevich
- *
- */
-public class UISubTableToggleControl extends UIComponentBase {
-
- public static final String COMPONENT_TYPE = "org.richfaces.SubTableToggleControl";
-
- public static final String COMPONENT_FAMILY = "org.richfaces.SubTableToggleControl";
-
- enum PropertyKeys {
- expandIcon, collapseIcon, expandLabel, collapseLabel, forId, event
- }
-
- public String getFamily() {
- return COMPONENT_FAMILY;
- }
-
- public String getExpandLabel() {
- return (String)getStateHelper().eval(PropertyKeys.expandLabel);
- }
-
- public void setExpandLabel(String expandLabel) {
- getStateHelper().put(PropertyKeys.expandLabel, expandLabel);
- }
-
- public String getCollapseLabel() {
- return (String)getStateHelper().eval(PropertyKeys.collapseLabel);
- }
-
- public void setCollapseLabel(String collapseLabel) {
- getStateHelper().put(PropertyKeys.collapseLabel, collapseLabel);
- }
-
- public String getExpandIcon() {
- return (String) getStateHelper().eval(PropertyKeys.expandIcon, null);
- }
-
- public void setExpandIcon(String expandIcon) {
- getStateHelper().put(PropertyKeys.expandIcon, expandIcon);
- }
-
- public String getCollapseIcon() {
- return (String) getStateHelper().eval(PropertyKeys.collapseIcon, null);
- }
-
- public void setCollapseIcon(String collapseIcon) {
- getStateHelper().put(PropertyKeys.collapseIcon, collapseIcon);
- }
-
- public String getFor() {
- return (String) getStateHelper().eval(PropertyKeys.forId, null);
- }
-
- public void setFor(String forId) {
- getStateHelper().put(PropertyKeys.forId, forId);
- }
-
- public String getEvent() {
- return (String) getStateHelper().eval(PropertyKeys.event, "onclick");
-
- }
-
- public void setEvent(String event) {
- getStateHelper().put(PropertyKeys.event, event);
- }
-}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/event/DataTablePreRenderListener.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/event/DataTablePreRenderListener.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/event/DataTablePreRenderListener.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -38,7 +38,7 @@
import org.ajax4jsf.Messages;
import org.richfaces.DataScrollerUtils;
import org.richfaces.component.UIDataAdaptor;
-import org.richfaces.component.UIDataScroller;
+import org.richfaces.component.AbstractDataScroller;
import org.richfaces.component.util.MessageUtil;
import org.richfaces.log.RichfacesLogger;
import org.slf4j.Logger;
@@ -51,12 +51,12 @@
return ((source instanceof UIDataAdaptor) || (source instanceof UIData));
}
- public UIDataScroller processActiveDatascroller(FacesContext facesContext, List<UIDataScroller> dataScrollers,
+ public AbstractDataScroller processActiveDatascroller(FacesContext facesContext, List<AbstractDataScroller> dataScrollers,
UIComponent dataTable) {
- UIDataScroller activeComponent = null;
+ AbstractDataScroller activeComponent = null;
List<Object> values = new ArrayList<Object>(dataScrollers.size());
- String stateKey = dataTable.getClientId(facesContext) + UIDataScroller.SCROLLER_STATE_ATTRIBUTE;
+ String stateKey = dataTable.getClientId(facesContext) + AbstractDataScroller.SCROLLER_STATE_ATTRIBUTE;
Map<String, Object> attributes = dataTable.getAttributes();
Object pageValue = attributes.get(stateKey);
@@ -64,7 +64,7 @@
if (pageValue == null) {
- for (UIDataScroller datascroller : dataScrollers) {
+ for (AbstractDataScroller datascroller : dataScrollers) {
Object nextPageValue = null;
if (datascroller.isLocalPageSet()) {
@@ -103,13 +103,13 @@
public void processEvent(SystemEvent event) throws AbortProcessingException {
UIComponent dataTable = (UIComponent) event.getSource();
- List<UIDataScroller> dataScrollers = DataScrollerUtils.findDataScrollers(dataTable);
+ List<AbstractDataScroller> dataScrollers = DataScrollerUtils.findDataScrollers(dataTable);
if (!dataScrollers.isEmpty()) {
FacesContext facesContext = FacesContext.getCurrentInstance();
- UIDataScroller activeComponent = processActiveDatascroller(facesContext, dataScrollers, dataTable);
+ AbstractDataScroller activeComponent = processActiveDatascroller(facesContext, dataScrollers, dataTable);
int rowCount = DataScrollerUtils.getRowCount(dataTable);
int rows = DataScrollerUtils.getRows(dataTable);
@@ -134,7 +134,7 @@
page = newPage;
dataTable.getAttributes().put(
- dataTable.getClientId(facesContext) + UIDataScroller.SCROLLER_STATE_ATTRIBUTE, page);
+ dataTable.getClientId(facesContext) + AbstractDataScroller.SCROLLER_STATE_ATTRIBUTE, page);
}
int first;
@@ -142,13 +142,13 @@
String lastPageMode = activeComponent.getLastPageMode();
if (lastPageMode == null) {
- lastPageMode = UIDataScroller.PAGEMODE_SHORT;
- } else if (!UIDataScroller.PAGEMODE_SHORT.equals(lastPageMode)
- && !UIDataScroller.PAGEMODE_FULL.equals(lastPageMode)) {
+ lastPageMode = AbstractDataScroller.PAGEMODE_SHORT;
+ } else if (!AbstractDataScroller.PAGEMODE_SHORT.equals(lastPageMode)
+ && !AbstractDataScroller.PAGEMODE_FULL.equals(lastPageMode)) {
throw new IllegalArgumentException("Illegal value of 'lastPageMode' attribute: '" + lastPageMode + "'");
}
- if (page != pageCount || UIDataScroller.PAGEMODE_SHORT.equals(lastPageMode)) {
+ if (page != pageCount || AbstractDataScroller.PAGEMODE_SHORT.equals(lastPageMode)) {
first = (page - 1) * rows;
} else {
first = rowCount - rows;
@@ -160,14 +160,14 @@
}
}
- private String getPageDifferentMessage(FacesContext facesContext, UIDataScroller activeComponent,
- List<UIDataScroller> dataScrollers, List<Object> values) {
+ private String getPageDifferentMessage(FacesContext facesContext, AbstractDataScroller activeComponent,
+ List<AbstractDataScroller> dataScrollers, List<Object> values) {
StringBuilder builder = new StringBuilder("\n[");
- Iterator<UIDataScroller> scrollerItr = dataScrollers.iterator();
+ Iterator<AbstractDataScroller> scrollerItr = dataScrollers.iterator();
Iterator<Object> valueItr = values.iterator();
while (scrollerItr.hasNext()) {
- UIDataScroller next = scrollerItr.next();
+ AbstractDataScroller next = scrollerItr.next();
builder.append(MessageUtil.getLabel(facesContext, next));
builder.append(": ");
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/package-info.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/package-info.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/package-info.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,5 +1,5 @@
/**
- * Implementation of RichFaces data lists
+ * Implementation of RichFaces iteration components
*/
-(a)org.richfaces.cdk.annotations.TagLibrary(uri="http://richfaces.org/lists", shortName="lists")
+(a)org.richfaces.cdk.annotations.TagLibrary(uri="http://richfaces.org/iteration", shortName="iteration")
package org.richfaces;
\ No newline at end of file
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractRowsRenderer.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -25,6 +25,8 @@
import java.io.IOException;
import javax.faces.FacesException;
+import javax.faces.application.ResourceDependencies;
+import javax.faces.application.ResourceDependency;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
@@ -38,6 +40,12 @@
* @author Anton Belevich
*
*/
+
+@ResourceDependencies({
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "richfaces.js")
+})
public abstract class AbstractRowsRenderer extends RendererBase implements DataVisitor {
public abstract void encodeRow(ResponseWriter writer, FacesContext facesContext, RowHolderBase rowHolder) throws IOException;
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableBaseRenderer.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -54,7 +54,7 @@
public void encodeColumn(FacesContext context, ResponseWriter writer, UIColumn component, RowHolder rowHolder) throws IOException {
String parentId = rowHolder.getParentClientId();
- if (component instanceof org.richfaces.component.UIColumn) {
+ if (component instanceof org.richfaces.component.AbstractColumn) {
Map<String, Object> attributes = component.getAttributes();
if (Boolean.TRUE.equals(attributes.get(BREAK_ROW_BEFORE)) && rowHolder.getProcessCell() != 0) {
encodeRowEnd(writer);
@@ -89,17 +89,17 @@
String cellClass = getCellClass(context, parentId);
encodeStyleClass(writer, context, component, HTML.STYLE_CLASS_ATTR, cellClass);
- if (component instanceof org.richfaces.component.UIColumn) {
+ if (component instanceof org.richfaces.component.AbstractColumn) {
Map<String, Object> attributes = component.getAttributes();
- int rowspan = (Integer) attributes.get(HTML.ROWSPAN_ATTRIBUTE);
- if (rowspan != Integer.MIN_VALUE) {
- writer.writeAttribute(HTML.ROWSPAN_ATTRIBUTE, Integer.valueOf(rowspan), null);
+ Integer rowspan = (Integer) attributes.get(HTML.ROWSPAN_ATTRIBUTE);
+ if (rowspan != null && rowspan != Integer.MIN_VALUE) {
+ writer.writeAttribute(HTML.ROWSPAN_ATTRIBUTE, rowspan, null);
}
- int colspan = (Integer) attributes.get(HTML.COLSPAN_ATTRIBUTE);
- if (colspan != Integer.MIN_VALUE) {
- writer.writeAttribute(HTML.COLSPAN_ATTRIBUTE, Integer.valueOf(colspan), null);
+ Integer colspan = (Integer) attributes.get(HTML.COLSPAN_ATTRIBUTE);
+ if (colspan != null && colspan != Integer.MIN_VALUE) {
+ writer.writeAttribute(HTML.COLSPAN_ATTRIBUTE, colspan, null);
}
}
}
@@ -216,7 +216,7 @@
count = currentLength;
}
currentLength = 0;
- } else if (component instanceof org.richfaces.component.UIColumn) {
+ } else if (component instanceof org.richfaces.component.AbstractColumn) {
// For new row, save length of previsous.
Map<String, Object> attributes = component.getAttributes();
if (Boolean.TRUE.equals(attributes.get(BREAK_ROW_BEFORE))) {
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/AbstractTableRenderer.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -40,8 +40,10 @@
* @author Anton Belevich
*
*/
-@ResourceDependencies(value = { @ResourceDependency(library = "javax.faces", name = "jsf.js"),
- @ResourceDependency(name = "jquery.js"), @ResourceDependency(name = "richfaces.js"), @ResourceDependency(name = "richfaces-event.js")})
+
+@ResourceDependencies({
+ @ResourceDependency(name = "richfaces-event.js")
+})
public abstract class AbstractTableRenderer extends AbstractTableBaseRenderer implements MetaComponentRenderer {
public static final String HIDDEN_CONTAINER_ID =":sc";
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ColumnGroupRenderer.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -31,19 +31,22 @@
import javax.faces.context.ResponseWriter;
import javax.faces.event.AbortProcessingException;
-import org.richfaces.component.UIColumnGroup;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractColumnGroup;
import org.richfaces.component.UIDataTableBase;
/**
* @author Anton Belevich
*
*/
+
+@JsfRenderer(type="org.richfaces.ColumnGroupRenderer", family=AbstractColumnGroup.COMPONENT_FAMILY)
public class ColumnGroupRenderer extends AbstractTableBaseRenderer {
public void encodeRow(ResponseWriter writer, FacesContext facesContext, RowHolderBase holder) throws IOException {
RowHolder rowHolder = (RowHolder) holder;
- UIColumnGroup row = (UIColumnGroup)rowHolder.getRow();
+ AbstractColumnGroup row = (AbstractColumnGroup)rowHolder.getRow();
rowHolder.setRowStart(true);
Iterator<UIComponent> components = row.columns();
@@ -64,7 +67,7 @@
throw new AbortProcessingException("UIColumnGroup should be a child of UIDataTable or UISubTable");
}
- RowHolder rowHolder = new RowHolder(context, (UIColumnGroup)component);
+ RowHolder rowHolder = new RowHolder(context, (AbstractColumnGroup)component);
rowHolder.setParentClientId(parent.getClientId());
return rowHolder;
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataGridRenderer.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -33,8 +33,9 @@
import org.ajax4jsf.model.DataVisitResult;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractDataGrid;
import org.richfaces.component.Row;
-import org.richfaces.component.UIDataGrid;
import org.richfaces.component.UIDataTableBase;
/**
@@ -42,17 +43,19 @@
*
*/
+@JsfRenderer(type = "org.richfaces.DataGridRenderer", family = AbstractDataGrid.COMPONENT_FAMILY)
+
@ResourceDependencies({@ResourceDependency(library = "javax.faces", name = "jsf.js"),
@ResourceDependency(name = "jquery.js"), @ResourceDependency(name = "richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"), @ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(name = "datagrid.ecss")})
+ @ResourceDependency(library="org.richfaces", name = "datagrid.ecss")})
public class DataGridRenderer extends AbstractRowsRenderer implements MetaComponentRenderer {
private static final EncodeStrategy THEAD = new EncodeStrategy () {
public void begin(ResponseWriter writer, FacesContext context, UIComponent component, Object[] params)
throws IOException {
- UIDataGrid dataGrid = (UIDataGrid)component;
+ AbstractDataGrid dataGrid = (AbstractDataGrid)component;
String clientId = dataGrid.getClientId(context) + ":h";
boolean partial = (Boolean)(Boolean)params[0];
@@ -90,7 +93,7 @@
public void begin(ResponseWriter writer, FacesContext context, UIComponent component, Object[] params)
throws IOException {
- UIDataGrid dataGrid = (UIDataGrid)component;
+ AbstractDataGrid dataGrid = (AbstractDataGrid)component;
String clientId = dataGrid.getClientId(context) + ":f";
int columns = dataGrid.getColumns();
@@ -154,7 +157,7 @@
@Override
public void encodeRow(ResponseWriter writer, FacesContext facesContext, RowHolderBase rowHolder) throws IOException {
- UIDataGrid dataGrid = (UIDataGrid) rowHolder.getRow();
+ AbstractDataGrid dataGrid = (AbstractDataGrid) rowHolder.getRow();
int columns = dataGrid.getColumns();
int processCell = rowHolder.getProcessCell();
@@ -175,27 +178,27 @@
writer.endElement(HTML.TD_ELEM);
}
- public void encodeHeader(ResponseWriter writer, FacesContext facesContext, UIDataGrid dataGrid, boolean partial) throws IOException {
+ public void encodeHeader(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid, boolean partial) throws IOException {
UIComponent headerFacet = dataGrid.getHeaderFacet();
encodeFacet(writer, facesContext, headerFacet, THEAD, dataGrid, new Object[] {partial});
}
- public void encodeFooter(ResponseWriter writer, FacesContext facesContext, UIDataGrid dataGrid, boolean partial) throws IOException {
+ public void encodeFooter(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid, boolean partial) throws IOException {
UIComponent footerFacet = dataGrid.getFooterFacet();
encodeFacet(writer, facesContext, footerFacet, TFOOT, dataGrid, new Object[] {partial});
}
- public void encodeCaption(ResponseWriter writer, FacesContext facesContext, UIDataGrid dataGrid) throws IOException {
+ public void encodeCaption(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid) throws IOException {
UIComponent captionFacet = dataGrid.getCaptionFacet();
encodeFacet(writer, facesContext, captionFacet, CAPTION, dataGrid, null);
}
- public void encodeNoData(ResponseWriter writer, FacesContext facesContext, UIDataGrid dataGrid) throws IOException {
+ public void encodeNoData(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid) throws IOException {
UIComponent noDataFacet = dataGrid.getNoDataFacet();
encodeFacet(writer, facesContext, noDataFacet, NODATA, dataGrid, null);
}
- public void encodeFacet(ResponseWriter writer, FacesContext facesContext, UIComponent facet, EncodeStrategy strategy, UIDataGrid dataGrid, Object [] params) throws IOException{
+ public void encodeFacet(ResponseWriter writer, FacesContext facesContext, UIComponent facet, EncodeStrategy strategy, AbstractDataGrid dataGrid, Object [] params) throws IOException{
if(facet != null && facet.isRendered()) {
strategy.begin(writer, facesContext, dataGrid, params);
facet.encodeAll(facesContext);
@@ -203,7 +206,7 @@
}
}
- public void encodeTBody(ResponseWriter writer, FacesContext facesContext, UIDataGrid dataGrid, boolean partial) throws IOException {
+ public void encodeTBody(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid, boolean partial) throws IOException {
String clientId = dataGrid.getClientId(facesContext) + ":dgb";
if(partial) {
@@ -227,7 +230,7 @@
@Override
protected void doEncodeChildren(ResponseWriter writer, FacesContext facesContext, UIComponent component)
throws IOException {
- UIDataGrid dataGrid = (UIDataGrid)component;
+ AbstractDataGrid dataGrid = (AbstractDataGrid)component;
writer.startElement(HTML.TABLE_ELEMENT, dataGrid);
writer.writeAttribute(HTML.ID_ATTRIBUTE, dataGrid.getClientId(facesContext), null);
writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rf-dg", null);
@@ -242,17 +245,17 @@
@Override
public RowHolderBase createRowHolder(FacesContext context, UIComponent component, Object[] options) {
- return new RowHolder(context, (UIDataGrid)component);
+ return new RowHolder(context, (AbstractDataGrid)component);
}
@Override
protected Class<? extends UIComponent> getComponentClass() {
- return UIDataGrid.class;
+ return AbstractDataGrid.class;
}
public void encodeMetaComponent(FacesContext context, UIComponent component, String metaComponentId)
throws IOException {
- UIDataGrid table = (UIDataGrid) component;
+ AbstractDataGrid table = (AbstractDataGrid) component;
if (UIDataTableBase.HEADER.equals(metaComponentId)) {
encodeHeader(context.getResponseWriter(), context, table, true);
@@ -268,7 +271,7 @@
@Override
protected void doCleanup(FacesContext context, RowHolderBase rowHolder) throws IOException {
ResponseWriter writer = context.getResponseWriter();
- UIDataGrid dataGrid = (UIDataGrid)rowHolder.getRow();
+ AbstractDataGrid dataGrid = (AbstractDataGrid)rowHolder.getRow();
int cell = rowHolder.getProcessCell();
int columns = dataGrid.getColumns();
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataScrollerBaseRenderer.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -41,7 +41,7 @@
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.RendererBase;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.UIDataScroller;
+import org.richfaces.component.AbstractDataScroller;
import org.richfaces.event.DataScrollerEvent;
@ResourceDependencies( { @ResourceDependency(library = "javax.faces", name = "jsf-uncompressed.js"),
@@ -62,7 +62,7 @@
if (param != null) {
- UIDataScroller scroller = (UIDataScroller) component;
+ AbstractDataScroller scroller = (AbstractDataScroller) component;
int newPage = scroller.getPageForFacet(param);
int page = scroller.getPage();
@@ -246,19 +246,19 @@
String clientId = component.getClientId(context);
if (controlsState.getFirstRendered() && controlsState.getFirstEnabled()) {
- left.put(clientId + "_ds_f", UIDataScroller.FIRST_FACET_NAME);
+ left.put(clientId + "_ds_f", AbstractDataScroller.FIRST_FACET_NAME);
}
if (controlsState.getFastRewindRendered() && controlsState.getFastRewindEnabled()) {
- left.put(clientId + "_ds_fr", UIDataScroller.FAST_REWIND_FACET_NAME);
+ left.put(clientId + "_ds_fr", AbstractDataScroller.FAST_REWIND_FACET_NAME);
}
if (controlsState.getFastForwardRendered() && controlsState.getFastForwardEnabled()) {
- right.put(clientId + "_ds_ff", UIDataScroller.FAST_FORWARD_FACET_NAME);
+ right.put(clientId + "_ds_ff", AbstractDataScroller.FAST_FORWARD_FACET_NAME);
}
if (controlsState.getLastRendered() && controlsState.getLastEnabled()) {
- right.put(clientId + "_ds_l", UIDataScroller.LAST_FACET_NAME);
+ right.put(clientId + "_ds_l", AbstractDataScroller.LAST_FACET_NAME);
}
if (!left.isEmpty()) {
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/DataTableRenderer.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -38,24 +38,28 @@
import org.ajax4jsf.renderkit.AjaxEventOptions;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractDataTable;
+import org.richfaces.component.AbstractSubTable;
import org.richfaces.component.Row;
-import org.richfaces.component.UIDataTable;
import org.richfaces.component.UIDataTableBase;
-import org.richfaces.component.UISubTable;
import org.richfaces.component.util.HtmlUtil;
/**
* @author Anton Belevich
*/
-@ResourceDependencies({@ResourceDependency(library = "javax.faces", name = "jsf.js"),
- @ResourceDependency(name = "jquery.js"), @ResourceDependency(name = "richfaces.js"),
- @ResourceDependency(name = "richfaces-event.js"), @ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(name = "datatable.js"), @ResourceDependency(name = "datatable.ecss")})
+
+@JsfRenderer(type = "org.richfaces.DataTableRenderer", family = AbstractDataTable.COMPONENT_FAMILY)
+@ResourceDependencies({
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library="org.richfaces", name = "datatable.js"),
+ @ResourceDependency(library="org.richfaces", name = "datatable.ecss")
+})
public class DataTableRenderer extends AbstractTableRenderer {
private class DataTableHiddenEncodeStrategy implements EncodeStrategy {
public void begin(ResponseWriter writer, FacesContext context, UIComponent component, Object[] params) throws IOException {
- UIDataTable dataTable = (UIDataTable)component;
+ AbstractDataTable dataTable = (AbstractDataTable)component;
writer.startElement(HTML.TBODY_ELEMENT, dataTable);
writer.writeAttribute(HTML.ID_ATTRIBUTE, dataTable.getClientId(context) + HIDDEN_CONTAINER_ID, null);
@@ -74,7 +78,7 @@
private class RichHeaderEncodeStrategy implements EncodeStrategy {
public void begin(ResponseWriter writer, FacesContext context, UIComponent component, Object [] params) throws IOException {
- org.richfaces.component.UIColumn column = (org.richfaces.component.UIColumn) component;
+ org.richfaces.component.AbstractColumn column = (org.richfaces.component.AbstractColumn) component;
writer.writeAttribute(HTML.ID_ATTRIBUTE, column.getClientId(context), null);
if (isSortable(column)) {
@@ -85,7 +89,7 @@
}
public void end(ResponseWriter writer, FacesContext context, UIComponent component, Object [] params) throws IOException {
- org.richfaces.component.UIColumn column = (org.richfaces.component.UIColumn) component;
+ org.richfaces.component.AbstractColumn column = (org.richfaces.component.AbstractColumn) component;
if (isSortable(column)) {
writer.endElement(HTML.SPAN_ELEM);
}
@@ -94,8 +98,8 @@
public void encodeTableStructure(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable)
throws IOException {
- if (dataTable instanceof UIDataTable) {
- encodeCaption(writer, context, (UIDataTable) dataTable);
+ if (dataTable instanceof AbstractDataTable) {
+ encodeCaption(writer, context, (AbstractDataTable) dataTable);
// TODO nick - do we need this element if "columnsWidth" is absent?
writer.startElement(HTML.COLGROUP_ELEMENT, dataTable);
@@ -143,7 +147,7 @@
RowHolder rowHolder = (RowHolder) holder;
Row row = rowHolder.getRow();
- UIDataTable dataTable = (UIDataTable)row;
+ AbstractDataTable dataTable = (AbstractDataTable)row;
boolean partialUpdate = rowHolder.isUpdatePartial();
boolean parentTbodyStart = rowHolder.isEncodeParentTBody();
@@ -156,7 +160,7 @@
UIComponent child = components.next();
if(child instanceof Row) {
- boolean isSubtable = (child instanceof UISubTable);
+ boolean isSubtable = (child instanceof AbstractSubTable);
//new row -> close </tr>
if (rowHolder.getProcessCell() != 0) {
encodeRowEnd(writer);
@@ -235,10 +239,10 @@
}
protected Class<? extends UIComponent> getComponentClass() {
- return UIDataTable.class;
+ return AbstractDataTable.class;
}
- public void encodeCaption(ResponseWriter writer, FacesContext context, UIDataTable dataTable) throws IOException {
+ public void encodeCaption(ResponseWriter writer, FacesContext context, AbstractDataTable dataTable) throws IOException {
UIComponent caption = dataTable.getCaption();
if (caption == null) {
@@ -268,7 +272,7 @@
}
public EncodeStrategy getHeaderEncodeStrategy(UIComponent column, String facetName) {
- return (column instanceof org.richfaces.component.UIColumn && UIDataTableBase.HEADER.equals(facetName)) ? new RichHeaderEncodeStrategy() : new SimpleHeaderEncodeStrategy();
+ return (column instanceof org.richfaces.component.AbstractColumn && UIDataTableBase.HEADER.equals(facetName)) ? new RichHeaderEncodeStrategy() : new SimpleHeaderEncodeStrategy();
}
public boolean containsThead() {
@@ -276,15 +280,15 @@
}
public boolean isSortable(UIColumn column) {
- if (column instanceof org.richfaces.component.UIColumn) {
+ if (column instanceof org.richfaces.component.AbstractColumn) {
//TODO: anton - add check for the "comparator" property
- return ((org.richfaces.component.UIColumn) column).getValueExpression("sortBy") != null;
+ return ((org.richfaces.component.AbstractColumn) column).getValueExpression("sortBy") != null;
}
return false;
}
public void encodeClientScript(ResponseWriter writer, FacesContext facesContext, UIDataTableBase dataTableBase) throws IOException {
- UIDataTable dataTable = (UIDataTable) dataTableBase;
+ AbstractDataTable dataTable = (AbstractDataTable) dataTableBase;
writer.startElement(HTML.SCRIPT_ELEM, dataTable);
writer.writeAttribute(HTML.TYPE_ATTR, HTML.JAVASCRIPT_TYPE, null);
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -54,8 +54,9 @@
import org.ajax4jsf.renderkit.RendererUtils;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.ajax4jsf.renderkit.RendererUtils.ScriptHashVariableWrapper;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractExtendedDataTable;
import org.richfaces.component.UIDataTableBase;
-import org.richfaces.component.UIExtendedDataTable;
import org.richfaces.component.util.HtmlUtil;
import org.richfaces.context.OnOffResponseWriter;
import org.richfaces.model.SelectionMode;
@@ -64,10 +65,14 @@
* @author Konstantin Mishin
*
*/
-@ResourceDependencies({@ResourceDependency(name = "extendedDataTable.ecss"),
- @ResourceDependency(library = "javax.faces", name = "jsf.js"), @ResourceDependency(name = "jquery.js"),
- @ResourceDependency(name = "jquery.position.js"), @ResourceDependency(name = "richfaces.js"),
- @ResourceDependency(name = "extendedDataTable.js") })
+
+
+@JsfRenderer(type = "org.richfaces.ExtendedDataTableRenderer", family = AbstractExtendedDataTable.COMPONENT_FAMILY)
+@ResourceDependencies({
+ @ResourceDependency(name = "jquery.position.js"),
+ @ResourceDependency(library="org.richfaces", name = "extendedDataTable.ecss"),
+ @ResourceDependency(library="org.richfaces", name = "extendedDataTable.js")
+})
public class ExtendedDataTableRenderer extends SelectionRenderer implements MetaComponentRenderer {
private static enum PartName {
@@ -437,16 +442,16 @@
@Override
protected Class<? extends UIComponent> getComponentClass() {
- return UIExtendedDataTable.class;
+ return AbstractExtendedDataTable.class;
}
public void encodeMetaComponent(FacesContext context, UIComponent component, String metaComponentId)
throws IOException {
- UIExtendedDataTable table = (UIExtendedDataTable) component;
- if (UIExtendedDataTable.SCROLL.equals(metaComponentId)) {
+ AbstractExtendedDataTable table = (AbstractExtendedDataTable) component;
+ if (AbstractExtendedDataTable.SCROLL.equals(metaComponentId)) {
final PartialResponseWriter writer = context.getPartialViewContext().getPartialResponseWriter();
int clientFirst = table.getClientFirst();
- Integer oldClientFirst = (Integer) table.getAttributes().remove(UIExtendedDataTable.OLD_CLIENT_FIRST);
+ Integer oldClientFirst = (Integer) table.getAttributes().remove(AbstractExtendedDataTable.OLD_CLIENT_FIRST);
if (oldClientFirst == null) {
oldClientFirst = clientFirst;
}
@@ -821,9 +826,9 @@
Integer value = Integer.valueOf(clientFirst);
Map<String, Object> attributes = component.getAttributes();
if (!value.equals(attributes.get("clientFirst"))) {
- attributes.put(UIExtendedDataTable.SUBMITTED_CLIENT_FIRST, value);
+ attributes.put(AbstractExtendedDataTable.SUBMITTED_CLIENT_FIRST, value);
context.getPartialViewContext().getRenderIds().add(
- component.getClientId(context) + "@" + UIExtendedDataTable.SCROLL);
+ component.getClientId(context) + "@" + AbstractExtendedDataTable.SCROLL);
}
}
}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SortingFilteringRowsRenderer.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -43,6 +43,7 @@
* @author Anton Belevich
*
*/
+
public abstract class SortingFilteringRowsRenderer extends AbstractRowsRenderer {
private static final String FILTERING_STRING = "rich:filtering";
@@ -58,7 +59,6 @@
private static final String SEPARATOR = ":";
protected void decodeSortingFiltering(FacesContext context, UIComponent component) {
-
if(component instanceof UIDataTableBase) {
UIDataTableBase dataTableBase = (UIDataTableBase)component;
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableRenderer.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -28,6 +28,7 @@
import java.util.Iterator;
import java.util.Map;
+import javax.faces.application.ResourceDependency;
import javax.faces.component.UIColumn;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -37,16 +38,20 @@
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
+import org.richfaces.cdk.annotations.JsfRenderer;
+import org.richfaces.component.AbstractDataTable;
+import org.richfaces.component.AbstractSubTable;
import org.richfaces.component.Row;
-import org.richfaces.component.UIDataTable;
import org.richfaces.component.UIDataTableBase;
-import org.richfaces.component.UISubTable;
import org.richfaces.event.ToggleEvent;
/**
* @author Anton Belevich
*
*/
+
+@JsfRenderer(type = "org.richfaces.SubTableRenderer", family = AbstractSubTable.COMPONENT_FAMILY)
+@ResourceDependency(library="org.richfaces", name = "subtable.js")
public class SubTableRenderer extends AbstractTableRenderer {
public static final String TB_ROW = ":c";
@@ -60,7 +65,7 @@
private class SubTableHiddenEncodeStrategy implements EncodeStrategy {
public void begin(ResponseWriter writer, FacesContext context, UIComponent component, Object[] params) throws IOException {
- UISubTable subTable = (UISubTable)component;
+ AbstractSubTable subTable = (AbstractSubTable)component;
writer.startElement(HTML.TR_ELEMENT, subTable);
writer.writeAttribute(HTML.ID_ATTRIBUTE, subTable.getClientId(context) + HIDDEN_CONTAINER_ID, null);
writer.writeAttribute(HTML.STYLE_ATTRIBUTE, DISPLAY_NONE, null);
@@ -82,7 +87,7 @@
};
protected void doDecode(FacesContext facesContext, UIComponent component) {
- UISubTable subTable = (UISubTable)component;
+ AbstractSubTable subTable = (AbstractSubTable)component;
String clientId = subTable.getClientId(facesContext);
Map<String, String> requestMap = facesContext.getExternalContext().getRequestParameterMap();
@@ -124,7 +129,7 @@
}
public void encodeTableFacets(ResponseWriter writer, FacesContext context, UIDataTableBase dataTable) throws IOException {
- UISubTable subTable = (UISubTable)dataTable;
+ AbstractSubTable subTable = (AbstractSubTable)dataTable;
encodeHeaderFacet(writer, context, subTable, false);
@@ -141,10 +146,10 @@
@Override
public void encodeTableBodyStart(ResponseWriter writer, FacesContext facesContext, UIDataTableBase dataTableBase) throws IOException {
- UISubTable subTable = (UISubTable)dataTableBase;
+ AbstractSubTable subTable = (AbstractSubTable)dataTableBase;
UIDataTableBase component = findParent(subTable);
- if(component instanceof UIDataTable) {
+ if(component instanceof AbstractDataTable) {
writer.startElement(HTML.TBODY_ELEMENT, null);
writer.writeAttribute(HTML.ID_ATTRIBUTE, component.getRelativeClientId(facesContext) + ":" + subTable.getId() + TB_ROW, null);
writer.writeAttribute(HTML.CLASS_ATTRIBUTE, getTableSkinClass(), null);
@@ -156,14 +161,14 @@
@Override
public void encodeBeforeRows(ResponseWriter writer, FacesContext facesContext, UIDataTableBase dataTableBase, boolean encodeParentTBody, boolean partialUpdate) throws IOException {
- UISubTable subTable = (UISubTable)dataTableBase;
+ AbstractSubTable subTable = (AbstractSubTable)dataTableBase;
encodeTableBodyStart(writer, facesContext, subTable);
encodeSubTableDomElement(writer, facesContext, subTable);
setupTableStartElement(facesContext, subTable);
encodeHeaderFacet(writer, facesContext, subTable, false);
}
- private void encodeSubTableDomElement(ResponseWriter writer, FacesContext facesContext, UISubTable subTable) throws IOException{
+ private void encodeSubTableDomElement(ResponseWriter writer, FacesContext facesContext, AbstractSubTable subTable) throws IOException{
writer.startElement(HTML.TR_ELEMENT, subTable);
writer.writeAttribute(HTML.STYLE_ATTRIBUTE, DISPLAY_NONE, null);
writer.writeAttribute(HTML.ID_ATTRIBUTE, subTable.getClientId(facesContext), null);
@@ -179,7 +184,7 @@
rowHolder.setRowStart(true);
Iterator<UIComponent> components = row.columns();
if (rowHolder.isUpdatePartial()) {
- partialStart(facesContext,((UISubTable) row).getRelativeClientId(facesContext) + ":b");
+ partialStart(facesContext,((AbstractSubTable) row).getRelativeClientId(facesContext) + ":b");
}
while (components.hasNext()) {
@@ -188,7 +193,7 @@
if(component instanceof UIColumn) {
encodeColumn(facesContext, writer, (UIColumn)component , rowHolder);
- } else if (component instanceof UISubTable) {
+ } else if (component instanceof AbstractSubTable) {
if(component.isRendered()) {
encodeRowEnd(writer);
}
@@ -208,19 +213,19 @@
@Override
public void encodeAfterRows(ResponseWriter writer, FacesContext facesContext, UIDataTableBase dataTableBase,
boolean encodeParentTBody, boolean partialUpdate) throws IOException {
- UISubTable subTable = (UISubTable)dataTableBase;
+ AbstractSubTable subTable = (AbstractSubTable)dataTableBase;
encodeFooterFacet(writer, facesContext, subTable, false);
}
@Override
public boolean encodeParentTBody(UIDataTableBase dataTableBase) {
- UIDataTableBase parent = findParent((UISubTable)dataTableBase);
- return (parent instanceof UIDataTable);
+ UIDataTableBase parent = findParent((AbstractSubTable)dataTableBase);
+ return (parent instanceof AbstractDataTable);
}
public void encodeHiddenInput(ResponseWriter writer, FacesContext facesContext, UIDataTableBase dataTableBase)
throws IOException {
- UISubTable subTable = (UISubTable) dataTableBase;
+ AbstractSubTable subTable = (AbstractSubTable) dataTableBase;
String stateId = subTable.getClientId(facesContext) + STATE;
@@ -229,7 +234,7 @@
writer.writeAttribute(HTML.NAME_ATTRIBUTE, stateId, null);
writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
- int state = subTable.isExpanded() ? UISubTable.EXPAND_STATE : UISubTable.COLLAPSE_STATE;
+ int state = subTable.isExpanded() ? AbstractSubTable.EXPAND_STATE : AbstractSubTable.COLLAPSE_STATE;
writer.writeAttribute(HTML.VALUE_ATTRIBUTE, state, null);
writer.endElement(HTML.INPUT_ELEM);
@@ -255,7 +260,7 @@
public void encodeClientScript(ResponseWriter writer, FacesContext facesContext, UIDataTableBase component)
throws IOException {
- UISubTable subTable = (UISubTable) component;
+ AbstractSubTable subTable = (AbstractSubTable) component;
String id = subTable.getClientId(facesContext);
@@ -362,10 +367,10 @@
@Override
public void encodeMetaComponent(FacesContext facesContext, UIComponent component, String metaComponentId)
throws IOException {
- UISubTable subTable = (UISubTable)component;
+ AbstractSubTable subTable = (AbstractSubTable)component;
setupTableStartElement(facesContext, subTable);
- if(UISubTable.BODY.equals(metaComponentId)) {
+ if(AbstractSubTable.BODY.equals(metaComponentId)) {
ResponseWriter writer = facesContext.getResponseWriter();
UIDataTableBase dataTableBase = findParent(subTable);
@@ -386,7 +391,7 @@
setupTableStartElement(context, component, HTML.TD_ELEM);
}
- protected UIDataTableBase findParent(UISubTable subTable) {
+ protected UIDataTableBase findParent(AbstractSubTable subTable) {
UIComponent parent = subTable.getParent();
while(parent != null && !(parent instanceof UIDataTableBase)) {
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableToggleControlRendererBase.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableToggleControlRendererBase.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/renderkit/SubTableToggleControlRendererBase.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -35,21 +35,23 @@
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.renderkit.RendererBase;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
-import org.richfaces.component.UISubTable;
-import org.richfaces.component.UISubTableToggleControl;
+import org.richfaces.component.AbstractSubTable;
+import org.richfaces.component.AbstarctSubTableToggleControl;
/**
* @author Anton Belevich
*/
+
+
@ResourceDependencies({@ResourceDependency(library = "javax.faces", name = "jsf.js"),
@ResourceDependency(name = "richfaces.js"), @ResourceDependency(name = "subtable-toggler.js")})
public class SubTableToggleControlRendererBase extends RendererBase {
private static final String DISPLAY_NONE = "display: none;";
- private static final String UP_ICON_URL = "up_icon.gif";
+ private static final String UP_ICON_URL = "org.richfaces:up_icon.gif";
- private static final String DOWN_ICON_URL = "down_icon.gif";
+ private static final String DOWN_ICON_URL = "org.richfaces:down_icon.gif";
private static final String EXPAND_STATE = "expand";
@@ -61,8 +63,8 @@
}
protected void encodeControl(FacesContext context, UIComponent component) throws IOException {
- UISubTableToggleControl toggleControl = (UISubTableToggleControl) component;
- UISubTable subTable = findComponent(context, toggleControl);
+ AbstarctSubTableToggleControl toggleControl = (AbstarctSubTableToggleControl) component;
+ AbstractSubTable subTable = findComponent(context, toggleControl);
if (subTable != null) {
String switchType = subTable.getExpandMode();
@@ -84,7 +86,7 @@
}
}
- protected void encodeControl(FacesContext context, ResponseWriter writer, UISubTableToggleControl control,
+ protected void encodeControl(FacesContext context, ResponseWriter writer, AbstarctSubTableToggleControl control,
String switchType, boolean expanded, boolean visible) throws IOException {
String state = getState(expanded);
String styleClass = getStyleClass(context, control);
@@ -155,7 +157,7 @@
writer.endElement(HTML.SPAN_ELEM);
}
- public HashMap<String, Object> encodeOptions(FacesContext context, UISubTableToggleControl toggleControl, UISubTable subTable) {
+ public HashMap<String, Object> encodeOptions(FacesContext context, AbstarctSubTableToggleControl toggleControl, AbstractSubTable subTable) {
String forId = subTable.getClientId(context);
String toggleControlId = toggleControl.getClientId(context);
@@ -170,21 +172,21 @@
return options;
}
- public String getStyleClass(FacesContext context, UISubTableToggleControl control) {
+ public String getStyleClass(FacesContext context, AbstarctSubTableToggleControl control) {
return null;
}
- public String getStyle(FacesContext context, UISubTableToggleControl control) {
+ public String getStyle(FacesContext context, AbstarctSubTableToggleControl control) {
return null;
}
- protected UISubTable findComponent(FacesContext context, UISubTableToggleControl toggleControl) {
+ protected AbstractSubTable findComponent(FacesContext context, AbstarctSubTableToggleControl toggleControl) {
String forId = toggleControl.getFor();
if (forId != null && forId.length() > 0) {
UIComponent subTable = getUtils().findComponentFor(context, toggleControl, forId);
- if (subTable instanceof UISubTable) {
- return (UISubTable) subTable;
+ if (subTable instanceof AbstractSubTable) {
+ return (AbstractSubTable) subTable;
}
}
return null;
Added: trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java (rev 0)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataScrollerHandler.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.richfaces.taglib;
+
+import javax.el.ValueExpression;
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
+import org.richfaces.component.AbstractDataScroller;
+
+/**
+ * Created 11.03.2008
+ *
+ * @author Nick Belaevski
+ * @since 3.2
+ */
+
+public class DataScrollerHandler extends ComponentHandler {
+
+ private static final MetaRule PAGERULE = new MetaRule() {
+
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ if ("page".equals(name)) {
+ return new PageMapper(attribute);
+ } else {
+ return null;
+ }
+ }
+ };
+
+ private static final MetaRule SCROLL_LISTENER_RULE = new MetaRule() {
+
+ @Override
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(AbstractDataScroller.class)) {
+ if ("scrollListener".equals(name)) {
+ return new ScrollListenerMapper(attribute);
+ }
+ }
+ return null;
+ }
+
+ };
+
+ private static final class ScrollListenerMapper extends Metadata {
+
+ private static final Class[] SIGNATURE = new Class[] { org.richfaces.event.DataScrollerEvent.class };
+
+ private final TagAttribute attribute;
+
+ public ScrollListenerMapper(TagAttribute attribute) {
+ this.attribute = attribute;
+ }
+
+ @Override
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+
+ ((AbstractDataScroller) instance).addScrollerListener((new MethodExpressionScrollListener(this.attribute
+ .getMethodExpression(ctx, null, SIGNATURE))));
+ }
+ }
+
+ private static final class PageMapper extends Metadata {
+
+ private final TagAttribute page;
+
+ public PageMapper(TagAttribute attribute) {
+ page = attribute;
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ AbstractDataScroller datascroller = (AbstractDataScroller) instance;
+
+ ValueExpression ve = page.getValueExpression(ctx, int.class);
+ if (ve.isLiteralText()) {
+ Integer value = (Integer) ve.getValue(ctx.getFacesContext().getELContext());
+ datascroller.setPage(value);
+ } else {
+ datascroller.setValueExpression("page", ve);
+ }
+ }
+
+ }
+
+ public DataScrollerHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset ruleset = super.createMetaRuleset(type);
+ ruleset.addRule(PAGERULE);
+ ruleset.addRule(SCROLL_LISTENER_RULE);
+ ruleset.alias("for", "forComponent");
+ return ruleset;
+ }
+}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataTableHandler.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataTableHandler.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DataTableHandler.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -32,7 +32,7 @@
import javax.faces.view.facelets.MetadataTarget;
import javax.faces.view.facelets.TagAttribute;
-import org.richfaces.component.UIDataTable;
+import org.richfaces.component.AbstractDataTable;
/**
* @author Anton Belevich
@@ -55,7 +55,7 @@
static class SortingFilteringRule extends MetaRule {
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
- if(meta.isTargetInstanceOf(UIDataTable.class)) {
+ if(meta.isTargetInstanceOf(AbstractDataTable.class)) {
if("sortingListener".equals(name)) {
return new SortingListenerMapper(attribute);
@@ -81,7 +81,7 @@
}
public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UIDataTable) instance).addSortingListener(new MethodExpressionSortingListener(this.attribute.getMethodExpression(ctx, null, SIGNATURE)));
+ ((AbstractDataTable) instance).addSortingListener(new MethodExpressionSortingListener(this.attribute.getMethodExpression(ctx, null, SIGNATURE)));
}
}
@@ -96,7 +96,7 @@
}
public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UIDataTable) instance).addFilteringListener(new MethodExpressionFilteringListener(this.attribute.getMethodExpression(ctx, null, SIGNATURE)));
+ ((AbstractDataTable) instance).addFilteringListener(new MethodExpressionFilteringListener(this.attribute.getMethodExpression(ctx, null, SIGNATURE)));
}
}
}
Deleted: trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DatascrollerTagHandler.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DatascrollerTagHandler.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/DatascrollerTagHandler.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,122 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.taglib;
-
-import javax.el.ValueExpression;
-import javax.faces.view.facelets.ComponentConfig;
-import javax.faces.view.facelets.ComponentHandler;
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.MetaRule;
-import javax.faces.view.facelets.MetaRuleset;
-import javax.faces.view.facelets.Metadata;
-import javax.faces.view.facelets.MetadataTarget;
-import javax.faces.view.facelets.TagAttribute;
-
-import org.richfaces.component.UIDataScroller;
-
-/**
- * Created 11.03.2008
- *
- * @author Nick Belaevski
- * @since 3.2
- */
-
-public class DatascrollerTagHandler extends ComponentHandler {
-
- private static final MetaRule PAGERULE = new MetaRule() {
-
- public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
- if ("page".equals(name)) {
- return new PageMapper(attribute);
- } else {
- return null;
- }
- }
- };
-
- private static final MetaRule SCROLL_LISTENER_RULE = new MetaRule() {
-
- @Override
- public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
- if (meta.isTargetInstanceOf(UIDataScroller.class)) {
- if ("scrollListener".equals(name)) {
- return new ScrollListenerMapper(attribute);
- }
- }
- return null;
- }
-
- };
-
- private static final class ScrollListenerMapper extends Metadata {
-
- private static final Class[] SIGNATURE = new Class[] { org.richfaces.event.DataScrollerEvent.class };
-
- private final TagAttribute attribute;
-
- public ScrollListenerMapper(TagAttribute attribute) {
- this.attribute = attribute;
- }
-
- @Override
- public void applyMetadata(FaceletContext ctx, Object instance) {
-
- ((UIDataScroller) instance).addScrollerListener((new MethodExpressionScrollListener(this.attribute
- .getMethodExpression(ctx, null, SIGNATURE))));
- }
- }
-
- private static final class PageMapper extends Metadata {
-
- private final TagAttribute page;
-
- public PageMapper(TagAttribute attribute) {
- page = attribute;
- }
-
- public void applyMetadata(FaceletContext ctx, Object instance) {
- UIDataScroller datascroller = (UIDataScroller) instance;
-
- ValueExpression ve = page.getValueExpression(ctx, int.class);
- if (ve.isLiteralText()) {
- Integer value = (Integer) ve.getValue(ctx.getFacesContext().getELContext());
- datascroller.setPage(value);
- } else {
- datascroller.setValueExpression("page", ve);
- }
- }
-
- }
-
- public DatascrollerTagHandler(ComponentConfig config) {
- super(config);
- }
-
- protected MetaRuleset createMetaRuleset(Class type) {
- MetaRuleset ruleset = super.createMetaRuleset(type);
- ruleset.addRule(PAGERULE);
- ruleset.addRule(SCROLL_LISTENER_RULE);
- ruleset.alias("for", "forComponent");
- return ruleset;
- }
-}
Modified: trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/SubTableHandler.java
===================================================================
--- trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/SubTableHandler.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/java/org/richfaces/taglib/SubTableHandler.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -32,7 +32,7 @@
import javax.faces.view.facelets.MetadataTarget;
import javax.faces.view.facelets.TagAttribute;
-import org.richfaces.component.UISubTable;
+import org.richfaces.component.AbstractSubTable;
/**
* @author Anton Belevich
@@ -56,7 +56,7 @@
static class SubTableHandlerMetaRule extends MetaRule {
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
- if (meta.isTargetInstanceOf(UISubTable.class) && "toggleListener".equals(name)) {
+ if (meta.isTargetInstanceOf(AbstractSubTable.class) && "toggleListener".equals(name)) {
return new SubTableMapper(attribute);
}
return null;
@@ -75,7 +75,7 @@
}
public void applyMetadata(FaceletContext ctx, Object instance) {
- ((UISubTable) instance).addToggleListener((new MethodExpressionToggleListener(this.attribute.getMethodExpression(ctx, null, SIGNATURE))));
+ ((AbstractSubTable) instance).addToggleListener((new MethodExpressionToggleListener(this.attribute.getMethodExpression(ctx, null, SIGNATURE))));
}
}
}
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/dataTable.faces-config.xml
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/dataTable.faces-config.xml 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/dataTable.faces-config.xml 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<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://richfaces.org/cdk/extensions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <name>richfaces</name>
- <application>
- <system-event-listener>
- <system-event-listener-class>org.richfaces.event.DataTablePreRenderListener</system-event-listener-class>
- <system-event-class>javax.faces.event.PreRenderComponentEvent</system-event-class>
- </system-event-listener>
- </application>
- <render-kit>
- <render-kit-id>HTML_BASIC</render-kit-id>
- <renderer>
- <component-family>org.richfaces.DataScroller</component-family>
- <renderer-type>org.richfaces.DataScrollerRenderer</renderer-type>
- <renderer-class>org.richfaces.renderkit.html.DataScrollerRenderer</renderer-class>
- </renderer>
- </render-kit>
-</faces-config>
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/datascroller.taglib.xml
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/datascroller.taglib.xml 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/datascroller.taglib.xml 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
- version="2.0" id="a4j">
- <namespace>http://richfaces.org/datascroller</namespace>
- <tag>
- <tag-name>dataScroller</tag-name>
- <component>
- <component-type>org.richfaces.DataScroller</component-type>
- <renderer-type>org.richfaces.DataScrollerRenderer</renderer-type>
- <handler-class>org.richfaces.taglib.DatascrollerTagHandler</handler-class>
- </component>
- </tag>
-</facelet-taglib>
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/org.richfaces.renderkit.html.images.ColumnHeaderGradientImage
===================================================================
Added: trunk/ui/iteration/ui/src/main/resources/META-INF/org.richfaces.renderkit.html.images.ColumnHeaderGradientImage.resource
===================================================================
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datagrid.ecss
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datagrid.ecss 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datagrid.ecss 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,100 +0,0 @@
-.rf-dg{
- background-color:'#{richSkin.tableBackgroundColor}';
- border-collapse:collapse;
- border-left-width:'#{richSkin.tableBorderWidth}';
- border-left-style:solid;
- border-left-color:'#{richSkin.tableBorderColor}';
- border-top-width:'#{richSkin.tableBorderWidth}';
- border-top-style:solid;
- border-top-color:'#{richSkin.tableBorderColor}';
- empty-cells:show;
-}
-
-.rf-dg-nd-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- color:'#{richSkin.generalTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- padding:4px;
-}
-
-
-.rf-dg-cap{
-}
-
-.rf-dg-r{
-}
-
-.rf-dg-f-r{
-}
-
-.rf-dg-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- color:'#{richSkin.generalTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- padding:4px;
-}
-
-.rf-dg-h{
-}
-
-.rf-dg-h-f{
-}
-
-.rf-dg-h-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- background-color : '#{richSkin.tableHeaderBackgroundColor}';
- background-image : "url(#{resource['org.richfaces.renderkit.html.images.ColumnHeaderGradientImage']})";
- background-position: top left;
- color:'#{richSkin.tableHeaderTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- font-weight:bold;
- padding:4px;
- text-align:center;
-}
-
-.rf-dg-th{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
-}
-
-.rf-dg-f {
-
-}
-
-.rf-dg-f-f{
-}
-
-.rf-dg-f-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- color:'#{richSkin.generalTextColor}';
- background-color:'#{richSkin.tableFooterBackgroundColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- font-weight:bold;
- padding:4px;
- text-align:center;
-}
\ No newline at end of file
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datatable.ecss
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datatable.ecss 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datatable.ecss 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,271 +0,0 @@
-.rf-dt{
- background-color:'#{richSkin.tableBackgroundColor}';
- border-collapse:collapse;
- border-left-width:'#{richSkin.tableBorderWidth}';
- border-left-style:solid;
- border-left-color:'#{richSkin.tableBorderColor}';
- border-top-width:'#{richSkin.tableBorderWidth}';
- border-top-style:solid;
- border-top-color:'#{richSkin.tableBorderColor}';
- empty-cells:show;
-}
-
-.rf-dt-cap{
-}
-
-.rf-dt-r{
-}
-
-.rf-dt-f-r{
-}
-
-.rf-dt-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- color:'#{richSkin.generalTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- padding:4px;
-}
-
-.rf-dt-nd-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- color:'#{richSkin.generalTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- padding:4px;
-}
-
-.rf-dt-h{
-}
-
-.rf-dt-h-f{
-}
-
-.rf-dt-h-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- background-color : '#{richSkin.tableHeaderBackgroundColor}';
- background-image : "url(#{resource['org.richfaces.renderkit.html.images.ColumnHeaderGradientImage']})";
- background-position: top left;
- color:'#{richSkin.tableHeaderTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- font-weight:bold;
- padding:4px;
- text-align:center;
-}
-
-.rf-dt-sh {
-}
-
-.rf-dt-sh-f {
-}
-
-.rf-dt-sh-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- background-color : '#{richSkin.tableHeaderBackgroundColor}';
- background-image : "url(#{resource['org.richfaces.renderkit.html.images.ColumnHeaderGradientImage']})";
- background-position: top left;
- color:'#{richSkin.tableHeaderTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- font-weight:bold;
- padding:4px;
- text-align:center;
-}
-
-.rf-dt-sf{
-}
-
-.rf-dt-sf-f{
-}
-
-.rf-dt-sf-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- background-color:'#{richSkin.tableSubfooterBackgroundColor}';
- color:'#{richSkin.generalTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- font-weight:bold;
- padding:4px;
- text-align:center;
-
-
-}
-
-.rf-dt-th{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
-}
-
-.rf-dt-f {
-
-}
-
-.rf-dt-f-f{
-}
-
-.rf-dt-f-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- color:'#{richSkin.generalTextColor}';
- background-color:'#{richSkin.tableFooterBackgroundColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- font-weight:bold;
- padding:4px;
- text-align:center;
-}
-
-.rf-st{
-}
-
-.rf-st-r{
-}
-
-.rf-st-f-r{
-}
-
-.rf-st-h-r{
-}
-
-.rf-st-h-f-r{
-}
-
-.rf-st-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- color:'#{richSkin.generalTextColor}';
- background-color:'#{richSkin.tableBackgroundColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- padding:4px;
-}
-
-.rf-st-h-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- color:'#{richSkin.generalTextColor}';
- background-color:'#{richSkin.tableSubHeaderBackgroundColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- font-weight:bold;
- padding:4px;
- text-align:left;
-}
-
-.rf-st-sh-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- background-color:'#{richSkin.tableSubHeaderBackgroundColor}';
- color:'#{richSkin.generalTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- font-weight:bold;
- padding:4px;
-}
-
-.rf-st-sh{
-}
-
-.rf-st-f {
-}
-
-.rf-st-f-c{
- border-bottom-width:3px;
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- background-color:'#{richSkin.tableSubfooterBackgroundColor}';
- color:'#{richSkin.generalTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size: '#{richSkin.generalSizeFont}';
- font-weight:bold;
- padding:4px;
- text-align:left;
-}
-
-.rf-st-sf-c{
- border-bottom-width:'#{richSkin.tableBorderWidth}';
- border-bottom-style:solid;
- border-bottom-color:'#{richSkin.tableBorderColor}';
- border-right-width:'#{richSkin.tableBorderWidth}';
- border-right-style:solid;
- border-right-color:'#{richSkin.tableBorderColor}';
- background-color:'#{richSkin.tableSubfooterBackgroundColor}';
- color:'#{richSkin.generalTextColor}';
- font-family:'#{richSkin.generalFamilyFont}';
- font-size:'#{richSkin.generalSizeFont}';
- padding:4px;
-}
-
-.rf-st-sf{
-}
-
-.rf-st-sf-f{
-}
-
-.rf-st-sh-f{
-}
-
-.rf-st-f-f{
-}
-
-.rf-st-h-f{
-}
-
-.rf-st-h{
-}
-
-
-/*should be generated in M1*/
-.rf-stt-exp{
- background-image: url("#{resource['up_icon.gif']}");
-}
-
-.rf-stt-col{
- background-image: url("#{resource['down_icon.gif']}");
-}
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datatable.js
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datatable.js 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/datatable.js 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,105 +0,0 @@
-(function ($, richfaces) {
-
- richfaces.ui = richfaces.ui || {};
-
- richfaces.ui.DataTable = function(id, options) {
- this.id = id;
- this.options = options;
- $super.constructor.call(this,id);
- this.attachToDom(id);
-
- };
-
- var $super = richfaces.BaseComponent.extend(richfaces.ui.DataTable);
- var $p = richfaces.BaseComponent.extend(richfaces.ui.DataTable, {});
- var $super = richfaces.ui.DataTable.$super;
-
- $.extend(richfaces.ui.DataTable, {
- SORTING: "rich:sorting",
- FILTERING: "rich:filtering",
- SUBTABLE_SELECTOR:".rich-subtable"
- });
-
- $.extend(richfaces.ui.DataTable.prototype, ( function () {
-
- var invoke = function(event, attributes) {
- richfaces.ajax(this.id, event, {"parameters" : attributes});
- };
-
- var createParameters = function(type, id, arg1, arg2) {
- var parameters = {};
- var key = this.id + type;
- parameters[key] = ((id || "") + ":" + (arg1 || "") + ":" + (arg2 || true));
-
- var eventOptions = this.options.ajaxEventOption;
- for (key in eventOptions) {
- if(!parameters[key]) {
- parameters[key] = eventOptions[key];
- }
- }
- return parameters;
- };
-
-
- return {
-
- name : "RichFaces.ui.DataTable",
-
- sort: function(columnId, direction, isClear) {
- invoke.call(this,null,createParameters.call(this,richfaces.ui.DataTable.SORTING, columnId, direction, isClear));
- },
-
- filter: function(columnId, filterValue, isClear) {
- invoke.call(this,null,createParameters.call(this,richfaces.ui.DataTable.FILTERING, columnId, filterValue, isClear));
- },
-
- expandAllSubTables: function() {
- this.invokeOnSubTables('expand');
- },
-
- collapseAllSubTables: function() {
- this.invokeOnSubTables('collapse');
- },
-
- switchSubTable: function(id) {
- this.getSubTable(id).toggle();
- },
-
- getSubTable: function(id) {
- return richfaces.$(id);
- },
-
- invokeOnSubTables: function(funcName) {
- var elements = $(document.getElementById(this.id)).children(richfaces.ui.DataTable.SUBTABLE_SELECTOR);
- var invokeOnComponent = this.invokeOnComponent;
- elements.each(
- function(){
- if(this.richfaces && this.richfaces.component) {
- var component = this.richfaces.component;
- if(component instanceof RichFaces.ui.SubTable) {
- invokeOnComponent(component, funcName);
- }
- }
- }
- );
- },
-
- invokeOnSubTable: function(id, funcName) {
- var subtable = this.getSubTable(id);
- this.invokeOnComponent(subtable, funcName);
- },
-
- invokeOnComponent: function(component, funcName) {
- if(component) {
- var func = component[funcName];
- if(typeof func == 'function') {
- func.call(component);
- }
- }
- }
- }
-
- })());
-
-})(jQuery, window.RichFaces);
-
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/down_icon.gif
===================================================================
(Binary files differ)
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/extendedDataTable.ecss
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/extendedDataTable.ecss 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/extendedDataTable.ecss 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,159 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-.rf-edt {
- overflow: hidden;
- background-color: '#{richSkin.tableBackgroundColor}';
- border: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
-}
-
-.rf-edt-h, .rf-edt-th {
- background-image : "url(#{resource['org.richfaces.renderkit.html.images.ColumnHeaderGradientImage']})";
-}
-
-.rf-edt-th {
- border-bottom: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
-}
-
-.rf-edt-b {
- overflow-x: hidden;
- overflow-y: auto;
- width: 100%;
-}
-
-.rf-edt-s {
- height: 0px;
- font-size: 0px; /*for IE7 only*/
-}
-
-.rf-edt-f, .rf-edt-tf {
- border-top: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
- background-color: '#{richSkin.tableFooterBackgroundColor}';
-}
-
-.rf-edt-fa {
- vertical-align: top;
-}
-
-.rf-edt-p {
- overflow: hidden;
-}
-
-.rf-edt-fp {
- overflow-x: auto;
- overflow-y: visible;
-}
-
-.rf-edt-rsh {
- left : 0px;
- position: relative;
- height: 0px;
-}
-
-.rf-edt-rs {
- background-image: url("#{resource['spacer.gif']}");
- cursor: e-resize;
- height: 20px; /*TODO*/
- position: absolute;
- left: 100%;
- margin-left: -3px;
- width: 6px;
-}
-
-.rf-edt-d {
- cursor: e-resize;
- position: absolute;
- border-left: '1px dotted #{richSkin.generalTextColor}';
- /*background-color: #848089;*/
- width: 1px;
- display: none;
-}
-
-.rf-edt-ro {
- position: absolute;
- border-collapse: collapse;
- display: none;
-}
-
-.rf-edt-ro th {
- width: 20px;
- height: 5px;
- font-size: 1px;
- background-color: '#{richSkin.tableHeaderBackgroundColor}';
- border: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
-}
-
-.rf-edt-ro td {
- width: 20px;
- height: 5px;
- font-size: 1px;
- background-color: '#{richSkin.tableBackgroundColor}';
- border: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
-}
-
-.rf-edt-c, .rf-edt-hc, .rf-edt-fc {
- height: 20px;
- overflow: hidden;
- border-bottom: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
- border-right: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
-}
-
-.rf-edt-efc {
- border-right: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
- height: 1px;
-}
-
-.rf-edt-cc, .rf-edt-hcc, .rf-edt-fcc, .rf-edt-th, .rf-edt-tf {
- padding: 3px 7px;
- white-space: nowrap;
- font-family: '#{richSkin.generalFamilyFont}';
- font-size: '#{richSkin.generalSizeFont}';
-}
-
-.rf-edt-hcc, .rf-edt-th, .rf-edt-fcc, .rf-edt-tf {
- font-weight: bold;
- text-align: center;
-}
-
-.rf-edt-hcc, .rf-edt-th {
- color: '#{richSkin.tableHeaderTextColor}';
-}
-
-.rf-edt-cc, .rf-edt-fcc, .rf-edt-tf {
- color: '#{richSkin.generalTextColor}';
-}
-
-.rf-edt-rom {
- position: absolute;
- height: 9px;
- font-size: 9px;
- width: 9px;
- background-image: url("#{resource['reorderMarker.gif']}");
- display: none;
-}
-
-.rf-edt-r-s {
- background-color: '#{richSkin.additionalBackgroundColor}'; /*TODO Probably use other skin property.*/
-}
-
-.rf-edt-r-a {
- font-weight: bold; /*TODO Probably use other property.*/
-}
\ No newline at end of file
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/extendedDataTable.js
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,694 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-(function(richfaces, jQuery) {
- richfaces.utils = richfaces.utils || {};
-
- richfaces.utils.getCSSRule = function (className) {
- var rule = null;
- var sheets = document.styleSheets;
- for (var j = 0; !rule && j < sheets.length; j++) {
- var rules = sheets[j].cssRules ? sheets[j].cssRules : sheets[j].rules;
- for (var i = 0; !rule && i < rules.length; i++) {
- if (rules[i].selectorText && rules[i].selectorText.toLowerCase() == className.toLowerCase()) {
- rule = rules[i];
- }
- }
- }
- return rule;
- };
-
- richfaces.utils.Ranges = function() {
- this.ranges = [];
- };
-
- richfaces.utils.Ranges.prototype = {
-
- add: function(index) {
- var i = 0;
- while(i < this.ranges.length && index >= this.ranges[i++][1]);
- i--;
- if(this.ranges[i-1] && index==(this.ranges[i-1][1]+1) ) {
- if(index==(this.ranges[i][0]-1)) {
- this.ranges[i-1][1] = this.ranges[i][1];
- this.ranges.splice(i, 1);
- } else {
- this.ranges[i-1][1]++;
- }
- } else {
- if(this.ranges[i]){
- if(this.ranges[i] && index==(this.ranges[i][0]-1)) {
- this.ranges[i][0]--;
- } else {
- if(index==(this.ranges[i][1]+1)){
- this.ranges[i][1]++;
- } else {
- if(index<this.ranges[i][1]){
- this.ranges.splice(i, 0, [index, index]);
- } else {
- this.ranges.splice(i + 1, 0, [index, index]);
- }
- }
- }
- } else {
- this.ranges.splice(i, 0, [index, index]);
- }
- }
- },
-
- remove: function(index) {
- var i = 0;
- while(i < this.ranges.length && index > this.ranges[i++][1]);
- i--;
- if(this.ranges[i]) {
- if(index==(this.ranges[i][1]) ) {
- if(index==(this.ranges[i][0])){
- this.ranges.splice(i, 1);
- } else {
- this.ranges[i][1]--;
- }
- } else {
- if(index==(this.ranges[i][0])){
- this.ranges[i][0]++;
- } else {
- this.ranges.splice(i+1, 0, [index+1, this.ranges[i][1]]);
- this.ranges[i][1] = index-1;
- }
- }
- }
- },
-
- clear: function() {
- this.ranges = [];
- },
-
- contains: function(index) {
- var i = 0;
- while(i < this.ranges.length && index >= this.ranges[i][0]) {
- if(index >= this.ranges[i][0] && index <= this.ranges[i][1]) {
- return true;
- } else {
- i++;
- }
- }
- return false;
- },
-
- toString: function() {
- var ret = new Array(this.ranges.length);
- for (var i = 0; i < this.ranges.length; i++) {
- ret[i] = this.ranges[i].join();
- }
- return ret.join(";");
- }
- };
-
- richfaces.ExtendedDataTable = function(id, rowCount, ajaxFunction, options) {
- var WIDTH_CLASS_NAME_BASE = "rf-edt-cw-";
- var MIN_WIDTH = 20;
-
- options = options || {};
- var ranges = new richfaces.utils.Ranges();
- var element = document.getElementById(id);
- var bodyElement, contentElement, spacerElement, dataTableElement, rows, rowHeight, parts, tbodies, shiftIndex,
- activeIndex, selectionFlag;
- var dragElement = document.getElementById(id + ":d");
- var reorderElement = document.getElementById(id + ":r");
- var reorderMarkerElement = document.getElementById(id + ":rm");
- var widthInput = document.getElementById(id + ":wi");
- var selectionInput = document.getElementById(id + ":si");
- var normalPartStyle = richfaces.utils.getCSSRule(".rf-edt-pw").style;
- var header = jQuery(element).children(".rf-edt-h");
- var resizerHolders = header.find(".rf-edt-rsh");
-
- var frozenHeaderPartElement = document.getElementById(id + ":frozenHeader");
- var frozenColumnCount = frozenHeaderPartElement ? frozenHeaderPartElement.firstChild.rows[0].cells.length : 0;//TODO Richfaces.firstDescendant;
-
- var scrollElement = document.getElementById(id + ":footer");
-
- var resizeData = {};
- var idOfReorderingColumn = "";
- var newWidths = {};
-
- var timeoutId = null;
-
- var sendAjax = function(event, map) {
- for (key in options.parameters) {
- if(!map[key]) {
- map[key] = options.parameters[key];
- }
- }
- ajaxFunction(event, map);
- };
-
- var updateLayout = function() {
- normalPartStyle.width = "auto";
- var offsetWidth = frozenHeaderPartElement ? frozenHeaderPartElement.offsetWidth : 0;
- var width = Math.max(0, element.clientWidth - offsetWidth);
- if (width) {
- if (parts.width() > width) {
- normalPartStyle.width = width + "px";
- }
- normalPartStyle.display = "block";
- if (scrollElement.clientWidth < scrollElement.scrollWidth
- && scrollElement.scrollHeight == scrollElement.offsetHeight) {
- scrollElement.style.overflowX = "scroll";
- } else {
- scrollElement.style.overflowX = "";
- }
- var delta = scrollElement.firstChild.offsetHeight - scrollElement.clientHeight;
- if (delta) {
- scrollElement.style.height = scrollElement.offsetHeight + delta;
- }
- } else {
- normalPartStyle.display = "none";
- }
- var height = element.clientHeight;
- var el = element.firstChild;
- while (el) {
- if(el.nodeName && el.nodeName.toUpperCase() == "DIV" && el != bodyElement) {
- height -= el.offsetHeight;
- }
- el = el.nextSibling;
- }
- if (bodyElement.offsetHeight > height) {
- bodyElement.style.height = height + "px";
- }
- };
-
- var adjustResizers = function() {
- var scrollLeft = scrollElement ? scrollElement.scrollLeft : 0;
- var clientWidth = element.clientWidth - 3;
- var i = 0;
- for (; i < frozenColumnCount; i++) {
- if (clientWidth > 0) {
- resizerHolders[i].style.display = "none";
- resizerHolders[i].style.display = "";
- clientWidth -= resizerHolders[i].offsetWidth;
- }
- if (clientWidth <= 0) {
- resizerHolders[i].style.display = "none";
- }
- }
- scrollLeft -= 3;
- for (; i < resizerHolders.length; i++) {
- if (clientWidth > 0) {
- resizerHolders[i].style.display = "none";
- if (scrollLeft > 0) {
- resizerHolders[i].style.display = "";
- scrollLeft -= resizerHolders[i].offsetWidth;
- if (scrollLeft > 0) {
- resizerHolders[i].style.display = "none";
- } else {
- clientWidth += scrollLeft;
- }
- } else {
- resizerHolders[i].style.display = "";
- clientWidth -= resizerHolders[i].offsetWidth;
- }
- }
- if (clientWidth <= 0) {
- resizerHolders[i].style.display = "none";
- }
- }
- };
-
- var updateScrollPosition = function() {
- if (scrollElement) {
- var scrollLeft = scrollElement.scrollLeft;
- parts.each(function() {
- this.scrollLeft = scrollLeft;
- });
- }
- adjustResizers();
- };
-
- var initialize = function() {
- bodyElement = document.getElementById(id + ":b");
- bodyElement.tabIndex = -1; //TODO don't use tabIndex.
- var bodyJQuery = jQuery(bodyElement);
- contentElement = bodyJQuery.children("div:first")[0];
- if (contentElement) {
- spacerElement = contentElement.firstChild;//TODO this.marginElement = Richfaces.firstDescendant(this.contentElement);
- dataTableElement = contentElement.lastChild;//TODO this.dataTableElement = Richfaces.lastDescendant(this.contentElement);
- tbodies = jQuery(document.getElementById(id + ":tbf")).add(document.getElementById(id + ":tbn"));
- rows = tbodies[0].rows.length;
- rowHeight = dataTableElement.offsetHeight / rows;
- if (rowCount != rows) {
- contentElement.style.height = (rowCount * rowHeight) + "px";
- }
- bodyJQuery.bind("scroll", bodyScrollListener);
- if (options.selectionMode != "none") {
- tbodies.bind("click", selectionClickListener);
- bodyJQuery.bind(window.opera ? "keypress" : "keydown", selectionKeyDownListener);
- initializeSelection();
- }
- } else {
- spacerElement = null;
- dataTableElement = null;
- }
- parts = jQuery(element).find(".rf-edt-p");
- updateLayout();
- updateScrollPosition(); //TODO Restore horizontal scroll position
- };
-
- var drag = function(event) {
- jQuery(dragElement).setPosition({left:Math.max(resizeData.left + MIN_WIDTH, event.pageX)});
- return false;
- };
-
- var beginResize = function(event) {
- var id = this.parentNode.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1];
- resizeData = {
- id : id,
- left : jQuery(this).parent().offset().left
- };
- dragElement.style.height = element.offsetHeight + "px";
- jQuery(dragElement).setPosition({top:jQuery(element).offset().top, left:event.pageX});
- dragElement.style.display = "block";
- jQuery(document).bind("mousemove", drag);
- jQuery(document).one("mouseup", endResize);
- return false;
- };
-
- var setColumnWidth = function(id, width) {
- width = width + "px";
- richfaces.utils.getCSSRule("." + WIDTH_CLASS_NAME_BASE + id).style.width = width;
- newWidths[id] = width;
- var widthsArray = new Array();
- for (var id in newWidths) {
- widthsArray.push(id + ":" + newWidths[id]);
- }
- widthInput.value = widthsArray.toString();
- updateLayout();
- adjustResizers();
- sendAjax(); // TODO Maybe, event model should be used here.
- };
-
- var endResize = function(event) {
- jQuery(document).unbind("mousemove", drag);
- dragElement.style.display = "none";
- var width = Math.max(MIN_WIDTH, event.pageX - resizeData.left);
- setColumnWidth(resizeData.id, width);
- };
-
- var reorder = function(event) {
- jQuery(reorderElement).setPosition(event, {offset:[5,5]});
- reorderElement.style.display = "block";
- return false;
- };
-
- var beginReorder = function(event) {
- idOfReorderingColumn = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1];
- jQuery(document).bind("mousemove", reorder);
- header.find(".rf-edt-hc").bind("mouseover", overReorder);
- jQuery(document).one("mouseup", cancelReorder);
- return false;
- };
-
- var overReorder = function(event) {
- if (idOfReorderingColumn != this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1]) {
- var thisElement = jQuery(this);
- var offset = thisElement.offset();
- jQuery(reorderMarkerElement).setPosition({top:offset.top + thisElement.height(), left:offset.left - 5});
- reorderMarkerElement.style.display = "block";
- thisElement.one("mouseout", outReorder);
- thisElement.one("mouseup", endReorder);
- }
- };
-
- var outReorder = function(event) {
- reorderMarkerElement.style.display = "";
- jQuery(this).unbind("mouseup", endReorder);
- };
-
- var endReorder = function(event) {
- reorderMarkerElement.style.display = "";
- jQuery(this).unbind("mouseout", outReorder);
- var id = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1];
- var colunmsOrder = "";
- header.find(".rf-edt-hc").each(function() {
- var i = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1];
- if (i == id) {
- colunmsOrder += idOfReorderingColumn + "," + id + ",";
- } else if (i != idOfReorderingColumn) {
- colunmsOrder += i + ",";
- }
- });
- sendAjax(event, {"rich:columnsOrder" : colunmsOrder}); // TODO Maybe, event model should be used here.
- };
-
- var cancelReorder = function(event) {
- jQuery(document).unbind("mousemove", reorder);
- header.find(".rf-edt-hc").unbind("mouseover", overReorder);
- reorderElement.style.display = "none";
- };
-
- var loadData = function(event) {
- var clientFirst = Math.round((bodyElement.scrollTop + bodyElement.clientHeight / 2) / (rowHeight) - rows / 2);
- if (clientFirst <= 0) {
- clientFirst = 0;
- } else {
- clientFirst = Math.min(rowCount - rows, clientFirst);
- }
- sendAjax(event, {"rich:clientFirst" : clientFirst});// TODO Maybe, event model should be used here.
- }
-
- var bodyScrollListener = function(event) {
- if(timeoutId) {
- window.clearTimeout(timeoutId);
- timeoutId = null;
- }
- if (Math.max(this.scrollTop - rowHeight, 0) < spacerElement.offsetHeight
- || Math.min(this.scrollTop + rowHeight + this.clientHeight, this.scrollHeight) > spacerElement.offsetHeight + dataTableElement.offsetHeight) {
- timeoutId = window.setTimeout(function (event) {loadData(event)}, 1000);
- }
- };
-
- var showActiveRow = function() {
- if (bodyElement.scrollTop > activeIndex * rowHeight + spacerElement.offsetHeight) { //UP
- bodyElement.scrollTop = Math.max(bodyElement.scrollTop - rowHeight, 0);
- } else if (bodyElement.scrollTop + bodyElement.clientHeight
- < (activeIndex + 1) * rowHeight + spacerElement.offsetHeight) { //DOWN
- bodyElement.scrollTop = Math.min(bodyElement.scrollTop + rowHeight, bodyElement.scrollHeight - bodyElement.clientHeight);
- }
- }
-
- var selectRow = function(index) {
- ranges.add(index);
- for ( var i = 0; i < tbodies.length; i++) {
- jQuery(tbodies[i].rows[index]).addClass("rf-edt-r-s");
- }
- }
-
- var deselectRow = function (index) {
- ranges.remove(index);
- for ( var i = 0; i < tbodies.length; i++) {
- jQuery(tbodies[i].rows[index]).removeClass("rf-edt-r-s");
- }
- }
-
- var setActiveRow = function (index) {
- if(typeof activeIndex == "number") {
- for ( var i = 0; i < tbodies.length; i++) {
- jQuery(tbodies[i].rows[activeIndex]).removeClass("rf-edt-r-a");
- }
-
- }
- activeIndex = index;
- for ( var i = 0; i < tbodies.length; i++) {
- jQuery(tbodies[i].rows[activeIndex]).addClass("rf-edt-r-a");
- }
- }
-
- var resetShiftRow = function () {
- if(typeof shiftIndex == "number") {
- for ( var i = 0; i < tbodies.length; i++) {
- jQuery(tbodies[i].rows[shiftIndex]).removeClass("rf-edt-r-t");
- }
-
- }
- shiftIndex = null;
- }
-
- var setShiftRow = function (index) {
- resetShiftRow();
- shiftIndex = index;
- if(typeof index == "number") {
- for ( var i = 0; i < tbodies.length; i++) {
- jQuery(tbodies[i].rows[shiftIndex]).addClass("rf-edt-r-t");
- }
- }
- }
-
- var initializeSelection = function() {
- ranges.clear();
- var strings = selectionInput.value.split("|");
- activeIndex = strings[1] || null;
- shiftIndex = strings[2] || null;
- selectionFlag = null;
- var rows = tbodies[0].rows;
- for (var i = 0; i < rows.length; i++) {
- var row = jQuery(rows[i]);
- if (row.hasClass("rf-edt-r-s")) {
- ranges.add(row[0].rowIndex)
- }
- if (row.hasClass("rf-edt-r-a")) {
- activeIndex = row[0].rowIndex;
- }
- if (row.hasClass("rf-edt-r-t")) {
- shiftIndex = row[0].rowIndex;
- }
- }
- writeSelection();
- }
-
- var writeSelection = function() {
- selectionInput.value = [ranges, activeIndex, shiftIndex, selectionFlag].join("|");
- }
-
- var selectRows = function(range) {
- if (typeof range == "number") {
- range = [range, range];
- }
- var changed;
- var i = 0;
- for (; i < range[0]; i++) {
- if (ranges.contains(i)) {
- deselectRow(i);
- changed = true;
- }
- }
- for (; i <= range[1]; i++) {
- if (!ranges.contains(i)) {
- selectRow(i);
- changed = true;
- }
- }
- for (; i < rows; i++) {
- if (ranges.contains(i)) {
- deselectRow(i);
- changed = true;
- }
- }
- selectionFlag = typeof shiftIndex == "string" ? shiftIndex : "x";
- return changed;
- }
-
- var processSlectionWithShiftKey = function(index) {
- if(shiftIndex == null) {
- setShiftRow(activeIndex != null ? activeIndex : index);
- }
- var range;
- if ("u" == shiftIndex) {
- range = [0, index];
- } else if ("d" == shiftIndex) {
- range = [index, rows - 1];
- } else if (index >= shiftIndex) {
- range = [shiftIndex, index];
- } else {
- range = [index, shiftIndex];
- }
- return selectRows(range);
- }
-
- var onbeforeselectionchange = function (event) {
- return !options.onbeforeselectionchange || options.onbeforeselectionchange.call(element, event) !== false;
- }
-
- var onselectionchange = function (event, index, changed) {
- if(!event.shiftKey) {
- resetShiftRow();
- }
- if (activeIndex != index) {
- setActiveRow(index);
- showActiveRow();
- }
- if (changed) {
- writeSelection();
- if (options.onselectionchange) {
- options.onselectionchange.call(element, event);
- }
- }
- }
-
- var selectionClickListener = function (event) {
- if (!onbeforeselectionchange(event)) {
- return;
- }
- var changed;
- if (event.shiftKey || event.ctrlKey) {
- if (window.getSelection) { //TODO Try to find other way.
- window.getSelection().removeAllRanges();
- } else if (document.selection) {
- document.selection.empty();
- }
- }
- var tr = event.target;
- while (tbodies.index(tr.parentNode) == -1) {
- tr = tr.parentNode;
- }
- var index = tr.rowIndex;
- if (options.selectionMode == "single" || (options.selectionMode != "multipleKeyboardFree"
- && !event.shiftKey && !event.ctrlKey)) {
- changed = selectRows(index);
- } else if (options.selectionMode == "multipleKeyboardFree" || (!event.shiftKey && event.ctrlKey)) {
- if (ranges.contains(index)) {
- deselectRow(index);
- } else {
- selectRow(index);
- }
- changed = true;
- } else {
- changed = processSlectionWithShiftKey(index);
- }
- onselectionchange(event, index, changed);
- }
-
- var selectionKeyDownListener = function(event) {
- if (event.ctrlKey && options.selectionMode != "single" && (event.keyCode == 65 || event.keyCode == 97) //Ctrl-A
- && onbeforeselectionchange(event)) {
- selectRows([0, rows]);
- selectionFlag = "a";
- onselectionchange(event, activeIndex, true); //TODO Is there a way to know that selection haven't changed?
- event.preventDefault();
- } else {
- var index;
- if (event.keyCode == 38) { //UP
- index = -1;
- } else if (event.keyCode == 40) { //DOWN
- index = 1;
- }
- if (index != null && onbeforeselectionchange(event)) {
- if (typeof activeIndex == "number") {
- index += activeIndex;
- if (index >= 0 && index < rows ) {
- var changed;
- if (options.selectionMode == "single" || (!event.shiftKey && !event.ctrlKey)) {
- changed = selectRows(index);
- } else if (event.shiftKey) {
- changed = processSlectionWithShiftKey(index);
- }
- onselectionchange(event, index, changed);
- }
- }
- event.preventDefault();
- }
- }
- }
-
- var ajaxComplete = function (event, data) {
- if (data.reinitializeHeader) {
- bindHeaderHandlers();
- } else {
- selectionInput = document.getElementById(id + ":si");
- if (data.reinitializeBody) {
- rowCount = data.rowCount;
- initialize();
- } else if (options.selectionMode != "none") {
- initializeSelection();
- }
- if (spacerElement) {
- spacerElement.style.height = (data.first * rowHeight) + "px";
- }
- }
- };
-
- jQuery(document).ready(initialize);
- jQuery(window).bind("resize", updateLayout);
- jQuery(scrollElement).bind("scroll", updateScrollPosition);
- var bindHeaderHandlers = function () {
- header.find(".rf-edt-rs").bind("mousedown", beginResize);
- header.find(".rf-edt-hc").bind("mousedown", beginReorder);
- }
- bindHeaderHandlers();
- jQuery(element).bind("rich:onajaxcomplete", ajaxComplete);
-
- //JS API
- element["richfaces"] = element["richfaces"] || {}; // TODO ExtendedDataTable should extend richfaces.BaseComponent instead of using it.
- element.richfaces.component = this;
-
- this.getColumnPosition = function(id) {
- var position;
- var headers = header.find(".rf-edt-hc");
- for (var i = 0; i < headers.length; i++) {
- if (id == headers[i].className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1]) {
- position = i;
- }
- }
- return position;
- }
-
- this.setColumnPosition = function(id, position) {
- var colunmsOrder = "";
- var before;
- var headers = header.find(".rf-edt-hc");
- for (var i = 0; i < headers.length; i++) {
- var current = headers[i].className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1];
- if (i == position) {
- if (before) {
- colunmsOrder += current + "," + id + ",";
- } else {
- colunmsOrder += id + "," + current + ",";
- }
- } else {
- if (id != current) {
- colunmsOrder += current + ",";
- } else {
- before = true;
- }
- }
- }
- sendAjax(null, {"rich:columnsOrder" : colunmsOrder}); // TODO Maybe, event model should be used here.
- }
-
- this.setColumnWidth = function(id, width) {
- setColumnWidth(id, width);
- }
-
- this.filter = function(colunmId, filterValue, isClear) {
- if (typeof(filterValue) == "undefined" || filterValue == null) {
- filterValue = "";
- }
- var map = {}
- map[id + "rich:filtering"] = colunmId + ":" + filterValue + ":" + isClear;
- sendAjax(null, map); // TODO Maybe, event model should be used here.
- }
-
- this.clearFiltering = function() {
- this.filter("", "", true);
- }
-
- this.sort = function(colunmId, sortOrder, isClear) {
- if (typeof(sortOrder) == "string") {
- sortOrder = sortOrder.toUpperCase();
- }
- var map = {}
- map[id + "rich:sorting"] = colunmId + ":" + sortOrder + ":" + isClear;
- sendAjax(null, map); // TODO Maybe, event model should be used here.
- }
-
- this.clearSorting = function() {
- this.filter("", "", true);
- }
- };
-}(window.RichFaces, jQuery));
-
Added: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datagrid.ecss
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datagrid.ecss (rev 0)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datagrid.ecss 2010-08-13 11:33:47 UTC (rev 18612)
@@ -0,0 +1,100 @@
+.rf-dg{
+ background-color:'#{richSkin.tableBackgroundColor}';
+ border-collapse:collapse;
+ border-left-width:'#{richSkin.tableBorderWidth}';
+ border-left-style:solid;
+ border-left-color:'#{richSkin.tableBorderColor}';
+ border-top-width:'#{richSkin.tableBorderWidth}';
+ border-top-style:solid;
+ border-top-color:'#{richSkin.tableBorderColor}';
+ empty-cells:show;
+}
+
+.rf-dg-nd-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ padding:4px;
+}
+
+
+.rf-dg-cap{
+}
+
+.rf-dg-r{
+}
+
+.rf-dg-f-r{
+}
+
+.rf-dg-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ padding:4px;
+}
+
+.rf-dg-h{
+}
+
+.rf-dg-h-f{
+}
+
+.rf-dg-h-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ background-color : '#{richSkin.tableHeaderBackgroundColor}';
+ background-image : "url(#{resource['org.richfaces.renderkit.html.images.ColumnHeaderGradientImage']})";
+ background-position: top left;
+ color:'#{richSkin.tableHeaderTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-weight:bold;
+ padding:4px;
+ text-align:center;
+}
+
+.rf-dg-th{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+}
+
+.rf-dg-f {
+
+}
+
+.rf-dg-f-f{
+}
+
+.rf-dg-f-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ color:'#{richSkin.generalTextColor}';
+ background-color:'#{richSkin.tableFooterBackgroundColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-weight:bold;
+ padding:4px;
+ text-align:center;
+}
\ No newline at end of file
Added: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.ecss
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.ecss (rev 0)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.ecss 2010-08-13 11:33:47 UTC (rev 18612)
@@ -0,0 +1,271 @@
+.rf-dt{
+ background-color:'#{richSkin.tableBackgroundColor}';
+ border-collapse:collapse;
+ border-left-width:'#{richSkin.tableBorderWidth}';
+ border-left-style:solid;
+ border-left-color:'#{richSkin.tableBorderColor}';
+ border-top-width:'#{richSkin.tableBorderWidth}';
+ border-top-style:solid;
+ border-top-color:'#{richSkin.tableBorderColor}';
+ empty-cells:show;
+}
+
+.rf-dt-cap{
+}
+
+.rf-dt-r{
+}
+
+.rf-dt-f-r{
+}
+
+.rf-dt-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ padding:4px;
+}
+
+.rf-dt-nd-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ padding:4px;
+}
+
+.rf-dt-h{
+}
+
+.rf-dt-h-f{
+}
+
+.rf-dt-h-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ background-color : '#{richSkin.tableHeaderBackgroundColor}';
+ background-image : "url(#{resource['org.richfaces.renderkit.html.images.ColumnHeaderGradientImage']})";
+ background-position: top left;
+ color:'#{richSkin.tableHeaderTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-weight:bold;
+ padding:4px;
+ text-align:center;
+}
+
+.rf-dt-sh {
+}
+
+.rf-dt-sh-f {
+}
+
+.rf-dt-sh-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ background-color : '#{richSkin.tableHeaderBackgroundColor}';
+ background-image : "url(#{resource['org.richfaces.renderkit.html.images.ColumnHeaderGradientImage']})";
+ background-position: top left;
+ color:'#{richSkin.tableHeaderTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-weight:bold;
+ padding:4px;
+ text-align:center;
+}
+
+.rf-dt-sf{
+}
+
+.rf-dt-sf-f{
+}
+
+.rf-dt-sf-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ background-color:'#{richSkin.tableSubfooterBackgroundColor}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-weight:bold;
+ padding:4px;
+ text-align:center;
+
+
+}
+
+.rf-dt-th{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+}
+
+.rf-dt-f {
+
+}
+
+.rf-dt-f-f{
+}
+
+.rf-dt-f-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ color:'#{richSkin.generalTextColor}';
+ background-color:'#{richSkin.tableFooterBackgroundColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-weight:bold;
+ padding:4px;
+ text-align:center;
+}
+
+.rf-st{
+}
+
+.rf-st-r{
+}
+
+.rf-st-f-r{
+}
+
+.rf-st-h-r{
+}
+
+.rf-st-h-f-r{
+}
+
+.rf-st-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ color:'#{richSkin.generalTextColor}';
+ background-color:'#{richSkin.tableBackgroundColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ padding:4px;
+}
+
+.rf-st-h-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ color:'#{richSkin.generalTextColor}';
+ background-color:'#{richSkin.tableSubHeaderBackgroundColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-weight:bold;
+ padding:4px;
+ text-align:left;
+}
+
+.rf-st-sh-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ background-color:'#{richSkin.tableSubHeaderBackgroundColor}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ font-weight:bold;
+ padding:4px;
+}
+
+.rf-st-sh{
+}
+
+.rf-st-f {
+}
+
+.rf-st-f-c{
+ border-bottom-width:3px;
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ background-color:'#{richSkin.tableSubfooterBackgroundColor}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size: '#{richSkin.generalSizeFont}';
+ font-weight:bold;
+ padding:4px;
+ text-align:left;
+}
+
+.rf-st-sf-c{
+ border-bottom-width:'#{richSkin.tableBorderWidth}';
+ border-bottom-style:solid;
+ border-bottom-color:'#{richSkin.tableBorderColor}';
+ border-right-width:'#{richSkin.tableBorderWidth}';
+ border-right-style:solid;
+ border-right-color:'#{richSkin.tableBorderColor}';
+ background-color:'#{richSkin.tableSubfooterBackgroundColor}';
+ color:'#{richSkin.generalTextColor}';
+ font-family:'#{richSkin.generalFamilyFont}';
+ font-size:'#{richSkin.generalSizeFont}';
+ padding:4px;
+}
+
+.rf-st-sf{
+}
+
+.rf-st-sf-f{
+}
+
+.rf-st-sh-f{
+}
+
+.rf-st-f-f{
+}
+
+.rf-st-h-f{
+}
+
+.rf-st-h{
+}
+
+
+/*should be generated in M1*/
+.rf-stt-exp{
+ background-image: url("#{resource['org.richfaces:up_icon.gif']}");
+}
+
+.rf-stt-col{
+ background-image: url("#{resource['org.richfaces:down_icon.gif']}");
+}
Added: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js (rev 0)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/datatable.js 2010-08-13 11:33:47 UTC (rev 18612)
@@ -0,0 +1,105 @@
+(function ($, richfaces) {
+
+ richfaces.ui = richfaces.ui || {};
+
+ richfaces.ui.DataTable = function(id, options) {
+ this.id = id;
+ this.options = options;
+ $super.constructor.call(this,id);
+ this.attachToDom(id);
+
+ };
+
+ var $super = richfaces.BaseComponent.extend(richfaces.ui.DataTable);
+ var $p = richfaces.BaseComponent.extend(richfaces.ui.DataTable, {});
+ var $super = richfaces.ui.DataTable.$super;
+
+ $.extend(richfaces.ui.DataTable, {
+ SORTING: "rich:sorting",
+ FILTERING: "rich:filtering",
+ SUBTABLE_SELECTOR:".rich-subtable"
+ });
+
+ $.extend(richfaces.ui.DataTable.prototype, ( function () {
+
+ var invoke = function(event, attributes) {
+ richfaces.ajax(this.id, event, {"parameters" : attributes});
+ };
+
+ var createParameters = function(type, id, arg1, arg2) {
+ var parameters = {};
+ var key = this.id + type;
+ parameters[key] = ((id || "") + ":" + (arg1 || "") + ":" + (arg2 || true));
+
+ var eventOptions = this.options.ajaxEventOption;
+ for (key in eventOptions) {
+ if(!parameters[key]) {
+ parameters[key] = eventOptions[key];
+ }
+ }
+ return parameters;
+ };
+
+
+ return {
+
+ name : "RichFaces.ui.DataTable",
+
+ sort: function(columnId, direction, isClear) {
+ invoke.call(this,null,createParameters.call(this,richfaces.ui.DataTable.SORTING, columnId, direction, isClear));
+ },
+
+ filter: function(columnId, filterValue, isClear) {
+ invoke.call(this,null,createParameters.call(this,richfaces.ui.DataTable.FILTERING, columnId, filterValue, isClear));
+ },
+
+ expandAllSubTables: function() {
+ this.invokeOnSubTables('expand');
+ },
+
+ collapseAllSubTables: function() {
+ this.invokeOnSubTables('collapse');
+ },
+
+ switchSubTable: function(id) {
+ this.getSubTable(id).toggle();
+ },
+
+ getSubTable: function(id) {
+ return richfaces.$(id);
+ },
+
+ invokeOnSubTables: function(funcName) {
+ var elements = $(document.getElementById(this.id)).children(richfaces.ui.DataTable.SUBTABLE_SELECTOR);
+ var invokeOnComponent = this.invokeOnComponent;
+ elements.each(
+ function(){
+ if(this.richfaces && this.richfaces.component) {
+ var component = this.richfaces.component;
+ if(component instanceof RichFaces.ui.SubTable) {
+ invokeOnComponent(component, funcName);
+ }
+ }
+ }
+ );
+ },
+
+ invokeOnSubTable: function(id, funcName) {
+ var subtable = this.getSubTable(id);
+ this.invokeOnComponent(subtable, funcName);
+ },
+
+ invokeOnComponent: function(component, funcName) {
+ if(component) {
+ var func = component[funcName];
+ if(typeof func == 'function') {
+ func.call(component);
+ }
+ }
+ }
+ }
+
+ })());
+
+})(jQuery, window.RichFaces);
+
Added: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/down_icon.gif
===================================================================
(Binary files differ)
Property changes on: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/down_icon.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.ecss
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.ecss (rev 0)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.ecss 2010-08-13 11:33:47 UTC (rev 18612)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+.rf-edt {
+ overflow: hidden;
+ background-color: '#{richSkin.tableBackgroundColor}';
+ border: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
+}
+
+.rf-edt-h, .rf-edt-th {
+ background-image : "url(#{resource['org.richfaces.renderkit.html.images.ColumnHeaderGradientImage']})";
+}
+
+.rf-edt-th {
+ border-bottom: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
+}
+
+.rf-edt-b {
+ overflow-x: hidden;
+ overflow-y: auto;
+ width: 100%;
+}
+
+.rf-edt-s {
+ height: 0px;
+ font-size: 0px; /*for IE7 only*/
+}
+
+.rf-edt-f, .rf-edt-tf {
+ border-top: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
+ background-color: '#{richSkin.tableFooterBackgroundColor}';
+}
+
+.rf-edt-fa {
+ vertical-align: top;
+}
+
+.rf-edt-p {
+ overflow: hidden;
+}
+
+.rf-edt-fp {
+ overflow-x: auto;
+ overflow-y: visible;
+}
+
+.rf-edt-rsh {
+ left : 0px;
+ position: relative;
+ height: 0px;
+}
+
+.rf-edt-rs {
+ background-image: url("#{resource['spacer.gif']}");
+ cursor: e-resize;
+ height: 20px; /*TODO*/
+ position: absolute;
+ left: 100%;
+ margin-left: -3px;
+ width: 6px;
+}
+
+.rf-edt-d {
+ cursor: e-resize;
+ position: absolute;
+ border-left: '1px dotted #{richSkin.generalTextColor}';
+ /*background-color: #848089;*/
+ width: 1px;
+ display: none;
+}
+
+.rf-edt-ro {
+ position: absolute;
+ border-collapse: collapse;
+ display: none;
+}
+
+.rf-edt-ro th {
+ width: 20px;
+ height: 5px;
+ font-size: 1px;
+ background-color: '#{richSkin.tableHeaderBackgroundColor}';
+ border: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
+}
+
+.rf-edt-ro td {
+ width: 20px;
+ height: 5px;
+ font-size: 1px;
+ background-color: '#{richSkin.tableBackgroundColor}';
+ border: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
+}
+
+.rf-edt-c, .rf-edt-hc, .rf-edt-fc {
+ height: 20px;
+ overflow: hidden;
+ border-bottom: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
+ border-right: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
+}
+
+.rf-edt-efc {
+ border-right: '#{richSkin.tableBorderWidth} solid #{richSkin.tableBorderColor}';
+ height: 1px;
+}
+
+.rf-edt-cc, .rf-edt-hcc, .rf-edt-fcc, .rf-edt-th, .rf-edt-tf {
+ padding: 3px 7px;
+ white-space: nowrap;
+ font-family: '#{richSkin.generalFamilyFont}';
+ font-size: '#{richSkin.generalSizeFont}';
+}
+
+.rf-edt-hcc, .rf-edt-th, .rf-edt-fcc, .rf-edt-tf {
+ font-weight: bold;
+ text-align: center;
+}
+
+.rf-edt-hcc, .rf-edt-th {
+ color: '#{richSkin.tableHeaderTextColor}';
+}
+
+.rf-edt-cc, .rf-edt-fcc, .rf-edt-tf {
+ color: '#{richSkin.generalTextColor}';
+}
+
+.rf-edt-rom {
+ position: absolute;
+ height: 9px;
+ font-size: 9px;
+ width: 9px;
+ background-image: url("#{resource['reorderMarker.gif']}");
+ display: none;
+}
+
+.rf-edt-r-s {
+ background-color: '#{richSkin.additionalBackgroundColor}'; /*TODO Probably use other skin property.*/
+}
+
+.rf-edt-r-a {
+ font-weight: bold; /*TODO Probably use other property.*/
+}
\ No newline at end of file
Added: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.js
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.js (rev 0)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/extendedDataTable.js 2010-08-13 11:33:47 UTC (rev 18612)
@@ -0,0 +1,694 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+(function(richfaces, jQuery) {
+ richfaces.utils = richfaces.utils || {};
+
+ richfaces.utils.getCSSRule = function (className) {
+ var rule = null;
+ var sheets = document.styleSheets;
+ for (var j = 0; !rule && j < sheets.length; j++) {
+ var rules = sheets[j].cssRules ? sheets[j].cssRules : sheets[j].rules;
+ for (var i = 0; !rule && i < rules.length; i++) {
+ if (rules[i].selectorText && rules[i].selectorText.toLowerCase() == className.toLowerCase()) {
+ rule = rules[i];
+ }
+ }
+ }
+ return rule;
+ };
+
+ richfaces.utils.Ranges = function() {
+ this.ranges = [];
+ };
+
+ richfaces.utils.Ranges.prototype = {
+
+ add: function(index) {
+ var i = 0;
+ while(i < this.ranges.length && index >= this.ranges[i++][1]);
+ i--;
+ if(this.ranges[i-1] && index==(this.ranges[i-1][1]+1) ) {
+ if(index==(this.ranges[i][0]-1)) {
+ this.ranges[i-1][1] = this.ranges[i][1];
+ this.ranges.splice(i, 1);
+ } else {
+ this.ranges[i-1][1]++;
+ }
+ } else {
+ if(this.ranges[i]){
+ if(this.ranges[i] && index==(this.ranges[i][0]-1)) {
+ this.ranges[i][0]--;
+ } else {
+ if(index==(this.ranges[i][1]+1)){
+ this.ranges[i][1]++;
+ } else {
+ if(index<this.ranges[i][1]){
+ this.ranges.splice(i, 0, [index, index]);
+ } else {
+ this.ranges.splice(i + 1, 0, [index, index]);
+ }
+ }
+ }
+ } else {
+ this.ranges.splice(i, 0, [index, index]);
+ }
+ }
+ },
+
+ remove: function(index) {
+ var i = 0;
+ while(i < this.ranges.length && index > this.ranges[i++][1]);
+ i--;
+ if(this.ranges[i]) {
+ if(index==(this.ranges[i][1]) ) {
+ if(index==(this.ranges[i][0])){
+ this.ranges.splice(i, 1);
+ } else {
+ this.ranges[i][1]--;
+ }
+ } else {
+ if(index==(this.ranges[i][0])){
+ this.ranges[i][0]++;
+ } else {
+ this.ranges.splice(i+1, 0, [index+1, this.ranges[i][1]]);
+ this.ranges[i][1] = index-1;
+ }
+ }
+ }
+ },
+
+ clear: function() {
+ this.ranges = [];
+ },
+
+ contains: function(index) {
+ var i = 0;
+ while(i < this.ranges.length && index >= this.ranges[i][0]) {
+ if(index >= this.ranges[i][0] && index <= this.ranges[i][1]) {
+ return true;
+ } else {
+ i++;
+ }
+ }
+ return false;
+ },
+
+ toString: function() {
+ var ret = new Array(this.ranges.length);
+ for (var i = 0; i < this.ranges.length; i++) {
+ ret[i] = this.ranges[i].join();
+ }
+ return ret.join(";");
+ }
+ };
+
+ richfaces.ExtendedDataTable = function(id, rowCount, ajaxFunction, options) {
+ var WIDTH_CLASS_NAME_BASE = "rf-edt-cw-";
+ var MIN_WIDTH = 20;
+
+ options = options || {};
+ var ranges = new richfaces.utils.Ranges();
+ var element = document.getElementById(id);
+ var bodyElement, contentElement, spacerElement, dataTableElement, rows, rowHeight, parts, tbodies, shiftIndex,
+ activeIndex, selectionFlag;
+ var dragElement = document.getElementById(id + ":d");
+ var reorderElement = document.getElementById(id + ":r");
+ var reorderMarkerElement = document.getElementById(id + ":rm");
+ var widthInput = document.getElementById(id + ":wi");
+ var selectionInput = document.getElementById(id + ":si");
+ var normalPartStyle = richfaces.utils.getCSSRule(".rf-edt-pw").style;
+ var header = jQuery(element).children(".rf-edt-h");
+ var resizerHolders = header.find(".rf-edt-rsh");
+
+ var frozenHeaderPartElement = document.getElementById(id + ":frozenHeader");
+ var frozenColumnCount = frozenHeaderPartElement ? frozenHeaderPartElement.firstChild.rows[0].cells.length : 0;//TODO Richfaces.firstDescendant;
+
+ var scrollElement = document.getElementById(id + ":footer");
+
+ var resizeData = {};
+ var idOfReorderingColumn = "";
+ var newWidths = {};
+
+ var timeoutId = null;
+
+ var sendAjax = function(event, map) {
+ for (key in options.parameters) {
+ if(!map[key]) {
+ map[key] = options.parameters[key];
+ }
+ }
+ ajaxFunction(event, map);
+ };
+
+ var updateLayout = function() {
+ normalPartStyle.width = "auto";
+ var offsetWidth = frozenHeaderPartElement ? frozenHeaderPartElement.offsetWidth : 0;
+ var width = Math.max(0, element.clientWidth - offsetWidth);
+ if (width) {
+ if (parts.width() > width) {
+ normalPartStyle.width = width + "px";
+ }
+ normalPartStyle.display = "block";
+ if (scrollElement.clientWidth < scrollElement.scrollWidth
+ && scrollElement.scrollHeight == scrollElement.offsetHeight) {
+ scrollElement.style.overflowX = "scroll";
+ } else {
+ scrollElement.style.overflowX = "";
+ }
+ var delta = scrollElement.firstChild.offsetHeight - scrollElement.clientHeight;
+ if (delta) {
+ scrollElement.style.height = scrollElement.offsetHeight + delta;
+ }
+ } else {
+ normalPartStyle.display = "none";
+ }
+ var height = element.clientHeight;
+ var el = element.firstChild;
+ while (el) {
+ if(el.nodeName && el.nodeName.toUpperCase() == "DIV" && el != bodyElement) {
+ height -= el.offsetHeight;
+ }
+ el = el.nextSibling;
+ }
+ if (bodyElement.offsetHeight > height) {
+ bodyElement.style.height = height + "px";
+ }
+ };
+
+ var adjustResizers = function() {
+ var scrollLeft = scrollElement ? scrollElement.scrollLeft : 0;
+ var clientWidth = element.clientWidth - 3;
+ var i = 0;
+ for (; i < frozenColumnCount; i++) {
+ if (clientWidth > 0) {
+ resizerHolders[i].style.display = "none";
+ resizerHolders[i].style.display = "";
+ clientWidth -= resizerHolders[i].offsetWidth;
+ }
+ if (clientWidth <= 0) {
+ resizerHolders[i].style.display = "none";
+ }
+ }
+ scrollLeft -= 3;
+ for (; i < resizerHolders.length; i++) {
+ if (clientWidth > 0) {
+ resizerHolders[i].style.display = "none";
+ if (scrollLeft > 0) {
+ resizerHolders[i].style.display = "";
+ scrollLeft -= resizerHolders[i].offsetWidth;
+ if (scrollLeft > 0) {
+ resizerHolders[i].style.display = "none";
+ } else {
+ clientWidth += scrollLeft;
+ }
+ } else {
+ resizerHolders[i].style.display = "";
+ clientWidth -= resizerHolders[i].offsetWidth;
+ }
+ }
+ if (clientWidth <= 0) {
+ resizerHolders[i].style.display = "none";
+ }
+ }
+ };
+
+ var updateScrollPosition = function() {
+ if (scrollElement) {
+ var scrollLeft = scrollElement.scrollLeft;
+ parts.each(function() {
+ this.scrollLeft = scrollLeft;
+ });
+ }
+ adjustResizers();
+ };
+
+ var initialize = function() {
+ bodyElement = document.getElementById(id + ":b");
+ bodyElement.tabIndex = -1; //TODO don't use tabIndex.
+ var bodyJQuery = jQuery(bodyElement);
+ contentElement = bodyJQuery.children("div:first")[0];
+ if (contentElement) {
+ spacerElement = contentElement.firstChild;//TODO this.marginElement = Richfaces.firstDescendant(this.contentElement);
+ dataTableElement = contentElement.lastChild;//TODO this.dataTableElement = Richfaces.lastDescendant(this.contentElement);
+ tbodies = jQuery(document.getElementById(id + ":tbf")).add(document.getElementById(id + ":tbn"));
+ rows = tbodies[0].rows.length;
+ rowHeight = dataTableElement.offsetHeight / rows;
+ if (rowCount != rows) {
+ contentElement.style.height = (rowCount * rowHeight) + "px";
+ }
+ bodyJQuery.bind("scroll", bodyScrollListener);
+ if (options.selectionMode != "none") {
+ tbodies.bind("click", selectionClickListener);
+ bodyJQuery.bind(window.opera ? "keypress" : "keydown", selectionKeyDownListener);
+ initializeSelection();
+ }
+ } else {
+ spacerElement = null;
+ dataTableElement = null;
+ }
+ parts = jQuery(element).find(".rf-edt-p");
+ updateLayout();
+ updateScrollPosition(); //TODO Restore horizontal scroll position
+ };
+
+ var drag = function(event) {
+ jQuery(dragElement).setPosition({left:Math.max(resizeData.left + MIN_WIDTH, event.pageX)});
+ return false;
+ };
+
+ var beginResize = function(event) {
+ var id = this.parentNode.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1];
+ resizeData = {
+ id : id,
+ left : jQuery(this).parent().offset().left
+ };
+ dragElement.style.height = element.offsetHeight + "px";
+ jQuery(dragElement).setPosition({top:jQuery(element).offset().top, left:event.pageX});
+ dragElement.style.display = "block";
+ jQuery(document).bind("mousemove", drag);
+ jQuery(document).one("mouseup", endResize);
+ return false;
+ };
+
+ var setColumnWidth = function(id, width) {
+ width = width + "px";
+ richfaces.utils.getCSSRule("." + WIDTH_CLASS_NAME_BASE + id).style.width = width;
+ newWidths[id] = width;
+ var widthsArray = new Array();
+ for (var id in newWidths) {
+ widthsArray.push(id + ":" + newWidths[id]);
+ }
+ widthInput.value = widthsArray.toString();
+ updateLayout();
+ adjustResizers();
+ sendAjax(); // TODO Maybe, event model should be used here.
+ };
+
+ var endResize = function(event) {
+ jQuery(document).unbind("mousemove", drag);
+ dragElement.style.display = "none";
+ var width = Math.max(MIN_WIDTH, event.pageX - resizeData.left);
+ setColumnWidth(resizeData.id, width);
+ };
+
+ var reorder = function(event) {
+ jQuery(reorderElement).setPosition(event, {offset:[5,5]});
+ reorderElement.style.display = "block";
+ return false;
+ };
+
+ var beginReorder = function(event) {
+ idOfReorderingColumn = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1];
+ jQuery(document).bind("mousemove", reorder);
+ header.find(".rf-edt-hc").bind("mouseover", overReorder);
+ jQuery(document).one("mouseup", cancelReorder);
+ return false;
+ };
+
+ var overReorder = function(event) {
+ if (idOfReorderingColumn != this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1]) {
+ var thisElement = jQuery(this);
+ var offset = thisElement.offset();
+ jQuery(reorderMarkerElement).setPosition({top:offset.top + thisElement.height(), left:offset.left - 5});
+ reorderMarkerElement.style.display = "block";
+ thisElement.one("mouseout", outReorder);
+ thisElement.one("mouseup", endReorder);
+ }
+ };
+
+ var outReorder = function(event) {
+ reorderMarkerElement.style.display = "";
+ jQuery(this).unbind("mouseup", endReorder);
+ };
+
+ var endReorder = function(event) {
+ reorderMarkerElement.style.display = "";
+ jQuery(this).unbind("mouseout", outReorder);
+ var id = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1];
+ var colunmsOrder = "";
+ header.find(".rf-edt-hc").each(function() {
+ var i = this.className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1];
+ if (i == id) {
+ colunmsOrder += idOfReorderingColumn + "," + id + ",";
+ } else if (i != idOfReorderingColumn) {
+ colunmsOrder += i + ",";
+ }
+ });
+ sendAjax(event, {"rich:columnsOrder" : colunmsOrder}); // TODO Maybe, event model should be used here.
+ };
+
+ var cancelReorder = function(event) {
+ jQuery(document).unbind("mousemove", reorder);
+ header.find(".rf-edt-hc").unbind("mouseover", overReorder);
+ reorderElement.style.display = "none";
+ };
+
+ var loadData = function(event) {
+ var clientFirst = Math.round((bodyElement.scrollTop + bodyElement.clientHeight / 2) / (rowHeight) - rows / 2);
+ if (clientFirst <= 0) {
+ clientFirst = 0;
+ } else {
+ clientFirst = Math.min(rowCount - rows, clientFirst);
+ }
+ sendAjax(event, {"rich:clientFirst" : clientFirst});// TODO Maybe, event model should be used here.
+ }
+
+ var bodyScrollListener = function(event) {
+ if(timeoutId) {
+ window.clearTimeout(timeoutId);
+ timeoutId = null;
+ }
+ if (Math.max(this.scrollTop - rowHeight, 0) < spacerElement.offsetHeight
+ || Math.min(this.scrollTop + rowHeight + this.clientHeight, this.scrollHeight) > spacerElement.offsetHeight + dataTableElement.offsetHeight) {
+ timeoutId = window.setTimeout(function (event) {loadData(event)}, 1000);
+ }
+ };
+
+ var showActiveRow = function() {
+ if (bodyElement.scrollTop > activeIndex * rowHeight + spacerElement.offsetHeight) { //UP
+ bodyElement.scrollTop = Math.max(bodyElement.scrollTop - rowHeight, 0);
+ } else if (bodyElement.scrollTop + bodyElement.clientHeight
+ < (activeIndex + 1) * rowHeight + spacerElement.offsetHeight) { //DOWN
+ bodyElement.scrollTop = Math.min(bodyElement.scrollTop + rowHeight, bodyElement.scrollHeight - bodyElement.clientHeight);
+ }
+ }
+
+ var selectRow = function(index) {
+ ranges.add(index);
+ for ( var i = 0; i < tbodies.length; i++) {
+ jQuery(tbodies[i].rows[index]).addClass("rf-edt-r-s");
+ }
+ }
+
+ var deselectRow = function (index) {
+ ranges.remove(index);
+ for ( var i = 0; i < tbodies.length; i++) {
+ jQuery(tbodies[i].rows[index]).removeClass("rf-edt-r-s");
+ }
+ }
+
+ var setActiveRow = function (index) {
+ if(typeof activeIndex == "number") {
+ for ( var i = 0; i < tbodies.length; i++) {
+ jQuery(tbodies[i].rows[activeIndex]).removeClass("rf-edt-r-a");
+ }
+
+ }
+ activeIndex = index;
+ for ( var i = 0; i < tbodies.length; i++) {
+ jQuery(tbodies[i].rows[activeIndex]).addClass("rf-edt-r-a");
+ }
+ }
+
+ var resetShiftRow = function () {
+ if(typeof shiftIndex == "number") {
+ for ( var i = 0; i < tbodies.length; i++) {
+ jQuery(tbodies[i].rows[shiftIndex]).removeClass("rf-edt-r-t");
+ }
+
+ }
+ shiftIndex = null;
+ }
+
+ var setShiftRow = function (index) {
+ resetShiftRow();
+ shiftIndex = index;
+ if(typeof index == "number") {
+ for ( var i = 0; i < tbodies.length; i++) {
+ jQuery(tbodies[i].rows[shiftIndex]).addClass("rf-edt-r-t");
+ }
+ }
+ }
+
+ var initializeSelection = function() {
+ ranges.clear();
+ var strings = selectionInput.value.split("|");
+ activeIndex = strings[1] || null;
+ shiftIndex = strings[2] || null;
+ selectionFlag = null;
+ var rows = tbodies[0].rows;
+ for (var i = 0; i < rows.length; i++) {
+ var row = jQuery(rows[i]);
+ if (row.hasClass("rf-edt-r-s")) {
+ ranges.add(row[0].rowIndex)
+ }
+ if (row.hasClass("rf-edt-r-a")) {
+ activeIndex = row[0].rowIndex;
+ }
+ if (row.hasClass("rf-edt-r-t")) {
+ shiftIndex = row[0].rowIndex;
+ }
+ }
+ writeSelection();
+ }
+
+ var writeSelection = function() {
+ selectionInput.value = [ranges, activeIndex, shiftIndex, selectionFlag].join("|");
+ }
+
+ var selectRows = function(range) {
+ if (typeof range == "number") {
+ range = [range, range];
+ }
+ var changed;
+ var i = 0;
+ for (; i < range[0]; i++) {
+ if (ranges.contains(i)) {
+ deselectRow(i);
+ changed = true;
+ }
+ }
+ for (; i <= range[1]; i++) {
+ if (!ranges.contains(i)) {
+ selectRow(i);
+ changed = true;
+ }
+ }
+ for (; i < rows; i++) {
+ if (ranges.contains(i)) {
+ deselectRow(i);
+ changed = true;
+ }
+ }
+ selectionFlag = typeof shiftIndex == "string" ? shiftIndex : "x";
+ return changed;
+ }
+
+ var processSlectionWithShiftKey = function(index) {
+ if(shiftIndex == null) {
+ setShiftRow(activeIndex != null ? activeIndex : index);
+ }
+ var range;
+ if ("u" == shiftIndex) {
+ range = [0, index];
+ } else if ("d" == shiftIndex) {
+ range = [index, rows - 1];
+ } else if (index >= shiftIndex) {
+ range = [shiftIndex, index];
+ } else {
+ range = [index, shiftIndex];
+ }
+ return selectRows(range);
+ }
+
+ var onbeforeselectionchange = function (event) {
+ return !options.onbeforeselectionchange || options.onbeforeselectionchange.call(element, event) !== false;
+ }
+
+ var onselectionchange = function (event, index, changed) {
+ if(!event.shiftKey) {
+ resetShiftRow();
+ }
+ if (activeIndex != index) {
+ setActiveRow(index);
+ showActiveRow();
+ }
+ if (changed) {
+ writeSelection();
+ if (options.onselectionchange) {
+ options.onselectionchange.call(element, event);
+ }
+ }
+ }
+
+ var selectionClickListener = function (event) {
+ if (!onbeforeselectionchange(event)) {
+ return;
+ }
+ var changed;
+ if (event.shiftKey || event.ctrlKey) {
+ if (window.getSelection) { //TODO Try to find other way.
+ window.getSelection().removeAllRanges();
+ } else if (document.selection) {
+ document.selection.empty();
+ }
+ }
+ var tr = event.target;
+ while (tbodies.index(tr.parentNode) == -1) {
+ tr = tr.parentNode;
+ }
+ var index = tr.rowIndex;
+ if (options.selectionMode == "single" || (options.selectionMode != "multipleKeyboardFree"
+ && !event.shiftKey && !event.ctrlKey)) {
+ changed = selectRows(index);
+ } else if (options.selectionMode == "multipleKeyboardFree" || (!event.shiftKey && event.ctrlKey)) {
+ if (ranges.contains(index)) {
+ deselectRow(index);
+ } else {
+ selectRow(index);
+ }
+ changed = true;
+ } else {
+ changed = processSlectionWithShiftKey(index);
+ }
+ onselectionchange(event, index, changed);
+ }
+
+ var selectionKeyDownListener = function(event) {
+ if (event.ctrlKey && options.selectionMode != "single" && (event.keyCode == 65 || event.keyCode == 97) //Ctrl-A
+ && onbeforeselectionchange(event)) {
+ selectRows([0, rows]);
+ selectionFlag = "a";
+ onselectionchange(event, activeIndex, true); //TODO Is there a way to know that selection haven't changed?
+ event.preventDefault();
+ } else {
+ var index;
+ if (event.keyCode == 38) { //UP
+ index = -1;
+ } else if (event.keyCode == 40) { //DOWN
+ index = 1;
+ }
+ if (index != null && onbeforeselectionchange(event)) {
+ if (typeof activeIndex == "number") {
+ index += activeIndex;
+ if (index >= 0 && index < rows ) {
+ var changed;
+ if (options.selectionMode == "single" || (!event.shiftKey && !event.ctrlKey)) {
+ changed = selectRows(index);
+ } else if (event.shiftKey) {
+ changed = processSlectionWithShiftKey(index);
+ }
+ onselectionchange(event, index, changed);
+ }
+ }
+ event.preventDefault();
+ }
+ }
+ }
+
+ var ajaxComplete = function (event, data) {
+ if (data.reinitializeHeader) {
+ bindHeaderHandlers();
+ } else {
+ selectionInput = document.getElementById(id + ":si");
+ if (data.reinitializeBody) {
+ rowCount = data.rowCount;
+ initialize();
+ } else if (options.selectionMode != "none") {
+ initializeSelection();
+ }
+ if (spacerElement) {
+ spacerElement.style.height = (data.first * rowHeight) + "px";
+ }
+ }
+ };
+
+ jQuery(document).ready(initialize);
+ jQuery(window).bind("resize", updateLayout);
+ jQuery(scrollElement).bind("scroll", updateScrollPosition);
+ var bindHeaderHandlers = function () {
+ header.find(".rf-edt-rs").bind("mousedown", beginResize);
+ header.find(".rf-edt-hc").bind("mousedown", beginReorder);
+ }
+ bindHeaderHandlers();
+ jQuery(element).bind("rich:onajaxcomplete", ajaxComplete);
+
+ //JS API
+ element["richfaces"] = element["richfaces"] || {}; // TODO ExtendedDataTable should extend richfaces.BaseComponent instead of using it.
+ element.richfaces.component = this;
+
+ this.getColumnPosition = function(id) {
+ var position;
+ var headers = header.find(".rf-edt-hc");
+ for (var i = 0; i < headers.length; i++) {
+ if (id == headers[i].className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1]) {
+ position = i;
+ }
+ }
+ return position;
+ }
+
+ this.setColumnPosition = function(id, position) {
+ var colunmsOrder = "";
+ var before;
+ var headers = header.find(".rf-edt-hc");
+ for (var i = 0; i < headers.length; i++) {
+ var current = headers[i].className.match(new RegExp(WIDTH_CLASS_NAME_BASE + "([^\\W]*)"))[1];
+ if (i == position) {
+ if (before) {
+ colunmsOrder += current + "," + id + ",";
+ } else {
+ colunmsOrder += id + "," + current + ",";
+ }
+ } else {
+ if (id != current) {
+ colunmsOrder += current + ",";
+ } else {
+ before = true;
+ }
+ }
+ }
+ sendAjax(null, {"rich:columnsOrder" : colunmsOrder}); // TODO Maybe, event model should be used here.
+ }
+
+ this.setColumnWidth = function(id, width) {
+ setColumnWidth(id, width);
+ }
+
+ this.filter = function(colunmId, filterValue, isClear) {
+ if (typeof(filterValue) == "undefined" || filterValue == null) {
+ filterValue = "";
+ }
+ var map = {}
+ map[id + "rich:filtering"] = colunmId + ":" + filterValue + ":" + isClear;
+ sendAjax(null, map); // TODO Maybe, event model should be used here.
+ }
+
+ this.clearFiltering = function() {
+ this.filter("", "", true);
+ }
+
+ this.sort = function(colunmId, sortOrder, isClear) {
+ if (typeof(sortOrder) == "string") {
+ sortOrder = sortOrder.toUpperCase();
+ }
+ var map = {}
+ map[id + "rich:sorting"] = colunmId + ":" + sortOrder + ":" + isClear;
+ sendAjax(null, map); // TODO Maybe, event model should be used here.
+ }
+
+ this.clearSorting = function() {
+ this.filter("", "", true);
+ }
+ };
+}(window.RichFaces, jQuery));
+
Added: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/reorderMarker.gif
===================================================================
(Binary files differ)
Property changes on: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/reorderMarker.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/subtable-toggler.js
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/subtable-toggler.js (rev 0)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/subtable-toggler.js 2010-08-13 11:33:47 UTC (rev 18612)
@@ -0,0 +1,54 @@
+(function ($, richfaces) {
+
+ richfaces.ui = richfaces.ui || {};
+
+ richfaces.ui.SubTableToggler = function(id, options) {
+ this.id = id;
+ this.eventName = options.eventName;
+ this.expandControl = options.expandControl;
+ this.collapseControl = options.collapseControl;
+ this.forId = options.forId;
+
+ richfaces.Event.bindById(this.id, this.eventName, this.toggle, this);
+ };
+
+ $.extend(richfaces.ui.SubTableToggler.prototype, (function () {
+
+ var getElementById= function(id) {
+ return $(document.getElementById(id))
+ }
+
+ return {
+
+ toggle: function(e) {
+ var subtable = richfaces.$(this.forId);
+ if(subtable) {
+ var mode = subtable.getMode();
+
+ if(richfaces.ui.SubTable.MODE_CLNT == mode) {
+ this.toggleControl(subtable.isExpand());
+ }
+
+ subtable.setOption(this.id);
+ subtable.toggle(e);
+ }
+ },
+
+ toggleControl: function(expanded) {
+ var expandControl = getElementById(this.expandControl);
+ var collapseControl = getElementById(this.collapseControl);
+
+ if(expanded) {
+ collapseControl.hide();
+ expandControl.show();
+ } else {
+ expandControl.hide();
+ collapseControl.show();
+ }
+ }
+
+ };
+
+ })());
+
+})(jQuery, window.RichFaces);
\ No newline at end of file
Added: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/subtable.js
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/subtable.js (rev 0)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/subtable.js 2010-08-13 11:33:47 UTC (rev 18612)
@@ -0,0 +1,115 @@
+(function ($, richfaces) {
+
+ richfaces.ui = richfaces.ui || {};
+
+ richfaces.ui.SubTable = function(id, f, options) {
+ this.id = id;
+ this.stateInput = options.stateInput;
+ this.optionsInput = options.optionsInput;
+ this.expandMode = options.expandMode;
+ this.eventOptions = options.eventOptions;
+ this.formId = f;
+
+ $super.constructor.call(this, id);
+ this.attachToDom(id);
+ };
+
+ $.extend(richfaces.ui.SubTable, {
+ MODE_AJAX: "ajax",
+ MODE_SRV: "server",
+ MODE_CLNT: "client",
+ collapse: 0,
+ expand: 1
+ })
+
+ var $super = richfaces.BaseComponent.extend(richfaces.ui.SubTable);
+ var $p = richfaces.BaseComponent.extend(richfaces.ui.SubTable, {});
+ var $super = richfaces.ui.SubTable.$super;
+
+ $.extend(richfaces.ui.SubTable.prototype, (function () {
+
+ var element = function() {
+ //use parent tbody as parent dom elem
+ return $(document.getElementById(this.id)).parent();
+ };
+
+ var stateInputElem = function() {
+ return $(document.getElementById(this.stateInput));
+ };
+
+ var optionsInputElem = function() {
+ return $(document.getElementById(this.optionsInput));
+ };
+
+ var ajax = function(e, options) {
+ this.switchState();
+ richfaces.ajax(this.id, e, options);
+ };
+
+ var server = function(options) {
+ this.switchState();
+ $(document.getElementById(this.formId)).submit();
+ };
+
+ var client = function(options) {
+ if(this.isExpand()) {
+ this.collapse(options);
+ } else {
+ this.expand(options);
+ }
+ };
+
+
+ return {
+
+ name: "RichFaces.ui.SubTable",
+
+ toggle: function(e, options) {
+ if(this.expandMode == richfaces.ui.SubTable.MODE_AJAX) {
+ ajax.call(this, e, this.eventOptions, options);
+ }else if(this.expandMode == richfaces.ui.SubTable.MODE_SRV) {
+ server.call(this, options);
+ }else if(this.expandMode == richfaces.ui.SubTable.MODE_CLNT) {
+ client.call(this, options);
+ }
+ },
+
+ collapse: function(options) {
+ this.setState(richfaces.ui.SubTable.collapse);
+ element.call(this).hide();
+ },
+
+ expand: function(options) {
+ this.setState(richfaces.ui.SubTable.expand);
+ element.call(this).show();
+ },
+
+ isExpand: function() {
+ return (this.getState() > richfaces.ui.SubTable.collapse);
+ },
+
+ switchState: function(options) {
+ var state = this.isExpand() ? richfaces.ui.SubTable.collapse : richfaces.ui.SubTable.expand;
+ this.setState(state);
+ },
+
+ getState: function() {
+ return stateInputElem.call(this).val();
+ },
+
+ setState: function(state) {
+ stateInputElem.call(this).val(state)
+ },
+
+ setOption: function(option) {
+ optionsInputElem.call(this).val(option);
+ },
+
+ getMode: function() {
+ return this.expandMode;
+ }
+ };
+
+ })());
+
+})(jQuery, window.RichFaces);
\ No newline at end of file
Added: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/up_icon.gif
===================================================================
(Binary files differ)
Property changes on: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/org.richfaces/up_icon.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/reorderMarker.gif
===================================================================
(Binary files differ)
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/subtable-toggler.js
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/subtable-toggler.js 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/subtable-toggler.js 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,54 +0,0 @@
-(function ($, richfaces) {
-
- richfaces.ui = richfaces.ui || {};
-
- richfaces.ui.SubTableToggler = function(id, options) {
- this.id = id;
- this.eventName = options.eventName;
- this.expandControl = options.expandControl;
- this.collapseControl = options.collapseControl;
- this.forId = options.forId;
-
- richfaces.Event.bindById(this.id, this.eventName, this.toggle, this);
- };
-
- $.extend(richfaces.ui.SubTableToggler.prototype, (function () {
-
- var getElementById= function(id) {
- return $(document.getElementById(id))
- }
-
- return {
-
- toggle: function(e) {
- var subtable = richfaces.$(this.forId);
- if(subtable) {
- var mode = subtable.getMode();
-
- if(richfaces.ui.SubTable.MODE_CLNT == mode) {
- this.toggleControl(subtable.isExpand());
- }
-
- subtable.setOption(this.id);
- subtable.toggle(e);
- }
- },
-
- toggleControl: function(expanded) {
- var expandControl = getElementById(this.expandControl);
- var collapseControl = getElementById(this.collapseControl);
-
- if(expanded) {
- collapseControl.hide();
- expandControl.show();
- } else {
- expandControl.hide();
- collapseControl.show();
- }
- }
-
- };
-
- })());
-
-})(jQuery, window.RichFaces);
\ No newline at end of file
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/subtable.js
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/resources/subtable.js 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/resources/subtable.js 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,115 +0,0 @@
-(function ($, richfaces) {
-
- richfaces.ui = richfaces.ui || {};
-
- richfaces.ui.SubTable = function(id, f, options) {
- this.id = id;
- this.stateInput = options.stateInput;
- this.optionsInput = options.optionsInput;
- this.expandMode = options.expandMode;
- this.eventOptions = options.eventOptions;
- this.formId = f;
-
- $super.constructor.call(this, id);
- this.attachToDom(id);
- };
-
- $.extend(richfaces.ui.SubTable, {
- MODE_AJAX: "ajax",
- MODE_SRV: "server",
- MODE_CLNT: "client",
- collapse: 0,
- expand: 1
- })
-
- var $super = richfaces.BaseComponent.extend(richfaces.ui.SubTable);
- var $p = richfaces.BaseComponent.extend(richfaces.ui.SubTable, {});
- var $super = richfaces.ui.SubTable.$super;
-
- $.extend(richfaces.ui.SubTable.prototype, (function () {
-
- var element = function() {
- //use parent tbody as parent dom elem
- return $(document.getElementById(this.id)).parent();
- };
-
- var stateInputElem = function() {
- return $(document.getElementById(this.stateInput));
- };
-
- var optionsInputElem = function() {
- return $(document.getElementById(this.optionsInput));
- };
-
- var ajax = function(e, options) {
- this.switchState();
- richfaces.ajax(this.id, e, options);
- };
-
- var server = function(options) {
- this.switchState();
- $(document.getElementById(this.formId)).submit();
- };
-
- var client = function(options) {
- if(this.isExpand()) {
- this.collapse(options);
- } else {
- this.expand(options);
- }
- };
-
-
- return {
-
- name: "RichFaces.ui.SubTable",
-
- toggle: function(e, options) {
- if(this.expandMode == richfaces.ui.SubTable.MODE_AJAX) {
- ajax.call(this, e, this.eventOptions, options);
- }else if(this.expandMode == richfaces.ui.SubTable.MODE_SRV) {
- server.call(this, options);
- }else if(this.expandMode == richfaces.ui.SubTable.MODE_CLNT) {
- client.call(this, options);
- }
- },
-
- collapse: function(options) {
- this.setState(richfaces.ui.SubTable.collapse);
- element.call(this).hide();
- },
-
- expand: function(options) {
- this.setState(richfaces.ui.SubTable.expand);
- element.call(this).show();
- },
-
- isExpand: function() {
- return (this.getState() > richfaces.ui.SubTable.collapse);
- },
-
- switchState: function(options) {
- var state = this.isExpand() ? richfaces.ui.SubTable.collapse : richfaces.ui.SubTable.expand;
- this.setState(state);
- },
-
- getState: function() {
- return stateInputElem.call(this).val();
- },
-
- setState: function(state) {
- stateInputElem.call(this).val(state)
- },
-
- setOption: function(option) {
- optionsInputElem.call(this).val(option);
- },
-
- getMode: function() {
- return this.expandMode;
- }
- };
-
- })());
-
-})(jQuery, window.RichFaces);
\ No newline at end of file
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/resources/up_icon.gif
===================================================================
(Binary files differ)
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/tables.faces-config.xml
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/tables.faces-config.xml 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/tables.faces-config.xml 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,114 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!--
-JBoss, Home of Professional Open Source
-Copyright ${year}, Red Hat, Inc. and individual contributors
-by the @authors tag. See the copyright.txt in the distribution for a
-full listing of individual contributors.
-
-
-This is free software; you can redistribute it and/or modify it
-under the terms of the GNU Lesser General Public License as
-published by the Free Software Foundation; either version 2.1 of
-the License, or (at your option) any later version.
-
-
-This software is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Lesser General Public License for more details.
-
-
-You should have received a copy of the GNU Lesser General Public
-License along with this software; if not, write to the Free
-Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-02110-1301 USA, or see the FSF site: http://www.fsf.org.
--->
-<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
- version="2.0">
-
- <component>
- <component-type>org.richfaces.DataTable</component-type>
- <component-class>org.richfaces.component.html.HtmlDataTable</component-class>
- <component-extension>
- <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions">false</cdk:generate>
- </component-extension>
- </component>
-
- <component>
- <component-type>org.richfaces.ExtendedDataTable</component-type>
- <component-class>org.richfaces.component.html.HtmlExtendedDataTable</component-class>
- <component-extension>
- <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions">false</cdk:generate>
- </component-extension>
- </component>
- <component>
- <component-type>org.richfaces.Column</component-type>
- <component-class>org.richfaces.component.html.HtmlColumn</component-class>
- <component-extension>
- <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions">false</cdk:generate>
- </component-extension>
- </component>
- <component>
- <component-type>org.richfaces.ColumnGroup</component-type>
- <component-class>org.richfaces.component.html.HtmlColumnGroup</component-class>
- <component-extension>
- <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions">false</cdk:generate>
- </component-extension>
- </component>
- <component>
- <component-type>org.richfaces.SubTable</component-type>
- <component-class>org.richfaces.component.html.HtmlSubTable</component-class>
- <component-extension>
- <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions">false</cdk:generate>
- </component-extension>
- </component>
- <component>
- <component-type>org.richfaces.SubTableToggleControl</component-type>
- <component-class>org.richfaces.component.html.HtmlSubTableToggleControl</component-class>
- <component-extension>
- <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions">false</cdk:generate>
- </component-extension>
- </component>
- <component>
- <component-type>org.richfaces.DataGrid</component-type>
- <component-class>org.richfaces.component.html.HtmlDataGrid</component-class>
- <component-extension>
- <cdk:generate xmlns:cdk="http://richfaces.org/cdk/extensions">false</cdk:generate>
- </component-extension>
- </component>
-
-
- <render-kit>
- <render-kit-id>HTML_BASIC</render-kit-id>
- <renderer>
- <component-family>org.richfaces.Data</component-family>
- <renderer-type>org.richfaces.DataTableRenderer</renderer-type>
- <renderer-class>org.richfaces.renderkit.DataTableRenderer</renderer-class>
- </renderer>
- <renderer>
- <component-family>org.richfaces.Data</component-family>
- <renderer-type>org.richfaces.SubTableRenderer</renderer-type>
- <renderer-class>org.richfaces.renderkit.SubTableRenderer</renderer-class>
- </renderer>
- <renderer>
- <component-family>org.richfaces.Column</component-family>
- <renderer-type>org.richfaces.ColumnGroupRenderer</renderer-type>
- <renderer-class>org.richfaces.renderkit.ColumnGroupRenderer</renderer-class>
- </renderer>
- <renderer>
- <component-family>org.richfaces.Data</component-family>
- <renderer-type>org.richfaces.ExtendedDataTableRenderer</renderer-type>
- <renderer-class>org.richfaces.renderkit.ExtendedDataTableRenderer</renderer-class>
- </renderer>
- <renderer>
- <component-family>org.richfaces.SubTableToggleControl</component-family>
- <renderer-type>org.richfaces.SubTableToggleControl</renderer-type>
- <renderer-class>org.richfaces.renderkit.html.SubTableToggleControlRenderer</renderer-class>
- </renderer>
- <renderer>
- <component-family>org.richfaces.Data</component-family>
- <renderer-type>org.richfaces.DataGridRenderer</renderer-type>
- <renderer-class>org.richfaces.renderkit.DataGridRenderer</renderer-class>
- </renderer>
- </render-kit>
-</faces-config>
\ No newline at end of file
Deleted: trunk/ui/iteration/ui/src/main/resources/META-INF/tables.taglib.xml
===================================================================
--- trunk/ui/iteration/ui/src/main/resources/META-INF/tables.taglib.xml 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/main/resources/META-INF/tables.taglib.xml 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<facelet-taglib version="2.0" xmlns="http://java.sun.com/xml/ns/javaee" id="a4j">
- <namespace>http://richfaces.org/rich</namespace>
-
- <tag>
- <tag-name>dataTable</tag-name>
- <component>
- <component-type>org.richfaces.DataTable</component-type>
- <renderer-type>org.richfaces.DataTableRenderer</renderer-type>
- </component>
- </tag>
- <tag>
- <tag-name>extendedDataTable</tag-name>
- <component>
- <component-type>org.richfaces.ExtendedDataTable</component-type>
- <renderer-type>org.richfaces.ExtendedDataTableRenderer</renderer-type>
- </component>
- </tag>
- <tag>
- <tag-name>column</tag-name>
- <component>
- <component-type>org.richfaces.Column</component-type>
- </component>
-
- </tag>
- <tag>
- <tag-name>columnGroup</tag-name>
- <component>
- <component-type>org.richfaces.ColumnGroup</component-type>
- <renderer-type>org.richfaces.ColumnGroupRenderer</renderer-type>
- </component>
- </tag>
- <tag>
- <tag-name>subTable</tag-name>
- <component>
- <component-type>org.richfaces.SubTable</component-type>
- <renderer-type>org.richfaces.SubTableRenderer</renderer-type>
- <handler-class>org.richfaces.taglib.SubTableHandler</handler-class>
- </component>
- </tag>
- <tag>
- <tag-name>subTableToggleControl</tag-name>
- <component>
- <component-type>org.richfaces.SubTableToggleControl</component-type>
- <renderer-type>org.richfaces.SubTableToggleControlRenderer</renderer-type>
- </component>
- </tag>
- <tag>
- <tag-name>dataGrid</tag-name>
- <component>
- <component-type>org.richfaces.DataGrid</component-type>
- <renderer-type>org.richfaces.DataGridRenderer</renderer-type>
- <handler-class>org.richfaces.taglib.DataGridHandler</handler-class>
- </component>
- </tag>
-
-</facelet-taglib>
Added: trunk/ui/iteration/ui/src/main/templates/toggle-control.template.xml
===================================================================
--- trunk/ui/iteration/ui/src/main/templates/toggle-control.template.xml (rev 0)
+++ trunk/ui/iteration/ui/src/main/templates/toggle-control.template.xml 2010-08-13 11:33:47 UTC (rev 18612)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+
+<cdk:root xmlns="http://richfaces.org/cdk/xhtml-el" xmlns:cdk="http://richfaces.org/cdk/core"
+ xmlns:c="http://richfaces.org/cdk/jstl/core" xmlns:cc="http://richfaces.org/cdk/jsf/composite"
+ xmlns:javaee="http://java.sun.com/xml/ns/javaee">
+
+ <cc:interface>
+ <cdk:class>org.richfaces.renderkit.html.SubTableToggleControlRenderer</cdk:class>
+ <cdk:superclass>org.richfaces.renderkit.SubTableToggleControlRendererBase</cdk:superclass>
+ <cdk:component-family>org.richfaces.SubTableToggleControl</cdk:component-family>
+ <cdk:renderer-type>org.richfaces.SubTableToggleControlRenderer</cdk:renderer-type>
+ </cc:interface>
+
+ <cc:implementation>
+ <span id="#{clientId}" class="#{component.attributes['styleClass']}">
+ <cdk:call expression="encodeControl(facesContext, component);" />
+ </span>
+ </cc:implementation>
+
+</cdk:root>
\ No newline at end of file
Deleted: trunk/ui/iteration/ui/src/test/java/org/richfaces/component/UIDataTableBaseTest.java
===================================================================
--- trunk/ui/iteration/ui/src/test/java/org/richfaces/component/UIDataTableBaseTest.java 2010-08-13 10:24:21 UTC (rev 18611)
+++ trunk/ui/iteration/ui/src/test/java/org/richfaces/component/UIDataTableBaseTest.java 2010-08-13 11:33:47 UTC (rev 18612)
@@ -1,274 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import javax.el.ELContext;
-import javax.el.ExpressionFactory;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIOutput;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.model.DataVisitor;
-import org.ajax4jsf.model.ExtendedDataModel;
-import org.ajax4jsf.model.Range;
-import org.jboss.test.faces.AbstractFacesTest;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.richfaces.model.Arrangeable;
-import org.richfaces.model.ArrangeableState;
-import org.richfaces.model.FilterField;
-import org.richfaces.model.SortField;
-import org.richfaces.model.SortMode;
-
-/**
- * @author Konstantin Mishin
- *
- */
-public class UIDataTableBaseTest extends AbstractFacesTest {
-
- private class MockArrangeableModel extends ExtendedDataModel<Object> implements Arrangeable {
-
- private ArrangeableState state;
- @Override
- public Object getRowKey() {
- return null;
- }
-
- @Override
- public void setRowKey(Object key) {
- }
-
- @Override
- public void walk(FacesContext context, DataVisitor visitor, Range range, Object argument) {
- }
-
- @Override
- public int getRowCount() {
- return 0;
- }
-
- @Override
- public Object getRowData() {
- return null;
- }
-
- @Override
- public int getRowIndex() {
- return 0;
- }
-
- @Override
- public Object getWrappedData() {
- return null;
- }
-
- @Override
- public boolean isRowAvailable() {
- return false;
- }
-
- @Override
- public void setRowIndex(int rowIndex) {
- }
-
- @Override
- public void setWrappedData(Object data) {
- }
-
- public void arrange(FacesContext context, ArrangeableState state) {
- this.state = state;
- }
-
- public ArrangeableState getState() {
- return state;
- }
-
- }
- private UIDataTableBase table = null;
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- super.setUp();
- setupFacesRequest();
- table = new UIDataTableBase();
- }
-
- /**
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {
- table = null;
- super.tearDown();
- }
-
- /**
- * Test method for {@link org.richfaces.component.UIDataTableBase#getRendersChildren()}.
- */
- @Test
- public void testGetRendersChildren() {
- Assert.assertTrue(table.getRendersChildren());
- }
-
- /**
- * Test method for {@link org.richfaces.component.UIDataTableBase#dataChildren()}.
- */
- @Test
- public void testDataChildren() {
- Assert.assertTrue(table.dataChildren() instanceof DataTableDataIterator);
- }
-
- /**
- * Test method for {@link org.richfaces.component.UIDataTableBase#fixedChildren()}.
- */
- @Test
- public void testFixedChildren() {
- Assert.assertTrue(table.fixedChildren() instanceof DataTableFixedChildrenIterator);
- }
-
- /**
- * Test method for {@link org.richfaces.component.UIDataTableBase#createExtendedDataModel()}.
- */
- @Test
- public void testCreateExtendedDataModel() {
- Assert.assertFalse(table.createExtendedDataModel() instanceof Arrangeable);
- List<String> sortPriority = Arrays.asList("id2", "id0", "id1");
- List<UIComponent> children = table.getChildren();
- ExpressionFactory expressionFactory = facesContext.getApplication().getExpressionFactory();
- ELContext elContext = facesContext.getELContext();
- UIColumn column = new UIColumn();
- column.setRendered(false);
- children.add(column);
- for (int i = 0; i < sortPriority.size(); i++) {
- UIColumn child = new UIColumn();
- child.setId("id" + i);
- child.setValueExpression("filterExpression", expressionFactory
- .createValueExpression(elContext, "#{'id" + i + "'}", Object.class));
- child.setValueExpression("sortBy", expressionFactory
- .createValueExpression(elContext, "#{'id" + i + "'}", Object.class));
- child.setSortOrder(SortOrder.ascending);
- children.add(child);
- }
- Assert.assertTrue(table.createExtendedDataModel() instanceof Arrangeable);
- MockArrangeableModel model = new MockArrangeableModel();
- table.setValue(model);
- table.setSortPriority(sortPriority);
- Assert.assertSame(model, table.createExtendedDataModel());
- ArrangeableState state = model.getState();
- List<FilterField> filterFields = state.getFilterFields();
- for (int i = 0; i < sortPriority.size(); i++) {
- Assert.assertEquals("id" + i , filterFields.get(i).getFilterExpression().getValue(elContext));
- }
- List<SortField> sortFields = state.getSortFields();
- for (int i = 0; i < sortPriority.size(); i++) {
- Assert.assertEquals(sortPriority.get(i), sortFields.get(i).getSortBy().getValue(elContext));
- }
- Assert.assertEquals(facesContext.getViewRoot().getLocale(), state.getLocale());
- }
-
- /**
- * Test method for {@link org.richfaces.component.UIDataTableBase#columns()}.
- */
- @Test
- public void testColumns() {
- Assert.assertTrue(table.columns() instanceof DataTableColumnsIterator);
- }
-
- /**
- * Test method for {@link org.richfaces.component.UIDataTableBase#getHeader()}.
- */
- @Test
- public void testGetHeader() {
- UIOutput component = new UIOutput();
- table.getFacets().put("header", component);
- Assert.assertSame(component, table.getHeader());
- }
-
- /**
- * Test method for {@link org.richfaces.component.UIDataTableBase#getFooter()}.
- */
- @Test
- public void testGetFooter() {
- UIOutput component = new UIOutput();
- table.getFacets().put("footer", component);
- Assert.assertSame(component, table.getFooter());
- }
-
- /**
- * Test method for {@link org.richfaces.component.UIDataTableBase#getFilterVar()} and
- * {@link org.richfaces.component.UIDataTableBase#setFilterVar(java.lang.String)}.
- */
- @Test
- public void testFilterVar() {
- String string = "fv";
- table.setFilterVar(string);
- Assert.assertEquals(string, table.getFilterVar());
- }
-
- /**
- * Test method for {@link org.richfaces.component.UIDataTableBase#getSortPriority()} and
- * {@link org.richfaces.component.UIDataTableBase#setSortPriority(java.util.Collection)}.
- */
- @Test
- public void testSortPriority() {
- table.setSortPriority(Collections.EMPTY_LIST);
- Assert.assertEquals(Collections.EMPTY_LIST, table.getSortPriority());
- }
-
- /**
- * Test method for {@link org.richfaces.component.UIDataTableBase#getSortMode()} and
- * {@link org.richfaces.component.UIDataTableBase#setSortMode(org.richfaces.model.SortMode)}.
- */
- @Test
- public void testSortMode() {
- table.setSortMode(SortMode.multi);
- Assert.assertEquals(SortMode.multi, table.getSortMode());
- }
-
- /**
- * Test method for {@link org.richfaces.component.UIDataTableBase#isColumnFacetPresent(java.lang.String)}.
- */
- @Test
- public void testIsColumnFacetPresent() {
- String facetName = "header";
- Assert.assertFalse(table.isColumnFacetPresent(facetName));
- UIColumn child = new UIColumn();
- List<UIComponent> children = table.getChildren();
- children.add(new UIColumn());
- children.add(child);
- Assert.assertFalse(table.isColumnFacetPresent(facetName));
- child.getFacets().put(facetName, new UIOutput());
- Assert.assertTrue(table.isColumnFacetPresent(facetName));
- child.setRendered(false);
- Assert.assertFalse(table.isColumnFacetPresent(facetName));
- }
-}
15 years, 9 months