incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1388138 - in /incubator/isis/trunk/framework: core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/ core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/ progmodels/dfl...
Date Thu, 20 Sep 2012 17:55:32 GMT
Author: danhaywood
Date: Thu Sep 20 17:55:31 2012
New Revision: 1388138

URL: http://svn.apache.org/viewvc?rev=1388138&view=rev
Log:
ISIS-242: more JodaTime support

* facet factories
* component factories (for wicket viewer)

Added:
    incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/
    incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueFacet.java
    incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueSemanticsProvider.java
    incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueSemanticsProviderAbstract.java
    incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueTypeFacetFactory.java
    incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/
    incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueFacet.java
    incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueSemanticsProvider.java
    incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueSemanticsProviderAbstract.java
    incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueTypeFacetFactory.java
    incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanel.css
    incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanel.html
    incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanel.java
    incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanelFactory.java
    incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanel.css
    incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanel.html
    incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanel.java
    incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanelFactory.java
Modified:
    incubator/isis/trunk/framework/progmodels/dflt/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
    incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-applib/src/main/resources/plugin.xml
    incubator/isis/trunk/framework/viewer/wicket/wicket-viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java

Added: incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueFacet.java?rev=1388138&view=auto
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueFacet.java (added)
+++ incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueFacet.java Thu Sep 20 17:55:31 2012
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets.value.datetimejoda;
+
+import org.joda.time.DateTime;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+public interface JodaDateTimeValueFacet extends Facet {
+
+    DateTime dateValue(ObjectAdapter object);
+
+    ObjectAdapter createValue(DateTime date);
+
+}

Added: incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueSemanticsProvider.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueSemanticsProvider.java?rev=1388138&view=auto
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueSemanticsProvider.java (added)
+++ incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueSemanticsProvider.java Thu Sep 20 17:55:31 2012
@@ -0,0 +1,71 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets.value.datetimejoda;
+
+import java.util.Date;
+
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
+import org.joda.time.DateTime;
+
+public class JodaDateTimeValueSemanticsProvider extends JodaDateTimeValueSemanticsProviderAbstract<DateTime> {
+
+    // no default
+    private static final DateTime DEFAULT_VALUE = null;
+
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public JodaDateTimeValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public JodaDateTimeValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(holder, DateTime.class, DEFAULT_VALUE, configuration, context);
+    }
+
+    @Override
+    protected DateTime add(final DateTime original, final int years, final int months, final int days, final int hours, final int minutes) {
+        if(hours != 0 || minutes != 0) {
+            throw new IllegalArgumentException("cannot add non-zero hours or minutes to a DateTime");
+        }
+        return original.plusYears(years).plusMonths(months).plusDays(days);
+    }
+
+    @Override
+    protected DateTime now() {
+        return new DateTime();
+    }
+
+    @Override
+    protected Date dateValue(final Object value) {
+        return ((DateTime) value).toDateTime().toDate();
+    }
+
+    @Override
+    protected DateTime setDate(final Date date) {
+        return new DateTime(date.getTime());
+    }
+}

