You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2010/04/27 06:20:19 UTC
svn commit: r938319 [1/3] - in
/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces: component/
component/html/ext/ custom/calendar/ custom/collapsiblepanel/
custom/column/ custom/datalist/ custom/date/ custom/div/ custom/layout/
custom/navi...
Author: lu4242
Date: Tue Apr 27 04:20:18 2010
New Revision: 938319
URL: http://svn.apache.org/viewvc?rev=938319&view=rev
Log:
TOMAHAWK-1474 Behavior support for components that contains event aware properties in jsf 2.0 module
Added:
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/EventAware.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlMessage.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlMessages.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlOutputText.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlPanelGroup.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/collapsiblepanel/
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/collapsiblepanel/AbstractHtmlCollapsiblePanel.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelRenderer.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/column/
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/column/AbstractHtmlSimpleColumn.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/column/HtmlColumn.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/datalist/
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/datalist/HtmlListRenderer.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/div/
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/div/AbstractDiv.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/div/DivRenderer.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/layout/
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/layout/AbstractHtmlPanelLayout.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/layout/HtmlLayoutRenderer.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/navigation/
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/navigation/AbstractHtmlPanelNavigation.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/navigation/HtmlNavigationRenderer.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/AbstractHtmlPanelNavigationMenu.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/popup/AbstractHtmlPopup.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/tabbedpane/AbstractHtmlPanelTab.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlGroupRenderer.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlTextRenderer.java
Modified:
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/date/HtmlDateRenderer.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/navmenu/htmlnavmenu/HtmlNavigationMenuRenderer.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/picklist/HtmlPicklistRenderer.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/tabbedpane/AbstractHtmlPanelTabbedPane.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/tabbedpane/HtmlTabbedPaneRenderer.java
myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlTableRenderer.java
Added: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/EventAware.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/EventAware.java?rev=938319&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/EventAware.java (added)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/EventAware.java Tue Apr 27 04:20:18 2010
@@ -0,0 +1,102 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.component;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
+/**
+ *
+ * @since 1.1.7
+ * @author Leonardo Uribe (latest modification by $Author: lu4242 $)
+ * @version $Revision: 691856 $ $Date: 2008-09-03 21:40:30 -0500 (mié, 03 sep 2008) $
+ */
+public interface EventAware
+{
+
+ /**
+ * HTML: Script to be invoked when the element is clicked.
+ *
+ */
+ @JSFProperty(clientEvent="click")
+ public String getOnclick();
+
+ /**
+ * HTML: Script to be invoked when the element is double-clicked.
+ *
+ */
+ @JSFProperty(clientEvent="dblclick")
+ public String getOndblclick();
+
+ /**
+ * HTML: Script to be invoked when a key is pressed down over this element.
+ *
+ */
+ @JSFProperty(clientEvent="keydown")
+ public String getOnkeydown();
+
+ /**
+ * HTML: Script to be invoked when a key is pressed over this element.
+ *
+ */
+ @JSFProperty(clientEvent="keypress")
+ public String getOnkeypress();
+
+ /**
+ * HTML: Script to be invoked when a key is released over this element.
+ *
+ */
+ @JSFProperty(clientEvent="keyup")
+ public String getOnkeyup();
+
+ /**
+ * HTML: Script to be invoked when the pointing device is pressed over this element.
+ *
+ */
+ @JSFProperty(clientEvent="mousedown")
+ public String getOnmousedown();
+
+ /**
+ * HTML: Script to be invoked when the pointing device is moved while it is in this element.
+ *
+ */
+ @JSFProperty(clientEvent="mousemove")
+ public String getOnmousemove();
+
+ /**
+ * HTML: Script to be invoked when the pointing device is moves out of this element.
+ *
+ */
+ @JSFProperty(clientEvent="mouseout")
+ public String getOnmouseout();
+
+ /**
+ * HTML: Script to be invoked when the pointing device is moved into this element.
+ *
+ */
+ @JSFProperty(clientEvent="mouseover")
+ public String getOnmouseover();
+
+ /**
+ * HTML: Script to be invoked when the pointing device is released over this element.
+ *
+ */
+ @JSFProperty(clientEvent="mouseup")
+ public String getOnmouseup();
+
+}
Added: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlMessage.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlMessage.java?rev=938319&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlMessage.java (added)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlMessage.java Tue Apr 27 04:20:18 2010
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.component.html.ext;
+
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.component.EventAware;
+import org.apache.myfaces.component.ForceIdAware;
+import org.apache.myfaces.component.UniversalProperties;
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.component.UserRoleUtils;
+import org.apache.myfaces.component.html.util.HtmlComponentUtils;
+
+/**
+ * MyFaces extension to the standard messages tag: see summaryDetailSeparator attribute.
+ *
+ * Unless otherwise specified, all attributes accept static values or EL expressions.
+ *
+ * @JSFComponent
+ * name = "t:message"
+ * class = "org.apache.myfaces.component.html.ext.HtmlMessage"
+ * tagClass = "org.apache.myfaces.generated.taglib.html.ext.HtmlMessageTag"
+ * @since 1.1.7
+ * @author Manfred Geiler (latest modification by $Author: lu4242 $)
+ * @version $Revision: 691856 $ $Date: 2008-09-03 21:40:30 -0500 (mié, 03 sep 2008) $
+ */
+public abstract class AbstractHtmlMessage
+ extends javax.faces.component.html.HtmlMessage
+ implements UserRoleAware, MessageProperties, ForceIdAware,
+ EventAware, UniversalProperties,
+ ClientBehaviorHolder
+{
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlMessage";
+ public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Message";
+
+ public String getClientId(FacesContext context)
+ {
+ String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
+ if (clientId == null)
+ {
+ clientId = super.getClientId(context);
+ }
+ return clientId;
+ }
+
+ public boolean isRendered()
+ {
+ if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
+ return super.isRendered();
+ }
+
+ public boolean getForceSpan(){
+ return isForceSpan();
+ }
+}
Added: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlMessages.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlMessages.java?rev=938319&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlMessages.java (added)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlMessages.java Tue Apr 27 04:20:18 2010
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.component.html.ext;
+
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.component.EventAware;
+import org.apache.myfaces.component.ForceIdAware;
+import org.apache.myfaces.component.UniversalProperties;
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.component.UserRoleUtils;
+import org.apache.myfaces.component.html.util.HtmlComponentUtils;
+
+/**
+ * MyFaces extension to the standard messages tag: see showInputLabel attribute.
+ *
+ * Unless otherwise specified, all attributes accept static values or EL expressions.
+ *
+ * @JSFComponent
+ * name = "t:messages"
+ * class = "org.apache.myfaces.component.html.ext.HtmlMessages"
+ * tagClass = "org.apache.myfaces.generated.taglib.html.ext.HtmlMessagesTag"
+ * @since 1.1.7
+ * @author Thomas Spiegl (latest modification by $Author: lu4242 $)
+ * @author Manfred Geiler
+ * @version $Revision: 691856 $ $Date: 2008-09-03 21:40:30 -0500 (mié, 03 sep 2008) $
+ */
+public abstract class AbstractHtmlMessages
+ extends javax.faces.component.html.HtmlMessages
+ implements UserRoleAware, MessageProperties, ForceIdAware,
+ EventAware, UniversalProperties,
+ ClientBehaviorHolder
+{
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlMessages";
+ public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Messages";
+
+ public String getClientId(FacesContext context)
+ {
+ String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
+ if (clientId == null)
+ {
+ clientId = super.getClientId(context);
+ }
+
+ return clientId;
+ }
+
+ public boolean isRendered()
+ {
+ if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
+ return super.isRendered();
+ }
+
+ public boolean getForceSpan(){
+ return isForceSpan();
+ }
+
+ /**
+ * Like summaryFormat, but applies to global messages
+ * (i.e. messages not associated with a component). If no
+ * globalSummaryFormat is given, the summaryFormat is used
+ * for global messages. Example: "{0}:"
+ *
+ * @JSFProperty
+ */
+ public abstract String getGlobalSummaryFormat();
+
+}
Added: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlOutputText.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlOutputText.java?rev=938319&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlOutputText.java (added)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlOutputText.java Tue Apr 27 04:20:18 2010
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.component.html.ext;
+
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.component.EventAware;
+import org.apache.myfaces.component.ForceIdAware;
+import org.apache.myfaces.component.UniversalProperties;
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.component.UserRoleUtils;
+import org.apache.myfaces.component.html.util.HtmlComponentUtils;
+
+/**
+ * Extends standard outputText with user role support.
+ *
+ * Unless otherwise specified, all attributes accept static values or EL expressions.
+ *
+ * @JSFComponent
+ * name = "t:outputText"
+ * class = "org.apache.myfaces.component.html.ext.HtmlOutputText"
+ * tagClass = "org.apache.myfaces.generated.taglib.html.ext.HtmlOutputTextTag"
+ * @since 1.1.7
+ * @author Manfred Geiler (latest modification by $Author: lu4242 $)
+ * @version $Revision: 691856 $ $Date: 2008-09-03 21:40:30 -0500 (mié, 03 sep 2008) $
+ */
+public abstract class AbstractHtmlOutputText
+ extends javax.faces.component.html.HtmlOutputText
+ implements UserRoleAware, ForceIdAware, EventAware,UniversalProperties,
+ ClientBehaviorHolder
+{
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlOutputText";
+ public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Text";
+
+ public String getClientId(FacesContext context)
+ {
+ String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
+ if (clientId == null)
+ {
+ clientId = super.getClientId(context);
+ }
+
+ return clientId;
+ }
+
+ public boolean isRendered()
+ {
+ if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
+ return super.isRendered();
+ }
+
+}
Added: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlPanelGroup.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlPanelGroup.java?rev=938319&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlPanelGroup.java (added)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/component/html/ext/AbstractHtmlPanelGroup.java Tue Apr 27 04:20:18 2010
@@ -0,0 +1,105 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.component.html.ext;
+
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.component.DisplayValueOnlyAware;
+import org.apache.myfaces.component.EventAware;
+import org.apache.myfaces.component.ForceIdAware;
+import org.apache.myfaces.component.UniversalProperties;
+import org.apache.myfaces.component.UserRoleAware;
+import org.apache.myfaces.component.UserRoleUtils;
+import org.apache.myfaces.component.html.util.HtmlComponentUtils;
+import org.apache.myfaces.shared_tomahawk.component.DisplayValueOnlyCapable;
+
+/**
+ * Extends standard panelGroup with user role support.
+ *
+ * Unless otherwise specified, all attributes accept static values or EL expressions.
+ *
+ * @JSFComponent
+ * name = "t:panelGroup"
+ * class = "org.apache.myfaces.component.html.ext.HtmlPanelGroup"
+ * tagClass = "org.apache.myfaces.generated.taglib.html.ext.HtmlPanelGroupTag"
+ * @since 1.1.7
+ * @author Manfred Geiler (latest modification by $Author: lu4242 $)
+ * @version $Revision: 691856 $ $Date: 2008-09-03 21:40:30 -0500 (mié, 03 sep 2008) $
+ */
+public abstract class AbstractHtmlPanelGroup
+ extends javax.faces.component.html.HtmlPanelGroup
+ implements UserRoleAware, DisplayValueOnlyCapable,
+ DisplayValueOnlyAware, ForceIdAware, EventAware, UniversalProperties,
+ ClientBehaviorHolder
+{
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlPanelGroup";
+ public static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Group";
+
+ public static final int DEFAULT_COLSPAN = Integer.MIN_VALUE;
+ public static final String BLOCK_LAYOUT = "block";
+
+ public String getClientId(FacesContext context)
+ {
+ String clientId = HtmlComponentUtils.getClientId(this, getRenderer(context), context);
+ if (clientId == null)
+ {
+ clientId = super.getClientId(context);
+ }
+
+ return clientId;
+ }
+
+ public boolean isRendered()
+ {
+ if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
+ return super.isRendered();
+ }
+
+ public boolean isSetDisplayValueOnly(){
+ return getDisplayValueOnly() != null ? true : false;
+ }
+
+ public boolean isDisplayValueOnly(){
+ return getDisplayValueOnly() != null ? getDisplayValueOnly().booleanValue() : false;
+ }
+
+ public void setDisplayValueOnly(boolean displayValueOnly){
+ this.setDisplayValueOnly((Boolean) Boolean.valueOf(displayValueOnly));
+ }
+
+ /**
+ * Determines the type of layout that is used when rendering a
+ * panelGroup: when 'block' is specified, an HTML div is rendered
+ * instead of the default HTML span.
+ *
+ * @JSFProperty
+ * defaultValue = "block"
+ */
+ public abstract String getLayout();
+
+ /**
+ * standard html colspan attribute for table cell
+ *
+ * @JSFProperty
+ * defaultValue = "Integer.MIN_VALUE"
+ */
+ public abstract int getColspan();
+
+}
Modified: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java?rev=938319&r1=938318&r2=938319&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java (original)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java Tue Apr 27 04:20:18 2010
@@ -36,6 +36,7 @@ import javax.faces.component.EditableVal
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.component.UIParameter;
+import javax.faces.component.behavior.ClientBehavior;
import javax.faces.component.html.HtmlCommandLink;
import javax.faces.component.html.HtmlOutputText;
import javax.faces.context.FacesContext;
@@ -336,8 +337,19 @@ public class HtmlCalendarRenderer
writer.startElement(HTML.TABLE_ELEM, inputCalendar);
HtmlRendererUtils.renderHTMLAttributes(writer, inputCalendar, HTML.UNIVERSAL_ATTRIBUTES);
- HtmlRendererUtils.renderHTMLAttributes(writer, inputCalendar, HTML.EVENT_HANDLER_ATTRIBUTES);
- HtmlRendererUtils.renderHTMLAttributes(writer, inputCalendar, HTML.COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONSELECT_AND_ONCHANGE);
+
+ Map<String, List<ClientBehavior>> behaviors = inputCalendar.getClientBehaviors();
+
+ if (behaviors != null && !behaviors.isEmpty())
+ {
+ HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, inputCalendar, behaviors);
+ HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(facesContext, writer, inputCalendar, behaviors);
+ }
+ else
+ {
+ HtmlRendererUtils.renderHTMLAttributes(writer, inputCalendar, HTML.EVENT_HANDLER_ATTRIBUTES);
+ HtmlRendererUtils.renderHTMLAttributes(writer, inputCalendar, HTML.COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONSELECT_AND_ONCHANGE);
+ }
writer.flush();
HtmlRendererUtils.writePrettyLineSeparator(facesContext);
Added: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/collapsiblepanel/AbstractHtmlCollapsiblePanel.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/collapsiblepanel/AbstractHtmlCollapsiblePanel.java?rev=938319&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/collapsiblepanel/AbstractHtmlCollapsiblePanel.java (added)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/collapsiblepanel/AbstractHtmlCollapsiblePanel.java Tue Apr 27 04:20:18 2010
@@ -0,0 +1,291 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.custom.collapsiblepanel;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+
+import org.apache.myfaces.component.EventAware;
+import org.apache.myfaces.component.StyleAware;
+import org.apache.myfaces.component.UniversalProperties;
+import org.apache.myfaces.component.UserRoleAware;
+
+/**
+ * A component which just renders as a single icon (with optional label) when "collapsed", hiding all child components.
+ *
+ * When open, the child components can be seen.
+ *
+ * The title attribute defines the label shown for the collapsible panel.
+ *
+ * @JSFComponent
+ * name = "t:collapsiblePanel"
+ * class = "org.apache.myfaces.custom.collapsiblepanel.HtmlCollapsiblePanel"
+ * tagClass = "org.apache.myfaces.custom.collapsiblepanel.HtmlCollapsiblePanelTag"
+ *
+ * @JSFJspProperty name = "converter" tagExcluded = "true"
+ * @since 1.1.7
+ * @author Kalle Korhonen (latest modification by $Author: lu4242 $)
+ * @version $Revision: 691856 $ $Date: 2008-09-03 21:40:30 -0500 (mié, 03 sep 2008) $
+ *
+ */
+public abstract class AbstractHtmlCollapsiblePanel extends UIInput
+ implements StyleAware, UniversalProperties, EventAware,
+ UserRoleAware, ClientBehaviorHolder
+{
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlCollapsiblePanel";
+ public static final String COMPONENT_FAMILY = "javax.faces.Panel";
+ private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.CollapsiblePanel";
+
+ private static final String HEADER_FACET_NAME = "header";
+
+ private static final String CLOSED_CONTENT_FACET_NAME = "closedContent";
+
+ private boolean _currentlyCollapsed;
+
+ public void setCurrentlyCollapsed(boolean collapsed)
+ {
+ _currentlyCollapsed = collapsed;
+ }
+
+ public boolean isCurrentlyCollapsed()
+ {
+ return _currentlyCollapsed;
+ }
+
+ public void setHeader(UIComponent header)
+ {
+ getFacets().put(HEADER_FACET_NAME, header);
+ }
+
+ /**
+ * @JSFFacet
+ */
+ public UIComponent getHeader()
+ {
+ return (UIComponent) getFacets().get(HEADER_FACET_NAME);
+ }
+
+ public void setClosedContent(UIComponent closedContent)
+ {
+ getFacets().put(CLOSED_CONTENT_FACET_NAME, closedContent);
+ }
+
+ /**
+ * @JSFFacet
+ */
+ public UIComponent getClosedContent()
+ {
+ return (UIComponent) getFacets().get(CLOSED_CONTENT_FACET_NAME);
+ }
+
+ //private static final Log log = LogFactory.getLog(HtmlCollapsiblePanel.class);
+
+ public void processDecodes(FacesContext context)
+ {
+ if (context == null) throw new NullPointerException("context");
+
+ initialiseVars(context);
+
+ if (!isRendered()) return;
+
+ try
+ {
+ decode(context);
+ }
+ catch (RuntimeException e)
+ {
+ context.renderResponse();
+ throw e;
+ }
+
+ UIComponent headerComponent = getFacet("header");
+
+ if(headerComponent != null)
+ {
+ for (Iterator it = headerComponent.getChildren().iterator(); it.hasNext(); )
+ {
+ UIComponent child = (UIComponent)it.next();
+
+ child.processDecodes(context);
+ }
+ }
+
+ if(isCurrentlyCollapsed())
+ {
+ UIComponent component = getFacet("closedContent");
+
+ if(component != null)
+ {
+ component.processDecodes(context);
+ }
+ }
+ else
+ {
+ for (Iterator it = getChildren().iterator(); it.hasNext(); )
+ {
+ UIComponent child = (UIComponent)it.next();
+ child.processDecodes(context);
+ }
+ }
+
+ removeVars(context);
+ }
+
+ public String getClientId(FacesContext context)
+ {
+ return super.getClientId(context);
+ }
+
+ public void processUpdates(FacesContext context)
+ {
+ initialiseVars(context);
+
+ super.processUpdates(context);
+
+ removeVars(context);
+ }
+
+ private void initialiseVars(FacesContext context)
+ {
+ if(getVar()!=null)
+ {
+ context.getExternalContext().getRequestMap().put(getVar(),
+ Boolean.valueOf(isCollapsed()));
+ }
+
+ if(getTitleVar()!=null)
+ {
+ context.getExternalContext().getRequestMap().put(getTitleVar(),
+ getTitle());
+ }
+ }
+
+ private void removeVars(FacesContext context)
+ {
+ if(getVar()!=null)
+ {
+ context.getExternalContext().getRequestMap().remove(getVar());
+ }
+
+ if(getTitleVar()!=null)
+ {
+ context.getExternalContext().getRequestMap().remove(getTitleVar());
+ }
+ }
+
+ public void processValidators(FacesContext context)
+ {
+ initialiseVars(context);
+
+ super.processValidators(context);
+
+ removeVars(context);
+ }
+
+ public void encodeChildren(FacesContext context) throws IOException
+ {
+ initialiseVars(context);
+
+ super.encodeChildren(context);
+
+ removeVars(context);
+ }
+
+ public void updateModel(FacesContext context)
+ {
+ super.updateModel(context);
+ }
+
+ public boolean isCollapsed()
+ {
+ return isCollapsed(getValue());
+ }
+
+ public static boolean isCollapsed(Object collapsedValue)
+ {
+ Object value = collapsedValue;
+
+ if(value instanceof Boolean)
+ {
+ return ((Boolean) value).booleanValue();
+ }
+ else if (value instanceof String)
+ {
+ return Boolean.valueOf((String) value).booleanValue();
+ }
+
+ return true;
+ }
+
+ /**
+ * The variable which you can use to check for the collapsed
+ * state of the enclosing component. This is especially useful
+ * for custom headers you define in a facet with name 'header'.
+ *
+ * @JSFProperty
+ */
+ public abstract String getVar();
+
+ /**
+ * This variable is defined to hold the value of the title
+ * component - you can use it for accessing this value in
+ * custom headers you define in a facet with name 'header'.
+ *
+ * @JSFProperty
+ */
+ public abstract String getTitleVar();
+
+ /**
+ * @JSFProperty tagExcluded = "true"
+ */
+ public MethodBinding getValidator(){
+ return super.getValidator();
+ }
+
+ /**
+ * @JSFProperty tagExcluded = "true"
+ */
+ public MethodBinding getValueChangeListener()
+ {
+ return super.getValueChangeListener();
+ }
+
+ /**
+ * @JSFProperty tagExcluded = "true"
+ */
+ public boolean isImmediate()
+ {
+ return super.isImmediate();
+ }
+
+ /**
+ * @JSFProperty tagExcluded = "true"
+ */
+ public boolean isRequired()
+ {
+ return super.isRequired();
+ }
+
+}
Added: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelRenderer.java?rev=938319&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelRenderer.java (added)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/collapsiblepanel/HtmlCollapsiblePanelRenderer.java Tue Apr 27 04:20:18 2010
@@ -0,0 +1,244 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.custom.collapsiblepanel;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.application.Application;
+import javax.faces.application.ViewHandler;
+import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
+import javax.faces.component.behavior.ClientBehavior;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import javax.faces.component.html.HtmlCommandLink;
+import javax.faces.component.html.HtmlOutputText;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.convert.ConverterException;
+
+import org.apache.myfaces.renderkit.html.util.DummyFormUtils;
+import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRenderer;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils;
+
+/**
+ * @JSFRenderer
+ * renderKitId = "HTML_BASIC"
+ * family = "javax.faces.Panel"
+ * type = "org.apache.myfaces.CollapsiblePanel"
+ *
+ * @author Kalle Korhonen (latest modification by $Author: lu4242 $)
+ * @version $Revision: 671709 $ $Date: 2008-06-25 22:12:59 -0500 (mié, 25 jun 2008) $
+ */
+public class HtmlCollapsiblePanelRenderer extends HtmlRenderer {
+ //private static final Log log = LogFactory.getLog(HtmlCollapsiblePanel.class);
+ private static final String LINK_ID = "ToggleCollapsed".intern();
+ private static final String COLLAPSED_STATE_ID = "CollapsedState".intern();
+
+ public boolean getRendersChildren() {
+ return true;
+ }
+
+ public void encodeChildren(FacesContext facesContext, UIComponent uiComponent) throws IOException {
+ // RendererUtils.checkParamValidity(facesContext, uiComponent, HtmlCollapsiblePanel.class);
+ ResponseWriter writer = facesContext.getResponseWriter();
+ HtmlCollapsiblePanel collapsiblePanel = (HtmlCollapsiblePanel) uiComponent;
+
+ UIComponent headerComp = collapsiblePanel.getFacet("header");
+
+ if (headerComp == null){
+ HtmlCommandLink link = getLink(facesContext, collapsiblePanel);
+ collapsiblePanel.getChildren().add(link);
+
+ headerComp = link;
+ }
+
+ //Render the current state - collapsed or not - of the panel.
+ HtmlRendererUtils.renderHiddenInputField(writer, collapsiblePanel.getClientId(facesContext) +
+ COLLAPSED_STATE_ID,
+ collapsiblePanel.getSubmittedValue() != null ?
+ collapsiblePanel.getSubmittedValue() : (collapsiblePanel.isCollapsed() + ""));
+
+ // Always render the header - to be able toggle the collapsed state
+ RendererUtils.renderChild(facesContext, headerComp);
+ headerComp.setRendered(false);
+
+ // conditionally render the rest of the children
+ if (!collapsiblePanel.isCollapsed()) {
+ HtmlRendererUtils.writePrettyLineSeparator(facesContext);
+ // TODO apply styles from the parent element to this DIV
+ writer.startElement(HTML.DIV_ELEM, uiComponent);
+ RendererUtils.renderChildren(facesContext, uiComponent);
+ writer.endElement(HTML.DIV_ELEM);
+ HtmlRendererUtils.writePrettyLineSeparator(facesContext);
+ }
+ else {
+ UIComponent component = collapsiblePanel.getFacet("closedContent");
+ if (component != null) {
+ writer.startElement(HTML.DIV_ELEM, uiComponent);
+ RendererUtils.renderChild(facesContext, component);
+ writer.endElement(HTML.DIV_ELEM);
+ HtmlRendererUtils.writePrettyLineSeparator(facesContext);
+ }
+ }
+
+ headerComp.setRendered(true);
+ }
+
+ public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException {
+ RendererUtils.checkParamValidity(facesContext, uiComponent, HtmlCollapsiblePanel.class);
+ ResponseWriter writer = facesContext.getResponseWriter();
+
+ HtmlRendererUtils.writePrettyLineSeparator(facesContext);
+ writer.startElement(HTML.DIV_ELEM, uiComponent);
+
+ Map<String, List<ClientBehavior>> behaviors = null;
+ if (uiComponent instanceof ClientBehaviorHolder)
+ {
+ behaviors = ((ClientBehaviorHolder) uiComponent).getClientBehaviors();
+ }
+
+ if (behaviors != null && !behaviors.isEmpty())
+ {
+ HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.UNIVERSAL_ATTRIBUTES);
+ HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, uiComponent, behaviors);
+ }
+ else
+ {
+ HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.COMMON_PASSTROUGH_ATTRIBUTES);
+ }
+
+ ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
+ String viewId = facesContext.getViewRoot().getViewId();
+ viewHandler.getActionURL(facesContext, viewId);
+
+ facesContext.getApplication();
+ }
+
+
+ public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException {
+ //RendererUtils.checkParamValidity(facesContext, uiComponent, HtmlCollapsiblePanel.class);
+ ResponseWriter writer = facesContext.getResponseWriter();
+ writer.endElement(HTML.DIV_ELEM);
+ HtmlRendererUtils.writePrettyLineSeparator(facesContext);
+ }
+
+ public void decode(FacesContext facesContext, UIComponent uiComponent) {
+ RendererUtils.checkParamValidity(facesContext, uiComponent, HtmlCollapsiblePanel.class);
+ HtmlCollapsiblePanel collapsiblePanel = (HtmlCollapsiblePanel) uiComponent;
+
+ Map reqParams = facesContext.getExternalContext().getRequestParameterMap();
+
+ String togglingIndicated = (String) reqParams.get(HtmlRendererUtils
+ .getHiddenCommandLinkFieldName(
+ DummyFormUtils.findNestingForm(collapsiblePanel, facesContext)));
+ // if togglingIndicated is null this application could be running within the RI.
+ // The RI denotes link activation by adding a hidden field with the name
+ // and value of the link client ID.
+ if (togglingIndicated == null
+ && reqParams.containsKey(collapsiblePanel.getClientId(facesContext) + LINK_ID)) {
+ togglingIndicated = collapsiblePanel.getClientId(facesContext) + LINK_ID;
+ }
+
+ String reqValue = (String) reqParams.get(
+ collapsiblePanel.getClientId(facesContext) + COLLAPSED_STATE_ID);
+
+ collapsiblePanel.setCurrentlyCollapsed(HtmlCollapsiblePanel.isCollapsed(reqValue));
+
+ if ((collapsiblePanel.getClientId(facesContext) + LINK_ID).equals(togglingIndicated)) {
+ if (reqValue != null)
+ {
+ collapsiblePanel.setSubmittedValue("" + !collapsiblePanel.isCurrentlyCollapsed());
+ }
+ else
+ {
+ collapsiblePanel.setSubmittedValue("" + !collapsiblePanel.isCollapsed());
+ }
+
+ UIComponent header = collapsiblePanel.getFacet("header");
+
+ if (header != null)
+ {
+ UICommand link = (UICommand)RendererUtils.findComponent(header,HtmlHeaderLink.class);
+
+ if (link != null && link.isImmediate())
+ {
+ //In this case we need to update the model directly, because
+ //PROCESS_VALIDATIONS and UPDATE_MODEL phase is not called
+ //(immediate=true), but we need to reflect the change
+ //on the collapsed value.
+ //In this case, no ValueChangeEvent is fired,
+ //because it is an immediate call.
+ Object convertedValue = getConvertedValue(facesContext,collapsiblePanel,
+ collapsiblePanel.getSubmittedValue());
+
+ collapsiblePanel.setValue(convertedValue);
+ collapsiblePanel.setSubmittedValue(null);
+ collapsiblePanel.updateModel(facesContext);
+ }
+ }
+ }
+ else {
+ if (reqValue != null)
+ collapsiblePanel.setSubmittedValue("" + collapsiblePanel.isCurrentlyCollapsed());
+ }
+ }
+
+ protected HtmlCommandLink getLink(FacesContext facesContext, HtmlCollapsiblePanel collapsiblePanel)
+ throws IOException {
+ Application application = facesContext.getApplication();
+ HtmlCommandLink link = (HtmlCommandLink) application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
+ link.setId(collapsiblePanel.getId() + LINK_ID);
+ link.setTransient(true);
+ link.setImmediate(true);
+
+ List children = link.getChildren();
+ // Create the indicator. You could later make this conditional and render optional images instead
+ HtmlOutputText uiText = (HtmlOutputText) application.createComponent(HtmlOutputText.COMPONENT_TYPE);
+ uiText.setTransient(true);
+ uiText.setValue(collapsiblePanel.isCollapsed() ? ">" : "ν");
+ uiText.setEscape(false);
+ uiText.setStyleClass(collapsiblePanel.getStyleClass());
+ uiText.setStyle(collapsiblePanel.getStyle());
+ children.add(uiText);
+
+ // Create the optional label
+ String label = collapsiblePanel.getTitle();
+ if (label != null) {
+ uiText = (HtmlOutputText) application.createComponent(HtmlOutputText.COMPONENT_TYPE);
+ uiText.setTransient(true);
+ uiText.setValue(" " + label);
+ uiText.setStyleClass(collapsiblePanel.getStyleClass());
+ uiText.setStyle(collapsiblePanel.getStyle());
+ children.add(uiText);
+ }
+ return link;
+ }
+
+ public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException {
+ if (submittedValue instanceof String) {
+ return Boolean.valueOf((String) submittedValue);
+ }
+
+ return super.getConvertedValue(context, component, submittedValue);
+ }
+}
Added: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/column/AbstractHtmlSimpleColumn.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/column/AbstractHtmlSimpleColumn.java?rev=938319&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/column/AbstractHtmlSimpleColumn.java (added)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/column/AbstractHtmlSimpleColumn.java Tue Apr 27 04:20:18 2010
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.custom.column;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+
+/**
+ * A tag that extend h:column to provide HTML passthrough attributes.
+ * Tag t:column can be used instead of h:column in a t:datatable.
+ * It provides HTML passthrough attributes for header (th), footer
+ * (td) and row cells (td). Unless otherwise specified, all
+ * attributes accept static values or EL expressions.
+ *
+ * @JSFComponent
+ * name = "t:column"
+ * class = "org.apache.myfaces.custom.column.HtmlSimpleColumn"
+ * tagClass = "org.apache.myfaces.custom.column.HtmlColumnTag"
+ * @since 1.1.7
+ * @author Mathias Broekelmann (latest modification by $Author: lu4242 $)
+ * @version $Revision: 691856 $ $Date: 2008-09-03 21:40:30 -0500 (mié, 03 sep 2008) $
+ */
+public abstract class AbstractHtmlSimpleColumn extends UIColumn implements HtmlColumn,
+ ClientBehaviorHolder
+{
+ public static final String COMPONENT_TYPE = "org.apache.myfaces.HtmlColumn";
+
+
+ public boolean isGroupByValueSet()
+ {
+ return getGroupByValue() != null;
+ }
+
+ /**
+ * This attribute tells the datatable to group by data in this column
+ *
+ * @JSFProperty
+ * defaultValue = "false"
+ */
+ public abstract boolean isGroupBy();
+
+
+ /**
+ * Optional - Allows you configure where to get the value to
+ * check for the group change condition. Default: all children
+ * of the column cell will be checked
+ *
+ * @JSFProperty
+ */
+ public abstract Object getGroupByValue();
+
+ /**
+ * This attribute tells the datatable to make this column the
+ * default sorted, when sortable=true
+ *
+ * @JSFProperty
+ * defaultValue = "false"
+ */
+ public abstract boolean isDefaultSorted();
+
+ /**
+ * This attribute makes this column automaticaly sortable
+ * by a row object's property
+ *
+ * @JSFProperty
+ * defaultValue = "false"
+ */
+ public abstract boolean isSortable();
+
+ /**
+ * This attribute tells row object's property by which
+ * sorting will be performed on this column
+ *
+ * @JSFProperty
+ */
+ public abstract String getSortPropertyName();
+
+}
Added: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/column/HtmlColumn.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/column/HtmlColumn.java?rev=938319&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/column/HtmlColumn.java (added)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/column/HtmlColumn.java Tue Apr 27 04:20:18 2010
@@ -0,0 +1,454 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.custom.column;
+
+import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
+
+/**
+ * @author Mathias Broekelmann (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public interface HtmlColumn
+{
+ /**
+ *
+ */
+ @JSFProperty
+ String getFooterdir();
+
+ void setFooterdir(String footerdir);
+
+ /**
+ *
+ */
+ @JSFProperty
+ String getFooterlang();
+
+ void setFooterlang(String footerlang);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="footerclick")
+ String getFooteronclick();
+
+ void setFooteronclick(String footeronclick);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="footerdblclick")
+ String getFooterondblclick();
+
+ void setFooterondblclick(String footerondblclick);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="footerkeydown")
+ String getFooteronkeydown();
+
+ void setFooteronkeydown(String footeronkeydown);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="footerkeypress")
+ String getFooteronkeypress();
+
+ void setFooteronkeypress(String footeronkeypress);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="footerkeyup")
+ String getFooteronkeyup();
+
+ void setFooteronkeyup(String footeronkeyup);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="footermousedown")
+ String getFooteronmousedown();
+
+ void setFooteronmousedown(String footeronmousedown);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="footermousemove")
+ String getFooteronmousemove();
+
+ void setFooteronmousemove(String footeronmousemove);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="footermouseout")
+ String getFooteronmouseout();
+
+ void setFooteronmouseout(String footeronmouseout);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="footermouseover")
+ String getFooteronmouseover();
+
+ void setFooteronmouseover(String footeronmouseover);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="footermouseup")
+ String getFooteronmouseup();
+
+ void setFooteronmouseup(String footeronmouseup);
+
+ /**
+ *
+ */
+ @JSFProperty
+ String getFooterstyle();
+
+ void setFooterstyle(String footerstyle);
+
+ /**
+ * Corresponds to the HTML class attribute.
+ *
+ *
+ */
+ @JSFProperty
+ String getFooterstyleClass();
+
+ void setFooterstyleClass(String footerstyleClass);
+
+ /**
+ *
+ */
+ @JSFProperty
+ String getFootertitle();
+
+ void setFootertitle(String footertitle);
+
+ /**
+ *
+ */
+ @JSFProperty
+ String getHeaderdir();
+
+ void setHeaderdir(String headerdir);
+
+ /**
+ *
+ */
+ @JSFProperty
+ String getHeaderlang();
+
+ void setHeaderlang(String headerlang);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="headerclick")
+ String getHeaderonclick();
+
+ void setHeaderonclick(String headeronclick);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="headerdblclick")
+ String getHeaderondblclick();
+
+ void setHeaderondblclick(String headerondblclick);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="headerkeydown")
+ String getHeaderonkeydown();
+
+ void setHeaderonkeydown(String headeronkeydown);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="headerkeypress")
+ String getHeaderonkeypress();
+
+ void setHeaderonkeypress(String headeronkeypress);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="headerkeyup")
+ String getHeaderonkeyup();
+
+ void setHeaderonkeyup(String headeronkeyup);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="headermousedown")
+ String getHeaderonmousedown();
+
+ void setHeaderonmousedown(String headeronmousedown);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="headermousemove")
+ String getHeaderonmousemove();
+
+ void setHeaderonmousemove(String headeronmousemove);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="headermouseout")
+ String getHeaderonmouseout();
+
+ void setHeaderonmouseout(String headeronmouseout);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="headermouseover")
+ String getHeaderonmouseover();
+
+ void setHeaderonmouseover(String headeronmouseover);
+
+ /**
+ *
+ */
+ @JSFProperty(clientEvent="headermouseup")
+ String getHeaderonmouseup();
+
+ void setHeaderonmouseup(String headeronmouseup);
+
+ /**
+ *
+ */
+ @JSFProperty
+ String getHeaderstyle();
+
+ void setHeaderstyle(String headerstyle);
+
+ /**
+ * Corresponds to the HTML class attribute.
+ *
+ */
+ @JSFProperty
+ String getHeaderstyleClass();
+
+ void setHeaderstyleClass(String headerstyleClass);
+
+ /**
+ *
+ */
+ @JSFProperty
+ String getHeadertitle();
+
+ void setHeadertitle(String headertitle);
+
+ /**
+ * HTML: The direction of text display, either 'ltr'
+ * (left-to-right) or 'rtl' (right-to-left).
+ *
+ */
+ @JSFProperty
+ String getDir();
+
+ void setDir(String dir);
+
+ /**
+ * HTML: The base language of this document.
+ *
+ */
+ @JSFProperty
+ String getLang();
+
+ void setLang(String lang);
+
+ /**
+ * HTML: Script to be invoked when the element is clicked.
+ *
+ */
+ @JSFProperty(clientEvent="click")
+ public String getOnclick();
+
+ void setOnclick(String onclick);
+
+ /**
+ * HTML: Script to be invoked when the element is double-clicked.
+ *
+ */
+ @JSFProperty(clientEvent="dblclick")
+ public String getOndblclick();
+
+ void setOndblclick(String ondblclick);
+
+ /**
+ * HTML: Script to be invoked when a key is pressed down over this element.
+ *
+ */
+ @JSFProperty(clientEvent="keydown")
+ public String getOnkeydown();
+
+ void setOnkeydown(String onkeydown);
+
+ /**
+ * HTML: Script to be invoked when a key is pressed over this element.
+ *
+ */
+ @JSFProperty(clientEvent="keypress")
+ public String getOnkeypress();
+
+ void setOnkeypress(String onkeypress);
+
+ /**
+ * HTML: Script to be invoked when a key is released over this element.
+ *
+ */
+ @JSFProperty(clientEvent="keyup")
+ public String getOnkeyup();
+
+ void setOnkeyup(String onkeyup);
+
+ /**
+ * HTML: Script to be invoked when the pointing device is pressed over this element.
+ *
+ */
+ @JSFProperty(clientEvent="mousedown")
+ public String getOnmousedown();
+
+ void setOnmousedown(String onmousedown);
+
+ /**
+ * HTML: Script to be invoked when the pointing device is moved while it is in this element.
+ *
+ */
+ @JSFProperty(clientEvent="mousemove")
+ public String getOnmousemove();
+
+ void setOnmousemove(String onmousemove);
+
+ /**
+ * HTML: Script to be invoked when the pointing device is moves out of this element.
+ *
+ */
+ @JSFProperty(clientEvent="mouseout")
+ public String getOnmouseout();
+
+ void setOnmouseout(String onmouseout);
+
+ /**
+ * HTML: Script to be invoked when the pointing device is moved into this element.
+ *
+ */
+ @JSFProperty(clientEvent="mouseover")
+ public String getOnmouseover();
+
+ void setOnmouseover(String onmouseover);
+
+ /**
+ * HTML: Script to be invoked when the pointing device is released over this element.
+ *
+ */
+ @JSFProperty(clientEvent="mouseup")
+ public String getOnmouseup();
+
+ void setOnmouseup(String onmouseup);
+
+ /**
+ * HTML: CSS styling instructions.
+ *
+ */
+ @JSFProperty
+ String getStyle();
+
+ void setStyle(String style);
+
+ /**
+ * The CSS class for this element. Corresponds to the HTML 'class' attribute.
+ *
+ */
+ @JSFProperty
+ String getStyleClass();
+
+ void setStyleClass(String styleClass);
+
+ /**
+ * HTML: An advisory title for this element. Often used by
+ * the user agent as a tooltip.
+ *
+ */
+ @JSFProperty
+ String getTitle();
+
+ void setTitle(String title);
+
+ /**
+ * This attribute can be used to set the width of the elements.
+ *
+ */
+ @JSFProperty
+ String getWidth();
+
+ void setWidth(String width);
+
+ /**
+ * This attribute specifies the colspan attribute for the cell
+ *
+ */
+ @JSFProperty
+ String getColspan();
+
+ void setColspan(String colspan);
+
+ /**
+ *
+ */
+ @JSFProperty
+ String getHeadercolspan();
+
+ void setHeadercolspan(String headercolspan);
+
+ /**
+ *
+ */
+ @JSFProperty
+ String getFootercolspan();
+
+ void setFootercolspan(String footercolspan);
+
+ /**
+ * The columnId which will be used as id for the column header.
+ * Notice: As the rowId on t:datatable this will not add
+ * any namespace to the id. The id will be rendered exactly
+ * as you provide it.
+ *
+ */
+ @JSFProperty
+ String getColumnId();
+
+ void setColumnId(String columnId);
+}
\ No newline at end of file
Added: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/datalist/HtmlListRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/datalist/HtmlListRenderer.java?rev=938319&view=auto
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/datalist/HtmlListRenderer.java (added)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/datalist/HtmlListRenderer.java Tue Apr 27 04:20:18 2010
@@ -0,0 +1,348 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.custom.datalist;
+
+import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
+import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRenderer;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIData;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.behavior.ClientBehavior;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @JSFRenderer
+ * renderKitId = "HTML_BASIC"
+ * family = "javax.faces.Data"
+ * type = "org.apache.myfaces.List"
+ *
+ * @author Manfred Geiler (latest modification by $Author: lu4242 $)
+ * @version $Revision: 659874 $ $Date: 2008-05-24 15:59:15 -0500 (sáb, 24 may 2008) $
+ */
+public class HtmlListRenderer
+ extends HtmlRenderer
+{
+ //private static final Log log = LogFactory.getLog(HtmlListRenderer.class);
+
+ public static final String LAYOUT_SIMPLE = "simple";
+ public static final String LAYOUT_UL = "unorderedList";
+ public static final String LAYOUT_OL = "orderedList";
+ public static final String LAYOUT_GRID = "grid";
+
+ public boolean getRendersChildren()
+ {
+ return true;
+ }
+
+ public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException
+ {
+ RendererUtils.checkParamValidity(facesContext, uiComponent, UIData.class);
+ ResponseWriter writer = facesContext.getResponseWriter();
+ String layout = getLayout(uiComponent);
+
+ Map<String, List<ClientBehavior>> behaviors = null;
+ if (uiComponent instanceof ClientBehaviorHolder)
+ {
+ behaviors = ((ClientBehaviorHolder) uiComponent).getClientBehaviors();
+ }
+
+ if (layout != null)
+ {
+ if (! layout.equals(LAYOUT_SIMPLE)) {
+ HtmlRendererUtils.writePrettyLineSeparator(facesContext);
+ }
+ if (layout.equals(LAYOUT_UL))
+ {
+ writer.startElement(HTML.UL_ELEM, uiComponent);
+
+ writer.writeAttribute(HTML.ID_ATTR, uiComponent.getClientId(facesContext), null);
+
+ if (behaviors != null && !behaviors.isEmpty())
+ {
+ HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.UNIVERSAL_ATTRIBUTES);
+ HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, uiComponent, behaviors);
+ }
+ else
+ {
+ HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent,
+ HTML.COMMON_PASSTROUGH_ATTRIBUTES);
+ }
+ }
+ else if (layout.equals(LAYOUT_OL))
+ {
+ writer.startElement(HTML.OL_ELEM, uiComponent);
+
+ writer.writeAttribute(HTML.ID_ATTR, uiComponent.getClientId(facesContext), null);
+
+ if (behaviors != null && !behaviors.isEmpty())
+ {
+ HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.UNIVERSAL_ATTRIBUTES);
+ HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, uiComponent, behaviors);
+ }
+ else
+ {
+ HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent,
+ HTML.COMMON_PASSTROUGH_ATTRIBUTES);
+ }
+ }
+ else if (layout.equals(LAYOUT_GRID))
+ {
+ writer.startElement(HTML.TABLE_ELEM, uiComponent);
+
+ writer.writeAttribute(HTML.ID_ATTR, uiComponent.getClientId(facesContext), null);
+
+ if (behaviors != null && !behaviors.isEmpty())
+ {
+ HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.UNIVERSAL_ATTRIBUTES);
+ HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, uiComponent, behaviors);
+ }
+ else
+ {
+ HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent,
+ HTML.COMMON_PASSTROUGH_ATTRIBUTES);
+ }
+ }
+ else
+ {
+ if (behaviors != null && !behaviors.isEmpty())
+ {
+ writer.startElement(HTML.SPAN_ELEM, uiComponent);
+ writer.writeAttribute(HTML.ID_ATTR, uiComponent.getClientId(facesContext), null);
+ HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.UNIVERSAL_ATTRIBUTES);
+ HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, uiComponent, behaviors);
+ }
+ else
+ {
+ if (uiComponent.getId() != null && !uiComponent.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
+ {
+ writer.startElement(HTML.SPAN_ELEM, uiComponent);
+
+ writer.writeAttribute(HTML.ID_ATTR, uiComponent.getClientId(facesContext), null);
+
+ HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.COMMON_PASSTROUGH_ATTRIBUTES);
+ }
+ else
+ {
+ HtmlRendererUtils.renderHTMLAttributesWithOptionalStartElement(writer, uiComponent,
+ HTML.SPAN_ELEM, HTML.COMMON_PASSTROUGH_ATTRIBUTES);
+ }
+ }
+ }
+ }
+ }
+
+ public void encodeChildren(FacesContext facesContext, UIComponent component) throws IOException
+ {
+ RendererUtils.checkParamValidity(facesContext, component, UIData.class);
+
+ UIData uiData = (UIData) component;
+ String layout = getLayout(component);
+ //Map requestMap = facesContext.getExternalContext().getRequestMap();
+
+ ResponseWriter writer = facesContext.getResponseWriter();
+
+ int first = uiData.getFirst();
+ int rows = uiData.getRows();
+ int rowCount = uiData.getRowCount();
+ if (rows <= 0)
+ {
+ rows = rowCount - first;
+ }
+ int last = first + rows;
+ if (last > rowCount) last = rowCount;
+
+ /*
+ String rowIndexVar = getRowIndexVar(component);
+ String rowCountVar = getRowCountVar(component);
+
+ if (rowCountVar != null)
+ {
+ requestMap.put(rowCountVar, new Integer(rowCount));
+ }
+ */
+
+ if (layout != null && layout.equals(LAYOUT_GRID)){
+ // output table row
+ writer.startElement(HTML.TR_ELEM, null);
+ }
+ for (int i = first; i < last; i++)
+ {
+ uiData.setRowIndex(i);
+ if (uiData.isRowAvailable())
+ {
+ /*
+ if (rowIndexVar != null)
+ {
+ requestMap.put(rowIndexVar, new Integer(i));
+ }
+ */
+
+ if (layout != null)
+ {
+ if (! layout.equals(LAYOUT_SIMPLE)) {
+ HtmlRendererUtils.writePrettyLineSeparator(facesContext);
+ }
+ if (layout.equals(LAYOUT_UL) || (layout.equals(LAYOUT_OL)))
+ {
+ writer.startElement(HTML.LI_ELEM, component);
+ HtmlRendererUtils.renderHTMLAttribute(writer, component, "itemStyleClass", HTML.STYLE_CLASS_ATTR);
+ }
+ else if (layout.equals(LAYOUT_GRID))
+ {
+ // output table cells
+ writer.startElement(HTML.TD_ELEM, null);
+ }
+ }
+
+ RendererUtils.renderChildren(facesContext, component);
+
+ if (layout != null)
+ {
+ if (layout.equals(LAYOUT_UL) || (layout.equals(LAYOUT_OL)))
+ {
+ writer.endElement(HTML.LI_ELEM);
+ }
+ else if (layout.equals(LAYOUT_GRID))
+ {
+ // output table cells
+ writer.endElement(HTML.TD_ELEM);
+ }
+ }
+
+ /*
+ if (rowIndexVar != null)
+ {
+ requestMap.remove(rowIndexVar);
+ }
+ */
+ }
+ }
+ if (layout != null && layout.equals(LAYOUT_GRID)){
+ writer.endElement(HTML.TR_ELEM);
+ }
+ /*
+ if (rowCountVar != null)
+ {
+ requestMap.remove(rowCountVar);
+ }
+ */
+ }
+
+
+ public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException
+ {
+ RendererUtils.checkParamValidity(facesContext, uiComponent, UIData.class);
+ ResponseWriter writer = facesContext.getResponseWriter();
+ String layout = getLayout(uiComponent);
+ if (layout != null)
+ {
+ if (! layout.equals(LAYOUT_SIMPLE)) {
+ HtmlRendererUtils.writePrettyLineSeparator(facesContext);
+ }
+ if (layout.equals(LAYOUT_UL))
+ {
+ writer.endElement(HTML.UL_ELEM);
+ }
+ else if (layout.equals(LAYOUT_OL))
+ {
+ writer.endElement(HTML.OL_ELEM);
+ }
+ else if (layout.equals(LAYOUT_GRID))
+ {
+ writer.endElement(HTML.TABLE_ELEM);
+ }
+ else
+ {
+ Map<String, List<ClientBehavior>> behaviors = null;
+ if (uiComponent instanceof ClientBehaviorHolder)
+ {
+ behaviors = ((ClientBehaviorHolder) uiComponent).getClientBehaviors();
+ }
+
+ if (behaviors != null && !behaviors.isEmpty())
+ {
+ writer.endElement(HTML.SPAN_ELEM);
+ }
+ else
+ {
+ if (uiComponent.getId() != null && !uiComponent.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
+ {
+ writer.endElement(HTML.SPAN_ELEM);
+ }
+ else
+ {
+ HtmlRendererUtils.renderOptionalEndElement(writer,
+ uiComponent,
+ HTML.SPAN_ELEM,
+ HTML.COMMON_PASSTROUGH_ATTRIBUTES);
+ }
+ }
+ }
+ }
+ }
+
+
+ private String getLayout(UIComponent component)
+ {
+ if (component instanceof HtmlDataList)
+ {
+ return ((HtmlDataList) component).getLayout();
+ }
+ else
+ {
+ return (String) component.getAttributes().get(JSFAttr.LAYOUT_ATTR);
+ }
+ }
+
+ /*
+ private String getRowIndexVar(UIComponent component)
+ {
+ if (component instanceof HtmlDataList)
+ {
+ return ((HtmlDataList)component).getRowIndexVar();
+ }
+ else
+ {
+ return (String)component.getAttributes().get("rowIndexVar");
+ }
+ }
+
+ private String getRowCountVar(UIComponent component)
+ {
+ if (component instanceof HtmlDataList)
+ {
+ return ((HtmlDataList)component).getRowCountVar();
+ }
+ else
+ {
+ return (String)component.getAttributes().get("rowCountVar");
+ }
+ }
+ */
+
+}
Modified: myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/date/HtmlDateRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/date/HtmlDateRenderer.java?rev=938319&r1=938318&r2=938319&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/date/HtmlDateRenderer.java (original)
+++ myfaces/tomahawk/trunk/core20/src/main/java/org/apache/myfaces/custom/date/HtmlDateRenderer.java Tue Apr 27 04:20:18 2010
@@ -19,17 +19,18 @@
package org.apache.myfaces.custom.date;
import java.io.IOException;
-import java.io.StringReader;
import java.text.DateFormatSymbols;
import java.text.ParseException;
import java.util.Calendar;
+import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.Properties;
import java.util.StringTokenizer;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
+import javax.faces.component.behavior.ClientBehavior;
+import javax.faces.component.behavior.ClientBehaviorHolder;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.convert.ConverterException;
@@ -38,16 +39,16 @@ import javax.faces.event.ComponentSystem
import javax.faces.event.ListenerFor;
import org.apache.myfaces.component.UserRoleUtils;
-import org.apache.myfaces.custom.calendar.HtmlCalendarRenderer;
import org.apache.myfaces.custom.calendar.FunctionCallProvider;
+import org.apache.myfaces.custom.calendar.HtmlCalendarRenderer;
import org.apache.myfaces.custom.calendar.HtmlCalendarRenderer.CalendarDateTimeConverter;
import org.apache.myfaces.custom.date.AbstractHtmlInputDate.UserData;
-import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
-import org.apache.myfaces.shared_tomahawk.renderkit.html.util.JavascriptUtils;
+import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML;
import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRenderer;
import org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.util.JavascriptUtils;
import org.apache.myfaces.shared_tomahawk.util.MessageUtils;
import org.apache.myfaces.tomahawk.application.PreRenderViewAddResourceEvent;
@@ -180,9 +181,9 @@ public class HtmlDateRenderer extends Ht
writer.writeAttribute(HTML.ID_ATTR, clientId, null);
if( ! (type.equals("time") || type.equals("short_time"))){
- encodeInputDay(inputDate, writer, clientId, userData, disabled, readonly);
- encodeInputMonth(inputDate, writer, clientId, userData, currentLocale, disabled, readonly);
- encodeInputYear(inputDate, writer, clientId, userData, disabled, readonly);
+ encodeInputDay(facesContext, inputDate, writer, clientId, userData, disabled, readonly);
+ encodeInputMonth(facesContext, inputDate, writer, clientId, userData, currentLocale, disabled, readonly);
+ encodeInputYear(facesContext, inputDate, writer, clientId, userData, disabled, readonly);
if( inputDate.isPopupCalendar() && ! disabled && ! readonly )
encodePopupCalendarButton(facesContext, uiComponent, writer, clientId, currentLocale);
@@ -191,28 +192,43 @@ public class HtmlDateRenderer extends Ht
writer.write(" ");
}
if( ! type.equals("date")){
- encodeInputHours(uiComponent, writer, clientId, userData, disabled, readonly);
+ encodeInputHours(facesContext, uiComponent, writer, clientId, userData, disabled, readonly);
writer.write(":");
- encodeInputMinutes(uiComponent, writer, clientId, userData, disabled, readonly);
+ encodeInputMinutes(facesContext, uiComponent, writer, clientId, userData, disabled, readonly);
if (type.equals("full")|| type.equals("time")) {
writer.write(":");
- encodeInputSeconds(uiComponent, writer, clientId, userData, disabled, readonly);
+ encodeInputSeconds(facesContext, uiComponent, writer, clientId, userData, disabled, readonly);
}
if (ampm) {
- encodeInputAmpm(uiComponent, writer, clientId, userData, disabled, readonly, currentLocale);
+ encodeInputAmpm(facesContext, uiComponent, writer, clientId, userData, disabled, readonly, currentLocale);
}
}
writer.endElement(HTML.SPAN_ELEM);
}
- protected void encodeInputField(UIComponent uiComponent, ResponseWriter writer, String id,
+ protected void encodeInputField(FacesContext facesContext, UIComponent uiComponent, ResponseWriter writer, String id,
String value, int size, boolean disabled, boolean readonly) throws IOException {
writer.startElement(HTML.INPUT_ELEM, uiComponent);
HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.UNIVERSAL_ATTRIBUTES);
- HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.EVENT_HANDLER_ATTRIBUTES);
+ Map<String, List<ClientBehavior>> behaviors = null;
+ if (uiComponent instanceof ClientBehaviorHolder)
+ {
+ behaviors = ((ClientBehaviorHolder) uiComponent).getClientBehaviors();
+ }
+
+ if (behaviors != null && !behaviors.isEmpty())
+ {
+ HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, uiComponent, behaviors);
+ HtmlRendererUtils.renderBehaviorizedFieldEventHandlers(facesContext, writer, uiComponent, behaviors);
+ }
+ else
+ {
+ HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.EVENT_HANDLER_ATTRIBUTES);
+ HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.COMMON_FIELD_EVENT_ATTRIBUTES);
+ }
HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.INPUT_ATTRIBUTES);
- HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.COMMON_FIELD_EVENT_ATTRIBUTES);
+
if (disabled) {
writer.writeAttribute(HTML.DISABLED_ATTR, Boolean.TRUE, null);
@@ -231,20 +247,34 @@ public class HtmlDateRenderer extends Ht
writer.endElement(HTML.INPUT_ELEM);
}
- protected void encodeInputDay(UIComponent uiComponent, ResponseWriter writer, String clientId,
+ protected void encodeInputDay(FacesContext facesContext, UIComponent uiComponent, ResponseWriter writer, String clientId,
UserData userData, boolean disabled, boolean readonly) throws IOException {
- encodeInputField(uiComponent, writer, getClientIdForDaySubcomponent(clientId), userData.getDay(), 2, disabled, readonly);
+ encodeInputField(facesContext, uiComponent, writer, getClientIdForDaySubcomponent(clientId), userData.getDay(), 2, disabled, readonly);
}
- protected void encodeInputMonth(UIComponent uiComponent, ResponseWriter writer, String clientId, UserData userData, Locale currentLocale,
+ protected void encodeInputMonth(FacesContext facesContext, UIComponent uiComponent, ResponseWriter writer, String clientId, UserData userData, Locale currentLocale,
boolean disabled, boolean readonly) throws IOException {
writer.startElement(HTML.SELECT_ELEM, uiComponent);
writer.writeAttribute(HTML.ID_ATTR, clientId + ID_MONTH_POSTFIX, null);
writer.writeAttribute(HTML.NAME_ATTR, clientId + ID_MONTH_POSTFIX, null);
writer.writeAttribute(HTML.SIZE_ATTR, "1", null);
HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.UNIVERSAL_ATTRIBUTES);
- HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.EVENT_HANDLER_ATTRIBUTES);
- HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.COMMON_FIELD_EVENT_ATTRIBUTES);
+ Map<String, List<ClientBehavior>> behaviors = null;
+ if (uiComponent instanceof ClientBehaviorHolder)
+ {
+ behaviors = ((ClientBehaviorHolder) uiComponent).getClientBehaviors();
+ }
+
+ if (behaviors != null && !behaviors.isEmpty())
+ {
+ HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, uiComponent, behaviors);
+ HtmlRendererUtils.renderBehaviorizedFieldEventHandlers(facesContext, writer, uiComponent, behaviors);
+ }
+ else
+ {
+ HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.EVENT_HANDLER_ATTRIBUTES);
+ HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.COMMON_FIELD_EVENT_ATTRIBUTES);
+ }
if (disabled) {
writer.writeAttribute(HTML.DISABLED_ATTR, Boolean.TRUE, null);
@@ -289,24 +319,24 @@ public class HtmlDateRenderer extends Ht
writer.endElement(HTML.OPTION_ELEM);
}
- protected void encodeInputYear(UIComponent uiComponent, ResponseWriter writer, String clientId,
+ protected void encodeInputYear(FacesContext facesContext, UIComponent uiComponent, ResponseWriter writer, String clientId,
UserData userData, boolean disabled, boolean readonly) throws IOException {
- encodeInputField(uiComponent, writer, clientId + ID_YEAR_POSTFIX, userData.getYear(), 4, disabled, readonly);
+ encodeInputField(facesContext, uiComponent, writer, clientId + ID_YEAR_POSTFIX, userData.getYear(), 4, disabled, readonly);
}
- protected void encodeInputHours(UIComponent uiComponent, ResponseWriter writer, String clientId,
+ protected void encodeInputHours(FacesContext facesContext, UIComponent uiComponent, ResponseWriter writer, String clientId,
UserData userData, boolean disabled, boolean readonly) throws IOException {
- encodeInputField(uiComponent, writer, clientId + ID_HOURS_POSTFIX, userData.getHours(), 2, disabled, readonly);
+ encodeInputField(facesContext, uiComponent, writer, clientId + ID_HOURS_POSTFIX, userData.getHours(), 2, disabled, readonly);
}
- protected void encodeInputMinutes(UIComponent uiComponent, ResponseWriter writer, String clientId,
+ protected void encodeInputMinutes(FacesContext facesContext, UIComponent uiComponent, ResponseWriter writer, String clientId,
UserData userData, boolean disabled, boolean readonly) throws IOException {
- encodeInputField(uiComponent, writer, clientId + ID_MINUTES_POSTFIX, userData.getMinutes(), 2, disabled, readonly);
+ encodeInputField(facesContext, uiComponent, writer, clientId + ID_MINUTES_POSTFIX, userData.getMinutes(), 2, disabled, readonly);
}
- protected void encodeInputSeconds(UIComponent uiComponent, ResponseWriter writer, String clientId,
+ protected void encodeInputSeconds(FacesContext facesContext, UIComponent uiComponent, ResponseWriter writer, String clientId,
UserData userData, boolean disabled, boolean readonly) throws IOException {
- encodeInputField(uiComponent, writer, clientId + ID_SECONDS_POSTFIX, userData.getSeconds(), 2, disabled, readonly);
+ encodeInputField(facesContext, uiComponent, writer, clientId + ID_SECONDS_POSTFIX, userData.getSeconds(), 2, disabled, readonly);
}
protected void encodeAmpmChoice(DateFormatSymbols symbols, UIComponent uiComponent, ResponseWriter writer, int calendar_ampm, int selected) throws IOException {
@@ -320,15 +350,29 @@ public class HtmlDateRenderer extends Ht
writer.endElement(HTML.OPTION_ELEM);
}
- protected void encodeInputAmpm(UIComponent uiComponent, ResponseWriter writer, String clientId,
+ protected void encodeInputAmpm(FacesContext facesContext, UIComponent uiComponent, ResponseWriter writer, String clientId,
UserData userData, boolean disabled, boolean readonly, Locale currentLocale) throws IOException {
writer.startElement(HTML.SELECT_ELEM, uiComponent);
writer.writeAttribute(HTML.ID_ATTR, clientId + ID_AMPM_POSTFIX, null);
writer.writeAttribute(HTML.NAME_ATTR, clientId + ID_AMPM_POSTFIX, null);
writer.writeAttribute(HTML.SIZE_ATTR, "1", null);
HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.UNIVERSAL_ATTRIBUTES);
- HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.EVENT_HANDLER_ATTRIBUTES);
- HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.COMMON_FIELD_EVENT_ATTRIBUTES);
+ Map<String, List<ClientBehavior>> behaviors = null;
+ if (uiComponent instanceof ClientBehaviorHolder)
+ {
+ behaviors = ((ClientBehaviorHolder) uiComponent).getClientBehaviors();
+ }
+
+ if (behaviors != null && !behaviors.isEmpty())
+ {
+ HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, uiComponent, behaviors);
+ HtmlRendererUtils.renderBehaviorizedFieldEventHandlers(facesContext, writer, uiComponent, behaviors);
+ }
+ else
+ {
+ HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.EVENT_HANDLER_ATTRIBUTES);
+ HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, HTML.COMMON_FIELD_EVENT_ATTRIBUTES);
+ }
if (disabled) {
writer.writeAttribute(HTML.DISABLED_ATTR, Boolean.TRUE, null);