incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke...@apache.org
Subject svn commit: r1143787 - in /incubator/isis/trunk/framework/viewer/wicket: ui/src/main/java/org/apache/isis/viewer/wicket/ui/ ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuecollection/ viewer/src/main/java/org/apache/isis/viewe...
Date Thu, 07 Jul 2011 12:14:29 GMT
Author: kevin
Date: Thu Jul  7 12:14:28 2011
New Revision: 1143787

URL: http://svn.apache.org/viewvc?rev=1143787&view=rev
Log:
Initial foray into adding support for value types in parameter choices.

Added:
    incubator/isis/trunk/framework/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuecollection/
    incubator/isis/trunk/framework/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuecollection/ValueCollection.java
  (with props)
    incubator/isis/trunk/framework/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuecollection/ValueCollectionFactory.java
  (with props)
Modified:
    incubator/isis/trunk/framework/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/ComponentType.java
    incubator/isis/trunk/framework/viewer/wicket/viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryListDefault.java

Modified: incubator/isis/trunk/framework/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/ComponentType.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/ComponentType.java?rev=1143787&r1=1143786&r2=1143787&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/ComponentType.java
(original)
+++ incubator/isis/trunk/framework/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/ComponentType.java
Thu Jul  7 12:14:28 2011
@@ -19,9 +19,10 @@
 
 package org.apache.isis.viewer.wicket.ui;
 
-import org.apache.isis.viewer.wicket.model.util.Strings;
 import org.apache.wicket.Component;
 
+import org.apache.isis.viewer.wicket.model.util.Strings;
+
 /**
  * Enumerates the different types of {@link Component}s that can be constructed using {@link
ComponentFactory}.
  * 
@@ -111,7 +112,11 @@ public enum ComponentType {
     /**
      * A void result from an action.
      */
-    VOID_RETURN;
+    VOID_RETURN,
+    /**
+     * A collection of values.
+     */
+    VALUE_COLLECTION;
 
     /**
      * Returns the {@link #name()} formatted as {@link Strings#camelCase(String) camel case}.

Added: incubator/isis/trunk/framework/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuecollection/ValueCollection.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuecollection/ValueCollection.java?rev=1143787&view=auto
==============================================================================
--- incubator/isis/trunk/framework/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuecollection/ValueCollection.java
(added)
+++ incubator/isis/trunk/framework/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuecollection/ValueCollection.java
Thu Jul  7 12:14:28 2011
@@ -0,0 +1,38 @@
+/**
+ *  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.widgets.valuecollection;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.components.widgets.formcomponent.FormComponentPanelAbstract;
+
+/**
+ * Initial skeleton - trying to add support for value choices.
+ * 
+ * @version $Rev$ $Date$
+ */
+public class ValueCollection extends FormComponentPanelAbstract<ObjectAdapter> {
+
+    private static final long serialVersionUID = 1L;
+
+    public ValueCollection(final String id, final EntityModel entityModel) {
+        super(id, entityModel);
+        setType(ObjectAdapter.class);
+        // buildGui();
+    }
+
+}

Propchange: incubator/isis/trunk/framework/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuecollection/ValueCollection.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/isis/trunk/framework/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuecollection/ValueCollectionFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuecollection/ValueCollectionFactory.java?rev=1143787&view=auto
==============================================================================
--- incubator/isis/trunk/framework/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuecollection/ValueCollectionFactory.java
(added)
+++ incubator/isis/trunk/framework/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuecollection/ValueCollectionFactory.java
Thu Jul  7 12:14:28 2011
@@ -0,0 +1,61 @@
+/*
+ *  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.widgets.valuecollection;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.object.value.ValueFacet;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.model.models.ValueModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+
+/**
+ * Installed by {@link org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryListDefault}
+ * 
+ * 
+ * @version $Rev$ $Date$
+ */
+public class ValueCollectionFactory extends ComponentFactoryAbstract {
+
+    private static final long serialVersionUID = 1L;
+
+    public ValueCollectionFactory() {
+        super(ComponentType.VALUE_COLLECTION);
+    }
+
+    @Override
+    public ApplicationAdvice appliesTo(final IModel<?> model) {
+        if (!(model instanceof ValueModel)) {
+            return ApplicationAdvice.DOES_NOT_APPLY;
+        }
+        final ValueModel valueModel = (ValueModel) model;
+        final ObjectAdapter specification = valueModel.getObject();
+        return appliesIf(specification != null && specification.getSpecification().containsFacet(ValueFacet.class));
+    }
+
+    @Override
+    public Component createComponent(final String id, final IModel<?> model) {
+        final EntityModel entityModel = (EntityModel) model;
+        return new ValueCollection(id, entityModel);
+    }
+}

Propchange: incubator/isis/trunk/framework/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuecollection/ValueCollectionFactory.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: incubator/isis/trunk/framework/viewer/wicket/viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryListDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/wicket/viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryListDefault.java?rev=1143787&r1=1143786&r2=1143787&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/wicket/viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryListDefault.java
(original)
+++ incubator/isis/trunk/framework/viewer/wicket/viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryListDefault.java
Thu Jul  7 12:14:28 2011
@@ -71,6 +71,7 @@ import org.apache.isis.viewer.wicket.ui.
 import org.apache.isis.viewer.wicket.ui.components.voidreturn.VoidReturnPanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.welcome.WelcomePanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.widgets.entitylink.EntityLinkFactory;
+import org.apache.isis.viewer.wicket.ui.components.widgets.valuecollection.ValueCollectionFactory;
 
 /**
  * Default implementation of {@link ComponentFactoryList} that registers a hardcoded set
of built-in
@@ -122,6 +123,17 @@ public class ComponentFactoryListDefault
         addComponentFactoriesForVoidReturn(componentFactories);
         addComponentFactoriesForValue(componentFactories);
         addComponentFactoriesForParameters(componentFactories);
+
+        // TODO: KAM support for value choices:
+        addComponentFactoriesForValueChoices(componentFactories);
+
+    }
+
+    /**
+     * Trying to add support for value choices.
+     */
+    protected void addComponentFactoriesForValueChoices(List<ComponentFactory> componentFactories)
{
+        componentFactories.add(new ValueCollectionFactory());
     }
 
     protected void addComponentFactoriesForSpecial(final List<ComponentFactory> componentFactories)
{



Mime
View raw message