Added: incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueSemanticsProviderAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueSemanticsProviderAbstract.java?rev=1388138&view=auto
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueSemanticsProviderAbstract.java (added)
+++ incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueSemanticsProviderAbstract.java Thu Sep 20 17:55:31 2012
@@ -0,0 +1,118 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets.value.datetimejoda;
+
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import com.google.common.collect.Maps;
+
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.core.commons.config.ConfigurationConstants;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
+import org.apache.isis.core.progmodel.facets.value.ValueSemanticsProviderAbstractTemporal;
+
+public abstract class JodaDateTimeValueSemanticsProviderAbstract<T> extends ValueSemanticsProviderAbstractTemporal<T> {
+
+    private static Map<String, DateFormat> formats = Maps.newHashMap();
+
+    static {
+        formats.put(ISO_ENCODING_FORMAT, createDateEncodingFormat("yyyyMMdd"));
+        formats.put("iso", createDateFormat("yyyy-MM-dd"));
+        formats.put("medium", DateFormat.getDateInstance(DateFormat.MEDIUM));
+    }
+
+    public JodaDateTimeValueSemanticsProviderAbstract(final FacetHolder holder, final Class<T> adaptedClass, final T defaultValue, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super("date", holder, adaptedClass, 12, Immutability.IMMUTABLE, EqualByContent.HONOURED, defaultValue, configuration, context);
+
+        final String formatRequired = configuration.getString(ConfigurationConstants.ROOT + "value.format.date");
+        if (formatRequired == null) {
+            format = formats().get(defaultFormat());
+        } else {
+            setMask(formatRequired);
+        }
+    }
+
+
+    // //////////////////////////////////////////////////////////////////
+    // temporal-specific stuff
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected void clearFields(final Calendar cal) {
+        cal.set(Calendar.HOUR, 0);
+        cal.set(Calendar.HOUR_OF_DAY, 0);
+        cal.set(Calendar.MINUTE, 0);
+        cal.set(Calendar.SECOND, 0);
+        cal.set(Calendar.AM_PM, 0);
+        cal.set(Calendar.MILLISECOND, 0);
+    }
+
+    @Override
+    protected String defaultFormat() {
+        return "medium";
+    }
+
+    @Override
+    protected boolean ignoreTimeZone() {
+        return true;
+    }
+
+    @Override
+    protected Map<String, DateFormat> formats() {
+        return formats;
+    }
+
+    @Override
+    public String toString() {
+        return "DateValueSemanticsProvider: " + format;
+    }
+
+    @Override
+    protected DateFormat format(final Localization localization) {
+        final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, localization.getLocale());
+        dateFormat.setTimeZone(UTC_TIME_ZONE);
+        return dateFormat;
+    }
+
+    protected List<DateFormat> formatsToTry(Localization localization) {
+        List<DateFormat> formats = new ArrayList<DateFormat>();
+
+        Locale locale = localization == null ? Locale.getDefault() : localization.getLocale();
+        formats.add(DateFormat.getDateInstance(DateFormat.LONG, locale));
+        formats.add(DateFormat.getDateInstance(DateFormat.MEDIUM, locale));
+        formats.add(DateFormat.getDateInstance(DateFormat.SHORT, locale));
+        formats.add(createDateFormat("yyyy-MM-dd"));
+        formats.add(createDateFormat("yyyyMMdd"));
+
+        for (DateFormat format : formats) {
+            format.setTimeZone(UTC_TIME_ZONE);
+        }
+
+        return formats;
+    }
+
+}

Added: incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueTypeFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueTypeFacetFactory.java?rev=1388138&view=auto
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueTypeFacetFactory.java (added)
+++ incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejoda/JodaDateTimeValueTypeFacetFactory.java Thu Sep 20 17:55:31 2012
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets.value.datetimejoda;
+
+import org.joda.time.DateTime;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueUsingValueSemanticsProviderFacetFactory;
+
+public class JodaDateTimeValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<DateTime> {
+
+    public JodaDateTimeValueTypeFacetFactory() {
+     // as per inherited DateTimeValueSemanticsProvider#facetType
+        super(JodaDateTimeValueFacet.class); 
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != DateTime.class) {
+            return;
+        }
+        addFacets(new JodaDateTimeValueSemanticsProvider(holder, getConfiguration(), getContext()));
+    }
+
+}

Added: incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueFacet.java?rev=1388138&view=auto
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueFacet.java (added)
+++ incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueFacet.java Thu Sep 20 17:55:31 2012
@@ -0,0 +1,33 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets.value.datetimejodalocal;
+
+import org.joda.time.LocalDateTime;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+public interface JodaLocalDateTimeValueFacet extends Facet {
+
+    LocalDateTime dateValue(ObjectAdapter object);
+
+    ObjectAdapter createValue(LocalDateTime date);
+
+}

