[seam-commits] Seam SVN: r8898 - in trunk/ui/src/main: config/component and 2 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Sep 4 01:50:49 EDT 2008


Author: shane.bryzak at jboss.com
Date: 2008-09-04 01:50:49 -0400 (Thu, 04 Sep 2008)
New Revision: 8898

Removed:
   trunk/ui/src/main/config/component/selectDate.xml
   trunk/ui/src/main/java/org/jboss/seam/ui/component/UISelectDate.java
   trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/SelectDateRendererBase.java
   trunk/ui/src/main/resources/
Log:
JBSEAM-2732

Deleted: trunk/ui/src/main/config/component/selectDate.xml
===================================================================
--- trunk/ui/src/main/config/component/selectDate.xml	2008-09-04 05:32:00 UTC (rev 8897)
+++ trunk/ui/src/main/config/component/selectDate.xml	2008-09-04 05:50:49 UTC (rev 8898)
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN"  "http://jboss.org/jbossrichfaces/component-config.dtd" >
-<components>
-	<component>
-		<name>org.jboss.seam.ui.SelectDate</name>
-		<family>org.jboss.seam.ui.SelectDate</family>
-		<classname>org.jboss.seam.ui.component.html.HtmlSelectDate</classname>
-		<superclass>org.jboss.seam.ui.component.UISelectDate</superclass>
-		<description>
-			<![CDATA[Deprecated. You should use <rich:calendar /> instead.]]>
-		</description>
-		<renderer generate="false" override="false">
-			<name>org.jboss.seam.ui.SelectDateRenderer</name>
-			<classname>org.jboss.seam.ui.renderkit.SelectDateRendererBase</classname>
-		</renderer>
-		<tag>
-			<name>selectDate</name>
-			<classname>org.jboss.seam.ui.taglib.SelectDateTag</classname>
-			<superclass>
-				org.jboss.seam.ui.util.cdk.UIComponentTagBase
-			</superclass>
-		</tag>
-		&ui_component_attributes;
-		&html_style_attributes;
-		<property>
-			<name>for</name>
-			<classname>java.lang.String</classname>
-			<description></description>
-		</property>
-		<property>
-			<name>dateFormat</name>
-			<classname>java.lang.String</classname>
-			<description></description>
-			<defaultvalue>"MM/dd/yyyy"</defaultvalue>
-		</property>
-		<!-- should be el="false" -->
-		<property transient="true">
-			<name>startYear</name>
-			<classname>int</classname>
-			<description></description>
-			<defaultvalue>-1</defaultvalue>
-		</property>
-		<!-- should be el="false" -->
-		<property transient="true">
-			<name>endYear</name>
-			<classname>int</classname>
-			<description></description>
-			<defaultvalue>-1</defaultvalue>
-		</property>
-		<property>
-		  <name>firstDayOfWeek</name>
-		  <classname>java.lang.Integer</classname>
-		  <description>Set to override the default first day of week</description>
-		  <defaultvalue>null</defaultvalue>
-		</property>
-	</component>
-</components>

Deleted: trunk/ui/src/main/java/org/jboss/seam/ui/component/UISelectDate.java
===================================================================
--- trunk/ui/src/main/java/org/jboss/seam/ui/component/UISelectDate.java	2008-09-04 05:32:00 UTC (rev 8897)
+++ trunk/ui/src/main/java/org/jboss/seam/ui/component/UISelectDate.java	2008-09-04 05:50:49 UTC (rev 8898)
@@ -1,29 +0,0 @@
-package org.jboss.seam.ui.component;
-
-import javax.faces.component.UIComponentBase;
-
- at Deprecated
-public abstract class UISelectDate extends UIComponentBase
-{
-
-   public abstract String getDateFormat();
-
-   public abstract void setDateFormat(String dateFormat);
-
-   public abstract String getFor();
-
-   public abstract void setFor(String forField);
-
-   public abstract int getStartYear();
-
-   public abstract void setStartYear(int startYear);
-
-   public abstract int getEndYear();
-
-   public abstract void setEndYear(int endYear);
-   
-   public abstract Integer getFirstDayOfWeek();
-   
-   public abstract void setFirstDayOfWeek(Integer firstDayOfWeek);
-
-}

