You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2010/03/30 09:06:00 UTC

svn commit: r929021 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/taglib/component/ theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ theme/scarborough/src/main/resources/org/a...

Author: lofwyr
Date: Tue Mar 30 07:06:00 2010
New Revision: 929021

URL: http://svn.apache.org/viewvc?rev=929021&view=rev
Log:
TOBAGO-606: Calendar is a LayoutComponent now

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CalendarTagDeclaration.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CalendarRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CalendarTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CalendarTagDeclaration.java?rev=929021&r1=929020&r2=929021&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CalendarTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CalendarTagDeclaration.java Tue Mar 30 07:06:00 2010
@@ -25,12 +25,9 @@ import org.apache.myfaces.tobago.apt.ann
 import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
 import org.apache.myfaces.tobago.component.RendererTypes;
 import org.apache.myfaces.tobago.taglib.decl.HasIdBindingAndRendered;
+import org.apache.myfaces.tobago.taglib.decl.HasMarkup;
+import org.apache.myfaces.tobago.taglib.decl.IsGridLayoutComponent;
 
-/*
- * Created: Aug 6, 2005 3:24:33 PM
- * User: bommel
- * $Id$
- */
 /**
  * Renders a calendar.
  */
@@ -38,8 +35,9 @@ import org.apache.myfaces.tobago.taglib.
 @UIComponentTag(
     uiComponent = "org.apache.myfaces.tobago.component.UICalendar",
     uiComponentBaseClass = "javax.faces.component.UIOutput",
+    interfaces = "org.apache.myfaces.tobago.layout.LayoutComponent",
     rendererType = RendererTypes.CALENDAR)
-public interface CalendarTagDeclaration extends HasIdBindingAndRendered {
+public interface CalendarTagDeclaration extends HasIdBindingAndRendered, IsGridLayoutComponent, HasMarkup {
 
   /**
    * The current value of this component.

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CalendarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CalendarRenderer.java?rev=929021&r1=929020&r2=929021&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CalendarRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/CalendarRenderer.java Tue Mar 30 07:06:00 2010
@@ -17,27 +17,23 @@ package org.apache.myfaces.tobago.render
  * limitations under the License.
  */
 
-/*
- * Created 07.02.2003 16:00:00.
- * $Id$
- */
-
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.myfaces.tobago.component.Attributes;
+import org.apache.myfaces.tobago.component.UICalendar;
 import org.apache.myfaces.tobago.context.ResourceManagerUtil;
 import org.apache.myfaces.tobago.context.TobagoFacesContext;
 import org.apache.myfaces.tobago.model.CalendarModel;
 import org.apache.myfaces.tobago.model.DateModel;
 import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
+import org.apache.myfaces.tobago.renderkit.css.Style;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
 
 import javax.faces.component.UIComponent;
-import javax.faces.component.UIOutput;
 import javax.faces.context.FacesContext;
 import java.io.IOException;
 import java.text.SimpleDateFormat;
@@ -56,6 +52,7 @@ public class CalendarRenderer extends La
         "script/dateConverter.js"
     };
 
+  @Override
   public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
     super.prepareRender(facesContext, component);
     if (facesContext instanceof TobagoFacesContext) {
@@ -63,12 +60,11 @@ public class CalendarRenderer extends La
     }
   }
 