Added: incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueSemanticsProvider.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueSemanticsProvider.java?rev=1388138&view=auto
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueSemanticsProvider.java (added)
+++ incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueSemanticsProvider.java Thu Sep 20 17:55:31 2012
@@ -0,0 +1,71 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets.value.datetimejodalocal;
+
+import java.util.Date;
+
+import org.apache.isis.applib.adapters.EncoderDecoder;
+import org.apache.isis.applib.adapters.Parser;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
+import org.joda.time.LocalDateTime;
+
+public class JodaLocalDateTimeValueSemanticsProvider extends JodaLocalDateTimeValueSemanticsProviderAbstract<LocalDateTime> {
+
+    // no default
+    private static final LocalDateTime DEFAULT_VALUE = null;
+
+
+    /**
+     * Required because implementation of {@link Parser} and
+     * {@link EncoderDecoder}.
+     */
+    public JodaLocalDateTimeValueSemanticsProvider() {
+        this(null, null, null);
+    }
+
+    public JodaLocalDateTimeValueSemanticsProvider(final FacetHolder holder, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super(holder, LocalDateTime.class, DEFAULT_VALUE, configuration, context);
+    }
+
+    @Override
+    protected LocalDateTime add(final LocalDateTime original, final int years, final int months, final int days, final int hours, final int minutes) {
+        if(hours != 0 || minutes != 0) {
+            throw new IllegalArgumentException("cannot add non-zero hours or minutes to a LocalDateTime");
+        }
+        return original.plusYears(years).plusMonths(months).plusDays(days);
+    }
+
+    @Override
+    protected LocalDateTime now() {
+        return new LocalDateTime();
+    }
+
+    @Override
+    protected Date dateValue(final Object value) {
+        return ((LocalDateTime) value).toDateTime().toDate();
+    }
+
+    @Override
+    protected LocalDateTime setDate(final Date date) {
+        return new LocalDateTime(date.getTime());
+    }
+}

Added: incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueSemanticsProviderAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueSemanticsProviderAbstract.java?rev=1388138&view=auto
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueSemanticsProviderAbstract.java (added)
+++ incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueSemanticsProviderAbstract.java Thu Sep 20 17:55:31 2012
@@ -0,0 +1,118 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets.value.datetimejodalocal;
+
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import com.google.common.collect.Maps;
+
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.core.commons.config.ConfigurationConstants;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
+import org.apache.isis.core.progmodel.facets.value.ValueSemanticsProviderAbstractTemporal;
+
+public abstract class JodaLocalDateTimeValueSemanticsProviderAbstract<T> extends ValueSemanticsProviderAbstractTemporal<T> {
+
+    private static Map<String, DateFormat> formats = Maps.newHashMap();
+
+    static {
+        formats.put(ISO_ENCODING_FORMAT, createDateEncodingFormat("yyyyMMdd"));
+        formats.put("iso", createDateFormat("yyyy-MM-dd"));
+        formats.put("medium", DateFormat.getDateInstance(DateFormat.MEDIUM));
+    }
+
+    public JodaLocalDateTimeValueSemanticsProviderAbstract(final FacetHolder holder, final Class<T> adaptedClass, final T defaultValue, final IsisConfiguration configuration, final ValueSemanticsProviderContext context) {
+        super("date", holder, adaptedClass, 12, Immutability.IMMUTABLE, EqualByContent.HONOURED, defaultValue, configuration, context);
+
+        final String formatRequired = configuration.getString(ConfigurationConstants.ROOT + "value.format.date");
+        if (formatRequired == null) {
+            format = formats().get(defaultFormat());
+        } else {
+            setMask(formatRequired);
+        }
+    }
+
+
+    // //////////////////////////////////////////////////////////////////
+    // temporal-specific stuff
+    // //////////////////////////////////////////////////////////////////
+
+    @Override
+    protected void clearFields(final Calendar cal) {
+        cal.set(Calendar.HOUR, 0);
+        cal.set(Calendar.HOUR_OF_DAY, 0);
+        cal.set(Calendar.MINUTE, 0);
+        cal.set(Calendar.SECOND, 0);
+        cal.set(Calendar.AM_PM, 0);
+        cal.set(Calendar.MILLISECOND, 0);
+    }
+
+    @Override
+    protected String defaultFormat() {
+        return "medium";
+    }
+
+    @Override
+    protected boolean ignoreTimeZone() {
+        return true;
+    }
+
+    @Override
+    protected Map<String, DateFormat> formats() {
+        return formats;
+    }
+
+    @Override
+    public String toString() {
+        return "DateValueSemanticsProvider: " + format;
+    }
+
+    @Override
+    protected DateFormat format(final Localization localization) {
+        final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, localization.getLocale());
+        dateFormat.setTimeZone(UTC_TIME_ZONE);
+        return dateFormat;
+    }
+
+    protected List<DateFormat> formatsToTry(Localization localization) {
+        List<DateFormat> formats = new ArrayList<DateFormat>();
+
+        Locale locale = localization == null ? Locale.getDefault() : localization.getLocale();
+        formats.add(DateFormat.getDateInstance(DateFormat.LONG, locale));
+        formats.add(DateFormat.getDateInstance(DateFormat.MEDIUM, locale));
+        formats.add(DateFormat.getDateInstance(DateFormat.SHORT, locale));
+        formats.add(createDateFormat("yyyy-MM-dd"));
+        formats.add(createDateFormat("yyyyMMdd"));
+
+        for (DateFormat format : formats) {
+            format.setTimeZone(UTC_TIME_ZONE);
+        }
+
+        return formats;
+    }
+
+}

