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 2014/07/09 18:26:06 UTC
svn commit: r1609225 [2/3] - in /myfaces/tobago/branches/tobago-3.0.x: ./
tobago-core/src/main/java/org/apache/myfaces/tobago/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/config/
tobago-core/src/main/java/org/apache/myfaces/tobago/fac...
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/component/Attributes.java Wed Jul 9 16:26:02 2014
@@ -53,6 +53,8 @@ public final class Attributes {
public static final String CREATE_SPAN = "createSpan";
public static final String CSS = "css";
public static final String CSS_CLASSES_BLOCKS = "cssClassesBlocks";
+ /** @deprecated since 2.0.0 */
+ @Deprecated
public static final String DATE_INPUT_ID = "dateInputId";
public static final String DATE_STYLE = "dateStyle";
public static final String DEFAULT_COMMAND = "defaultCommand";
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java Wed Jul 9 16:26:02 2014
@@ -61,4 +61,11 @@ public abstract class TobagoConfig {
public abstract Sanitizer getSanitizer();
public abstract boolean isAutoAccessKeyFromLabel();
+
+ /**
+ * @return false
+ * @deprecated
+ */
+ @Deprecated
+ public abstract boolean isClassicDateTimePicker();
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java Wed Jul 9 16:26:02 2014
@@ -19,34 +19,15 @@
package org.apache.myfaces.tobago.facelets.extension;
-import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.component.OnComponentCreated;
import org.apache.myfaces.tobago.component.RendererTypes;
import org.apache.myfaces.tobago.component.UIDate;
-import org.apache.myfaces.tobago.component.UIDatePicker;
-import org.apache.myfaces.tobago.component.UIForm;
-import org.apache.myfaces.tobago.context.Markup;
-import org.apache.myfaces.tobago.util.ComponentUtils;
-
-import javax.el.ValueExpression;
-import javax.faces.application.Application;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIViewRoot;
+
import javax.faces.view.facelets.ComponentConfig;
-import javax.faces.view.facelets.FaceletContext;
-import javax.faces.view.facelets.TagAttribute;
public class DateExtensionHandler extends TobagoLabelExtensionHandler {
- private TagAttribute pickerIdAttribute;
- private TagAttribute formIdAttribute;
- private TagAttribute markupAttribute;
-
public DateExtensionHandler(final ComponentConfig config) {
super(config);
- pickerIdAttribute = getAttribute("pickerId");
- formIdAttribute = getAttribute("formId");
- markupAttribute = getAttribute(Attributes.MARKUP);
}
protected String getSubComponentType() {
@@ -56,46 +37,4 @@ public class DateExtensionHandler extend
protected String getSubRendererType() {
return RendererTypes.DATE;
}
-
- public void onComponentPopulated(
- final FaceletContext faceletContext, final UIComponent panel, final UIComponent parent) {
- super.onComponentPopulated(faceletContext, panel, parent);
- if (panel.getChildCount() == 2) {
- final Application application = faceletContext.getFacesContext().getApplication();
- final UIViewRoot root = ComponentUtils.findViewRoot(faceletContext, parent);
-
- final UIForm form = (UIForm) application.createComponent(UIForm.COMPONENT_TYPE);
- form.setRendererType(RendererTypes.FORM);
- final String formId = formIdAttribute != null
- ? formIdAttribute.getValue(faceletContext)
- : panel.getId() + "_tx_form";
- form.setId(formId);
- panel.getChildren().add(form);
-
- final UIDatePicker picker = (UIDatePicker) application.createComponent(UIDatePicker.COMPONENT_TYPE);
- picker.setRendererType(RendererTypes.DATE_PICKER);
- picker.setFor("@auto");
- final String pickerId = pickerIdAttribute != null
- ? pickerIdAttribute.getValue(faceletContext)
- : panel.getId() + "_tx_picker";
- picker.setId(pickerId);
- if (picker.getAttributes().get(OnComponentCreated.MARKER) == null) {
- picker.getAttributes().put(OnComponentCreated.MARKER, Boolean.TRUE);
- picker.onComponentCreated(faceletContext.getFacesContext(), panel);
- }
- if (markupAttribute != null) {
- if (markupAttribute.isLiteral()) {
- picker.setMarkup(Markup.valueOf(markupAttribute.getValue()));
- } else {
- final ValueExpression expression = markupAttribute.getValueExpression(faceletContext, Object.class);
- picker.setValueExpression(Attributes.MARKUP, expression);
- }
- }
- form.getChildren().add(picker);
- }
- }
-
- protected String getColumns(final String first) {
- return first + ";*;auto";
- }
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigImpl.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigImpl.java?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigImpl.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigImpl.java Wed Jul 9 16:26:02 2014
@@ -360,6 +360,10 @@ public class TobagoConfigImpl extends To
this.autoAccessKeyFromLabel = autoAccessKeyFromLabel;
}
+ public boolean isClassicDateTimePicker() {
+ return false;
+ }
+
@Override
public String toString() {
final StringBuilder builder = new StringBuilder();
Propchange: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigSorter.java
------------------------------------------------------------------------------
Merged /myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigSorter.java:r1604224
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/renderkit/html/DataAttributes.java Wed Jul 9 16:26:02 2014
@@ -50,7 +50,10 @@ public final class DataAttributes {
/**
* Reference to the corresponding date input field. Used for date picker popups.
+ *
+ * @deprecated Since 2.0.0. It's no longer needed, because this is resolved by JavaScript now.
*/
+ @Deprecated
public static final String DATE_INPUT_ID = "data-tobago-date-input-id";
/** @deprecated Since 1.5.11 */
@@ -58,14 +61,26 @@ public final class DataAttributes {
public static final String DATEINPUTID = DATE_INPUT_ID;
/**
+ * Marker for the compatibility mode.
+ */
+ public static final String CLASSIC_DATE_TIME_PICKER = "data-tobago-classic-date-time-picker";
+
+ /**
* Marker for the OK-button of the date picker popup.
+ *
+ * @deprecated Since 2.0.0. It's no longer needed, because this is resolved by JavaScript now.
*/
+ @Deprecated
public static final String DATE_PICKER_OK = "data-tobago-date-picker-ok";
/** @deprecated Since 1.5.11 */
@Deprecated
public static final String DATEPICKEROK = DATE_PICKER_OK;
+ public static final String DATE_TIME_I18N = "data-tobago-date-time-i18n";
+
+ public static final String DATE_TIME_ICON = "data-tobago-date-time-icon";
+
/**
* Holds the day of a calendar control.
*/
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/resources/org/apache/myfaces/tobago/config/tobago-config-2.0.xsd
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/resources/org/apache/myfaces/tobago/config/tobago-config-2.0.xsd?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/resources/org/apache/myfaces/tobago/config/tobago-config-2.0.xsd (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/resources/org/apache/myfaces/tobago/config/tobago-config-2.0.xsd Wed Jul 9 16:26:02 2014
@@ -68,6 +68,7 @@
<xs:element name="prevent-frame-attacks" type="xs:boolean" minOccurs="0" default="true"/>
<xs:element name="set-nosniff-header" type="xs:boolean" minOccurs="0" default="true"/>
<xs:element name="auto-access-key-from-label" type="xs:boolean" minOccurs="0" default="true"/>
+ <xs:element name="classic-date-time-picker" type="xs:boolean" minOccurs="0" default="false"/>
<xs:element name="content-security-policy" type="tobago:content-security-policy-type" minOccurs="0"/>
<xs:element name="sanitizer" type="tobago:sanitizer-type" minOccurs="0"/>
<xs:element name="renderers" type="tobago:renderers-type" minOccurs="0"/>
Propchange: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/resources/org/apache/myfaces/tobago/config/tobago-config-2.0.xsd
------------------------------------------------------------------------------
Merged /myfaces/tobago/trunk/tobago-core/src/main/resources/org/apache/myfaces/tobago/config/tobago-config-2.0.xsd:r1604224
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/html/DataAttributesUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/html/DataAttributesUnitTest.java?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/html/DataAttributesUnitTest.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/renderkit/html/DataAttributesUnitTest.java Wed Jul 9 16:26:02 2014
@@ -35,7 +35,7 @@ public class DataAttributesUnitTest {
continue;
}
final String value = (String) field.get(null);
- Assert.assertTrue("Regexp check: value='" + value + "'", value.matches("data-tobago(-[a-z]+)*-[a-z]+"));
+ Assert.assertTrue("Regexp check: value='" + value + "'", value.matches("data-tobago(-[a-z0-9]+)*-[a-z0-9]+"));
final String extension = value.substring("data-tobago-".length());
final String name = field.getName();
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/DateController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/DateController.java?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/DateController.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/DateController.java Wed Jul 9 16:26:02 2014
@@ -39,7 +39,7 @@ public class DateController implements S
public DateController() {
try {
- once = new SimpleDateFormat("yyyy-MM-dd").parse("1980-03-22");
+ once = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS").parse("1980-03-07 21:05:09 012");
} catch (ParseException e) {
LOG.error("should not happen. ", e
);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml Wed Jul 9 16:26:02 2014
@@ -36,8 +36,11 @@
<supported-locale>de_AT</supported-locale>
<supported-locale>de_CH</supported-locale>
<supported-locale>es</supported-locale>
+ <supported-locale>ja</supported-locale>
<supported-locale>ja_JP</supported-locale>
+ <supported-locale>ru</supported-locale>
<supported-locale>ru_RU</supported-locale>
+ <supported-locale>zh</supported-locale>
<supported-locale>zh_TW</supported-locale>
</locale-config>
<resource-bundle>
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/04/date.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/04/date.xhtml?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/04/date.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/04/date.xhtml Wed Jul 9 16:26:02 2014
@@ -25,8 +25,16 @@
<tc:box label="Time Specific Controls">
<f:facet name="layout">
<tc:gridLayout columns="400px;*"
- rows="auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;250px;*"/>
+ rows="auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;250px;*"/>
</f:facet>
+
+ <!-- code-sniplet-start id="date" -->
+ <tx:in label="Date as Text" value="#{dateController.once}">
+ <f:convertDateTime pattern="dd.MM.yyyy"/>
+ </tx:in>
+ <!-- code-sniplet-end id="date" -->
+ <tc:cell/>
+
<!-- code-sniplet-start id="date" -->
<tx:date label="Date" value="#{dateController.once}">
<f:convertDateTime pattern="dd.MM.yyyy"/>
@@ -34,14 +42,28 @@
<!-- code-sniplet-end id="date" -->
<tc:cell/>
+ <!-- code-sniplet-start id="date" -->
+ <tc:date value="#{dateController.once}">
+ <f:convertDateTime pattern="dd.MM.yyyy"/>
+ </tc:date>
+ <!-- code-sniplet-end id="date" -->
+ <tc:cell/>
+
<!-- code-sniplet-start id="dateTime" -->
+<!--
<tx:date label="Date/Time" value="#{dateController.once}">
<f:convertDateTime pattern="dd.MM.yyyy HH:mm"/>
</tx:date>
+-->
<!-- code-sniplet-end id="dateTime" -->
+<!--
<tc:cell/>
+-->
+<!--
<tx:date label="Date (focus)" focus="true">
+-->
+ <tx:date label="Date (focus)">
<f:convertDateTime pattern="dd.MM.yyyy"/>
</tx:date>
<tc:cell/>
Copied: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/DateController.java (from r1604224, myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/DateController.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/DateController.java?p2=myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/DateController.java&p1=myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/DateController.java&r1=1604224&r2=1609225&rev=1609225&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/DateController.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/DateController.java Wed Jul 9 16:26:02 2014
@@ -1,5 +1,3 @@
-package org.apache.myfaces.tobago.example.test;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,6 +17,8 @@ package org.apache.myfaces.tobago.exampl
* under the License.
*/
+package org.apache.myfaces.tobago.example.test;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -37,8 +37,7 @@ public class DateController implements S
try {
once = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS").parse("1980-03-07 21:05:09 012");
} catch (ParseException e) {
- LOG.error("should not happen. ", e
- );
+ LOG.error("should not happen. ", e);
}
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml Wed Jul 9 16:26:02 2014
@@ -23,6 +23,15 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
+ <application>
+ <locale-config>
+ <default-locale>en</default-locale>
+ <supported-locale>de</supported-locale>
+ <supported-locale>es</supported-locale>
+ <supported-locale>ja</supported-locale>
+ </locale-config>
+ </application>
+
<factory>
<exception-handler-factory>
org.apache.myfaces.tobago.example.test.TestExceptionHandlerFactory
@@ -251,6 +260,12 @@
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>dateController</managed-bean-name>
+ <managed-bean-class>org.apache.myfaces.tobago.example.test.DateController</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
<navigation-rule>
<navigation-case>
<from-outcome>navigation</from-outcome>
Copied: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/date/datetime.js (from r1604224, myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/date/datetime.js)
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/date/datetime.js?p2=myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/date/datetime.js&p1=myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/date/datetime.js&r1=1604224&r2=1609225&rev=1609225&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/date/datetime.js (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/date/datetime.js Wed Jul 9 16:26:02 2014
@@ -26,10 +26,16 @@ TestDateTime.init = function () {
var date = null; // type: JS date
var time = null; // type: jQuery UI time object
var jQueryValue = null;
+ var i18n = javaFormatted.data("tobago-date-time-i18n");
switch (analyzed.type) {
case "datetime":
-
- date = jQuery.datepicker.parseDateTime(analyzed.dateFormat, analyzed.timeFormat, javaValue);
+ date = jQuery.datepicker.parseDateTime(
+ analyzed.dateFormat, analyzed.timeFormat, javaValue, i18n, {
+ separator: analyzed.separator,
+ // workaround for bug: https://github.com/trentrichardson/jQuery-Timepicker-Addon/issues/736
+ timeFormat: analyzed.timeFormat
+ }
+ );
time = {
hour: date.getHours(),
minute: date.getMinutes(),
@@ -38,17 +44,17 @@ TestDateTime.init = function () {
microsec: date.getMicroseconds()
};
jQueryValue
- = jQuery.datepicker.formatDate(analyzed.dateFormat, date)
+ = jQuery.datepicker.formatDate(analyzed.dateFormat, date, i18n)
+ analyzed.separator
- + jQuery.datepicker.formatTime(analyzed.timeFormat, time);
+ + jQuery.datepicker.formatTime(analyzed.timeFormat, time, i18n);
break;
case "date":
- date = jQuery.datepicker.parseDate(analyzed.dateFormat, javaValue);
- jQueryValue = jQuery.datepicker.formatDate(analyzed.dateFormat, date);
+ date = jQuery.datepicker.parseDate(analyzed.dateFormat, javaValue, i18n);
+ jQueryValue = jQuery.datepicker.formatDate(analyzed.dateFormat, date, i18n);
break;
case "time":
- time = jQuery.datepicker.parseTime(analyzed.timeFormat, javaValue);
- jQueryValue = jQuery.datepicker.formatTime(analyzed.timeFormat, time);
+ time = jQuery.datepicker.parseTime(analyzed.timeFormat, javaValue, i18n);
+ jQueryValue = jQuery.datepicker.formatTime(analyzed.timeFormat, time, i18n);
break;
default:
console.error("invalid: not date-pattern nor time-pattern"); // @DEV_ONLY
Copied: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/date/datetime.xhtml (from r1604224, myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/date/datetime.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/date/datetime.xhtml?p2=myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/date/datetime.xhtml&p1=myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/date/datetime.xhtml&r1=1604224&r2=1609225&rev=1609225&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/date/datetime.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/date/datetime.xhtml Wed Jul 9 16:26:02 2014
@@ -17,6 +17,7 @@
-->
<f:view
+ locale="#{clientConfig.locale}"
xmlns:tc="http://myfaces.apache.org/tobago/component"
xmlns:f="http://java.sun.com/jsf/core">
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/tobago.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/tobago.css?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/tobago.css (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-richmond/src/main/resources/org/apache/myfaces/tobago/renderkit/html/richmond/standard/style/tobago.css Wed Jul 9 16:26:02 2014
@@ -334,6 +334,26 @@ li.tobago-menu-markup-selected {
background: #D6EBFF;
}
+input.tobago-time {
+ border: 1px #3366CC solid;
+ font: 12px arial, helvetica, sans-serif;
+ color: #3366CC;
+}
+
+input.tobago-time-markup-readonly {
+ background-color: #e6e6e6;
+ color: #3366cc;
+}
+
+input.tobago-time-markup-disabled {
+ color: #3366cc;
+ background-color: #e6e6e6;
+}
+
+input.tobago-time-markup-error, .tobago-time-markup-error {
+ border: 1px solid #ff0000;
+}
+
/* textarea -------------------------------------------------------------- */
.tobago-textarea {
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-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/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties Wed Jul 9 16:26:02 2014
@@ -184,11 +184,31 @@ Textarea.minimumHeight=36
Textarea.preferredWidth=200
Time.fixedWidth=105
-Time.maximumWidth=100
Time.minimumWidth=100
+Time.preferredWidth=100
+Time.maximumWidth=100
Time.minimumHeight=25
Time.preferredHeight=25
Time.maximumHeight=25
+Time.css.border-left-width=0
+Time.css.border-top-width=0
+Time.css.border-right-width=0
+Time.css.border-bottom-width=0
+Time.css.padding-left=0
+Time.css.padding-top=0
+Time.css.padding-right=0
+Time.css.padding-bottom=0
+Time[timepicker].minimumWidth=-80
+Time[timepicker].preferredWidth=100
+Time[timepicker].maximumWidth=1900
+Time[timepicker].css.border-left-width=2
+Time[timepicker].css.border-top-width=2
+Time[timepicker].css.border-right-width=2
+Time[timepicker].css.border-bottom-width=2
+Time[timepicker].css.padding-left=2
+Time[timepicker].css.padding-top=2
+Time[timepicker].css.padding-right=2
+Time[timepicker].css.padding-bottom=2
ToolBar.fontWidth=8
ToolBar.custom.icon-big-width=32
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css Wed Jul 9 16:26:02 2014
@@ -1443,6 +1443,37 @@ a:active.tobago-sheet-pagingLink {
left: 92px;
}
+input.tobago-time {
+ font-family: arial, helvetica, sans-serif;
+ font-size: 16px;
+ background: #ffffff;
+ height: 17px;
+ color: #000000;
+ border: 2px inset #bbccdd;
+ margin: 0;
+ padding: 2px;
+}
+
+input.tobago-time-markup-required {
+ background-image: url( "../image/required.gif" );
+ background-position: 3px 50%;
+ background-repeat: no-repeat;
+}
+
+input.tobago-time-markup-readonly {
+ background: #bbccdd;
+}
+
+input.tobago-time-markup-disabled {
+ color: #778899;
+ background: #bbccdd;
+}
+
+input.tobago-time-markup-error, input.tobago-time-markup-fatal {
+ border-style: solid;
+ border-color: #ff0000;
+}
+
/* toolBar ----------------------------------------------------------------- */
/* FIXME this is the same code for "toolBar", "boxToolBar" and "tabGroupToolBar"*/
Propchange: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
------------------------------------------------------------------------------
Merged /myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css:r1604224
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/tobago.less
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/tobago.less?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/tobago.less (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/less/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/tobago.less Wed Jul 9 16:26:02 2014
@@ -231,6 +231,42 @@
border: 1px solid @errorColor;
}
+.ui-datepicker {
+ border: 1px solid black;
+ .border-radius;
+}
+
+.ui-widget-header {
+ background: #E8E8E8 url(../image/box-header-bg.gif) repeat-x top;
+ height: 16px;
+ border: 1px solid black;
+ border-bottom-style: dotted;
+ .border-radius(3px 3px 0 0);
+ font: @boldFont;
+ color: @textColor2;
+ padding: 3px 0 0 5px;
+}
+
+.ui-datepicker .ui-datepicker-title {
+ line-height: 17px;
+}
+
+.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span {
+ top: 40%;
+}
+
+.ui-widget-content .ui-state-default {
+ color: @textColor;
+ font-weight: normal;
+}
+
+.ui-widget-content .ui-state-active {
+ color: @textColor2;
+ border-color: @textColor2;
+ background: white;
+ font-weight: bold;
+}
+
/* file ------------------------------------------------------------------- */
.tobago-file {
@@ -873,6 +909,35 @@ div.tobago-tabGroup-toolBar {
left: 88px;
}
+input.tobago-time {
+ border: 1px solid darken(@borderColor, 10%);
+ height: 14px;
+ font: @font;
+ padding-left: 2px;
+ padding-right: 2px;
+ .border-radius;
+ .transitionBorder;
+ &:focus {
+ outline: none;
+ border-color: @focusColor;
+ .field-focus-shadow;
+ }
+}
+
+input.tobago-time-markup-readonly {
+ background-color: @readonlyBackgroundColor;
+}
+
+input.tobago-time-markup-disabled {
+ color: @disabledTextColor;
+ background-color: @disabledBackgroundColor;
+}
+
+input.tobago-time-markup-error, input.tobago-time-markup-fatal {
+ border: 1px solid @errorColor;
+}
+
+
/* toolBar ----------------------------------------------------------------- */
/* FIXME this is the same code for "toolBar", "boxToolBar" and "tabGroupToolBar"
Added: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/date-time.png
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/date-time.png?rev=1609225&view=auto
==============================================================================
Binary file - no diff available.
Propchange: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/date-time.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/time.png
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/time.png?rev=1609225&view=auto
==============================================================================
Binary file - no diff available.
Propchange: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/image/time.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties Wed Jul 9 16:26:02 2014
@@ -103,6 +103,22 @@ Textarea.minimumHeight=33
Time.minimumHeight=20
Time.preferredHeight=20
Time.maximumHeight=20
+#Time.css.border-left-width=1
+#Time.css.border-top-width=1
+#Time.css.border-right-width=1
+#Time.css.border-bottom-width=1
+#Time.css.padding-left=2
+#Time.css.padding-top=2
+#Time.css.padding-right=2
+#Time.css.padding-bottom=2
+Time[timepicker].css.border-left-width=1
+Time[timepicker].css.border-top-width=1
+Time[timepicker].css.border-right-width=1
+Time[timepicker].css.border-bottom-width=1
+#Time[timepicker].css.padding-left=2
+#Time[timepicker].css.padding-top=2
+#Time[timepicker].css.padding-right=2
+#Time[timepicker].css.padding-bottom=2
TreeMenuCommand.custom.padding-left=15
TreeMenuLabel.custom.padding-left=15
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/JsonUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/JsonUtils.java?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/JsonUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/JsonUtils.java Wed Jul 9 16:26:02 2014
@@ -19,6 +19,8 @@
package org.apache.myfaces.tobago.renderkit.html;
+import org.apache.myfaces.tobago.internal.context.DateTimeI18n;
+
import java.util.Map;
public class JsonUtils {
@@ -179,4 +181,23 @@ public class JsonUtils {
builder.append("},");
}
+ public static String encode(final DateTimeI18n dateTimeI18n) {
+ final StringBuilder builder = new StringBuilder();
+ builder.append("{");
+ final int initialLength = builder.length();
+
+ encode(builder, "monthNames", dateTimeI18n.getMonthNames());
+ encode(builder, "monthNamesShort", dateTimeI18n.getMonthNamesShort());
+ encode(builder, "dayNames", dateTimeI18n.getDayNames());
+ encode(builder, "dayNamesShort", dateTimeI18n.getDayNamesShort());
+ encode(builder, "dayNamesMin", dateTimeI18n.getDayNamesMin());
+ encode(builder, "firstDay", dateTimeI18n.getFirstDay());
+
+ if (builder.length() - initialLength > 0) {
+ assert builder.charAt(builder.length() - 1) == ',';
+ builder.deleteCharAt(builder.length() - 1);
+ }
+ builder.append("}");
+ return builder.toString();
+ }
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/DateRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/DateRenderer.java?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/DateRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/DateRenderer.java Wed Jul 9 16:26:02 2014
@@ -19,9 +19,12 @@
package org.apache.myfaces.tobago.renderkit.html.standard.standard.tag;
+import org.apache.myfaces.tobago.context.ResourceManagerUtils;
import org.apache.myfaces.tobago.internal.component.AbstractUIInput;
+import org.apache.myfaces.tobago.internal.context.DateTimeI18n;
import org.apache.myfaces.tobago.internal.util.DateFormatUtils;
import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
+import org.apache.myfaces.tobago.renderkit.html.JsonUtils;
import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -54,6 +57,23 @@ public class DateRenderer extends InRend
}
writer.writeAttribute(DataAttributes.PATTERN, pattern, true);
+
+ final DateTimeI18n dateTimeI18n = DateTimeI18n.valueOf(facesContext.getViewRoot().getLocale());
+ writer.writeAttribute(DataAttributes.DATE_TIME_I18N, JsonUtils.encode(dateTimeI18n), true);
+
+ final String imageName;
+ if (pattern.contains("m")) { // simple guessing
+ if (pattern.contains("d")) {
+ imageName = "image/date-time.png";
+ } else {
+ imageName = "image/time.png";
+ }
+ } else {
+ imageName = "image/date.gif";
+ }
+ final String icon = ResourceManagerUtils.getImageWithPath(facesContext, imageName);
+ if (icon != null) {
+ writer.writeAttribute(DataAttributes.DATE_TIME_ICON, icon, true);
+ }
}
}
-
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InRenderer.java?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/InRenderer.java Wed Jul 9 16:26:02 2014
@@ -70,6 +70,7 @@ public class InRenderer extends InputRen
final String id = input.getClientId(facesContext);
final boolean readonly = input.isReadonly();
final boolean disabled = input.isDisabled();
+ final boolean required = ComponentUtils.getBooleanAttribute(input, Attributes.REQUIRED);
final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
@@ -128,7 +129,6 @@ public class InRenderer extends InputRen
// writer.writeAttribute(HtmlAttributes.ONCHANGE, onchange, null);
}
} */
- final boolean required = ComponentUtils.getBooleanAttribute(input, Attributes.REQUIRED);
writer.writeAttribute(HtmlAttributes.REQUIRED, required);
HtmlRendererUtils.renderFocus(id, input.isFocus(), ComponentUtils.isError(input), facesContext, writer);
writeAdditionalAttributes(facesContext, writer, input);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TimeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TimeRenderer.java?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TimeRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TimeRenderer.java Wed Jul 9 16:26:02 2014
@@ -19,166 +19,7 @@
package org.apache.myfaces.tobago.renderkit.html.standard.standard.tag;
-import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.component.UITime;
-import org.apache.myfaces.tobago.context.Markup;
-import org.apache.myfaces.tobago.context.ResourceManagerUtils;
-import org.apache.myfaces.tobago.internal.util.DateFormatUtils;
import org.apache.myfaces.tobago.renderkit.InputRendererBase;
-import org.apache.myfaces.tobago.renderkit.css.Classes;
-import org.apache.myfaces.tobago.renderkit.css.Style;
-import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
-import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
-import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
-import org.apache.myfaces.tobago.renderkit.html.HtmlInputTypes;
-import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
-import org.apache.myfaces.tobago.util.ComponentUtils;
-import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-import javax.faces.convert.DateTimeConverter;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
public class TimeRenderer extends InputRendererBase {
-
- private static final Logger LOG = LoggerFactory.getLogger(TimeRenderer.class);
-
- public void encodeEnd(final FacesContext facesContext, final UIComponent component) throws IOException {
-
- final UITime time = (UITime) component;
-
- final String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, time);
- final String currentValue = getCurrentValue(facesContext, time);
- if (LOG.isDebugEnabled()) {
- LOG.debug("currentValue = '" + currentValue + "'");
- }
-
- String pattern = "HH:mm";
- if (time.getConverter() != null) {
- final Converter converter = time.getConverter();
- if (converter instanceof DateTimeConverter) {
- final String string = DateFormatUtils.findPattern((DateTimeConverter) converter);
- if (string != null && string.indexOf('s') > -1) {
- pattern += ":ss";
- }
- }
- }
-
- final boolean hasSeconds = pattern.indexOf('s') > -1;
-
- final Object value = time.getValue();
- final Date date;
- if (value instanceof Date) {
- date = (Date) value;
- } else if (value instanceof Calendar) {
- date = ((Calendar) value).getTime();
- } else {
- date = new Date();
- }
-
- final String hour = new SimpleDateFormat("HH").format(date);
- final String minute = new SimpleDateFormat("mm").format(date);
- final String second = new SimpleDateFormat("ss").format(date);
-
- final String id = time.getClientId(facesContext);
- final String idPrefix = id + ComponentUtils.SUB_SEPARATOR;
-
- final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
-
- writer.startElement(HtmlElements.DIV, time);
- writer.writeIdAttribute(id);
- writer.writeClassAttribute(Classes.create(time));
- HtmlRendererUtils.writeDataAttributes(facesContext, writer, time);
- final Style style = new Style(facesContext, time);
- writer.writeStyleAttribute(style);
- final String dateInputId = (String) time.getAttributes().get(Attributes.DATE_INPUT_ID);
- if (dateInputId != null) {
- writer.writeAttribute(DataAttributes.DATE_INPUT_ID, dateInputId, false);
- }
- writer.writeAttribute(DataAttributes.PATTERN, pattern, false);
-
- writer.startElement(HtmlElements.DIV, time);
- writer.writeIdAttribute(idPrefix + "borderDiv");
- Markup markup = time.getCurrentMarkup();
- if (hasSeconds) {
- markup = markup.add(Markup.SECONDS);
- }
- writer.writeClassAttribute(Classes.create(time, "borderDiv", markup));
-
- writeInput(writer, time, idPrefix, "hour", hour, title, 24);
- writeInputSeparator(writer, time, ":");
- writeInput(writer, time, idPrefix, "minute", minute, title, 60);
- if (hasSeconds) {
- writeInputSeparator(writer, time, ":");
- writeInput(writer, time, idPrefix, "second", second, title, 60);
- }
-
- writer.endElement(HtmlElements.DIV);
-
- writer.startElement(HtmlElements.IMG, null);
- writer.writeIdAttribute(idPrefix + "inc");
- writer.writeClassAttribute(Classes.create(time, "incImage", markup));
- writer.writeAttribute(HtmlAttributes.SRC,
- ResourceManagerUtils.getImageWithPath(facesContext, "image/timeIncrement.gif"), true);
- writer.writeAttribute(HtmlAttributes.ALT, "", false); // TODO: tip
- writer.writeAttribute(HtmlAttributes.READONLY, time.isReadonly());
- writer.writeAttribute(HtmlAttributes.DISABLED, time.isDisabled());
- writer.endElement(HtmlElements.IMG);
-
- writer.startElement(HtmlElements.IMG, null);
- writer.writeIdAttribute(idPrefix + "dec");
- writer.writeClassAttribute(Classes.create(time, "decImage", markup));
- writer.writeAttribute(HtmlAttributes.SRC,
- ResourceManagerUtils.getImageWithPath(facesContext, "image/timeDecrement.gif"), true);
- writer.writeAttribute(HtmlAttributes.ALT, "", false); // TODO: tip
- writer.writeAttribute(HtmlAttributes.READONLY, time.isReadonly());
- writer.writeAttribute(HtmlAttributes.DISABLED, time.isDisabled());
- writer.endElement(HtmlElements.IMG);
-
- writer.startElement(HtmlElements.INPUT, time);
- writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN, false);
- writer.writeIdAttribute(idPrefix + "field");
- writer.writeNameAttribute(id);
- writer.writeAttribute(HtmlAttributes.VALUE, hour + ":" + minute + ":" + second, false);
- writer.endElement(HtmlElements.INPUT);
-
- writer.endElement(HtmlElements.DIV);
- }
-
- private void writeInputSeparator(final TobagoResponseWriter writer, final UITime time, final String sep)
- throws IOException {
- writer.startElement(HtmlElements.SPAN, null);
- writer.writeClassAttribute(Classes.create(time, "sep"));
- writer.writeText(sep);
- writer.endElement(HtmlElements.SPAN);
- }
-
- private void writeInput(
- final TobagoResponseWriter writer, final UITime input, final String idPrefix, final String unit,
- final String value, final String title, final int max)
- throws IOException {
- final Integer tabIndex = input.getTabIndex();
- writer.startElement(HtmlElements.INPUT, null);
- writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.TEXT, false);
- writer.writeIdAttribute(idPrefix + unit);
- if (tabIndex != null) {
- writer.writeAttribute(HtmlAttributes.TABINDEX, tabIndex);
- }
- writer.writeAttribute(HtmlAttributes.TITLE, title, true);
-
- writer.writeClassAttribute(Classes.create(input, "input"));
- writer.writeAttribute(HtmlAttributes.READONLY, input.isReadonly());
- writer.writeAttribute(HtmlAttributes.DISABLED, input.isDisabled());
- writer.writeAttribute(HtmlAttributes.VALUE, value, true);
- writer.writeAttribute(DataAttributes.MAX, Integer.toString(max), true);
- writer.writeAttribute(DataAttributes.UNIT, unit, true);
- writer.endElement(HtmlElements.INPUT);
- }
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml Wed Jul 9 16:26:02 2014
@@ -377,15 +377,23 @@
</renderers>
<resources production="true">
<script name="script/contrib/jquery-1.11.1.js"/>
- <script name="script/contrib/jquery-ui-1.10.3.custom.js"/>
+ <script name="script/contrib/jquery-ui-1.10.4.custom.js"/>
+ <script name="script/contrib/jquery-ui-datepicker-i18n-1.10.4.js"/>
+ <script name="script/contrib/jquery-ui-timepicker-addon-1.4.5.js"/>
+ <script name="script/contrib/jquery-ui-timepicker-i18n-1.4.5.js"/>
<script name="script/tobago.js"/>
+ <style name="style/contrib/ui-lightness/jquery-ui-1.10.4.custom.css"/>
+ <style name="style/contrib/jquery-ui-timepicker-addon-1.4.5.css"/>
<style name="style/tobago.css"/>
<!-- backward compatibility -->
<style name="style/style.css"/>
</resources>
<resources production="false">
<script name="script/contrib/jquery-1.11.1.js"/>
- <script name="script/contrib/jquery-ui-1.10.3.custom.js"/>
+ <script name="script/contrib/jquery-ui-1.10.4.custom.js"/>
+ <script name="script/contrib/jquery-ui-datepicker-i18n-1.10.4.js"/>
+ <script name="script/contrib/jquery-ui-timepicker-addon-1.4.5.js"/>
+ <script name="script/contrib/jquery-ui-timepicker-i18n-1.4.5.js"/>
<script name="script/tobago.js"/>
<script name="script/tobago-calendar.js"/>
<script name="script/tobago-console.js"/>
@@ -399,6 +407,8 @@
<script name="script/tobago-suggest.js"/>
<script name="script/tobago-tree.js"/>
<script name="script/tobago-utils.js"/>
+ <style name="style/contrib/ui-lightness/jquery-ui-1.10.4.custom.css"/>
+ <style name="style/contrib/jquery-ui-timepicker-addon-1.4.5.css"/>
<style name="style/tobago.css"/>
<!-- backward compatibility -->
<style name="style/style.css"/>
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-calendar.js Wed Jul 9 16:26:02 2014
@@ -481,3 +481,229 @@ Tobago.Time.keyUp = function (input, eve
Tobago.registerListener(Tobago.Time.init, Tobago.Phase.DOCUMENT_READY);
Tobago.registerListener(Tobago.Time.init, Tobago.Phase.AFTER_UPDATE);
+
+
+Tobago.DateTime = {};
+
+Tobago.DateTime.init = function (elements) {
+
+ // time input fields
+// jQuery.datepicker.setDefaults(jQuery.datepicker.regional['de']);
+
+ Tobago.Utils.selectWidthJQuery(elements, ".tobago-date, .tobago-time")
+ .not("[disabled]")
+ .not("[readonly]")
+ .not("[data-tobago-classic-date-time-picker]")
+ .each(function () {
+ var date = jQuery(this);
+ date.width(date.width() - 5 - 16); // reserve space for the picker.
+
+ var analyzed = Tobago.DateTime.analyzePattern(date.data("tobago-pattern"));
+ var options = {
+ showOn: "both",
+ buttonImageOnly: true,
+// tbd changeMonth: true,
+// tbd changeYear: true,
+ showAnim: "" // just show it directly
+ };
+ var icon = date.data("tobago-date-time-icon");
+ if (icon) {
+ options.buttonImage = icon;
+ }
+ if (analyzed.dateFormat) {
+ options.dateFormat = analyzed.dateFormat;
+ }
+ if (analyzed.timeFormat) {
+ options.timeFormat = analyzed.timeFormat;
+ }
+ if (analyzed.separator) {
+ options.separator = analyzed.separator;
+ }
+ var i18n = date.data("tobago-date-time-i18n");
+ if (i18n) {
+ var monthNames = i18n.monthNames;
+ if (monthNames) {
+ options.monthNames = monthNames;
+ }
+ var monthNamesShort = i18n.monthNamesShort;
+ if (monthNamesShort) {
+ options.monthNamesShort = monthNamesShort;
+ }
+ var dayNames = i18n.dayNames;
+ if (dayNames) {
+ options.dayNames = dayNames;
+ }
+ var dayNamesShort = i18n.dayNamesShort;
+ if (dayNamesShort) {
+ options.dayNamesShort = dayNamesShort;
+ }
+ var dayNamesMin = i18n.dayNamesMin;
+ if (dayNamesMin) {
+ options.dayNamesMin = dayNamesMin;
+ }
+ var firstDay = i18n.firstDay;
+ if (firstDay) {
+ options.firstDay = firstDay;
+ }
+ }
+
+ switch (analyzed.type) {
+ case "datetime":
+ date.datetimepicker(options);
+ break;
+ case "date":
+ date.datepicker(options);
+ break;
+ case "time":
+ date.timepicker(options);
+ break;
+ default:
+ console.error("invalid: not date-pattern nor time-pattern"); // @DEV_ONLY
+ }
+
+ var buttonImage = date.next("img");
+ buttonImage.css({
+ position: "absolute",
+ left: parseInt(date.css("left")) + date.outerWidth(true) + 5 + "px",
+ top: date.css("top")
+ });
+ });
+};
+
+/*
+ Get the pattern from the "Java world" (http://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html)
+ and convert it to jQuery UI. Here we need the "date" "time" and "separator" separately.
+
+ Attention: Not every pattern char is supported.
+ Currently only date time side-by-side is allowed.
+ */
+Tobago.DateTime.analyzePattern = function (pattern) {
+
+ if (!pattern || pattern.length > 100) {
+ console.warn("Pattern not supported: " + pattern); // @DEV_ONLY
+ pattern = "";
+ }
+
+ var dateChars = ["G", "y", "Y", "M", "L", "w", "W", "D", "d", "F", "E", "u"];
+ var timeChars = ["a", "H", "k", "K", "h", "m", "s", "S", "z", "Z", "X"];
+ var i, pos;
+ var dateFormat = "", timeFormat = "", separator = " ";
+
+ var minDate = Infinity, maxDate = -1;
+ for (i = 0; i < dateChars.length; i++) {
+ pos = pattern.indexOf(dateChars[i]);
+ if (pos > -1) {
+ minDate = Math.min(minDate, pos);
+ }
+ pos = pattern.lastIndexOf(dateChars[i]);
+ if (pos > -1) {
+ maxDate = Math.max(maxDate, pos);
+ }
+ }
+
+ var minTime = Infinity, maxTime = -1;
+ for (i = 0; i < timeChars.length; i++) {
+ pos = pattern.indexOf(timeChars[i]);
+ if (pos > -1) {
+ minTime = Math.min(minTime, pos);
+ }
+ pos = pattern.lastIndexOf(timeChars[i]);
+ if (pos > -1) {
+ maxTime = Math.max(maxTime, pos);
+ }
+ }
+
+ if (minDate != Infinity) {
+ if (minTime != Infinity) {
+ if (maxDate < minTime) {
+ dateFormat = pattern.substring(0, maxDate + 1);
+ separator = pattern.substring(maxDate + 1, minTime);
+ timeFormat = pattern.substring(minTime);
+ } else {
+ // should not happen, the Renderer should check the pattern.
+ console.warn("Pattern not supported: " + pattern); // @DEV_ONLY
+ }
+ } else {
+ dateFormat = pattern;
+ }
+ } else {
+ if (minTime != Infinity) {
+ timeFormat = pattern;
+ } else { // empty pattern
+ // should not happen, the Renderer should check the pattern.
+ console.warn("Pattern not supported: " + pattern); // @DEV_ONLY
+ }
+ }
+
+ // different pattern in Java and jQuery UI
+
+ if (dateFormat.search(/y{3,}/) > -1) {
+ dateFormat = dateFormat.replace(/y{3,}/g, "yy")
+ } else if (dateFormat.search(/y{2}/) > -1) {
+ dateFormat = dateFormat.replace(/y{2}/g, "y")
+ } else {
+ dateFormat = dateFormat.replace(/y/g, "yy")
+ }
+
+ if (dateFormat.search(/M{4,}/) > -1) {
+ dateFormat = dateFormat.replace(/M{4,}/g, "MM")
+ } else if (dateFormat.search(/M{3}/) > -1) {
+ dateFormat = dateFormat.replace(/M{3}/g, "M")
+ } else if (dateFormat.search(/M{2}/) > -1) {
+ dateFormat = dateFormat.replace(/M{2}/g, "mm")
+ } else {
+ dateFormat = dateFormat.replace(/M/g, "m")
+ }
+
+ if (dateFormat.search(/L{4,}/) > -1) {
+ dateFormat = dateFormat.replace(/L{4,}/g, "MM")
+ } else if (dateFormat.search(/L{3}/) > -1) {
+ dateFormat = dateFormat.replace(/L{3}/g, "M")
+ } else if (dateFormat.search(/L{2}/) > -1) {
+ dateFormat = dateFormat.replace(/L{2}/g, "mm")
+ } else {
+ dateFormat = dateFormat.replace(/L/g, "m")
+ }
+
+ if (dateFormat.search(/D{3,}/) > -1) {
+ dateFormat = dateFormat.replace(/D{3,}/g, "oo")
+ } else if (dateFormat.search(/D{1,2}/) > -1) {
+ dateFormat = dateFormat.replace(/D{1,2}/g, "o")
+ }
+
+ if (dateFormat.search(/d{2,}/) > -1) {
+ dateFormat = dateFormat.replace(/d{2,}/g, "dd")
+ } else {
+ dateFormat = dateFormat.replace(/d/g, "d")
+ }
+
+ if (dateFormat.search(/E{4,}/) > -1) {
+ dateFormat = dateFormat.replace(/E{4,}/g, "DD")
+ } else {
+ dateFormat = dateFormat.replace(/E{1,3}/g, "D")
+ }
+
+ timeFormat = timeFormat.replace(/S{1,}/g, "l");
+
+ timeFormat = timeFormat.replace(/a{1,}/g, "TT");
+
+ timeFormat = timeFormat.replace(/z/g, "Z"); // XXX is this correct?
+
+ if (dateFormat == "") {
+ dateFormat = null;
+ }
+ if (timeFormat == "") {
+ timeFormat = null;
+ }
+
+ return {
+ dateFormat: dateFormat,
+ separator: separator,
+ timeFormat: timeFormat,
+ type: dateFormat != null ? timeFormat != null ? "datetime" : "date" : timeFormat != null ? "time" : null
+ };
+
+};
+
+Tobago.registerListener(Tobago.DateTime.init, Tobago.Phase.DOCUMENT_READY);
+Tobago.registerListener(Tobago.DateTime.init, Tobago.Phase.AFTER_UPDATE);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-in.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-in.js?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-in.js (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-in.js Wed Jul 9 16:26:02 2014
@@ -36,6 +36,12 @@ Tobago.In.init = function(elements) {
var required = jQuery(this).attr("required") != undefined;
new Tobago.In(id, required, 'tobago-date-markup-required');
});
+ ins = Tobago.Utils.selectWidthJQuery(elements, "input.tobago-time");
+ ins.each(function(){
+ var id = jQuery(this).attr("id");
+ var required = jQuery(this).attr("required") != undefined;
+ new Tobago.In(id, required, 'tobago-time-markup-required');
+ });
ins = Tobago.Utils.selectWidthJQuery(elements, ".tobago-textarea");
ins.each(function(){
var id = jQuery(this).attr("id");
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1609225&r1=1609224&r2=1609225&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Wed Jul 9 16:26:02 2014
@@ -290,7 +290,7 @@ var Tobago = {
var page = jQuery(".tobago-page");
page.children("form").first()
.children(Tobago.Utils.escapeClientId(this.page.id + this.SUB_COMPONENT_SEP + 'form-clientDimension'))
- .val(page.width() + ';' + page.height());
+ .val(Math.floor(page.width()) + ';' + Math.floor(page.height()));
},
onBeforeUnload: function() {
@@ -826,13 +826,14 @@ var Tobago = {
Tobago.reloadComponent(this, commands.click.partially, action, commands.click);
}
event.preventDefault();
- return false;
+ event.stopPropagation();
} else if (commands.click.url) {
if (commands.click.target) {
window.open(commands.click.url, commands.click.target)
} else {
Tobago.navigateToUrl(commands.click.url);
event.preventDefault();
+ event.stopPropagation();
return false;
}
} else if (commands.click.script) { // XXX this case is deprecated.
Added: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/contrib/jquery-ui-timepicker-addon-1.4.5.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/contrib/jquery-ui-timepicker-addon-1.4.5.css?rev=1609225&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/contrib/jquery-ui-timepicker-addon-1.4.5.css (added)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/style/contrib/jquery-ui-timepicker-addon-1.4.5.css Wed Jul 9 16:26:02 2014
@@ -0,0 +1,11 @@
+.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
+.ui-timepicker-div dl { text-align: left; }
+.ui-timepicker-div dl dt { float: left; clear:left; padding: 0 0 0 5px; }
+.ui-timepicker-div dl dd { margin: 0 10px 10px 40%; }
+.ui-timepicker-div td { font-size: 90%; }
+.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
+
+.ui-timepicker-rtl{ direction: rtl; }
+.ui-timepicker-rtl dl { text-align: right; padding: 0 5px 0 0; }
+.ui-timepicker-rtl dl dt{ float: right; clear: right; }
+.ui-timepicker-rtl dl dd { margin: 0 40% 10px 10px; }
\ No newline at end of file