-  public void encodeEnd(FacesContext facesContext,
-      UIComponent component) throws IOException {
-    UIOutput output = (UIOutput) component;
+  @Override
+  public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
 
+    UICalendar output = (UICalendar) component;
     String id = output.getClientId(facesContext);
-
     String dateTextBoxId = (String) component.getAttributes().get(Attributes.DATE_INPUT_ID);
 
     if (LOG.isDebugEnabled()) {
@@ -90,14 +86,15 @@ public class CalendarRenderer extends La
     }
     CalendarModel model = new CalendarModel(calendar);
 
-    // rendering:
-
+    // rendering
     TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
 
     writer.startElement(HtmlConstants.TABLE, component);
     writer.writeIdAttribute(id);
     HtmlRendererUtils.renderDojoDndItem(component, writer, true);
     writer.writeClassAttribute();
+    Style style = new Style(facesContext, output);
+    writer.writeStyleAttribute(style);
     writer.writeAttribute(HtmlAttributes.CELLSPACING, 0);
     writer.writeAttribute(HtmlAttributes.CELLPADDING, 3);
     writer.writeAttribute(HtmlAttributes.SUMMARY, "", false);

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java?rev=929021&r1=929020&r2=929021&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java Tue Mar 30 07:06:00 2010
@@ -26,6 +26,7 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.component.RendererTypes;
 import org.apache.myfaces.tobago.component.UIBox;
 import org.apache.myfaces.tobago.component.UIButton;
+import org.apache.myfaces.tobago.component.UICalendar;
 import org.apache.myfaces.tobago.component.UIDate;
 import org.apache.myfaces.tobago.component.UIDatePicker;
 import org.apache.myfaces.tobago.component.UIGridLayout;
@@ -77,7 +78,6 @@ public class DatePickerRenderer extends 
         facesContext, UIPopup.COMPONENT_TYPE, RendererTypes.POPUP, popupId);
     popup.getAttributes().put(Attributes.Z_INDEX, 10);
     picker.getFacets().put(Facets.PICKER_POPUP, popup);
-
     popup.setRendered(false);
     popup.onComponentPopulated(facesContext);
 
@@ -91,8 +91,8 @@ public class DatePickerRenderer extends 
     box.getFacets().put(Facets.LAYOUT, layoutOfBox);
     layoutOfBox.setRows("*;fixed;fixed");
 
-    final UIComponent calendar = CreateComponentUtils.createComponent(
-        facesContext, javax.faces.component.UIOutput.COMPONENT_TYPE, RendererTypes.CALENDAR, "calendar");
+    final UICalendar calendar = (UICalendar) CreateComponentUtils.createComponent(
+        facesContext, UICalendar.COMPONENT_TYPE, RendererTypes.CALENDAR, "calendar");
     box.getChildren().add(calendar);
 
     // add time input
@@ -171,8 +171,8 @@ public class DatePickerRenderer extends 
     if (facesContext instanceof TobagoFacesContext) {
       UIPopup popup = (UIPopup) picker.getFacets().get(Facets.PICKER_POPUP);
       if (popup != null) {
-        popup.setWidth(getResourceManager().getThemeMeasure(facesContext, picker, "CalendarPopupWidth"));
-        popup.setHeight(getResourceManager().getThemeMeasure(facesContext, picker, "CalendarPopupHeight"));
+        popup.setWidth(getResourceManager().getThemeMeasure(facesContext, picker, "calendarPopupWidth"));
+        popup.setHeight(getResourceManager().getThemeMeasure(facesContext, picker, "calendarPopupHeight"));
         ((TobagoFacesContext) facesContext).getPopups().add(popup);
       }
     }

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties?rev=929021&r1=929020&r2=929021&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties Tue Mar 30 07:06:00 2010
@@ -27,8 +27,6 @@ Tobago.scrollbarWidth=19
 Tobago.clientBorder=12
 Tobago.headerHeight=0
 Tobago.labelSpace=0
-Tobago.CalendarPopupWidth=250
-Tobago.CalendarPopupHeight=350
 Tobago.DefaultPageWidth=800
 Tobago.DefaultPageHeight=600
 
@@ -53,8 +51,18 @@ Cell.headerHeight=0
 Cell.minimumWidth=0
 Cell.minimumHeight=0
 
+// todo: fixed make min+max obsolete
+Calendar.fixedWidth=208
+Calendar.fixedHeight=210
+Calendar.minimumWidth=208
+Calendar.minimumHeight=210
+Calendar.maximumWidth=208
+Calendar.maximumHeight=210
+
 ColumnSelector.fixedWidth=24
 
+DatePicker.calendarPopupWidth=250
+DatePicker.calendarPopupHeight=350
 DatePicker.fixedWidth=16
 DatePicker.pickerWidth=16