Added: incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueTypeFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueTypeFacetFactory.java?rev=1388138&view=auto
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueTypeFacetFactory.java (added)
+++ incubator/isis/trunk/framework/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/value/datetimejodalocal/JodaLocalDateTimeValueTypeFacetFactory.java Thu Sep 20 17:55:31 2012
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets.value.datetimejodalocal;
+
+import org.joda.time.LocalDateTime;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueUsingValueSemanticsProviderFacetFactory;
+
+public class JodaLocalDateTimeValueTypeFacetFactory extends ValueUsingValueSemanticsProviderFacetFactory<LocalDateTime> {
+
+    public JodaLocalDateTimeValueTypeFacetFactory() {
+     // as per inherited DateTimeValueSemanticsProvider#facetType
+        super(JodaLocalDateTimeValueFacet.class); 
+    }
+
+    @Override
+    public void process(final ProcessClassContext processClassContext) {
+        final Class<?> type = processClassContext.getCls();
+        final FacetHolder holder = processClassContext.getFacetHolder();
+
+        if (type != LocalDateTime.class) {
+            return;
+        }
+        addFacets(new JodaLocalDateTimeValueSemanticsProvider(holder, getConfiguration(), getContext()));
+    }
+
+}

Modified: incubator/isis/trunk/framework/progmodels/dflt/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/progmodels/dflt/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java?rev=1388138&r1=1388137&r2=1388138&view=diff
==============================================================================
--- incubator/isis/trunk/framework/progmodels/dflt/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java (original)
+++ incubator/isis/trunk/framework/progmodels/dflt/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java Thu Sep 20 17:55:31 2012
@@ -165,6 +165,8 @@ import org.apache.isis.core.progmodel.fa
 import org.apache.isis.core.progmodel.facets.value.datejodalocal.JodaLocalDateValueTypeFacetFactory;
 import org.apache.isis.core.progmodel.facets.value.datesql.JavaSqlDateValueTypeFacetFactory;
 import org.apache.isis.core.progmodel.facets.value.datetime.DateTimeValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.datetimejoda.JodaDateTimeValueTypeFacetFactory;
+import org.apache.isis.core.progmodel.facets.value.datetimejodalocal.JodaLocalDateTimeValueTypeFacetFactory;
 import org.apache.isis.core.progmodel.facets.value.dateutil.JavaUtilDateValueTypeFacetFactory;
 import org.apache.isis.core.progmodel.facets.value.floats.FloatPrimitiveValueTypeFacetFactory;
 import org.apache.isis.core.progmodel.facets.value.floats.FloatWrapperValueTypeFacetFactory;
@@ -413,7 +415,9 @@ public class ProgrammingModelFacetsJava5
 
         // jodatime values
         addFactory(JodaLocalDateValueTypeFacetFactory.class);
