You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2015/09/03 14:32:22 UTC
[31/87] [abbrv] [partial] isis git commit: ISIS-1194: moving the
wicket submodules to be direct children of core;
removing the isis-viewer-wicket parent pom.
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisDatePanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisDatePanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisDatePanelFactory.java
new file mode 100644
index 0000000..a008664
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisDatePanelFactory.java
@@ -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.isisapplib;
+
+import org.apache.wicket.Component;
+
+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 IsisDatePanel}.
+ */
+public class IsisDatePanelFactory extends ComponentFactoryScalarAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public IsisDatePanelFactory() {
+ super(IsisDatePanel.class, org.apache.isis.applib.value.Date.class);
+ }
+
+ @Override
+ public Component createComponent(final String id, final ScalarModel scalarModel) {
+ return new IsisDatePanel(id, scalarModel);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisDateTimePanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisDateTimePanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisDateTimePanel.java
new file mode 100644
index 0000000..b62e9bf
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisDateTimePanel.java
@@ -0,0 +1,52 @@
+/*
+ * 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.isisapplib;
+
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.isis.applib.value.DateTime;
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelTextFieldDatePickerAbstract;
+import org.apache.isis.viewer.wicket.ui.components.scalars.TextFieldValueModel;
+import org.apache.isis.viewer.wicket.ui.components.scalars.datepicker.TextFieldWithDateTimePicker;
+
+/**
+ * Panel for rendering scalars of type {@link DateTime Isis' applib.DateTime}.
+ */
+public class IsisDateTimePanel extends ScalarPanelTextFieldDatePickerAbstract<org.apache.isis.applib.value.DateTime> {
+
+ private static final long serialVersionUID = 1L;
+
+ public IsisDateTimePanel(final String id, final ScalarModel scalarModel) {
+ super(id, scalarModel, org.apache.isis.applib.value.DateTime.class);
+ init(new DateConverterForApplibDateTime(getSettings(), getAdjustBy()));
+ }
+
+ @Override
+ protected TextField<org.apache.isis.applib.value.DateTime> createTextField(final String id) {
+ return new TextFieldWithDateTimePicker<>(id, new TextFieldValueModel<org.apache.isis.applib.value.DateTime>(this), cls, converter);
+ }
+
+ @Override
+ protected IModel<String> getScalarPanelType() {
+ return Model.of("isisDateTimePanel");
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisDateTimePanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisDateTimePanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisDateTimePanelFactory.java
new file mode 100644
index 0000000..ba2a3f5
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisDateTimePanelFactory.java
@@ -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.isisapplib;
+
+import org.apache.wicket.Component;
+
+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 IsisDateTimePanel}.
+ */
+public class IsisDateTimePanelFactory extends ComponentFactoryScalarAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public IsisDateTimePanelFactory() {
+ super(IsisDateTimePanel.class, org.apache.isis.applib.value.DateTime.class);
+ }
+
+ @Override
+ public Component createComponent(final String id, final ScalarModel scalarModel) {
+ return new IsisDateTimePanel(id, scalarModel);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisMoneyPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisMoneyPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisMoneyPanel.java
new file mode 100644
index 0000000..7f677a7
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisMoneyPanel.java
@@ -0,0 +1,50 @@
+/*
+ * 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.isisapplib;
+
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.isis.applib.value.Money;
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelTextFieldParseableAbstract;
+
+/**
+ * Panel for rendering scalars of type {@link Money Isis' applib.Money}.
+ */
+public class IsisMoneyPanel extends ScalarPanelTextFieldParseableAbstract {
+
+ private static final long serialVersionUID = 1L;
+ private static final String ID_SCALAR_VALUE = "scalarValue";
+
+ public IsisMoneyPanel(final String id, final ScalarModel scalarModel) {
+ super(id, ID_SCALAR_VALUE, scalarModel);
+ }
+
+ @Override
+ protected IModel<String> getScalarPanelType() {
+ return Model.of("isisMoneyPanel");
+ }
+
+ @Override
+ protected void addSemantics() {
+ super.addSemantics();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisMoneyPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisMoneyPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisMoneyPanelFactory.java
new file mode 100644
index 0000000..2ffceeb
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisMoneyPanelFactory.java
@@ -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.isisapplib;
+
+import org.apache.wicket.Component;
+
+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 IsisMoneyPanel}.
+ */
+public class IsisMoneyPanelFactory extends ComponentFactoryScalarAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public IsisMoneyPanelFactory() {
+ super(IsisMoneyPanel.class, org.apache.isis.applib.value.Money.class);
+ }
+
+ @Override
+ public Component createComponent(final String id, final ScalarModel scalarModel) {
+ return new IsisMoneyPanel(id, scalarModel);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisPasswordPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisPasswordPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisPasswordPanel.java
new file mode 100644
index 0000000..a9b5cda
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisPasswordPanel.java
@@ -0,0 +1,85 @@
+/*
+ * 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.isisapplib;
+
+import de.agilecoders.wicket.core.util.Attributes;
+
+import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.markup.html.form.AbstractTextComponent;
+import org.apache.wicket.markup.html.form.PasswordTextField;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.isis.applib.value.Password;
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelTextFieldParseableAbstract;
+
+/**
+ * Panel for rendering scalars of type {@link Password Isis' applib.Password}.
+ */
+public class IsisPasswordPanel extends ScalarPanelTextFieldParseableAbstract {
+
+ private static final long serialVersionUID = 1L;
+ private static final String ID_SCALAR_VALUE = "scalarValue";
+
+ public IsisPasswordPanel(final String id, final ScalarModel scalarModel) {
+ super(id, ID_SCALAR_VALUE, scalarModel);
+ }
+
+ @Override
+ protected void addSemantics() {
+ super.addSemantics();
+ }
+
+ @Override
+ protected AbstractTextComponent<String> createTextFieldForRegular() {
+ final PasswordTextField passwordField = new PasswordTextField(idTextField, new Model<String>() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String getObject() {
+ return getModel().getObjectAsString();
+ }
+
+ @Override
+ public void setObject(final String object) {
+ if (object == null) {
+ getModel().setObject(null);
+ } else {
+ getModel().setObjectAsString(object);
+ }
+ }
+ }) {
+ @Override
+ protected void onComponentTag(ComponentTag tag) {
+ Attributes.set(tag, "type", "password");
+ super.onComponentTag(tag);
+ }
+ };
+
+ passwordField.setResetPassword(false);
+
+ return passwordField;
+ }
+
+ @Override
+ protected IModel<String> getScalarPanelType() {
+ return Model.of("isisPasswordPanel");
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisPasswordPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisPasswordPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisPasswordPanelFactory.java
new file mode 100644
index 0000000..e4b188d
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisPasswordPanelFactory.java
@@ -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.isisapplib;
+
+import org.apache.wicket.Component;
+
+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 IsisPasswordPanel}.
+ */
+public class IsisPasswordPanelFactory extends ComponentFactoryScalarAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public IsisPasswordPanelFactory() {
+ super(IsisPasswordPanel.class, org.apache.isis.applib.value.Password.class);
+ }
+
+ @Override
+ public Component createComponent(final String id, final ScalarModel scalarModel) {
+ return new IsisPasswordPanel(id, scalarModel);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisPercentagePanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisPercentagePanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisPercentagePanel.java
new file mode 100644
index 0000000..c514400
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisPercentagePanel.java
@@ -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.isisapplib;
+
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.isis.applib.value.Percentage;
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelTextFieldParseableAbstract;
+
+/**
+ * Panel for rendering scalars of type {@link Percentage Isis'
+ * applib.Percentage}.
+ */
+public class IsisPercentagePanel extends ScalarPanelTextFieldParseableAbstract {
+
+ private static final long serialVersionUID = 1L;
+ private static final String ID_SCALAR_VALUE = "scalarValue";
+
+ public IsisPercentagePanel(final String id, final ScalarModel scalarModel) {
+ super(id, ID_SCALAR_VALUE, scalarModel);
+ }
+
+ @Override
+ protected IModel<String> getScalarPanelType() {
+ return Model.of("isisPercentagePanel");
+ }
+
+ @Override
+ protected void addSemantics() {
+ super.addSemantics();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisPercentagePanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisPercentagePanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisPercentagePanelFactory.java
new file mode 100644
index 0000000..80bf1d1
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisPercentagePanelFactory.java
@@ -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.isisapplib;
+
+import org.apache.wicket.Component;
+
+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 IsisPercentagePanel}.
+ */
+public class IsisPercentagePanelFactory extends ComponentFactoryScalarAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public IsisPercentagePanelFactory() {
+ super(IsisPercentagePanel.class, org.apache.isis.applib.value.Percentage.class);
+ }
+
+ @Override
+ public Component createComponent(final String id, final ScalarModel scalarModel) {
+ return new IsisPercentagePanel(id, scalarModel);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisTimePanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisTimePanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisTimePanel.java
new file mode 100644
index 0000000..b021346
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisTimePanel.java
@@ -0,0 +1,49 @@
+/*
+ * 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.isisapplib;
+
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelTextFieldParseableAbstract;
+
+/**
+ * Panel for rendering scalars of type {@link Time Isis' applib.Time}.
+ */
+public class IsisTimePanel extends ScalarPanelTextFieldParseableAbstract {
+
+ private static final long serialVersionUID = 1L;
+ private static final String ID_SCALAR_VALUE = "scalarValue";
+
+ public IsisTimePanel(final String id, final ScalarModel scalarModel) {
+ super(id, ID_SCALAR_VALUE, scalarModel);
+ }
+
+ @Override
+ protected IModel<String> getScalarPanelType() {
+ return Model.of("isisTimePanel");
+ }
+
+ @Override
+ protected void addSemantics() {
+ super.addSemantics();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisTimePanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisTimePanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisTimePanelFactory.java
new file mode 100644
index 0000000..d667484
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisTimePanelFactory.java
@@ -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.isisapplib;
+
+import org.apache.wicket.Component;
+
+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 IsisTimePanel}.
+ */
+public class IsisTimePanelFactory extends ComponentFactoryScalarAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public IsisTimePanelFactory() {
+ super(IsisTimePanel.class, org.apache.isis.applib.value.Time.class);
+ }
+
+ @Override
+ public Component createComponent(final String id, final ScalarModel scalarModel) {
+ return new IsisTimePanel(id, scalarModel);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisTimeStampPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisTimeStampPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisTimeStampPanel.java
new file mode 100644
index 0000000..c52547c
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisTimeStampPanel.java
@@ -0,0 +1,50 @@
+/*
+ * 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.isisapplib;
+
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.isis.applib.value.TimeStamp;
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelTextFieldParseableAbstract;
+
+/**
+ * Panel for rendering scalars of type {@link TimeStamp Isis' applib.Timestamp}.
+ */
+public class IsisTimeStampPanel extends ScalarPanelTextFieldParseableAbstract {
+
+ private static final long serialVersionUID = 1L;
+ private static final String ID_SCALAR_VALUE = "scalarValue";
+
+ public IsisTimeStampPanel(final String id, final ScalarModel scalarModel) {
+ super(id, ID_SCALAR_VALUE, scalarModel);
+ }
+
+ @Override
+ protected IModel<String> getScalarPanelType() {
+ return Model.of("isisTimeStampPanel");
+ }
+
+ @Override
+ protected void addSemantics() {
+ super.addSemantics();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisTimeStampPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisTimeStampPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisTimeStampPanelFactory.java
new file mode 100644
index 0000000..6d0fca9
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/IsisTimeStampPanelFactory.java
@@ -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.isisapplib;
+
+import org.apache.wicket.Component;
+
+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 IsisTimeStampPanel}.
+ */
+public class IsisTimeStampPanelFactory extends ComponentFactoryScalarAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public IsisTimeStampPanelFactory() {
+ super(IsisTimeStampPanel.class, org.apache.isis.applib.value.TimeStamp.class);
+ }
+
+ @Override
+ public Component createComponent(final String id, final ScalarModel scalarModel) {
+ return new IsisTimeStampPanel(id, scalarModel);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaAbstract.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaAbstract.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaAbstract.java
new file mode 100644
index 0000000..b831ef8
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaAbstract.java
@@ -0,0 +1,41 @@
+/*
+ * 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.jdkdates;
+
+import java.text.SimpleDateFormat;
+
+import org.apache.isis.viewer.wicket.ui.components.scalars.DateConverterAbstract;
+
+public abstract class DateConverterForJavaAbstract<T extends java.util.Date> extends DateConverterAbstract<T> {
+ private static final long serialVersionUID = 1L;
+
+ public DateConverterForJavaAbstract(final Class<T> cls, final String datePattern, String dateTimePattern, String datePickerPattern, int adjustBy) {
+ super(cls, datePattern, dateTimePattern, datePickerPattern, adjustBy);
+ }
+
+ protected SimpleDateFormat newSimpleDateFormatUsingDatePattern() {
+ return new SimpleDateFormat(datePattern);
+ }
+
+ protected SimpleDateFormat newSimpleDateFormatUsingDateTimePattern() {
+ return new SimpleDateFormat(dateTimePattern);
+ }
+
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaSqlDate.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaSqlDate.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaSqlDate.java
new file mode 100644
index 0000000..2fa56ee
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaSqlDate.java
@@ -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.viewer.wicket.ui.components.scalars.jdkdates;
+
+import java.text.ParseException;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+
+import org.apache.wicket.util.convert.ConversionException;
+
+import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings;
+
+
+public class DateConverterForJavaSqlDate extends DateConverterForJavaAbstract<java.sql.Date> {
+ private static final long serialVersionUID = 1L;
+
+ public DateConverterForJavaSqlDate(WicketViewerSettings settings, int adjustBy) {
+ this(settings.getDatePattern(), settings.getDatePattern(), adjustBy);
+ }
+
+ private DateConverterForJavaSqlDate(String datePattern, String datePickerPattern, int adjustBy) {
+ super(java.sql.Date.class, datePattern, datePattern, datePickerPattern, adjustBy);
+ }
+
+ @Override
+ protected java.sql.Date doConvertToObject(String value, Locale locale) throws ConversionException {
+ final Date date = convert(value);
+ final java.util.Date adjustedDate = addDays(date, 0-adjustBy);
+ return new java.sql.Date(adjustedDate.getTime());
+ }
+
+ private java.util.Date convert(String value) {
+ try {
+ return newSimpleDateFormatUsingDatePattern().parse(value);
+ } catch (ParseException e) {
+ throw new ConversionException("Cannot convert into a date", e);
+ }
+ }
+
+ @Override
+ protected String doConvertToString(java.sql.Date value, Locale locale) {
+ return newSimpleDateFormatUsingDatePattern().format(addDays(value, adjustBy));
+ }
+
+ private static Date addDays(java.util.Date value, final int days) {
+ final Calendar cal = Calendar.getInstance();
+ cal.setTime(value);
+ cal.add(Calendar.DATE, days);
+ final Date adjusted = cal.getTime();
+ return adjusted;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaSqlTimestamp.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaSqlTimestamp.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaSqlTimestamp.java
new file mode 100644
index 0000000..ae749da
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaSqlTimestamp.java
@@ -0,0 +1,75 @@
+/*
+ * 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.jdkdates;
+
+import java.text.ParseException;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+
+import org.apache.wicket.util.convert.ConversionException;
+
+import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings;
+
+
+public class DateConverterForJavaSqlTimestamp extends DateConverterForJavaAbstract<java.sql.Timestamp> {
+ private static final long serialVersionUID = 1L;
+
+ public DateConverterForJavaSqlTimestamp(WicketViewerSettings settings, int adjustBy) {
+ this(settings.getDatePattern(), settings.getTimestampPattern(), adjustBy);
+ }
+ public DateConverterForJavaSqlTimestamp(final String datePattern, String timestampPattern, int adjustBy) {
+ super(java.sql.Timestamp.class, datePattern, timestampPattern, timestampPattern, adjustBy);
+ }
+
+ @Override
+ protected java.sql.Timestamp doConvertToObject(String value, Locale locale) throws ConversionException {
+ final java.sql.Timestamp date = convert(value);
+ final java.sql.Timestamp adjustedDate = addDays(date, 0-adjustBy);
+ return adjustedDate;
+ }
+
+ private java.sql.Timestamp convert(String valueStr) {
+ try {
+ Date parsed = newSimpleDateFormatUsingDateTimePattern().parse(valueStr);
+ return new java.sql.Timestamp(parsed.getTime());
+ } catch (ParseException ex) {
+ try {
+ return new java.sql.Timestamp(newSimpleDateFormatUsingDatePattern().parse(valueStr).getTime());
+ } catch (ParseException ex2) {
+ throw new ConversionException("Value cannot be converted as a date/time", ex);
+ }
+ }
+ }
+
+ @Override
+ protected String doConvertToString(java.sql.Timestamp value, Locale locale) throws ConversionException {
+ final java.sql.Timestamp adjustedDate = addDays(value, adjustBy);
+ return newSimpleDateFormatUsingDateTimePattern().format(adjustedDate);
+ }
+
+ private static java.sql.Timestamp addDays(java.util.Date value, final int days) {
+ final Calendar cal = Calendar.getInstance();
+ cal.setTime(value);
+ cal.add(Calendar.DATE, days);
+ final java.sql.Timestamp adjusted = new java.sql.Timestamp(cal.getTime().getTime());
+ return adjusted;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaUtilDate.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaUtilDate.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaUtilDate.java
new file mode 100644
index 0000000..c487cb5
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaUtilDate.java
@@ -0,0 +1,74 @@
+/*
+ * 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.jdkdates;
+
+import java.text.ParseException;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+
+import org.apache.wicket.util.convert.ConversionException;
+
+import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings;
+
+
+public class DateConverterForJavaUtilDate extends DateConverterForJavaAbstract<java.util.Date> {
+ private static final long serialVersionUID = 1L;
+
+ public DateConverterForJavaUtilDate(WicketViewerSettings settings, int adjustBy) {
+ this(settings.getDatePattern(), settings.getDateTimePattern(), settings.getDateTimePattern(), adjustBy);
+ }
+ public DateConverterForJavaUtilDate(String datePattern, String dateTimePattern, String datePickerPattern, int adjustBy) {
+ super(java.util.Date.class, datePattern, dateTimePattern, datePickerPattern, adjustBy);
+ }
+
+
+ @Override
+ protected java.util.Date doConvertToObject(String value, Locale locale) throws ConversionException {
+ final Date date = convert(value);
+ final Date adjustedDate = addDays(date, 0-adjustBy);
+ return adjustedDate;
+ }
+ private java.util.Date convert(String valueStr) {
+ try {
+ return newSimpleDateFormatUsingDateTimePattern().parse(valueStr);
+ } catch (ParseException ex) {
+ try {
+ return newSimpleDateFormatUsingDatePattern().parse(valueStr);
+ } catch (ParseException ex2) {
+ throw new ConversionException("Value cannot be converted as a date/time", ex);
+ }
+ }
+ }
+
+ @Override
+ protected String doConvertToString(java.util.Date value, Locale locale) throws ConversionException {
+ final Date adjustedDate = addDays(value, adjustBy);
+ return newSimpleDateFormatUsingDateTimePattern().format(adjustedDate);
+ }
+
+ private static Date addDays(java.util.Date value, final int days) {
+ final Calendar cal = Calendar.getInstance();
+ cal.setTime(value);
+ cal.add(Calendar.DATE, days);
+ final Date adjusted = cal.getTime();
+ return adjusted;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlDatePanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlDatePanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlDatePanel.java
new file mode 100644
index 0000000..9e69ffa
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlDatePanel.java
@@ -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.jdkdates;
+
+import java.sql.Date;
+
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+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 Date java.sql.Date}.
+ */
+public class JavaSqlDatePanel extends ScalarPanelTextFieldDatePickerAbstract<java.sql.Date> {
+
+ private static final long serialVersionUID = 1L;
+
+ public JavaSqlDatePanel(final String id, final ScalarModel scalarModel) {
+ super(id, scalarModel, java.sql.Date.class);
+ init(new DateConverterForJavaSqlDate(getSettings(), getAdjustBy()));
+ }
+
+ @Override
+ protected IModel<String> getScalarPanelType() {
+ return Model.of("javaSqlDatePanel");
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlDatePanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlDatePanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlDatePanelFactory.java
new file mode 100644
index 0000000..467f7a8
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlDatePanelFactory.java
@@ -0,0 +1,43 @@
+/*
+ * 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.jdkdates;
+
+import org.apache.wicket.Component;
+
+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 JavaSqlDatePanel}.
+ */
+public class JavaSqlDatePanelFactory extends ComponentFactoryScalarAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public JavaSqlDatePanelFactory() {
+ super(JavaSqlDatePanel.class, java.sql.Date.class);
+ }
+
+ @Override
+ public Component createComponent(final String id, final ScalarModel scalarModel) {
+ return new JavaSqlDatePanel(id, scalarModel);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlTimePanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlTimePanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlTimePanel.java
new file mode 100644
index 0000000..294d3cd
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlTimePanel.java
@@ -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.jdkdates;
+
+import java.sql.Time;
+
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelTextFieldParseableAbstract;
+
+/**
+ * Panel for rendering scalars of type {@link Time java.sql.Time}.
+ */
+public class JavaSqlTimePanel extends ScalarPanelTextFieldParseableAbstract {
+
+ private static final long serialVersionUID = 1L;
+ private static final String ID_SCALAR_VALUE = "scalarValue";
+
+ public JavaSqlTimePanel(final String id, final ScalarModel scalarModel) {
+ super(id, ID_SCALAR_VALUE, scalarModel);
+ }
+
+ @Override
+ protected IModel<String> getScalarPanelType() {
+ return Model.of("javaSqlTimePanel");
+ }
+
+ @Override
+ protected void addSemantics() {
+ super.addSemantics();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlTimePanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlTimePanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlTimePanelFactory.java
new file mode 100644
index 0000000..2334d92
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlTimePanelFactory.java
@@ -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.jdkdates;
+
+import org.apache.wicket.Component;
+
+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 JavaSqlTimePanel}.
+ */
+public class JavaSqlTimePanelFactory extends ComponentFactoryScalarAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public JavaSqlTimePanelFactory() {
+ super(JavaSqlTimePanel.class, java.util.Date.class);
+ }
+
+ @Override
+ public Component createComponent(final String id, final ScalarModel scalarModel) {
+ return new JavaSqlTimePanel(id, scalarModel);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlTimestampPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlTimestampPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlTimestampPanel.java
new file mode 100644
index 0000000..5c279e2
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlTimestampPanel.java
@@ -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.jdkdates;
+
+
+import java.sql.Timestamp;
+
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelTextFieldDatePickerAbstract;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+
+/**
+ * Panel for rendering scalars of type {@link java.sql.Timestamp}.
+ */
+public class JavaSqlTimestampPanel extends ScalarPanelTextFieldDatePickerAbstract<Timestamp> {
+
+ private static final long serialVersionUID = 1L;
+
+ public JavaSqlTimestampPanel(final String id, final ScalarModel scalarModel) {
+ super(id, scalarModel, java.sql.Timestamp.class);
+ init(new DateConverterForJavaSqlTimestamp(getSettings(), getAdjustBy()));
+ }
+
+ @Override
+ protected Integer getLengthAdjustHint() {
+ return +3;
+ }
+
+ @Override
+ protected IModel<String> getScalarPanelType() {
+ return Model.of("javaSqlTimestampPanel");
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlTimestampPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlTimestampPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlTimestampPanelFactory.java
new file mode 100644
index 0000000..20e19a8
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaSqlTimestampPanelFactory.java
@@ -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.jdkdates;
+
+import org.apache.wicket.Component;
+
+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 JavaUtilDatePanel}.
+ */
+public class JavaSqlTimestampPanelFactory extends ComponentFactoryScalarAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public JavaSqlTimestampPanelFactory() {
+ super(JavaSqlTimestampPanel.class, java.sql.Timestamp.class);
+ }
+
+ @Override
+ public Component createComponent(final String id, final ScalarModel scalarModel) {
+ return new JavaSqlTimestampPanel(id, scalarModel);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaUtilDatePanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaUtilDatePanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaUtilDatePanel.java
new file mode 100644
index 0000000..1cfef94
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaUtilDatePanel.java
@@ -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.jdkdates;
+
+
+
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+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 java.util.Date}.
+ */
+public class JavaUtilDatePanel extends ScalarPanelTextFieldDatePickerAbstract<java.util.Date> {
+
+ private static final long serialVersionUID = 1L;
+
+ public JavaUtilDatePanel(final String id, final ScalarModel scalarModel) {
+ super(id, scalarModel, java.util.Date.class);
+ init(new DateConverterForJavaUtilDate(getSettings(), getAdjustBy()));
+ }
+
+ @Override
+ protected IModel<String> getScalarPanelType() {
+ return Model.of("javaUtilDatePanel");
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaUtilDatePanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaUtilDatePanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaUtilDatePanelFactory.java
new file mode 100644
index 0000000..95ad764
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/JavaUtilDatePanelFactory.java
@@ -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.jdkdates;
+
+import org.apache.wicket.Component;
+
+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 JavaUtilDatePanel}.
+ */
+public class JavaUtilDatePanelFactory extends ComponentFactoryScalarAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public JavaUtilDatePanelFactory() {
+ super(JavaUtilDatePanel.class, java.util.Date.class);
+ }
+
+ @Override
+ public Component createComponent(final String id, final ScalarModel scalarModel) {
+ return new JavaUtilDatePanel(id, scalarModel);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/BigDecimalConverterWithScale.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/BigDecimalConverterWithScale.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/BigDecimalConverterWithScale.java
new file mode 100644
index 0000000..83780f9
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/BigDecimalConverterWithScale.java
@@ -0,0 +1,129 @@
+/**
+ * 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.jdkmath;
+
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.util.Locale;
+
+import org.apache.wicket.util.convert.ConversionException;
+import org.apache.wicket.util.convert.IConverter;
+import org.apache.wicket.util.convert.converter.AbstractNumberConverter;
+import org.apache.wicket.util.convert.converter.BigDecimalConverter;
+
+/**
+ * The {@link IConverter} implementation that our {@link BigDecimalTextField} delegates to for converting strings into
+ * values.
+ *
+ * <p>
+ * We reuse as much of Wicket's {@link BigDecimal} implementation as possible, but overriding where necessary.
+ * Whereas Wicket's own {@link BigDecimalConverter} is (clearly?) intended as a singleton, we actually want multiple
+ * instances, per scale. The {@link JavaMathBigDecimalPanelFactory} actually takes care of handling this cache,
+ * providing the {@link JavaMathBigDecimalPanel} with an appropriate underlying converter for it to delegate to.
+ */
+public class BigDecimalConverterWithScale extends BigDecimalConverter {
+
+ /**
+ * For {@link JavaMathBigDecimalPanelFactory} to call, so that there is a single instance.
+ */
+ static AbstractNumberConverter<BigDecimal> newThreadSafeConverter(Integer scale) {
+ return new BigDecimalConverterWithScale(scale);
+ }
+
+ private static final long serialVersionUID = 1L;
+ private final Integer scale;
+
+ public BigDecimalConverterWithScale(final Integer scale) {
+ this.scale = scale;
+ }
+
+ /**
+ * Disables thousands separator grouping.
+ */
+ @Override
+ protected NumberFormat newNumberFormat(Locale locale) {
+ NumberFormat numberFormat = NumberFormat.getInstance(locale);
+ numberFormat.setGroupingUsed(false);
+ return numberFormat;
+ }
+
+ /**
+ * Forces trailing zeros to be rendered.
+ */
+ @Override
+ public NumberFormat getNumberFormat(final Locale locale)
+ {
+ // we obtain a clone, so is okay to modify it to our purposes.
+ NumberFormat numberFormat = super.getNumberFormat(locale);
+ if(scale != null) {
+ numberFormat.setMaximumFractionDigits(scale);
+ numberFormat.setMinimumFractionDigits(scale);
+ }
+ return numberFormat;
+ }
+
+ @Override
+ public BigDecimal convertToObject(String valueStr, Locale locale) throws ConversionException {
+
+ DecimalFormat numberFormat = (DecimalFormat) getNumberFormat(locale);
+ char groupingSeparator = numberFormat.getDecimalFormatSymbols().getGroupingSeparator();
+
+ if(valueStr.contains(""+groupingSeparator)) {
+ // TODO: this is not actually shown; we see a generic error
+ // need to configure the ConversionException somehow
+ throw new ConversionException("Thousands separator '" + groupingSeparator + "' is not allowed in input");
+ }
+
+ // could also throw an exception
+ final BigDecimal bd = super.convertToObject(valueStr, locale);
+
+ if(this.scale != null) {
+ if(bd.scale() > this.scale) {
+ // TODO: this is not actually shown; we see a generic error
+ // need to configure the ConversionException somehow
+ throw new ConversionException("No more than " + this.scale + " digits can be entered after the decimal place");
+ }
+ try {
+ return bd != null ? bd.setScale(this.scale) : null;
+ } catch(Exception ex) {
+ // TODO: this is not actually shown; we see a generic error
+ // need to configure the ConversionException somehow
+ throw new ConversionException("'" + valueStr + "' is not a valid decimal number.");
+ }
+ } else {
+ return bd;
+ }
+ }
+
+ public IConverter<BigDecimal> forEditMode() {
+ return this;
+ }
+
+ public IConverter<BigDecimal> forViewMode() {
+ return new BigDecimalConverterWithScale(this.scale){
+ private static final long serialVersionUID = 1L;
+ @Override
+ public String convertToString(BigDecimal value, Locale locale) {
+ NumberFormat fmt = BigDecimalConverterWithScale.this.getNumberFormat(locale);
+ fmt.setGroupingUsed(true);// re-enable for view mode
+ return fmt.format(value);
+ }
+ };
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/BigDecimalTextField.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/BigDecimalTextField.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/BigDecimalTextField.java
new file mode 100644
index 0000000..89ee731
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/BigDecimalTextField.java
@@ -0,0 +1,57 @@
+/**
+ * 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.jdkmath;
+
+import java.math.BigDecimal;
+
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.util.convert.IConverter;
+
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.components.scalars.TextFieldAbstract;
+
+final class BigDecimalTextField extends TextFieldAbstract<BigDecimal> {
+
+ private static final long serialVersionUID = 1L;
+
+ private final BigDecimalConverterWithScale converter;
+
+ BigDecimalTextField(
+ final String id, final IModel<BigDecimal> model, final Class<BigDecimal> type,
+ final ScalarModel scalarModel,
+ final BigDecimalConverterWithScale converter) {
+ super(id, model, type, scalarModel);
+ this.converter = converter;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <C> IConverter<C> getConverter(Class<C> type) {
+ if (type != BigDecimal.class) {
+ return super.getConverter(type);
+ }
+ return (IConverter<C>) getConverterFor(scalarModel);
+ }
+
+ protected IConverter<BigDecimal> getConverterFor(ScalarModel scalarModel) {
+ if(scalarModel.isEditMode()) {
+ return converter.forEditMode();
+ } else {
+ return converter.forViewMode();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/BigIntegerConverter.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/BigIntegerConverter.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/BigIntegerConverter.java
new file mode 100644
index 0000000..3f581b4
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/BigIntegerConverter.java
@@ -0,0 +1,68 @@
+/*
+ * 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.jdkmath;
+
+import java.math.BigInteger;
+import java.util.Locale;
+import org.apache.wicket.util.convert.ConversionException;
+import org.apache.wicket.util.convert.IConverter;
+import org.apache.wicket.util.convert.converter.AbstractIntegerConverter;
+import org.apache.wicket.util.string.Strings;
+
+public final class BigIntegerConverter extends AbstractIntegerConverter<BigInteger> {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * The singleton instance for a big integer converter
+ * (cf the Wicket subclasses)
+ */
+ public static final IConverter<BigInteger> INSTANCE = new BigIntegerConverter();
+
+ @Override
+ public BigInteger convertToObject(String value, Locale locale) throws ConversionException {
+ if (Strings.isEmpty(value))
+ {
+ return null;
+ }
+
+ final Number number = parse(value, -Double.MAX_VALUE, Double.MAX_VALUE, locale);
+
+ if (number instanceof BigInteger)
+ {
+ return (BigInteger)number;
+ }
+ else if (number instanceof Long)
+ {
+ return BigInteger.valueOf(number.longValue());
+ }
+ else if (number instanceof Integer)
+ {
+ return BigInteger.valueOf(number.intValue());
+ }
+ else
+ {
+ return new BigInteger(value);
+ }
+ }
+
+ @Override
+ protected Class<BigInteger> getTargetType() {
+ return BigInteger.class;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/JavaMathBigDecimalPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/JavaMathBigDecimalPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/JavaMathBigDecimalPanel.java
new file mode 100644
index 0000000..eeaf703
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/JavaMathBigDecimalPanel.java
@@ -0,0 +1,56 @@
+/*
+ * 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.jdkmath;
+
+import java.math.BigDecimal;
+
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelTextFieldNumeric;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+
+/**
+ * Panel for rendering scalars of type {@link BigDecimal}.
+ */
+public class JavaMathBigDecimalPanel extends ScalarPanelTextFieldNumeric<BigDecimal> {
+
+ private static final long serialVersionUID = 1L;
+
+ private final BigDecimalConverterWithScale converter;
+
+ public JavaMathBigDecimalPanel(final String id, final ScalarModel scalarModel, final BigDecimalConverterWithScale converter) {
+ super(id, scalarModel, BigDecimal.class, converter.forViewMode());
+ this.converter = converter;
+ }
+
+ protected TextField<BigDecimal> createTextField(final String id) {
+ final ScalarModel model = getModel();
+ return new BigDecimalTextField(id, newTextFieldValueModel(), cls, model, converter);
+ }
+
+ @Override
+ protected IModel<String> getScalarPanelType() {
+ return Model.of("javaMathBigDecimalPanel");
+ }
+}
+
+
+
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/JavaMathBigDecimalPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/JavaMathBigDecimalPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/JavaMathBigDecimalPanelFactory.java
new file mode 100644
index 0000000..9e68289
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/JavaMathBigDecimalPanelFactory.java
@@ -0,0 +1,68 @@
+/*
+ * 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.jdkmath;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.wicket.Component;
+
+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 JavaMathBigDecimalPanel}.
+ */
+public class JavaMathBigDecimalPanelFactory extends ComponentFactoryScalarAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+
+ public JavaMathBigDecimalPanelFactory() {
+ super(JavaMathBigDecimalPanel.class, java.math.BigDecimal.class);
+ }
+
+ @Override
+ public Component createComponent(final String id, final ScalarModel scalarModel) {
+ BigDecimalConverterWithScale converter = getConverter(scalarModel);
+ return new JavaMathBigDecimalPanel(id, scalarModel, converter);
+ }
+
+
+ // //////////////////////////////////////
+
+ private final BigDecimalConverterWithScale converterForNullScale = new BigDecimalConverterWithScale(null);
+ private final Map<Integer, BigDecimalConverterWithScale> converterByScale = new ConcurrentHashMap<>();
+
+ private BigDecimalConverterWithScale getConverter(final ScalarModel scalarModel) {
+ final Integer scale = scalarModel.getScale();
+ if(scale == null) {
+ return converterForNullScale;
+ }
+ BigDecimalConverterWithScale bigDecimalConverter = converterByScale.get(scale);
+ if(bigDecimalConverter == null) {
+ bigDecimalConverter = new BigDecimalConverterWithScale(scale);
+ converterByScale.put(scale, bigDecimalConverter);
+ }
+ return bigDecimalConverter;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/JavaMathBigIntegerPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/JavaMathBigIntegerPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/JavaMathBigIntegerPanel.java
new file mode 100644
index 0000000..d68038d
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkmath/JavaMathBigIntegerPanel.java
@@ -0,0 +1,64 @@
+/*
+ * 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.jdkmath;
+
+import java.math.BigInteger;
+
+import org.apache.wicket.markup.html.form.AbstractTextComponent;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.util.convert.IConverter;
+
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelTextFieldNumeric;
+import org.apache.isis.viewer.wicket.ui.components.scalars.TextFieldValueModel;
+
+/**
+ * Panel for rendering scalars of type {@link BigInteger}.
+ */
+public class JavaMathBigIntegerPanel extends ScalarPanelTextFieldNumeric<BigInteger> {
+
+ private static final long serialVersionUID = 1L;
+ private static final String ID_SCALAR_VALUE = "scalarValue";
+
+ public JavaMathBigIntegerPanel(final String id, final ScalarModel scalarModel) {
+ super(id, scalarModel, BigInteger.class, BigIntegerConverter.INSTANCE);
+ }
+
+ @Override
+ protected AbstractTextComponent<BigInteger> createTextFieldForRegular() {
+ return new TextField<BigInteger>(ID_SCALAR_VALUE, new TextFieldValueModel<BigInteger>(this), BigInteger.class) {
+ private static final long serialVersionUID = 1L;
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <C> IConverter<C> getConverter(Class<C> type) {
+ return (IConverter<C>) (type == BigInteger.class? BigIntegerConverter.INSTANCE: super.getConverter(type));
+ }
+ };
+ }
+
+ @Override
+ protected IModel<String> getScalarPanelType() {
+ return Model.of("javaMathBigIntegerPanel");
+ }
+
+}