You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2006/11/03 01:29:24 UTC
svn commit: r470617 - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
Author: bommel
Date: Thu Nov 2 16:29:24 2006
New Revision: 470617
URL: http://svn.apache.org/viewvc?view=rev&rev=470617
Log:
getForComponet doesn't work in facelet need to set the size in Renderer
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java?view=diff&rev=470617&r1=470616&r2=470617
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java Thu Nov 2 16:29:24 2006
@@ -19,12 +19,10 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ALT;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_CALENDAR_DATE_INPUT_ID;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_COLUMNS;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HEIGHT;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LABEL;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_POPUP_RESET;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ROWS;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_STYLE_CLASS;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH;
import static org.apache.myfaces.tobago.TobagoConstants.FACET_LAYOUT;
import static org.apache.myfaces.tobago.TobagoConstants.FACET_PICKER_POPUP;
import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_BOX;
@@ -36,16 +34,12 @@
import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_PANEL;
import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_POPUP;
import static org.apache.myfaces.tobago.TobagoConstants.RENDERER_TYPE_TIME;
-import org.apache.myfaces.tobago.config.ThemeConfig;
import org.apache.myfaces.tobago.context.ResourceManagerUtil;
import org.apache.myfaces.tobago.event.DatePickerController;
-import org.apache.myfaces.tobago.renderkit.RendererBase;
import javax.faces.component.UIComponent;
import javax.faces.component.UIGraphic;
import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-import javax.faces.convert.DateTimeConverter;
import javax.faces.event.FacesEvent;
import java.util.Map;
@@ -154,10 +148,8 @@
Map<String, Object> attributes = popup.getAttributes();
attributes.put(ATTR_POPUP_RESET, Boolean.TRUE);
- attributes.put(ATTR_WIDTH, String.valueOf(
- ThemeConfig.getValue(facesContext, link, "CalendarPopupWidth")));
- int popupHeight = ThemeConfig.getValue(facesContext, link, "CalendarPopupHeight");
- attributes.put(ATTR_HEIGHT, String.valueOf(popupHeight));
+ //int popupHeight = ThemeConfig.getValue(facesContext, link, "CalendarPopupHeight");
+ //attributes.put(ATTR_HEIGHT, String.valueOf(popupHeight));
final UIComponent box = ComponentUtil.createComponent(
facesContext, UIPanel.COMPONENT_TYPE, RENDERER_TYPE_BOX);
popup.getChildren().add(box);
@@ -206,16 +198,7 @@
cell.setId("cell2");
timePanel.getChildren().add(cell);
- UIComponent input = getForComponent();
- Converter converter = ((RendererBase)
- getRenderer(facesContext)).getConverter(facesContext, input);
- if (converter instanceof DateTimeConverter) {
- String pattern = ((DateTimeConverter) converter).getPattern();
- if (pattern != null && (pattern.indexOf('h') > -1 || pattern.indexOf('H') > -1)) {
- popupHeight += ThemeConfig.getValue(facesContext, time, "fixedHeight");
- attributes.put(ATTR_HEIGHT, String.valueOf(popupHeight));
- }
- }
+
UIComponent buttonPanel = ComponentUtil.createComponent(
facesContext, UIPanel.COMPONENT_TYPE, RENDERER_TYPE_PANEL);
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?view=diff&rev=470617&r1=470616&r2=470617
==============================================================================
--- 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 Thu Nov 2 16:29:24 2006
@@ -21,12 +21,15 @@
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_ACTION_ONCLICK;
import static org.apache.myfaces.tobago.TobagoConstants.FACET_PICKER_POPUP;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_POPUP_RESET;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HEIGHT;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_POPUP_CALENDAR_FORCE_TIME;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH;
import org.apache.myfaces.tobago.component.UIDatePicker;
import org.apache.myfaces.tobago.component.UIPopup;
import org.apache.myfaces.tobago.component.UIDateInput;
import org.apache.myfaces.tobago.component.UIPage;
import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.config.ThemeConfig;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -58,6 +61,9 @@
}
String idPrefix = dateInput.getId() + "_picker";
Map<String, Object> attributes = link.getAttributes();
+ attributes.put(ATTR_WIDTH, String.valueOf(
+ ThemeConfig.getValue(facesContext, link, "CalendarPopupWidth")));
+ int popupHeight = ThemeConfig.getValue(facesContext, link, "CalendarPopupHeight");
link.setActionListener(datePickerController);
attributes.put(ATTR_LAYOUT_WIDTH, getConfiguredValue(facesContext, component, "pickerWidth"));
UIComponent hidden = (UIComponent) link.getChildren().get(0);
@@ -70,6 +76,7 @@
attributes = popup.getAttributes();
popup.setId(idPrefix + "popup");
attributes.put(ATTR_POPUP_RESET, Boolean.TRUE);
+ attributes.put(ATTR_HEIGHT, String.valueOf(popupHeight));
Converter converter = getConverter(facesContext, dateInput);
String converterPattern = "yyyy-MM-dd"; // from calendar.js initCalendarParse
if (converter instanceof DateTimeConverter) {
@@ -78,6 +85,7 @@
// LOG.warn("Converter for DateRenderer is not instance of DateTimeConverter. Using default Pattern "
// + converterPattern);
}
+
UICommand okButton = (UICommand) popup.findComponent("ok" + DatePickerController.CLOSE_POPUP);
attributes = okButton.getAttributes();
attributes.put(ATTR_ACTION_ONCLICK, "writeIntoField2(this); Tobago.closePickerPopup2(this)");
@@ -105,6 +113,9 @@
if (converterPattern != null && (converterPattern.indexOf('h') > -1 || converterPattern.indexOf('H') > -1)) {
if (converterPattern.indexOf('s') > -1) {
UIComponent time = timePanel.findComponent("time");
+ int popupHeight = ComponentUtil.getIntAttribute(popup, ATTR_HEIGHT);
+ popupHeight += ThemeConfig.getValue(FacesContext.getCurrentInstance(), time, "fixedHeight");
+ popup.getAttributes().put(ATTR_HEIGHT, String.valueOf(popupHeight));
time.getAttributes().put(ATTR_POPUP_CALENDAR_FORCE_TIME, true);
}
} else {