Deleted: trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/SelectDateRendererBase.java
===================================================================
--- trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/SelectDateRendererBase.java	2008-09-04 05:32:00 UTC (rev 8897)
+++ trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/SelectDateRendererBase.java	2008-09-04 05:50:49 UTC (rev 8898)
@@ -1,137 +0,0 @@
-package org.jboss.seam.ui.renderkit;
-
-import java.io.IOException;
-import java.text.DateFormatSymbols;
-import java.util.Calendar;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-
-import org.jboss.seam.ui.component.UISelectDate;
-import org.jboss.seam.ui.resource.WebResource;
-import org.jboss.seam.ui.util.cdk.RendererBase;
-
- at Deprecated
-public class SelectDateRendererBase extends RendererBase
-{
-
-   @Override
-   protected Class getComponentClass()
-   {
-      return UISelectDate.class;
-   }
-
-   @Override
-   protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
-   {
-      UISelectDate selectDate = (UISelectDate) component;
-      
-      UIComponent forComponent = selectDate.findComponent(selectDate.getFor());
-      if (forComponent==null)
-      {
-         throw new IllegalStateException("could not find component with id: " + selectDate.getFor());
-      }
-      writeScript(context, selectDate);
-      writer.startElement("span", selectDate);
-      writer.writeAttribute("onclick", "__selectDate('" + forComponent.getClientId(context)
-               + "', '" + forComponent.getClientId(context) + "');", null);
-   }
-   
-   @Override
-   protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
-   {
-      writer.endElement("span");
-      writer.flush();
-   }
-   
-   public void writeScript(FacesContext context, UISelectDate selectDate) throws IOException
-   {
-      Map request = context.getExternalContext().getRequestMap();
-      if (request.get("SELECTDATE_SCRIPT") != null)
-      {
-         // already written out
-         return;
-      }
-
-      request.put("SELECTDATE_SCRIPT", null);
-
-      ResponseWriter response = context.getResponseWriter();
-      writeLocaleInformation(response, context.getViewRoot().getLocale(), selectDate);
-
-      response.startElement("script", null);
-      response.writeAttribute("type", "text/javascript", null);
-      response.writeAttribute("src", context.getExternalContext().getRequestContextPath()
-               + WebResource.WEB_RESOURCE_PATH + "/date/calendar.js", null);
-      response.endElement("script");
-   }
-
-   private void writeLocaleInformation(ResponseWriter response, Locale locale, UISelectDate selectDate) throws IOException
-   {
-      response.startElement("script", null);
-      response.writeAttribute("type", "text/javascript", null);
-
-      Calendar cal = Calendar.getInstance(locale);
-      DateFormatSymbols symbols = new DateFormatSymbols(locale);
-
-      // Note: Calendar and DateFormatSymbols use 1 for the first day of the week, not 0.
-
-      response.write("\r");
-      response.write("var CAL_DAYS_SHORT = '" + commaSeparate(symbols.getShortWeekdays(), 2)
-               + "';\r");
-      response
-               .write("var CAL_DAYS_MEDIUM = '" + commaSeparate(symbols.getShortWeekdays())
-                        + "';\r");
-      response.write("var CAL_DAYS_LONG = '" + commaSeparate(symbols.getWeekdays()) + "';\r");
-      response
-               .write("var CAL_MONTHS_MEDIUM = '" + commaSeparate(symbols.getShortMonths())
-                        + "';\r");
-      response.write("var CAL_MONTHS_LONG = '" + commaSeparate(symbols.getMonths()) + "';\r");
-      response.write("var CAL_FIRST_DAY_OF_WEEK = " + (selectDate.getFirstDayOfWeek() != null ?
-               (selectDate.getFirstDayOfWeek().toString() + ";\r") : 
-               (cal.getFirstDayOfWeek() - 1) + ";\r"));
-      response.write("var CAL_DATE_FORMAT = '" + selectDate.getDateFormat() + "';\r");
-      
-      if (selectDate.getStartYear() != -1 && selectDate.getEndYear() != -1)
-      {
-         response.write("var CAL_START_YEAR = " + selectDate.getStartYear() + ";\r");
-         response.write("var CAL_END_YEAR = " + selectDate.getEndYear() + ";\r");
-      }
-
-      response.endElement("script");
-   }
-
-   private String commaSeparate(String[] values)
-   {
-      return commaSeparate(values, -1);
-   }
-
-   private String commaSeparate(String[] values, int maxLength)
-   {
-      StringBuilder sb = new StringBuilder();
-      for (String val : values)
-      {
-         if (!"".equals(val))
-         {
-            if (sb.length() > 0) sb.append(',');
-            sb.append(limitLength(val, maxLength));
-         }
-      }
-      return sb.toString();
-   }
-
-   private String limitLength(String source, int maxLength)
-   {
-      if (maxLength < 0 || maxLength > source.length())
-      {
-         return source;
-      }
-      else
-      {
-         return source.substring(0, maxLength);
-      }
-   }
-   
-}




More information about the seam-commits mailing list