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 2008/04/16 20:40:59 UTC
svn commit: r648791 - in /myfaces/tobago/branches/tobago-1.0.x: ./
core/src/main/java/org/apache/myfaces/tobago/
theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/
Author: bommel
Date: Wed Apr 16 11:40:56 2008
New Revision: 648791
URL: http://svn.apache.org/viewvc?rev=648791&view=rev
Log:
Merged revisions 648780 via svnmerge from
https://svn.apache.org/repos/asf/myfaces/tobago/trunk
........
r648780 | bommel | 2008-04-16 20:21:50 +0200 (Mi, 16 Apr 2008) | 1 line
(TOBAGO-647) Setting the converter of the timeInput in the datePicker depending on the supplied date and time pattern
........
Modified:
myfaces/tobago/branches/tobago-1.0.x/ (props changed)
myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java
myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java
Propchange: myfaces/tobago/branches/tobago-1.0.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java?rev=648791&r1=648790&r2=648791&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java Wed Apr 16 11:40:56 2008
@@ -120,7 +120,6 @@
public static final String ATTR_POPUP_LIST = "popupList";
public static final String ATTR_RENDERED_PARTIALLY = "renderedPartially";
public static final String ATTR_POPUP_RESET = "popupReset";
- public static final String ATTR_POPUP_CALENDAR_FORCE_TIME = "popupCalendarForceTime";
public static final String ATTR_POPUP_CALENDAR_ID = "popupCalendarId";
public static final String ATTR_PREFORMATED = "preformated";
public static final String ATTR_READONLY = "readonly";
Modified: myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java?rev=648791&r1=648790&r2=648791&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java Wed Apr 16 11:40:56 2008
@@ -24,7 +24,6 @@
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;
@@ -40,10 +39,13 @@
import javax.faces.context.FacesContext;
import javax.faces.component.UIComponent;
import javax.faces.component.UICommand;
+import javax.faces.component.ValueHolder;
import javax.faces.convert.Converter;
import javax.faces.convert.DateTimeConverter;
+import static javax.faces.convert.DateTimeConverter.CONVERTER_ID;
import java.io.IOException;
import java.util.Map;
+import java.util.TimeZone;
/*
* Date: 30.05.2006
@@ -109,7 +111,7 @@
attributes.put(TobagoConstants.ATTR_POPUP_CLOSE, "immediate");
//cancelButton.setActionListener(datePickerController);
- applyConverterPattern(popup, converterPattern);
+ applyConverterPattern(facesContext, popup, converterPattern);
if (popup != null) {
UIPage page = ComponentUtil.findPage(facesContext, link);
@@ -121,17 +123,23 @@
super.encodeBegin(facesContext, component);
}
- private void applyConverterPattern(UIPopup popup, String converterPattern) {
+ private void applyConverterPattern(FacesContext facesContext, UIPopup popup, String converterPattern) {
UIComponent box = (UIComponent) popup.getChildren().get(0);
UIComponent timePanel = box.findComponent("timePanel");
if (converterPattern != null && (converterPattern.indexOf('h') > -1 || converterPattern.indexOf('H') > -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, popupHeight);
+ DateTimeConverter dateTimeConverter
+ = (DateTimeConverter) facesContext.getApplication().createConverter(CONVERTER_ID);
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);
+ dateTimeConverter.setPattern("HH:mm:ss");
+ } else {
+ dateTimeConverter.setPattern("HH:mm");
}
+ dateTimeConverter.setTimeZone(TimeZone.getDefault());
+ ((ValueHolder) time).setConverter(dateTimeConverter);
} else {
timePanel.setRendered(false);
}
Modified: myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java?rev=648791&r1=648790&r2=648791&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TimeRenderer.java Wed Apr 16 11:40:56 2008
@@ -26,7 +26,6 @@
import org.apache.commons.logging.LogFactory;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_CALENDAR_DATE_INPUT_ID;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DISABLED;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_POPUP_CALENDAR_FORCE_TIME;
import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
import static org.apache.myfaces.tobago.TobagoConstants.ATTR_READONLY;
import org.apache.myfaces.tobago.component.ComponentUtil;
@@ -86,8 +85,6 @@
converterPattern += ":ss";
}
}
- } else if (ComponentUtil.getBooleanAttribute(input, ATTR_POPUP_CALENDAR_FORCE_TIME)) {
- converterPattern += ":ss";
}
boolean hasSeconds = converterPattern.indexOf('s') > -1;