You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by dr...@apache.org on 2007/09/04 22:02:05 UTC
svn commit: r572804 - in /myfaces/trinidad/trunk/trinidad:
trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/
trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/
trinidad-examples/trini...
Author: drobinson
Date: Tue Sep 4 13:02:03 2007
New Revision: 572804
URL: http://svn.apache.org/viewvc?rev=572804&view=rev
Log:
TRINIDAD-687
Added panelCaptionGroup component.
Added:
myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CorePanelCaptionGroup.xml
myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/PanelCaptionGroup.xml
myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/components/panelCaptionGroup.jspx
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelCaptionGroupRenderer.java
Modified:
myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SkinSelectors.java
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/adf/styles/base-desktop.xss
Added: myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CorePanelCaptionGroup.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CorePanelCaptionGroup.xml?rev=572804&view=auto
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CorePanelCaptionGroup.xml (added)
+++ myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CorePanelCaptionGroup.xml Tue Sep 4 13:02:03 2007
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:tr="http://myfaces.apache.org/trinidad"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:mfp="http://myfaces.apache.org/maven-faces-plugin"
+ xmlns:mafp="http://myfaces.apache.org/maven-trinidad-plugin"
+ xmlns:xhtml="http://www.w3.org/1999/xhtml">
+ <component>
+ <description>
+ <![CDATA[The panelCaptionGroup is used to render a set of components,
+ into a related and more managable grouping. The group is surrounded by a border
+ containing the group caption.]]>
+ </description>
+ <icon>
+ <small-icon>/org/apache/myfaces/trinidad/metadata/icons/PanelCaptionGroup.png</small-icon>
+ </icon>
+ <component-type>org.apache.myfaces.trinidad.CorePanelCaptionGroup</component-type>
+ <component-class>org.apache.myfaces.trinidad.component.core.layout.CorePanelCaptionGroup</component-class>
+ <xi:include href="includes/CommonAttrs.xml" xpointer="/faces-config/component/*"/>
+ <xi:include href="includes/CoreJSEvents.xml" xpointer="/faces-config/component/*"/>
+ <facet>
+ <description><![CDATA[Content to be rendered as the caption for the group content. The
+ facet takes precidence over the captionText attribute and can be used to specify more complex
+ or non-text captions (e.g. images).]]>
+ </description>
+ <facet-name>caption</facet-name>
+ <facet-extension>
+ <mfp:facet-metadata>
+ <mfp:preferred>true</mfp:preferred>
+ </mfp:facet-metadata>
+ </facet-extension>
+ </facet>
+ <property>
+ <description>
+ <![CDATA[The text to be rendered as the caption for the group content.]]>
+ </description>
+ <property-name>captionText</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <mfp:required>false</mfp:required>
+ <mfp:property-metadata>
+ <mfp:preferred>true</mfp:preferred>
+ </mfp:property-metadata>
+ </property-extension>
+ </property>
+ <component-extension>
+ <mfp:component-supertype>org.apache.myfaces.trinidad.Panel</mfp:component-supertype>
+ <mfp:renderer-type>org.apache.myfaces.trinidad.PanelCaptionGroup</mfp:renderer-type>
+ <mfp:tag-name>tr:panelCaptionGroup</mfp:tag-name>
+ <mfp:tag-class>org.apache.myfaces.trinidadinternal.taglib.core.layout.CorePanelCaptionGroupTag</mfp:tag-class>
+ <mfp:long-description><![CDATA[
+<html:p>
+The panelCaptionGroup is used to render a set of components, into a related and more
+managable grouping. The group is surrounded by a border containing the group caption.
+</html:p>
+<html:p>
+The caption facet can be used to specify a complex caption (e.g. Icons, Links, etc.) for the
+content group. For simple captions, the captionText attribute will suffice.
+</html:p>
+ ]]>
+ </mfp:long-description>
+ <mfp:example>
+ <mfp:source-code>
+ <![CDATA[
+<tr:panelCaptionGroup captionText="The Caption Text">
+ <tr:panelFormLayout>
+ <tr:inputText label="Field A" />
+ <tr:inputText label="Field B" />
+ </tr:panelFormLayout>
+</tr:panelCaptionGroup>
+
+<tr:panelCaptionGroup>
+ <f:facet name="caption">
+ <tr:icon name="error" shortDesc="An icon as a caption" />
+ </f:facet>
+ ...
+</tr:panelCaptionGroup>
+]]>
+ </mfp:source-code>
+ </mfp:example>
+ <mfp:author>Danny Robinson</mfp:author>
+ <mfp:uix2-local-name>panelCaptionGroup</mfp:uix2-local-name>
+ </component-extension>
+ </component>
+</faces-config>
Added: myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/PanelCaptionGroup.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/PanelCaptionGroup.xml?rev=572804&view=auto
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/PanelCaptionGroup.xml (added)
+++ myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/PanelCaptionGroup.xml Tue Sep 4 13:02:03 2007
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2006 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:mfp="http://myfaces.apache.org/maven-faces-plugin">
+ <render-kit>
+ <render-kit-id>org.apache.myfaces.trinidadinternal.core</render-kit-id>
+ <renderer>
+ <component-family>org.apache.myfaces.trinidad.Panel</component-family>
+ <renderer-type>org.apache.myfaces.trinidad.PanelCaptionGroup</renderer-type>
+ <renderer-class>org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelCaptionGroupRenderer</renderer-class>
+ <renderer-extension>
+ <mfp:component-type>org.apache.myfaces.trinidad.CorePanelCaptionGroup</mfp:component-type>
+ <mfp:unsupported-agents>phone voice</mfp:unsupported-agents>
+ </renderer-extension>
+ </renderer>
+ </render-kit>
+</faces-config>
Modified: myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml?rev=572804&r1=572803&r2=572804&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml Tue Sep 4 13:02:03 2007
@@ -830,6 +830,7 @@
<value>panelBorderLayout.jspx</value>
<value>panelBox.jspx</value>
<value>panelButtonBar.jspx</value>
+ <value>panelCaptionGroup.jspx</value>
<value>panelFormLayout.jspx</value>
<value>panelGroupLayout.jspx</value>
<value>panelHeader.jspx</value>
@@ -2041,13 +2042,17 @@
<redirect/>
</navigation-case>
+ <navigation-case>
+ <from-outcome>guide.panelCaptionGroup</from-outcome>
+ <to-view-id>/components/panelCaptionGroup.jspx</to-view-id>
+ <redirect/>
+ </navigation-case>
<navigation-case>
<from-outcome>guide.panelPopup</from-outcome>
<to-view-id>/components/panelPopup.jspx</to-view-id>
<redirect/>
</navigation-case>
-
<navigation-case>
<from-outcome>guide.form</from-outcome>
Added: myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/components/panelCaptionGroup.jspx
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/components/panelCaptionGroup.jspx?rev=572804&view=auto
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/components/panelCaptionGroup.jspx (added)
+++ myfaces/trinidad/trunk/trinidad/trinidad-examples/trinidad-demo/src/main/webapp/components/panelCaptionGroup.jspx Tue Sep 4 13:02:03 2007
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:trh="http://myfaces.apache.org/trinidad/html"
+ xmlns:tr="http://myfaces.apache.org/trinidad" >
+ <jsp:directive.page contentType="text/html;charset=utf-8"/>
+ <f:view>
+ <tr:document title="PanelCaptionGroup Demo">
+ <tr:form>
+ <tr:panelGroupLayout layout="vertical">
+ <f:facet name="separator">
+ <tr:separator />
+ </f:facet>
+ <tr:commandLink immediate="true" text="Component Guide"
+ action="guide"/>
+
+ <tr:outputFormatted styleUsage="instruction" value="<b>Simple panelCaptionGroup</b>"/>
+
+ <tr:panelCaptionGroup binding="#{editor.component}" captionText="Caption">
+ <tr:panelFormLayout>
+ <tr:inputText label="Field A" />
+ <tr:inputText label="Field B" columns="1"/>
+ <tr:inputText label="Field C" />
+ <tr:selectOneChoice label="Suffix" />
+ </tr:panelFormLayout>
+ </tr:panelCaptionGroup>
+
+ <jsp:directive.include file="editor.jspf" />
+
+ <tr:outputFormatted styleUsage="instruction" value="<b>PanelCaptionGroup using Facet</b>"/>
+
+ <tr:panelCaptionGroup>
+ <f:facet name="caption">
+ <tr:icon name="error" shortDesc="An icon as a caption" />
+ </f:facet>
+ <tr:panelFormLayout>
+ <tr:inputText label="Field A" />
+ <tr:inputText label="Field B" columns="1"/>
+ <tr:inputText label="Field C" />
+ <tr:selectOneChoice label="Suffix" />
+ </tr:panelFormLayout>
+ </tr:panelCaptionGroup>
+ </tr:panelGroupLayout>
+ </tr:form>
+ </tr:document>
+ </f:view>
+</jsp:root>
Added: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelCaptionGroupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelCaptionGroupRenderer.java?rev=572804&view=auto
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelCaptionGroupRenderer.java (added)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/PanelCaptionGroupRenderer.java Tue Sep 4 13:02:03 2007
@@ -0,0 +1,105 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.myfaces.trinidadinternal.renderkit.core.xhtml;
+
+import java.io.IOException;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+
+import org.apache.myfaces.trinidad.bean.FacesBean;
+import org.apache.myfaces.trinidad.bean.PropertyKey;
+import org.apache.myfaces.trinidad.component.core.layout.CorePanelCaptionGroup;
+import org.apache.myfaces.trinidad.context.RenderingContext;
+
+/**
+ * @author Danny Robinson
+ */
+public class PanelCaptionGroupRenderer extends XhtmlRenderer
+{
+ public PanelCaptionGroupRenderer()
+ {
+ this(CorePanelCaptionGroup.TYPE);
+ }
+
+ protected PanelCaptionGroupRenderer(FacesBean.Type type)
+ {
+ super(type);
+ }
+
+ public boolean getRendersChildren()
+ {
+ return true;
+ }
+
+ @Override
+ protected void findTypeConstants(FacesBean.Type type)
+ {
+ super.findTypeConstants(type);
+ _captionTextKey = type.findKey("captionText");
+ }
+
+ protected String getCaptionText(FacesBean bean)
+ {
+ return toString(this.resolveProperty(bean, _captionTextKey));
+ }
+
+ protected String getRootStyle()
+ {
+ return SkinSelectors.AF_PANEL_CAPTION_GROUP_ROOT_STYLE_CLASS;
+ }
+
+ protected String getCaptionStyle()
+ {
+ return SkinSelectors.AF_PANEL_CAPTION_GROUP_CAPTION_STYLE_CLASS;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void encodeAll(FacesContext context, RenderingContext arc,
+ UIComponent component, FacesBean bean) throws IOException
+ {
+ ResponseWriter writer = context.getResponseWriter();
+
+ writer.startElement(XhtmlConstants.FIELDSET_ELEMENT, component);
+ renderAllAttributes(context, arc, bean, false);
+ renderStyleClass(context, arc, getRootStyle());
+
+ UIComponent captionFacet = getFacet(component, CorePanelCaptionGroup.CAPTION_FACET);
+ String captionText = getCaptionText(bean);
+
+ // Render either the caption facet or the captionText
+ if (captionFacet != null || captionText != null)
+ {
+ writer.startElement(XhtmlConstants.LEGEND_ELEMENT, null);
+ renderStyleClass(context, arc, getCaptionStyle());
+
+ if (captionFacet != null)
+ encodeChild(context, captionFacet);
+ else
+ writer.writeText(captionText, "captionText");
+
+ writer.endElement(XhtmlConstants.LEGEND_ELEMENT);
+ }
+
+ // Output all the body of the component
+ encodeAllChildren(context, component);
+
+ writer.endElement(XhtmlConstants.FIELDSET_ELEMENT);
+ }
+
+ private PropertyKey _captionTextKey;
+
+}
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SkinSelectors.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SkinSelectors.java?rev=572804&r1=572803&r2=572804&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SkinSelectors.java (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SkinSelectors.java Tue Sep 4 13:02:03 2007
@@ -798,6 +798,20 @@
// //
// //
+ // ============================= tr:panelCaptionGroup ============================= //
+ // //
+ // //
+
+ // ============================ Style classes ============================ //
+ // Root class
+ public static final String AF_PANEL_CAPTION_GROUP_ROOT_STYLE_CLASS =
+ "af|panelCaptionGroup";
+ // panelBox parts
+ public static final String AF_PANEL_CAPTION_GROUP_CAPTION_STYLE_CLASS =
+ AF_PANEL_CAPTION_GROUP_ROOT_STYLE_CLASS + "::caption";
+
+ // //
+ // //
// ========================= tr:panelButtonBar ========================== //
// //
// //
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java?rev=572804&r1=572803&r2=572804&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java Tue Sep 4 13:02:03 2007
@@ -239,6 +239,9 @@
public static final String TABLE_HEADER_ELEMENT = "th";
public static final String TABLE_ROW_ELEMENT = "tr";
+ public static final String FIELDSET_ELEMENT = "fieldset";
+ public static final String LEGEND_ELEMENT = "legend";
+
//
// Copied from BaseDesktopConstants
//
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/adf/styles/base-desktop.xss
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/adf/styles/base-desktop.xss?rev=572804&r1=572803&r2=572804&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/adf/styles/base-desktop.xss (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/adf/styles/base-desktop.xss Tue Sep 4 13:02:03 2007
@@ -1848,6 +1848,18 @@
tr:panelPopup Styles
-->
+ <style selector="af|panelCaptionGroup">
+ <includeStyle name="AFLightAccentBorder"/>
+ </style>
+
+ <style selector="af|panelCaptionGroup::caption">
+ <includeStyle name="AFDefaultBoldFont"/>
+ </style>
+
+ <!--
+ tr:panelPopup Styles
+ -->
+
<style selector="af|panelPopup::link">
<includeStyle name="AFDefaultFont"/>
<includeStyle name="AFLinkForeground"/>