Author: yradtsevich
Date: 2010-11-04 13:55:56 -0400 (Thu, 04 Nov 2010)
New Revision: 26266
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/subTableToggleControl/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/subTableToggleControl/down_icon.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/subTableToggleControl/up_icon.gif
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSubTableToggleControlTemplate.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataScroller-RF4.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataScroller-RF4.xhtml.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/subTableToggleControl.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/subTableToggleControl.xhtml.xml
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java
Log:
https://jira.jboss.org/browse/JBIDE-7449: Vpe templates for rich iteration.
Created templates:
- rich:dataScroller
- rich:subTableToggleControl
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/subTableToggleControl/down_icon.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/subTableToggleControl/down_icon.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/subTableToggleControl/up_icon.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/subTableToggleControl/up_icon.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSubTableToggleControlTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSubTableToggleControlTemplate.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesSubTableToggleControlTemplate.java 2010-11-04
17:55:56 UTC (rev 26266)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.richfaces.template;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.mapping.AttributeData;
+import org.jboss.tools.vpe.editor.mapping.VpeElementData;
+import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.VisualDomUtil;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMText;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Template for rich:subTableToggleControl.
+ *
+ * @author Yahor Radtsevich (yradtsevich)
+ *
+ */
+public class RichFacesSubTableToggleControlTemplate extends VpeAbstractTemplate {
+
+ private static final String DOWN_ICON_PATH =
"/subTableToggleControl/down_icon.gif"; //$NON-NLS-1$
+
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools.vpe.editor.context.VpePageContext,
org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMDocument)
+ */
+ @Override
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+ Element sourceElement = (Element) sourceNode;
+
+ nsIDOMElement container = VisualDomUtil.createBorderlessContainer(visualDocument);
+ VpeCreationData creationData = new VpeCreationData(container);
+
+ if (sourceElement.hasAttribute(RichFaces.ATTR_COLLAPSE_LABEL)) {
+ Attr collapseLabelAttr =
sourceElement.getAttributeNode(RichFaces.ATTR_COLLAPSE_LABEL);
+ nsIDOMElement link = visualDocument.createElement(HTML.TAG_A);
+
+ nsIDOMText collapseLabelText
+ = visualDocument.createTextNode(collapseLabelAttr.getNodeValue());
+ link.appendChild(collapseLabelText);
+
+ VpeElementData elementData = new VpeElementData();
+ creationData.setElementData(elementData);
+ elementData.addNodeData(new AttributeData(collapseLabelAttr, collapseLabelText,
true));
+
+ container.appendChild(link);
+ } else {
+ nsIDOMElement img = visualDocument.createElement(HTML.TAG_IMG);
+ if (sourceElement.hasAttribute(RichFaces.ATTR_COLLAPSE_ICON)) {
+ String imgFullPath = VpeStyleUtil.addFullPathToImgSrc(
+ sourceElement.getAttribute(RichFaces.ATTR_COLLAPSE_ICON), pageContext, true);
+ img.setAttribute(HTML.ATTR_SRC, imgFullPath);
+ } else {
+ ComponentUtil.setImg(img, DOWN_ICON_PATH);
+ }
+
+ container.appendChild(img);
+ }
+
+ return creationData;
+ }
+}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java 2010-11-04
17:24:19 UTC (rev 26265)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/util/RichFaces.java 2010-11-04
17:55:56 UTC (rev 26266)
@@ -32,6 +32,8 @@
public static final String ATTR_BREAK_BEFORE = "breakBefore"; //$NON-NLS-1$
public static final String ATTR_CAPTION_CLASS = "captionClass"; //$NON-NLS-1$
public static final String ATTR_CAPTION_STYLE = "captionStyle"; //$NON-NLS-1$
+ public static final String ATTR_COLLAPSE_ICON = "collapseIcon"; //$NON-NLS-1$
+ public static final String ATTR_COLLAPSE_LABEL = "collapseLabel";
//$NON-NLS-1$
public static final String ATTR_COLUMN_CLASSES = "columnClasses";
//$NON-NLS-1$
public static final String ATTR_COLUMNS = "columns"; //$NON-NLS-1$
public static final String ATTR_COLUMNS_WIDTH = "columnsWidth"; //$NON-NLS-1$
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2010-11-04
17:24:19 UTC (rev 26265)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2010-11-04
17:55:56 UTC (rev 26266)
@@ -251,6 +251,7 @@
</vpe:tag>
+ <!-- keep in mind that there is the same template for RF 4.0 rich:dataScroller
(below)-->
<vpe:tag name="rich:datascroller" case-sensitive="yes">
<vpe:template children="yes" modify="yes"
class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesDataTableScrollerTemplate">
@@ -804,6 +805,30 @@
</vpe:dnd>
</vpe:template>
</vpe:tag>
+ <vpe:tag name="rich:dataScroller" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes"
+ class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesDataTableScrollerTemplate">
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="yes">
+ <vpe:container-child tag-name="f:facet" />
+ </vpe:drop>
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+ <vpe:tag name="rich:subTableToggleControl"
case-sensitive="yes">
+ <vpe:template children="no" modify="yes"
+ class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesSubTableToggleControlTemplate">
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no"/>
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
<vpe:tag name="rich:clientId" case-sensitive="yes">
<vpe:template children="no" modify="no">
</vpe:template>
@@ -824,5 +849,5 @@
<vpe:template children="no" modify="no">
</vpe:template>
</vpe:tag>
-
+
</vpe:templates>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataScroller-RF4.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataScroller-RF4.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataScroller-RF4.xhtml 2010-11-04
17:55:56 UTC (rev 26266)
@@ -0,0 +1,83 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+
+<head>
+</head>
+<body>
+<h:form>
+ <h1>dataScroller</h1>
+ <rich:dataScroller id="dataScroller" for="dataTable"
align="right" >
+ </rich:dataScroller>
+
+ <rich:dataTable cellpadding="0" cellspacing="0"
width="700" border="0"
+ var="row" value="#{bean.dtList}" rowKeyVar="rowKey"
id="dataTable"
+ rows="2">
+
+ <f:facet name="header">
+ <rich:columnGroup>
+ <rich:column rowspan="2">
+ <rich:spacer />
+ </rich:column>
+ <rich:column colspan="3">
+ <h:outputText value="FIELDS" />
+ </rich:column>
+ <rich:column breakBefore="true">
+ <h:outputText value="field1" />
+ </rich:column>
+ <rich:column>
+ <h:outputText value="field2" />
+ </rich:column>
+ <rich:column>
+ <h:outputText value="field3" />
+ </rich:column>
+ </rich:columnGroup>
+ </f:facet>
+
+
+ <rich:columnGroup>
+ <rich:column>
+ <h:outputText value="#{rowKey}" />
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{row.field1}">
+ </h:outputText>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{row.field2}">
+ </h:outputText>
+ </rich:column>
+ <rich:column>
+ <h:outputText value="#{row.field3}">
+ </h:outputText>
+ </rich:column>
+
+ </rich:columnGroup>
+
+
+
+ <f:facet name="footer">
+
+ <rich:columnGroup>
+ <rich:column></rich:column>
+ <rich:column>
+ <h:outputText value="footer1" />
+ </rich:column>
+ <rich:column>
+ <h:outputText value="footer2" />
+ </rich:column>
+ <rich:column>
+ <h:outputText value="footer3" />
+ </rich:column>
+
+ </rich:columnGroup>
+ </f:facet>
+
+ </rich:dataTable>
+</h:form>
+</body>
+</html>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataScroller-RF4.xhtml.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataScroller-RF4.xhtml.xml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/dataScroller-RF4.xhtml.xml 2010-11-04
17:55:56 UTC (rev 26266)
@@ -0,0 +1,31 @@
+<tests>
+ <test id="dataScroller">
+ <DIV ALIGN="right" CLASS="rich-datascr">
+ <TABLE CELLSPACING="1" CELLPADDING="0" BORDER="0"
+ CLASS="rich-dtascroller-table">
+ <TBODY>
+ <TR>
+ <TD ALIGN="center" CLASS="rich-datascr-button
rich-datascr-button-dsbld">««</TD>
+ <TD ALIGN="center" CLASS="rich-datascr-button
rich-datascr-button-dsbld">«</TD>
+ <TD ALIGN="center" CLASS="rich-datascr-button
rich-datascr-button-dsbld">
+ </TD>
+ <TD ALIGN="center" CLASS="rich-datascr-act">
1</TD>
+ <TD ALIGN="center" CLASS="rich-datascr-inact">
2</TD>
+ <TD ALIGN="center" CLASS="rich-datascr-inact">
3</TD>
+ <TD ALIGN="center" CLASS="rich-datascr-inact">
4</TD>
+ <TD ALIGN="center" CLASS="rich-datascr-inact">
5</TD>
+ <TD ALIGN="center" CLASS="rich-datascr-inact">
6</TD>
+ <TD ALIGN="center" CLASS="rich-datascr-inact">
7</TD>
+ <TD ALIGN="center" CLASS="rich-datascr-inact">
8</TD>
+ <TD ALIGN="center" CLASS="rich-datascr-inact">
9</TD>
+ <TD ALIGN="center" CLASS="rich-datascr-inact">
10</TD>
+ <TD ALIGN="center" CLASS="rich-datascr-button">
+ </TD>
+ <TD ALIGN="center"
CLASS="rich-datascr-button">»</TD>
+ <TD ALIGN="center"
CLASS="rich-datascr-button">»»</TD>
+ </TR>
+ </TBODY>
+ </TABLE>
+ </DIV>
+ </test>
+</tests>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/subTableToggleControl.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/subTableToggleControl.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/subTableToggleControl.xhtml 2010-11-04
17:55:56 UTC (rev 26266)
@@ -0,0 +1,51 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+ <h:form>
+ <b>Table 1</b>
+ <rich:dataTable value="#{carsBean.inventoryVendorLists}"
var="list">
+ <rich:column>
+ <rich:subTableToggleControl id="control1" for="sbtbl"/>
+ <h:outputText value="#{list.vendor}" />
+ </rich:column>
+ <rich:subTable value="#{list.vendorItems}" var="item"
id="sbtbl"
+ expandMode="client">
+ <rich:column>
+ <h:outputText value="#{item.model}" />
+ </rich:column>
+ </rich:subTable>
+ </rich:dataTable>
+
+ <b>Table 2</b>
+ <rich:dataTable value="#{carsBean.inventoryVendorLists}"
var="list">
+ <rich:column>
+ <rich:subTableToggleControl id="control2" for="sbtbl"
collapseLabel="collapse"/>
+ <h:outputText value="#{list.vendor}" />
+ </rich:column>
+ <rich:subTable value="#{list.vendorItems}" var="item"
id="sbtbl"
+ expandMode="client">
+ <rich:column>
+ <h:outputText value="#{item.model}" />
+ </rich:column>
+ </rich:subTable>
+ </rich:dataTable>
+
+ <b>Table 3</b>
+ <rich:dataTable value="#{carsBean.inventoryVendorLists}"
var="list">
+ <rich:column>
+ <rich:subTableToggleControl id="control3" for="sbtbl"
collapseIcon="images/icons/copy.gif"/>
+ <h:outputText value="#{list.vendor}" />
+ </rich:column>
+ <rich:subTable value="#{list.vendorItems}" var="item"
id="sbtbl"
+ expandMode="client">
+ <rich:column>
+ <h:outputText value="#{item.model}" />
+ </rich:column>
+ </rich:subTable>
+ </rich:dataTable>
+ </h:form>
+</ui:composition>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/subTableToggleControl.xhtml.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/subTableToggleControl.xhtml.xml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/subTableToggleControl.xhtml.xml 2010-11-04
17:55:56 UTC (rev 26266)
@@ -0,0 +1,16 @@
+<tests>
+ <test id="control1">
+ <SPAN CLASS="vpe-text">
+ <IMG SRC="/.*/resources/subTableToggleControl/down_icon.gif/" />
+ </SPAN>
+ </test>
+ <test id="control2">
+ <SPAN CLASS="vpe-text"><A>collapse</A>
+ </SPAN>
+ </test>
+ <test id="control3">
+ <SPAN CLASS="vpe-text">
+ <IMG SRC="/.*pages/components/images/icons/copy.gif/" />
+ </SPAN>
+ </test>
+</tests>
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java 2010-11-04
17:24:19 UTC (rev 26265)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComponentContentTest.java 2010-11-04
17:55:56 UTC (rev 26266)
@@ -78,6 +78,11 @@
performContentTest("components/datascroller.xhtml");//$NON-NLS-1$
}
+
+ public void testDataScrollerRF4() throws Throwable {
+
+ performContentTest("components/dataScroller-RF4.xhtml");//$NON-NLS-1$
+ }
public void testColumns() throws Throwable {
performContentTest("components/columns.xhtml");//$NON-NLS-1$
@@ -283,7 +288,11 @@
public void testSpacer() throws Throwable {
performContentTest("components/spacer.xhtml");//$NON-NLS-1$
}
-
+
+ public void testSubTableToggleControl() throws Throwable {
+ performContentTest("components/subTableToggleControl.xhtml");//$NON-NLS-1$
+ }
+
public void testSuggestionbox() throws Throwable {
performInvisibleTagTest("components/suggestionbox.xhtml",
"suggestionBox"); //$NON-NLS-1$ //$NON-NLS-2$
}