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/01/12 12:29:30 UTC
svn commit: r611402 - in /myfaces/tobago/branches/tobago-1.0.x: ./
core/src/main/java/org/apache/myfaces/tobago/component/
theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/
Author: bommel
Date: Sat Jan 12 03:29:22 2008
New Revision: 611402
URL: http://svn.apache.org/viewvc?rev=611402&view=rev
Log:
Merged revisions 609568-609629 via svnmerge from
https://svn.apache.org/repos/asf/myfaces/tobago/trunk
........
r609568 | bommel | 2008-01-07 11:54:02 +0100 (Mo, 07 Jan 2008) | 1 line
(TOBAGO-583) tc:time doesn't support disabled, readonly and tip attribute
........
r609570 | bommel | 2008-01-07 12:09:46 +0100 (Mo, 07 Jan 2008) | 1 line
(TOBAGO-582) DatePickerRenderer writes unopen a tag if dateInput is missing
........
r609629 | bommel | 2008-01-07 16:08:56 +0100 (Mo, 07 Jan 2008) | 1 line
(TOBAGO-582) DatePickerRenderer writes unopen a tag if dateInput is missing
........
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/component/UIDatePicker.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/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Jan 12 03:29:22 2008
@@ -1 +1 @@
-/myfaces/tobago/trunk:1-603371
+/myfaces/tobago/trunk:1-603371,609568-609629
Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java?rev=611402&r1=611401&r2=611402&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/UIDatePicker.java Sat Jan 12 03:29:22 2008
@@ -151,7 +151,7 @@
//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);
+ facesContext, UIBox.COMPONENT_TYPE, RENDERER_TYPE_BOX);
popup.getChildren().add(box);
box.setId("box");
// TODO: set string resources in renderer
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=611402&r1=611401&r2=611402&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 Sat Jan 12 03:29:22 2008
@@ -140,4 +140,14 @@
timePanel.setRendered(false);
}
}
+
+ public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
+ UIDatePicker link = (UIDatePicker) component;
+ UIDateInput dateInput = (UIDateInput) link.getForComponent();
+ if (dateInput != null) {
+ super.encodeEnd(facesContext, component);
+ } else {
+ LOG.error("No required UIDateInput component found.");
+ }
+ }
}
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=611402&r1=611401&r2=611402&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 Sat Jan 12 03:29:22 2008
@@ -28,6 +28,7 @@
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;
import org.apache.myfaces.tobago.component.UIPage;
import org.apache.myfaces.tobago.component.UITimeInput;
@@ -36,6 +37,7 @@
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
import org.apache.myfaces.tobago.renderkit.html.HtmlRendererUtil;
+import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
import org.apache.myfaces.tobago.util.DateFormatUtils;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
@@ -68,24 +70,7 @@
page.getScriptFiles().addAll(Arrays.asList(SCRIPTS));
UITimeInput input = (UITimeInput) component;
- // TODO title??
- /*
- Iterator messages = facesContext.getMessages(
- input.getClientId(facesContext));
- StringBuilder stringBuffer = new StringBuilder();
- while (messages.hasNext()) {
- FacesMessage message = (FacesMessage) messages.next();
- stringBuffer.append(message.getDetail());
- }
-
- String title = null;
- if (stringBuffer.length() > 0) {
- title = stringBuffer.toString();
- }
-
- title =
- HtmlRendererUtil.addTip(title, (String) input.getAttributes().get(ATTR_TIP));*/
-
+ String title = HtmlRendererUtil.getTitleFromTipAndMessages(facesContext, input);
String currentValue = getCurrentValue(facesContext, input);
if (LOG.isDebugEnabled()) {
LOG.debug("currentValue = '" + currentValue + "'");
@@ -132,13 +117,13 @@
writer.writeClassAttribute("tobago-time-borderDiv"
+ (hasSeconds ? " tobago-time-borderDiv-seconds" : ""));
- Integer tabIndex = input.getTabIndex();
- writeInput(writer, idPrefix + "hour", tabIndex, hour, true);
+
+ writeInput(writer, input, idPrefix + "hour", hour, true, title);
writeInputSeparator(writer, ":");
- writeInput(writer, idPrefix + "minute", tabIndex, minute, false);
+ writeInput(writer, input, idPrefix + "minute", minute, false, title);
if (hasSeconds) {
writeInputSeparator(writer, ":");
- writeInput(writer, idPrefix + "second", tabIndex, second, false);
+ writeInput(writer, input, idPrefix + "second", second, false, title);
}
writer.endElement(HtmlConstants.DIV);
@@ -148,13 +133,14 @@
HtmlRendererUtil.addImageSources(facesContext, writer, imageSrc, imageId);
writer.startElement(HtmlConstants.IMG, null);
writer.writeIdAttribute(imageId);
- writer.writeAttribute(HtmlAttributes.ONCLICK, "tbgIncTime(this)", false);
writer.writeClassAttribute("tobago-time-inc-image"
+ (hasSeconds ? " tobago-time-image-seconds" : ""));
writer.writeAttribute(HtmlAttributes.SRC, ResourceManagerUtil.getImageWithPath(facesContext, imageSrc), true);
writer.writeAttribute(HtmlAttributes.ALT, "", false); // TODO: tip
- if (!ComponentUtil.getBooleanAttribute(input, ATTR_DISABLED)) {
+ if (!(ComponentUtil.getBooleanAttribute(input, ATTR_DISABLED)
+ || ComponentUtil.getBooleanAttribute(input, ATTR_READONLY))) {
+ writer.writeAttribute(HtmlAttributes.ONCLICK, "tbgIncTime(this)", false);
writer.writeAttribute(HtmlAttributes.ONMOUSEOVER,
"Tobago.imageMouseover('" + imageId + "')", null);
writer.writeAttribute(HtmlAttributes.ONMOUSEOUT,
@@ -167,12 +153,13 @@
HtmlRendererUtil.addImageSources(facesContext, writer, imageSrc, imageId);
writer.startElement(HtmlConstants.IMG, null);
writer.writeIdAttribute(imageId);
- writer.writeAttribute(HtmlAttributes.ONCLICK, "tbgDecTime(this)", false);
writer.writeClassAttribute("tobago-time-dec-image"
+ (hasSeconds ? " tobago-time-image-seconds" : ""));
writer.writeAttribute(HtmlAttributes.SRC, ResourceManagerUtil.getImageWithPath(facesContext, imageSrc), true);
writer.writeAttribute(HtmlAttributes.ALT, "", false); // TODO: tip
- if (!ComponentUtil.getBooleanAttribute(input, ATTR_DISABLED)) {
+ if (!(ComponentUtil.getBooleanAttribute(input, ATTR_DISABLED)
+ || ComponentUtil.getBooleanAttribute(input, ATTR_READONLY))) {
+ writer.writeAttribute(HtmlAttributes.ONCLICK, "tbgDecTime(this)", false);
writer.writeAttribute(HtmlAttributes.ONMOUSEOVER,
"Tobago.imageMouseover('" + imageId + "')", null);
writer.writeAttribute(HtmlAttributes.ONMOUSEOUT,
@@ -210,18 +197,29 @@
writer.endElement(HtmlConstants.SPAN);
}
- private void writeInput(TobagoResponseWriter writer, String id, Integer tabIndex, String hour, boolean hourMode)
- throws IOException {
+ private void writeInput(TobagoResponseWriter writer, UITimeInput input, String id, String hour, boolean hourMode,
+ String title) throws IOException {
+ Integer tabIndex = input.getTabIndex();
writer.startElement(HtmlConstants.INPUT, null);
writer.writeAttribute(HtmlAttributes.TYPE, "text", false);
writer.writeIdAttribute(id);
if (tabIndex != null) {
writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
}
- writer.writeClassAttribute("tobago-time-input");
- writer.writeAttribute(HtmlAttributes.ONFOCUS, "tbgTimerInputFocus(this, " + hourMode + ")", false);
- writer.writeAttribute(HtmlAttributes.ONBLUR, "tbgTimerInputBlur(this)", false);
- writer.writeAttribute(HtmlAttributes.ONKEYUP, "tbgTimerKeyUp(this, event)", false);
+ writer.writeAttribute(HtmlAttributes.TITLE, title, true);
+
+ StyleClasses styleClasses = new StyleClasses();
+ //styleClasses.updateClassAttributeAndMarkup(input, "time");
+ styleClasses.addClass("time", "input");
+ writer.writeClassAttribute(styleClasses);
+ writer.writeAttribute(HtmlAttributes.READONLY, ComponentUtil.getBooleanAttribute(input, ATTR_READONLY));
+ writer.writeAttribute(HtmlAttributes.DISABLED, ComponentUtil.getBooleanAttribute(input, ATTR_DISABLED));
+ if (!(ComponentUtil.getBooleanAttribute(input, ATTR_DISABLED)
+ || ComponentUtil.getBooleanAttribute(input, ATTR_READONLY))) {
+ writer.writeAttribute(HtmlAttributes.ONFOCUS, "tbgTimerInputFocus(this, " + hourMode + ")", false);
+ writer.writeAttribute(HtmlAttributes.ONBLUR, "tbgTimerInputBlur(this)", false);
+ writer.writeAttribute(HtmlAttributes.ONKEYUP, "tbgTimerKeyUp(this, event)", false);
+ }
writer.writeAttribute(HtmlAttributes.VALUE, hour, true);
writer.endElement(HtmlConstants.INPUT);
}