-
+        addFactory(JodaLocalDateTimeValueTypeFacetFactory.class);
+        addFactory(JodaDateTimeValueTypeFacetFactory.class);
+        
         // written to not trample over TypeOf if already installed
         addFactory(CollectionFacetFactory.class);
         // must come after CollectionFacetFactory

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-applib/src/main/resources/plugin.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-applib/src/main/resources/plugin.xml?rev=1388138&r1=1388137&r2=1388138&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-applib/src/main/resources/plugin.xml (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-applib/src/main/resources/plugin.xml Thu Sep 20 17:55:31 2012
@@ -23,8 +23,15 @@
         <mapping 
             java-type="org.apache.isis.applib.value.DateTime" 
             mapping-class="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.IsisDateTimeMapping"/>
-        <mapping 
+<!--        <mapping 
             java-type="org.joda.time.LocalDate" 
             mapping-class="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.JodaLocalDateMapping"/>
+        <mapping 
+            java-type="org.joda.time.DateTime" 
+            mapping-class="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.JodaDateTimeMapping"/>
+        <mapping 
+            java-type="org.joda.time.LocalDateTime" 
+            mapping-class="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.JodaLocalDateTimeMapping"/>
+-->
     </extension>
 </plugin>
\ No newline at end of file

Added: incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanel.css
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanel.css?rev=1388138&view=auto
==============================================================================
--- incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanel.css (added)
+++ incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanel.css Thu Sep 20 17:55:31 2012
@@ -0,0 +1,18 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */

Added: incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanel.html
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanel.html?rev=1388138&view=auto
==============================================================================
--- incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanel.html (added)
+++ incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanel.html Thu Sep 20 17:55:31 2012
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+         http://www.apache.org/licenses/LICENSE-2.0
+         
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"  
+      xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"  
+      xml:lang="en"  
+      lang="en">
+	<head></head>
+	<body>
+		<wicket:panel>
+			<div class="javaUtilDate dateTime temporal scalarPanel">
+				<label for="scalarValue" wicket:id="scalarIfRegular">
+	      			<span wicket:id="scalarName" class="scalarName">[Label text]</span>
+	      			<span class="scalarValue">
+		      			<input type="text" name="scalarValue" id="scalarValue" wicket:id="scalarValue" />
+		      			<span wicket:id="feedback"></span>
+	      			</span>
+				</label>
+				<label wicket:id="scalarIfCompact"></label>
+			</div>
+		</wicket:panel>
+	</body>
+</html>

Added: incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanel.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanel.java?rev=1388138&view=auto
==============================================================================
--- incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanel.java (added)
+++ incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanel.java Thu Sep 20 17:55:31 2012
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.viewer.wicket.ui.components.scalars.jodatime;
+
+import java.util.Date;
+
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelTextFieldDatePickerAbstract;
+import org.joda.time.DateTime;
+import org.joda.time.LocalDateTime;
+
+/**
+ * Panel for rendering scalars of type {@link LocalDateTime}.
+ */
+public class JodaDateTimePanel extends ScalarPanelTextFieldDatePickerAbstract<DateTime> {
+
+    private static final long serialVersionUID = 1L;
+    private static final String ID_SCALAR_VALUE = "scalarValue";
+
+    public JodaDateTimePanel(final String id, final ScalarModel scalarModel) {
+        super(id, ID_SCALAR_VALUE, scalarModel);
+    }
+
+    @Override
+    protected Date asDate(DateTime pojo) {
+        return pojo.toDateTime().toDate();
+    }
+
+    @Override
+    protected DateTime asPojo(Date date) {
+        return new DateTime(date.getTime());
+    }
+
+}

Added: incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanelFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanelFactory.java?rev=1388138&view=auto
==============================================================================
--- incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanelFactory.java (added)
+++ incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaDateTimePanelFactory.java Thu Sep 20 17:55:31 2012
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.viewer.wicket.ui.components.scalars.jodatime;
+
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.components.scalars.ComponentFactoryScalarAbstract;
+import org.apache.wicket.Component;
+import org.joda.time.DateTime;
+
+/**
+ * {@link ComponentFactory} for {@link JodaLocalDatePanel}.
+ */
+public class JodaDateTimePanelFactory extends ComponentFactoryScalarAbstract {
+
+    private static final long serialVersionUID = 1L;
+
+    public JodaDateTimePanelFactory() {
+        super(DateTime.class);
+    }
+
+    @Override
+    public Component createComponent(final String id, final ScalarModel scalarModel) {
+        return new JodaDateTimePanel(id, scalarModel);
+    }
+
+}

Added: incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanel.css
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanel.css?rev=1388138&view=auto
==============================================================================
--- incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanel.css (added)
+++ incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanel.css Thu Sep 20 17:55:31 2012
@@ -0,0 +1,18 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */

Added: incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanel.html
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanel.html?rev=1388138&view=auto
==============================================================================
--- incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanel.html (added)
+++ incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanel.html Thu Sep 20 17:55:31 2012
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+         http://www.apache.org/licenses/LICENSE-2.0
+         
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"  
+      xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"  
+      xml:lang="en"  
+      lang="en">
+	<head></head>
+	<body>
+		<wicket:panel>
+			<div class="javaUtilDate dateTime temporal scalarPanel">
+				<label for="scalarValue" wicket:id="scalarIfRegular">
+	      			<span wicket:id="scalarName" class="scalarName">[Label text]</span>
+	      			<span class="scalarValue">
+		      			<input type="text" name="scalarValue" id="scalarValue" wicket:id="scalarValue" />
+		      			<span wicket:id="feedback"></span>
+	      			</span>
+				</label>
+				<label wicket:id="scalarIfCompact"></label>
+			</div>
+		</wicket:panel>
+	</body>
+</html>

Added: incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanel.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanel.java?rev=1388138&view=auto
==============================================================================
--- incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanel.java (added)
+++ incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanel.java Thu Sep 20 17:55:31 2012
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.viewer.wicket.ui.components.scalars.jodatime;
+
+import java.util.Date;
+
+import org.joda.time.LocalDateTime;
+
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelTextFieldDatePickerAbstract;
+
+/**
+ * Panel for rendering scalars of type {@link LocalDateTime}.
+ */
+public class JodaLocalDateTimePanel extends ScalarPanelTextFieldDatePickerAbstract<LocalDateTime> {
+
+    private static final long serialVersionUID = 1L;
+    private static final String ID_SCALAR_VALUE = "scalarValue";
+
+    public JodaLocalDateTimePanel(final String id, final ScalarModel scalarModel) {
+        super(id, ID_SCALAR_VALUE, scalarModel);
+    }
+
+    @Override
+    protected Date asDate(LocalDateTime pojo) {
+        return pojo.toDateTime().toDate();
+    }
+
+    @Override
+    protected LocalDateTime asPojo(Date date) {
+        return new LocalDateTime(date.getTime());
+    }
+
+}

Added: incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanelFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanelFactory.java?rev=1388138&view=auto
==============================================================================
--- incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanelFactory.java (added)
+++ incubator/isis/trunk/framework/viewer/wicket/wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/JodaLocalDateTimePanelFactory.java Thu Sep 20 17:55:31 2012
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.viewer.wicket.ui.components.scalars.jodatime;
+
+import org.apache.wicket.Component;
+import org.joda.time.LocalDateTime;
+
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.components.scalars.ComponentFactoryScalarAbstract;
+
+/**
+ * {@link ComponentFactory} for {@link JodaLocalDatePanel}.
+ */
+public class JodaLocalDateTimePanelFactory extends ComponentFactoryScalarAbstract {
+
+    private static final long serialVersionUID = 1L;
+
+    public JodaLocalDateTimePanelFactory() {
+        super(LocalDateTime.class);
+    }
+
+    @Override
+    public Component createComponent(final String id, final ScalarModel scalarModel) {
+        return new JodaLocalDateTimePanel(id, scalarModel);
+    }
+
+}

Modified: incubator/isis/trunk/framework/viewer/wicket/wicket-viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/wicket/wicket-viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java?rev=1388138&r1=1388137&r2=1388138&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/wicket/wicket-viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java (original)
+++ incubator/isis/trunk/framework/viewer/wicket/wicket-viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java Thu Sep 20 17:55:31 2012
@@ -59,7 +59,9 @@ import org.apache.isis.viewer.wicket.ui.
 import org.apache.isis.viewer.wicket.ui.components.scalars.jdkdates.JavaUtilDatePanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.scalars.jdkmath.JavaMathBigDecimalPanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.scalars.jdkmath.JavaMathBigIntegerPanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.scalars.jodatime.JodaDateTimePanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.scalars.jodatime.JodaLocalDatePanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.scalars.jodatime.JodaLocalDateTimePanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.scalars.primitive.BooleanPanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.scalars.primitive.BytePanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.scalars.primitive.CharacterPanelFactory;
@@ -217,6 +219,8 @@ public class ComponentFactoryRegistrarDe
         componentFactories.add(new JavaMathBigDecimalPanelFactory());
 
         componentFactories.add(new JodaLocalDatePanelFactory());
+        componentFactories.add(new JodaLocalDateTimePanelFactory());
+        componentFactories.add(new JodaDateTimePanelFactory());
 
         componentFactories.add(new ValuePanelFactory());
 



Mime
View raw message