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 2014/11/11 09:24:24 UTC

[01/44] isis git commit: ISIS-939: simplified PersistenceMechanismInstallerAbstract and its subclasses, also PersistenceSessionFactoryDelegating, PersistenceSessionFactoryDelegate.

Repository: isis
Updated Branches:
  refs/heads/master 11c6dcd37 -> 8b7267e60


ISIS-939: simplified PersistenceMechanismInstallerAbstract and its subclasses, also PersistenceSessionFactoryDelegating, PersistenceSessionFactoryDelegate.

* Replaced PersistenceSessionFactoryDelegate#createPersistenceSession with #createObjectStore (other common functionality moved to PersistenceSessionFactoryDelegating).
* Don't pass ObjectAdapterFactory, AdapaterManagerSpi, OidGenerator into PersistenceSession; instead it can new these up (there is no variation in implementation nor state held in these components)
* Removed IsisObjectStoreLogger, IsisObjectStoreDelegating.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/46dc3a48
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/46dc3a48
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/46dc3a48

Branch: refs/heads/master
Commit: 46dc3a48c1ef8bb9e02c1f4c971b6040a83fc5fa
Parents: 11c6dcd
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sat Nov 1 12:05:53 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Nov 6 16:18:54 2014 +0000

----------------------------------------------------------------------
 .../InMemoryPersistenceMechanismInstaller.java  |   6 +-
 .../PersistenceMechanismInstallerAbstract.java  | 167 +-----------
 .../PersistenceSessionFactoryDelegate.java      |  33 +--
 .../PersistenceSessionFactoryDelegating.java    |  69 +++--
 .../persistence/adapter/PojoAdapterFactory.java |   4 +-
 .../objectstore/IsisObjectStoreDelegating.java  | 194 --------------
 .../objectstore/IsisObjectStoreLogger.java      | 205 --------------
 .../system/persistence/PersistenceSession.java  |  38 +--
 .../persistence/PersistenceSessionFactory.java  |   5 +-
 .../jdo/datanucleus/DataNucleusObjectStore.java |   7 +-
 ...ataNucleusPersistenceMechanismInstaller.java |  61 ++---
 .../PersistenceSessionObjectStoreTest.java      | 268 -------------------
 .../persistence/PersistenceSessionTest.java     | 268 +++++++++++++++++++
 13 files changed, 377 insertions(+), 948 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/46dc3a48/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryPersistenceMechanismInstaller.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryPersistenceMechanismInstaller.java b/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryPersistenceMechanismInstaller.java
index 2f0acc2..293d557 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryPersistenceMechanismInstaller.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryPersistenceMechanismInstaller.java
@@ -20,12 +20,9 @@
 package org.apache.isis.core.objectstore;
 
 import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
 import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstallerAbstract;
 import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
 import org.apache.isis.core.runtime.system.DeploymentType;
-import org.apache.isis.core.runtime.system.persistence.AdapterManagerSpi;
-import org.apache.isis.core.runtime.system.persistence.ObjectFactory;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 
 /**
@@ -56,7 +53,8 @@ public class InMemoryPersistenceMechanismInstaller extends PersistenceMechanismI
      * Hook method to return {@link ObjectStoreSpi}.
      */
     @Override
-    protected ObjectStoreSpi createObjectStore(final IsisConfiguration configuration, final ObjectAdapterFactory adapterFactory, final AdapterManagerSpi adapterManager) {
+    public ObjectStoreSpi createObjectStore(
+            final IsisConfiguration configuration) {
         return new InMemoryObjectStore();
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/46dc3a48/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstallerAbstract.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstallerAbstract.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstallerAbstract.java
index e702e36..75e6fc4 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstallerAbstract.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstallerAbstract.java
@@ -20,128 +20,42 @@
 package org.apache.isis.core.runtime.installerregistry.installerapi;
 
 import java.util.List;
-import java.util.Properties;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.isis.core.commons.config.InstallerAbstract;
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
 import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.services.ServicesInjectorDefault;
-import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
 import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidator;
 import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
-import org.apache.isis.core.runtime.installerregistry.InstallerLookup;
-import org.apache.isis.core.runtime.installerregistry.InstallerLookupAware;
 import org.apache.isis.core.runtime.persistence.PersistenceSessionFactoryDelegating;
-import org.apache.isis.core.runtime.persistence.adapter.PojoAdapterFactory;
-import org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault;
-import org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreator;
-import org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorUnified;
-import org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession;
-import org.apache.isis.core.runtime.persistence.objectstore.IsisObjectStoreLogger;
-import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.*;
-import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
-import org.apache.isis.core.runtime.systemdependencyinjector.SystemDependencyInjector;
-
-import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
-import static org.hamcrest.CoreMatchers.*;
+import org.apache.isis.core.runtime.system.persistence.ObjectFactory;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 
 /**
  * An abstract implementation of {@link PersistenceMechanismInstaller} that will
  * lookup the {@link ObjectAdapterFactory} and {@link ObjectFactory} from the
  * supplied {@link IsisConfiguration}.
  */
-public abstract class PersistenceMechanismInstallerAbstract extends InstallerAbstract implements PersistenceMechanismInstaller, InstallerLookupAware {
-
-
-    private static final String LOGGING_PROPERTY = org.apache.isis.core.runtime.logging.Log4jLogger.PROPERTY_ROOT + "persistenceSession";
-    private static final Logger LOG = LoggerFactory.getLogger(PersistenceMechanismInstallerAbstract.class);
-
-    private SystemDependencyInjector installerLookup;
+public abstract class PersistenceMechanismInstallerAbstract extends InstallerAbstract implements PersistenceMechanismInstaller {
 
     public PersistenceMechanismInstallerAbstract(final String name) {
         super(PersistenceMechanismInstaller.TYPE, name);
     }
 
-    /**
-     * For subclasses that need to specify a different type.
-     */
-    public PersistenceMechanismInstallerAbstract(final String type, final String name) {
-        super(type, name);
-    }
-
-    
     //////////////////////////////////////////////////////////////////////
     // createPersistenceSessionFactory
     //////////////////////////////////////////////////////////////////////
 
+    //region > createPersistenceSessionFactory 
+    
     @Override
     public PersistenceSessionFactory createPersistenceSessionFactory(final DeploymentType deploymentType) {
         return new PersistenceSessionFactoryDelegating(deploymentType, getConfiguration(), this);
     }
 
-
-    //////////////////////////////////////////////////////////////////////
-    // createPersistenceSession
-    //////////////////////////////////////////////////////////////////////
-
-
-    /**
-     * Creates a {@link PersistenceSession} with internal (thread-safe) components obtained from the provided {@link PersistenceSessionFactory}.
-     * 
-     * <p>
-     * Typically should not be overridden.
-     */
-    @Override
-    public PersistenceSession createPersistenceSession(final PersistenceSessionFactory persistenceSessionFactory) {
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("installing " + this.getClass().getName());
-        }
-
-        ObjectAdapterFactory adapterFactory = persistenceSessionFactory.getAdapterFactory();
-        PojoRecreator pojoRecreator = new PojoRecreatorUnified(getConfiguration());
-        ServicesInjectorSpi servicesInjector = persistenceSessionFactory.getServicesInjector();
-        
-        final AdapterManagerDefault adapterManager = new AdapterManagerDefault(pojoRecreator);
-        
-        ObjectStoreSpi objectStore = createObjectStore(getConfiguration(), adapterFactory, adapterManager);
-        
-        ensureThatArg(objectStore, is(not(nullValue())));
-        
-        if (getConfiguration().getBoolean(LOGGING_PROPERTY, false)) {
-            final String level = getConfiguration().getString(LOGGING_PROPERTY + ".level", "debug");
-            objectStore = new IsisObjectStoreLogger(objectStore, level);
-        }
-        
-        final PersistenceSession persistenceSession = 
-                new PersistenceSession(persistenceSessionFactory, adapterFactory, servicesInjector, adapterManager, objectStore, getConfiguration());
-
-        final IsisTransactionManager transactionManager = new IsisTransactionManager(persistenceSession, objectStore, servicesInjector);
-        
-        persistenceSession.setDirtiableSupport(true);
-        persistenceSession.setTransactionManager(transactionManager);
-        
-        return persistenceSession;
-    }
-
-
-
-    // ///////////////////////////////////////////
-    // Mandatory hook methods
-    // ///////////////////////////////////////////
-
-    /**
-     * Hook method to return {@link ObjectStoreSpi}.
-     */
-    protected abstract ObjectStoreSpi createObjectStore(IsisConfiguration configuration, ObjectAdapterFactory adapterFactory, AdapterManagerSpi adapterManager);
-    
+    //endregion
 
     // ///////////////////////////////////////////
     // Optional hook methods
@@ -173,75 +87,6 @@ public abstract class PersistenceMechanismInstallerAbstract extends InstallerAbs
         // no-op
     }
 
-    /**
-     * Hook method to allow subclasses to specify a different implementation of
-     * {@link ObjectAdapterFactory}.
-     * 
-     * <p>
-     * By default, returns {@link PojoAdapterFactory};
-     */
-    public ObjectAdapterFactory createAdapterFactory(final IsisConfiguration configuration) {
-        return new PojoAdapterFactory();
-    }
-    
-
-    /**
-     * Hook method to allow subclasses to specify a different implementation of
-     * {@link ServicesInjectorSpi}
-     * 
-     * <p>
-     * By default, returns {@link ServicesInjectorDefault};
-     */
-    public ServicesInjectorSpi createServicesInjector(final IsisConfiguration configuration) {
-        return new ServicesInjectorDefault();
-    }
-
-
-    // ///////////////////////////////////////////
-    // Non overridable.
-    // ///////////////////////////////////////////
-
-    /**
-     * Returns a {@link RuntimeContext}, with all application-specific properties
-     * from the provided {@link IsisConfiguration} copied over.
-     */
-    public final RuntimeContext createRuntimeContext(final IsisConfiguration configuration) {
-        final RuntimeContextFromSession runtimeContext = new RuntimeContextFromSession();
-        final Properties properties = applicationPropertiesFrom(configuration);
-        runtimeContext.setProperties(properties);
-        return runtimeContext;
-    }
-
-    private static Properties applicationPropertiesFrom(final IsisConfiguration configuration) {
-        final Properties properties = new Properties();
-        final IsisConfiguration applicationConfiguration = configuration.getProperties("application");
-        for (final String key : applicationConfiguration) {
-            final String value = applicationConfiguration.getString(key);
-            final String newKey = key.substring("application.".length());
-            properties.setProperty(newKey, value);
-        }
-        return properties;
-    }
-
-
-    // /////////////////////////////////////////////////////
-    // Dependencies (from setters)
-    // /////////////////////////////////////////////////////
-
-    /**
-     * By virtue of being {@link InstallerLookupAware}.
-     */
-    @Override
-    public void setInstallerLookup(final InstallerLookup installerLookup) {
-        this.installerLookup = installerLookup;
-    }
-
-    /**
-     * @see #setInstallerLookup(InstallerLookup)
-     */
-    protected SystemDependencyInjector getInstallerLookup() {
-        return installerLookup;
-    }
 
     // /////////////////////////////////////////////////////
     // Dependencies (from context)

http://git-wip-us.apache.org/repos/asf/isis/blob/46dc3a48/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceSessionFactoryDelegate.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceSessionFactoryDelegate.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceSessionFactoryDelegate.java
index 9da2585..59a6010 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceSessionFactoryDelegate.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceSessionFactoryDelegate.java
@@ -21,43 +21,16 @@ package org.apache.isis.core.runtime.persistence;
 
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.commons.config.IsisConfigurationBuilderAware;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
 import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
+import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 
 /**
- * Creates a {@link PersistenceSession} on behalf of a
+ * Creates an {@link org.apache.isis.core.runtime.system.persistence.ObjectStore} on behalf of a
  * {@link PersistenceSessionFactory}.
  */
 public interface PersistenceSessionFactoryDelegate extends IsisConfigurationBuilderAware, MetaModelRefiner {
 
+    ObjectStoreSpi createObjectStore(final IsisConfiguration configuration);
 
-    ///////////////////////////////////////////////////////////////////////////
-    // singleton threadsafe components created during init
-    ///////////////////////////////////////////////////////////////////////////
-    
-    ObjectAdapterFactory createAdapterFactory(IsisConfiguration configuration);
-
-    ServicesInjectorSpi createServicesInjector(IsisConfiguration configuration);
-
-    RuntimeContext createRuntimeContext(IsisConfiguration configuration);
-
-    
-    ///////////////////////////////////////////////////////////////////////////
-    // created for each session
-    ///////////////////////////////////////////////////////////////////////////
-
-    /**
-     * As per {@link PersistenceSessionFactory#createPersistenceSession()}, but
-     * passing a {@link PersistenceSessionFactory} to act as the
-     * {@link PersistenceSession}'s
-     * {@link PersistenceSession#getPersistenceSessionFactory() owning factory}.
-     */
-    PersistenceSession createPersistenceSession(PersistenceSessionFactory persistenceSessionFactory);
-
-    
-    
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/46dc3a48/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceSessionFactoryDelegating.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceSessionFactoryDelegating.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceSessionFactoryDelegating.java
index c0902f7..69153f2 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceSessionFactoryDelegating.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceSessionFactoryDelegating.java
@@ -20,29 +20,38 @@
 package org.apache.isis.core.runtime.persistence;
 
 import java.util.List;
+import java.util.Properties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.apache.isis.applib.clock.Clock;
 import org.apache.isis.applib.fixtures.FixtureClock;
 import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
 import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
 import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.metamodel.services.ServicesInjectorDefault;
 import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
 import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
+import org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession;
+import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
+import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
 
+import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
 import static org.apache.isis.core.commons.ensure.Ensure.ensureThatState;
 import static org.hamcrest.CoreMatchers.*;
 
 /**
  * Implementation that just delegates to a supplied
- * {@link PersistenceSessionFactory}.
+ * {@link PersistenceSessionFactoryDelegate}.
  */
 public class PersistenceSessionFactoryDelegating implements PersistenceSessionFactory, FixturesInstalledFlag {
 
+    private static final Logger LOG = LoggerFactory.getLogger(PersistenceSessionFactoryDelegating.class);
+
     private final DeploymentType deploymentType;
     private final IsisConfiguration configuration;
     private final PersistenceSessionFactoryDelegate persistenceSessionFactoryDelegate;
@@ -54,8 +63,7 @@ public class PersistenceSessionFactoryDelegating implements PersistenceSessionFa
 
     private Boolean fixturesInstalled;
 
-    private ObjectAdapterFactory adapterFactory;
-    private ServicesInjectorSpi servicesInjector;
+    private final ServicesInjectorSpi servicesInjector = new ServicesInjectorDefault();
     private RuntimeContext runtimeContext;
 
     public PersistenceSessionFactoryDelegating(
@@ -78,7 +86,25 @@ public class PersistenceSessionFactoryDelegating implements PersistenceSessionFa
 
     @Override
     public PersistenceSession createPersistenceSession() {
-        return persistenceSessionFactoryDelegate.createPersistenceSession(this);
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("installing " + this.getClass().getName());
+        }
+
+        ServicesInjectorSpi servicesInjector = getServicesInjector();
+
+        final ObjectStoreSpi objectStore = persistenceSessionFactoryDelegate.createObjectStore(getConfiguration());
+
+        ensureThatArg(objectStore, is(not(nullValue())));
+
+        final PersistenceSession persistenceSession =new PersistenceSession(this, servicesInjector, objectStore, getConfiguration());
+
+        final IsisTransactionManager transactionManager = new IsisTransactionManager(persistenceSession, objectStore, servicesInjector);
+
+        persistenceSession.setDirtiableSupport(true);
+        persistenceSession.setTransactionManager(transactionManager);
+
+        return persistenceSession;
     }
 
     @Override
@@ -98,15 +124,7 @@ public class PersistenceSessionFactoryDelegating implements PersistenceSessionFa
             FixtureClock.initialize();
         }
 
-        adapterFactory = persistenceSessionFactoryDelegate.createAdapterFactory(getConfiguration());
-
-        ensureThatState(adapterFactory, is(not(nullValue())));
-
-        servicesInjector = persistenceSessionFactoryDelegate.createServicesInjector(getConfiguration());
-
-        ensureThatState(servicesInjector, is(not(nullValue())));
-
-        runtimeContext = persistenceSessionFactoryDelegate.createRuntimeContext(getConfiguration());
+        runtimeContext = createRuntimeContext(getConfiguration());
         ensureThatState(runtimeContext, is(not(nullValue())));
 
         // inject the specification loader etc.
@@ -123,6 +141,25 @@ public class PersistenceSessionFactoryDelegating implements PersistenceSessionFa
         servicesInjector.init();
     }
 
+    private RuntimeContext createRuntimeContext(final IsisConfiguration configuration) {
+        final RuntimeContextFromSession runtimeContext = new RuntimeContextFromSession();
+        final Properties properties = applicationPropertiesFrom(configuration);
+        runtimeContext.setProperties(properties);
+        return runtimeContext;
+    }
+
+    private static Properties applicationPropertiesFrom(final IsisConfiguration configuration) {
+        final Properties properties = new Properties();
+        final IsisConfiguration applicationConfiguration = configuration.getProperties("application");
+        for (final String key : applicationConfiguration) {
+            final String value = applicationConfiguration.getString(key);
+            final String newKey = key.substring("application.".length());
+            properties.setProperty(newKey, value);
+        }
+        return properties;
+    }
+
+
 
     @Override
     public final void shutdown() {
@@ -140,10 +177,6 @@ public class PersistenceSessionFactoryDelegating implements PersistenceSessionFa
     // Components (setup during init...)
     // //////////////////////////////////////////////////////
 
-    public ObjectAdapterFactory getAdapterFactory() {
-        return adapterFactory;
-    }
-    
     public ServicesInjectorSpi getServicesInjector() {
         return servicesInjector;
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/46dc3a48/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapterFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapterFactory.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapterFactory.java
index 97ada74..319942d 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapterFactory.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapterFactory.java
@@ -30,12 +30,10 @@ import org.apache.isis.core.runtime.system.context.IsisContext;
 public class PojoAdapterFactory implements ObjectAdapterFactory {
 
     @Override
-    public PojoAdapter createAdapter(final Object pojo, final Oid oid, AdapterManager adapterManager) {
+    public PojoAdapter createAdapter(final Object pojo, final Oid oid, final AdapterManager adapterManager) {
         return new PojoAdapter(pojo, oid, getSpecificationLoader(), adapterManager, getLocalization(), getAuthenticationSession());
     }
 
-    
-    
     protected AuthenticationSession getAuthenticationSession() {
         return IsisContext.getAuthenticationSession();
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/46dc3a48/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/IsisObjectStoreDelegating.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/IsisObjectStoreDelegating.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/IsisObjectStoreDelegating.java
deleted file mode 100644
index 02eb98d..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/IsisObjectStoreDelegating.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.persistence.objectstore;
-
-import java.util.List;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.RootOid;
-import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.CreateObjectCommand;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.DestroyObjectCommand;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.PersistenceCommand;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.SaveObjectCommand;
-import org.apache.isis.core.runtime.system.persistence.PersistenceQuery;
-
-/**
- * Implementation that simply delegates to underlying {@link ObjectStoreSpi}.
- * 
- * <p>
- * Useful for quickly writing decorating implementations.
- */
-public class IsisObjectStoreDelegating implements ObjectStoreSpi {
-
-    private final ObjectStoreSpi underlying;
-    private final String name;
-
-    public IsisObjectStoreDelegating(final ObjectStoreSpi underlying, final String name) {
-        this.underlying = underlying;
-        this.name = name;
-    }
-
-    // ////////////////////////////////////////////////
-    // name
-    // ////////////////////////////////////////////////
-
-    @Override
-    public String name() {
-        return name + "(" + underlying.name() + ")";
-    }
-
-    // ////////////////////////////////////////////////
-    // init, shutdown, reset, isInitialized
-    // ////////////////////////////////////////////////
-
-    @Override
-    public void open() {
-        underlying.open();
-    }
-
-    @Override
-    public void close() {
-        underlying.close();
-    }
-
-    @Override
-    public void reset() {
-        underlying.reset();
-    }
-
-    @Override
-    public boolean isFixturesInstalled() {
-        return underlying.isFixturesInstalled();
-    }
-
-    // ////////////////////////////////////////////////
-    // createXxxCommands
-    // ////////////////////////////////////////////////
-
-    @Override
-    public CreateObjectCommand createCreateObjectCommand(final ObjectAdapter object) {
-        return underlying.createCreateObjectCommand(object);
-    }
-
-    @Override
-    public DestroyObjectCommand createDestroyObjectCommand(final ObjectAdapter object) {
-        return underlying.createDestroyObjectCommand(object);
-    }
-
-    @Override
-    public SaveObjectCommand createSaveObjectCommand(final ObjectAdapter object) {
-        return underlying.createSaveObjectCommand(object);
-    }
-
-    // ////////////////////////////////////////////////
-    // execute
-    // ////////////////////////////////////////////////
-
-    @Override
-    public void execute(final List<PersistenceCommand> commands) {
-        underlying.execute(commands);
-    }
-
-    // ////////////////////////////////////////////////
-    // TransactionManagement
-    // ////////////////////////////////////////////////
-
-    @Override
-    public void startTransaction() {
-        underlying.startTransaction();
-    }
-
-    @Override
-    public void endTransaction() {
-        underlying.endTransaction();
-    }
-
-    @Override
-    public void abortTransaction() {
-        underlying.abortTransaction();
-    }
-
-    // ////////////////////////////////////////////////
-    // getObject, resolveImmediately, resolveField
-    // ////////////////////////////////////////////////
-
-    @Override
-    public ObjectAdapter loadInstanceAndAdapt(final TypedOid oid) {
-        return underlying.loadInstanceAndAdapt(oid);
-    }
-
-    @Override
-    public void resolveField(final ObjectAdapter object, final ObjectAssociation field) {
-        underlying.resolveField(object, field);
-    }
-
-    @Override
-    public void resolveImmediately(final ObjectAdapter object) {
-        underlying.resolveImmediately(object);
-    }
-
-    // ////////////////////////////////////////////////
-    // getInstances, hasInstances
-    // ////////////////////////////////////////////////
-
-    @Override
-    public List<ObjectAdapter> loadInstancesAndAdapt(final PersistenceQuery persistenceQuery) {
-        return underlying.loadInstancesAndAdapt(persistenceQuery);
-    }
-
-    @Override
-    public boolean hasInstances(final ObjectSpecification specification) {
-        return underlying.hasInstances(specification);
-    }
-
-    // ////////////////////////////////////////////////
-    // services
-    // ////////////////////////////////////////////////
-
-    @Override
-    public RootOid getOidForService(ObjectSpecification serviceSpecification) {
-        return underlying.getOidForService(serviceSpecification);
-    }
-
-    @Override
-    public void registerService(final RootOid rootOid) {
-        underlying.registerService(rootOid);
-    }
-
-    // ////////////////////////////////////////////////
-    // debug
-    // ////////////////////////////////////////////////
-
-    @Override
-    public void debugData(final DebugBuilder debug) {
-        underlying.debugData(debug);
-    }
-
-    @Override
-    public String debugTitle() {
-        return underlying.debugTitle();
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/46dc3a48/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/IsisObjectStoreLogger.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/IsisObjectStoreLogger.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/IsisObjectStoreLogger.java
deleted file mode 100644
index c619708..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/IsisObjectStoreLogger.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.persistence.objectstore;
-
-import java.util.List;
-
-import org.apache.isis.core.commons.config.IsisConfigurationException;
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.factory.InstanceCreationException;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
-import org.apache.isis.core.metamodel.adapter.oid.RootOid;
-import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
-import org.apache.isis.core.runtime.persistence.ObjectPersistenceException;
-import org.apache.isis.core.runtime.persistence.UnsupportedFindException;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.CreateObjectCommand;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.DestroyObjectCommand;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.PersistenceCommand;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.SaveObjectCommand;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceQuery;
-
-public class IsisObjectStoreLogger extends Slf4jLogger implements ObjectStoreSpi {
-    
-    
-    private final ObjectStoreSpi underlying;
-
-    public IsisObjectStoreLogger(final ObjectStoreSpi decorated, final String level) {
-        super(level);
-        this.underlying = decorated;
-    }
-
-    public IsisObjectStoreLogger(final ObjectStoreSpi decorated) {
-        this.underlying = decorated;
-    }
-
-    @Override
-    public CreateObjectCommand createCreateObjectCommand(final ObjectAdapter object) {
-        log("create object " + object);
-        return underlying.createCreateObjectCommand(object);
-    }
-
-    @Override
-    public void registerService(final RootOid rootOid) {
-        log("registering service: " + rootOid.enString(getOidMarshaller()));
-        underlying.registerService(rootOid);
-    }
-
-    @Override
-    public DestroyObjectCommand createDestroyObjectCommand(final ObjectAdapter object) {
-        log("destroy object " + object);
-        return underlying.createDestroyObjectCommand(object);
-    }
-
-    @Override
-    public SaveObjectCommand createSaveObjectCommand(final ObjectAdapter object) {
-        log("save object " + object);
-        return underlying.createSaveObjectCommand(object);
-    }
-
-    @Override
-    public void debugData(final DebugBuilder debug) {
-        underlying.debugData(debug);
-    }
-
-    @Override
-    public String debugTitle() {
-        return underlying.debugTitle();
-    }
-
-    @Override
-    protected Class<?> getDecoratedClass() {
-        return underlying.getClass();
-    }
-
-    @Override
-    public List<ObjectAdapter> loadInstancesAndAdapt(final PersistenceQuery criteria) throws ObjectPersistenceException, UnsupportedFindException {
-        log("get instances matching " + criteria);
-        return underlying.loadInstancesAndAdapt(criteria);
-    }
-
-
-    @Override
-    public ObjectAdapter loadInstanceAndAdapt(final TypedOid oid) throws ObjectNotFoundException, ObjectPersistenceException {
-        final ObjectAdapter adapter = underlying.loadInstanceAndAdapt(oid);
-        log("get object for " + oid + " (of type '" + oid.getObjectSpecId() + "')", adapter.getObject());
-        return adapter;
-    }
-
-    @Override
-    public RootOid getOidForService(ObjectSpecification serviceSpec) {
-        final RootOid serviceOid = underlying.getOidForService(serviceSpec);
-        if(serviceOid != null) {
-            log("get OID for service: " + serviceOid.enString(getOidMarshaller()));
-        } else {
-            log("get OID for service: null (presumably in the process of being registered for '" + serviceSpec.getSpecId() + "')");
-        }
-        return serviceOid;
-    }
-
-    @Override
-    public boolean hasInstances(final ObjectSpecification specification) throws ObjectPersistenceException {
-        final boolean hasInstances = underlying.hasInstances(specification);
-        log("has instances of " + specification.getShortIdentifier(), "" + hasInstances);
-        return hasInstances;
-    }
-
-    @Override
-    public boolean isFixturesInstalled() {
-        final boolean isInitialized = underlying.isFixturesInstalled();
-        log("is initialized: " + isInitialized);
-        return isInitialized;
-    }
-
-    @Override
-    public void open() throws IsisConfigurationException, InstanceCreationException, ObjectPersistenceException {
-        log("opening " + name());
-        underlying.open();
-    }
-
-    @Override
-    public String name() {
-        return underlying.name();
-    }
-
-    @Override
-    public void reset() {
-        log("reset");
-        underlying.reset();
-    }
-
-    @Override
-    public void resolveField(final ObjectAdapter object, final ObjectAssociation field) throws ObjectPersistenceException {
-        log("resolve eagerly object in field " + field + " of " + object);
-        underlying.resolveField(object, field);
-    }
-
-    @Override
-    public void resolveImmediately(final ObjectAdapter object) throws ObjectPersistenceException {
-        log("resolve immediately: " + object);
-        underlying.resolveImmediately(object);
-    }
-
-    @Override
-    public void execute(final List<PersistenceCommand> commands) throws ObjectPersistenceException {
-        log("execute commands");
-        int i = 0;
-        for (final PersistenceCommand command : commands) {
-            log("  " + (i++) + " " + command);
-        }
-        underlying.execute(commands);
-    }
-
-    @Override
-    public void close() throws ObjectPersistenceException {
-        log("closing " + underlying);
-        underlying.close();
-    }
-
-    @Override
-    public void startTransaction() {
-        underlying.startTransaction();
-    }
-
-    @Override
-    public void endTransaction() {
-        underlying.endTransaction();
-    }
-
-    @Override
-    public void abortTransaction() {
-        underlying.abortTransaction();
-    }
-    
-    
-    /////////////////////////////////////////////
-    // Dependencies (from context)
-    /////////////////////////////////////////////
-    
-    protected OidMarshaller getOidMarshaller() {
-        return IsisContext.getOidMarshaller();
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/46dc3a48/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
index ffd13b6..cdd3a10 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
@@ -54,6 +54,9 @@ import org.apache.isis.core.metamodel.spec.*;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.runtime.persistence.FixturesInstalledFlag;
 import org.apache.isis.core.runtime.persistence.NotPersistableException;
+import org.apache.isis.core.runtime.persistence.adapter.PojoAdapterFactory;
+import org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault;
+import org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorUnified;
 import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
 import org.apache.isis.core.runtime.persistence.objectstore.algorithm.PersistAlgorithm;
 import org.apache.isis.core.runtime.persistence.objectstore.algorithm.PersistAlgorithmUnified;
@@ -104,43 +107,24 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
      */
     public PersistenceSession(
             final PersistenceSessionFactory persistenceSessionFactory,
-            final ObjectAdapterFactory adapterFactory,
             final ServicesInjectorSpi servicesInjector,
-            final AdapterManagerSpi adapterManager,
-            final ObjectStore objectStore,
-            final IsisConfiguration configuration) {
-
-        this(persistenceSessionFactory, adapterFactory, servicesInjector, new OidGenerator(new IdentifierGeneratorUnified(configuration)), adapterManager, objectStore, configuration);
-    }
-
-    /**
-     * Initialize the object store so that calls to this object store access
-     * persisted objects and persist changes to the object that are saved.
-     */
-    public PersistenceSession(
-            final PersistenceSessionFactory persistenceSessionFactory,
-            final ObjectAdapterFactory adapterFactory,
-            final ServicesInjectorSpi servicesInjector,
-            final OidGenerator oidGenerator,
-            final AdapterManagerSpi adapterManager,
             final ObjectStore objectStore,
             final IsisConfiguration configuration) {
 
         ensureThatArg(persistenceSessionFactory, is(not(nullValue())), "persistence session factory required");
-
-        ensureThatArg(adapterFactory, is(not(nullValue())), "adapter factory required");
         ensureThatArg(servicesInjector, is(not(nullValue())), "services injector required");
-        ensureThatArg(oidGenerator, is(not(nullValue())), "OID generator required");
-        ensureThatArg(adapterManager, is(not(nullValue())), "adapter manager required");
+        ensureThatArg(objectStore, is(not(nullValue())), "object store required");
 
         // owning, application scope
         this.persistenceSessionFactory = persistenceSessionFactory;
 
         // session scope
-        this.objectAdapterFactory = adapterFactory;
         this.servicesInjector = servicesInjector;
-        this.oidGenerator = oidGenerator;
-        this.adapterManager = adapterManager;
+
+        this.objectAdapterFactory = new PojoAdapterFactory();
+        this.oidGenerator = new OidGenerator(new IdentifierGeneratorUnified(configuration));
+        this.adapterManager = new AdapterManagerDefault(new PojoRecreatorUnified(configuration));
+        this.persistAlgorithm = new PersistAlgorithmUnified(configuration);
 
         setState(State.NOT_INITIALIZED);
 
@@ -148,10 +132,6 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
             LOG.debug("creating " + this);
         }
 
-        this.persistAlgorithm = new PersistAlgorithmUnified(configuration);
-
-        ensureThatArg(objectStore, is(not(nullValue())), "object store required");
-
         this.objectStore = objectStore;
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/46dc3a48/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
index 7c3e2bf..9ab3529 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
@@ -21,14 +21,12 @@ package org.apache.isis.core.runtime.system.persistence;
 
 import java.util.List;
 import org.apache.isis.core.commons.components.ApplicationScopedComponent;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
 import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
 import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
-import org.apache.isis.core.runtime.persistence.PersistenceSessionFactoryDelegate;
 import org.apache.isis.core.runtime.system.DeploymentType;
 
 /**
- * @see PersistenceSessionFactoryDelegate
+ * @see org.apache.isis.core.runtime.persistence.PersistenceSessionFactoryDelegate
  */
 public interface PersistenceSessionFactory extends MetaModelRefiner, ApplicationScopedComponent {
 
@@ -39,7 +37,6 @@ public interface PersistenceSessionFactory extends MetaModelRefiner, Application
     // Singleton threadsafe components
     // //////////////////////////////////////////////////////
 
-    ObjectAdapterFactory getAdapterFactory();
     ServicesInjectorSpi getServicesInjector();
 
     

http://git-wip-us.apache.org/repos/asf/isis/blob/46dc3a48/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusObjectStore.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusObjectStore.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusObjectStore.java
index 3c6d792..edccfa1 100644
--- a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusObjectStore.java
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusObjectStore.java
@@ -31,7 +31,6 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.isis.applib.services.bookmark.Bookmark;
 import org.apache.isis.applib.services.exceprecog.ExceptionRecognizer;
 import org.apache.isis.applib.services.exceprecog.ExceptionRecognizer2;
 import org.apache.isis.core.commons.config.ConfigurationConstants;
@@ -49,6 +48,7 @@ import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
 import org.apache.isis.core.runtime.persistence.PojoRefreshException;
 import org.apache.isis.core.runtime.persistence.UnsupportedFindException;
+import org.apache.isis.core.runtime.persistence.adapter.PojoAdapterFactory;
 import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.CreateObjectCommand;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.DestroyObjectCommand;
@@ -122,7 +122,10 @@ public class DataNucleusObjectStore implements ObjectStoreSpi {
     private TransactionMode transactionMode;
     
 
-    public DataNucleusObjectStore(ObjectAdapterFactory adapterFactory, DataNucleusApplicationComponents applicationComponents) {
+    public DataNucleusObjectStore(
+            final DataNucleusApplicationComponents applicationComponents) {
+
+        final ObjectAdapterFactory adapterFactory = new PojoAdapterFactory();
         ensureThatArg(adapterFactory, is(notNullValue()));
         ensureThatArg(applicationComponents, is(notNullValue()));
 

http://git-wip-us.apache.org/repos/asf/isis/blob/46dc3a48/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
index 9961265..adffadc 100644
--- a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
@@ -27,7 +27,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.isis.core.commons.components.Installer;
 import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
 import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
@@ -35,7 +34,6 @@ import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorCom
 import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstallerAbstract;
 import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.AdapterManagerSpi;
 import org.apache.isis.objectstore.jdo.metamodel.facets.object.auditable.AuditableAnnotationInJdoApplibFacetFactory;
 import org.apache.isis.objectstore.jdo.metamodel.facets.object.auditable.AuditableMarkerInterfaceInJdoApplibFacetFactory;
 import org.apache.isis.objectstore.jdo.metamodel.facets.object.datastoreidentity.JdoDatastoreIdentityAnnotationFacetFactory;
@@ -79,37 +77,42 @@ public class DataNucleusPersistenceMechanismInstaller extends PersistenceMechani
 
     private static final String ISIS_CONFIG_PREFIX = "isis.persistor.datanucleus.impl";
 
-    private DataNucleusApplicationComponents applicationComponents = null;
-
     public DataNucleusPersistenceMechanismInstaller() {
         super(NAME);
     }
 
 
-    ////////////////////////////////////////////////////////////////////////
-    // createObjectStore
-    ////////////////////////////////////////////////////////////////////////
-    
+    //region > createObjectStore
+
     @Override
-    protected ObjectStoreSpi createObjectStore(IsisConfiguration configuration, ObjectAdapterFactory adapterFactory, AdapterManagerSpi adapterManager) {
-        createDataNucleusApplicationComponentsIfRequired(configuration);
-        return new DataNucleusObjectStore(adapterFactory, applicationComponents);
+    public ObjectStoreSpi createObjectStore(final IsisConfiguration configuration) {
+        final DataNucleusApplicationComponents applicationComponents = createDataNucleusApplicationComponentsIfRequired(configuration);
+        return new DataNucleusObjectStore(applicationComponents);
     }
 
-    private void createDataNucleusApplicationComponentsIfRequired(IsisConfiguration configuration) {
-        // this is, perhaps doing more work than necessary...
-        // maybe retain the applicationComponents and just tell it to discard its PMF?
-        // (doubt will make much different in terms of the amount of time to process, though)
-        if(applicationComponents != null && !applicationComponents.isStale()) {
-            return;
+    //endregion
+
+    //region > createDataNucleusApplicationComponentsIfRequired
+    
+    private DataNucleusApplicationComponents applicationComponents = null;
+
+    private DataNucleusApplicationComponents createDataNucleusApplicationComponentsIfRequired(IsisConfiguration configuration) {
+
+        if (applicationComponents == null || applicationComponents.isStale()) {
+
+            // this is, perhaps doing more work than necessary...
+            // maybe retain the applicationComponents and just tell it to discard its PMF?
+            // (doubt will make much different in terms of the amount of time to process, though)
+
+            final IsisConfiguration dataNucleusConfig = configuration.createSubset(ISIS_CONFIG_PREFIX);
+            final Map<String, String> props = dataNucleusConfig.asMap();
+            addDataNucleusPropertiesIfRequired(props);
+
+            final Set<String> classesToBePersisted = catalogClassesToBePersisted(configuration, getSpecificationLoader().allSpecifications());
+            applicationComponents = new DataNucleusApplicationComponents(props, classesToBePersisted);
         }
-        
-        final IsisConfiguration dataNucleusConfig = configuration.createSubset(ISIS_CONFIG_PREFIX);
-        final Map<String, String> props = dataNucleusConfig.asMap();
-        addDataNucleusPropertiesIfRequired(props);
 
-        final Set<String> classesToBePersisted = catalogClassesToBePersisted(configuration, getSpecificationLoader().allSpecifications());
-        applicationComponents = new DataNucleusApplicationComponents(props, classesToBePersisted);
+        return applicationComponents;
     }
 
     private static Set<String> catalogClassesToBePersisted(final IsisConfiguration configuration, Collection<ObjectSpecification> objectSpecs) {
@@ -178,10 +181,9 @@ public class DataNucleusPersistenceMechanismInstaller extends PersistenceMechani
             props.put(key, value);
         }
     }
+    //endregion
 
-    ////////////////////////////////////////////////////////////////////////
-    // PersistenceSessionFactoryDelegate impl
-    ////////////////////////////////////////////////////////////////////////
+    //region > PersistenceSessionFactoryDelegate impl
 
 
     @Override
@@ -211,14 +213,13 @@ public class DataNucleusPersistenceMechanismInstaller extends PersistenceMechani
         metaModelValidator.add(new JdoMetaModelValidator());
     }
 
+    //endregion
 
+    //region > dependencies
 
-    ////////////////////////////////////////////////////////////////////////
-    // Dependencies
-    ////////////////////////////////////////////////////////////////////////
-    
     protected SpecificationLoaderSpi getSpecificationLoader() {
         return IsisContext.getSpecificationLoader();
     }
 
+    //endregion
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/46dc3a48/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/objectstore/PersistenceSessionObjectStoreTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/objectstore/PersistenceSessionObjectStoreTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/objectstore/PersistenceSessionObjectStoreTest.java
deleted file mode 100644
index 7b6ac68..0000000
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/objectstore/PersistenceSessionObjectStoreTest.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.persistence.objectstore;
-
-import java.util.Collections;
-import org.jmock.Expectations;
-import org.jmock.Sequence;
-import org.jmock.auto.Mock;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.apache.isis.applib.services.audit.AuditingService3;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.authentication.MessageBroker;
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.commons.matchers.IsisMatchers;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
-import org.apache.isis.core.metamodel.adapter.version.Version;
-import org.apache.isis.core.metamodel.app.IsisMetaModel;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.services.ServicesInjectorDefault;
-import org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault;
-import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
-import org.apache.isis.core.metamodel.specloader.InjectorMethodEvaluatorDefault;
-import org.apache.isis.core.runtime.persistence.adapter.PojoAdapter;
-import org.apache.isis.core.runtime.persistence.adapter.PojoAdapterFactory;
-import org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault;
-import org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorUnified;
-import org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.*;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.PojoAdapterBuilder.Persistence;
-import org.apache.isis.core.runtime.system.persistence.*;
-import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-import org.apache.isis.progmodels.dflt.ProgrammingModelFacetsJava5;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-
-public class PersistenceSessionObjectStoreTest {
-
-    @Rule
-    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
-    private ServicesInjectorDefault servicesInjector;
-    private AdapterManagerSpi adapterManager;
-    private ObjectAdapterFactory adapterFactory;
-    
-    
-    private PersistenceSession persistenceSession;
-    private IsisTransactionManager transactionManager;
-    
-    private ObjectAdapter persistentAdapter;
-    private PojoAdapter transientAdapter;
-    
-    @Mock
-    private PersistenceSessionFactory mockPersistenceSessionFactory;
-    
-    @Mock
-    private AuthenticationSession mockAuthenticationSession;
-
-    @Mock
-    private ObjectStoreSpi mockObjectStore;
-    @Mock
-    private AuditingService3 mockAuditingService3;
-    @Mock
-    private PublishingServiceWithDefaultPayloadFactories mockPublishingService;
-
-    @Mock
-    private CreateObjectCommand createObjectCommand;
-    @Mock
-    private SaveObjectCommand saveObjectCommand;
-    @Mock
-    private DestroyObjectCommand destroyObjectCommand;
-
-    @Mock
-    private Version mockVersion;
-
-    @Mock
-    private RuntimeContext mockRuntimeContext;
-
-    @Mock
-    private IsisConfiguration mockConfiguration;
-    
-    @Mock
-    private MessageBroker mockMessageBroker;
-    
-    
-    private IsisMetaModel isisMetaModel;
-
-
-
-    public static class Customer {
-    }
-
-    public static class CustomerRepository {
-        public Customer x() {return null;}
-    }
-    
-    @Before
-    public void setUp() throws Exception {
-        org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.OFF);
-
-        context.ignoring(mockRuntimeContext);
-        context.ignoring(mockConfiguration);
-        context.ignoring(mockAuditingService3);
-
-        isisMetaModel = new IsisMetaModel(mockRuntimeContext, new ProgrammingModelFacetsJava5(), new CustomerRepository());
-        isisMetaModel.init();
-        
-        context.checking(new Expectations() {
-            {
-                ignoring(mockObjectStore).open();
-                ignoring(mockObjectStore).close();
-                ignoring(mockObjectStore).name();
-                ignoring(mockConfiguration);
-
-                ignoring(createObjectCommand);
-                ignoring(saveObjectCommand);
-                ignoring(destroyObjectCommand);
-                ignoring(mockVersion);
-                
-                allowing(mockAuthenticationSession).getMessageBroker();
-                will(returnValue(mockMessageBroker));
-            }
-        });
-
-        final RuntimeContextFromSession runtimeContext = new RuntimeContextFromSession();
-        final DomainObjectContainerDefault container = new DomainObjectContainerDefault();
-
-        runtimeContext.injectInto(container);
-
-        servicesInjector = new ServicesInjectorDefault(new InjectorMethodEvaluatorDefault());
-
-        adapterManager = new AdapterManagerDefault(new PojoRecreatorUnified(mockConfiguration));
-        adapterFactory = new PojoAdapterFactory();
-        persistenceSession = new PersistenceSession(mockPersistenceSessionFactory, adapterFactory, servicesInjector, new OidGenerator(new IdentifierGeneratorDefault()), adapterManager, mockObjectStore, mockConfiguration) {
-            @Override
-            protected SpecificationLoaderSpi getSpecificationLoader() {
-                return isisMetaModel.getSpecificationLoader();
-            }
-            
-        };
-        
-        servicesInjector.setServices(Collections.<Object>singletonList(container));
-        
-        context.checking(new Expectations(){{
-            allowing(mockAuthenticationSession).getUserName();
-            will(returnValue("sven"));
-        }});
-
-        
-        transactionManager = new IsisTransactionManager(persistenceSession, mockObjectStore, servicesInjector) {
-            @Override
-            public AuthenticationSession getAuthenticationSession() {
-                return mockAuthenticationSession;
-            }
-        };
-        persistenceSession.setTransactionManager(transactionManager);
-
-        persistentAdapter = PojoAdapterBuilder.create().withOid("CUS|1").withPojo(new Customer()).with(Persistence.PERSISTENT).with(mockVersion).with(isisMetaModel.getSpecificationLoader()).build();
-        transientAdapter = PojoAdapterBuilder.create().withOid("CUS|2").withPojo(new Customer()).with(Persistence.TRANSIENT).with(isisMetaModel.getSpecificationLoader()).build();
-    }
-
-
-    @Test
-    public void destroyObjectThenAbort() {
-        
-        final Sequence tran = context.sequence("tran");
-        context.checking(new Expectations() {
-            {
-                one(mockObjectStore).startTransaction();
-                inSequence(tran);
-
-                one(mockObjectStore).createDestroyObjectCommand(persistentAdapter);
-                inSequence(tran);
-
-                one(mockObjectStore).abortTransaction();
-                inSequence(tran);
-            }
-        });
-        
-        transactionManager.startTransaction();
-        persistenceSession.destroyObject(persistentAdapter);
-        transactionManager.abortTransaction();
-    }
-
-    @Test
-    public void destroyObject_thenCommit() {
-
-        final Sequence tran = context.sequence("tran");
-        context.checking(new Expectations() {
-            {
-                oneOf(mockObjectStore).startTransaction();
-                inSequence(tran);
-
-                oneOf(mockObjectStore).createDestroyObjectCommand(persistentAdapter);
-                inSequence(tran);
-                will(returnValue(destroyObjectCommand));
-                
-                oneOf(mockObjectStore).execute(with(IsisMatchers.listContaining((PersistenceCommand)destroyObjectCommand)));
-                inSequence(tran);
-
-                // second flush after publish
-                oneOf(mockObjectStore).execute(with(equalTo(Collections.<PersistenceCommand>emptyList())));
-                inSequence(tran);
-
-                // third flush after commands
-                oneOf(mockObjectStore).execute(with(equalTo(Collections.<PersistenceCommand>emptyList())));
-                inSequence(tran);
-
-                oneOf(mockObjectStore).endTransaction();
-                inSequence(tran);
-            }
-
-        });
-
-        transactionManager.startTransaction();
-        persistenceSession.destroyObject(persistentAdapter);
-        transactionManager.endTransaction();
-    }
-
-    @Test
-    public void makePersistent_happyCase() {
-
-        final Sequence tran = context.sequence("tran");
-        context.checking(new Expectations() {
-            {
-                oneOf(mockObjectStore).startTransaction();
-                inSequence(tran);
-
-                oneOf(mockObjectStore).execute(with(equalTo(Collections.<PersistenceCommand>emptyList())));
-                inSequence(tran);
-                // second flush after publish
-                oneOf(mockObjectStore).execute(with(equalTo(Collections.<PersistenceCommand>emptyList())));
-                inSequence(tran);
-                // third flush after commands
-                oneOf(mockObjectStore).execute(with(equalTo(Collections.<PersistenceCommand>emptyList())));
-                inSequence(tran);
-
-                oneOf(mockObjectStore).endTransaction();
-                inSequence(tran);
-            }
-        });
-
-        transactionManager.startTransaction();
-        persistenceSession.makePersistent(transientAdapter);
-        transactionManager.endTransaction();
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/46dc3a48/core/runtime/src/test/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionTest.java
new file mode 100644
index 0000000..2d67115
--- /dev/null
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionTest.java
@@ -0,0 +1,268 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.runtime.system.persistence;
+
+import java.util.Collections;
+import org.jmock.Expectations;
+import org.jmock.Sequence;
+import org.jmock.auto.Mock;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.apache.isis.applib.services.audit.AuditingService3;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.authentication.MessageBroker;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.matchers.IsisMatchers;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
+import org.apache.isis.core.metamodel.adapter.version.Version;
+import org.apache.isis.core.metamodel.app.IsisMetaModel;
+import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.metamodel.services.ServicesInjectorDefault;
+import org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.specloader.InjectorMethodEvaluatorDefault;
+import org.apache.isis.core.runtime.persistence.adapter.PojoAdapter;
+import org.apache.isis.core.runtime.persistence.adapter.PojoAdapterFactory;
+import org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault;
+import org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorUnified;
+import org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession;
+import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
+import org.apache.isis.core.runtime.persistence.objectstore.transaction.*;
+import org.apache.isis.core.runtime.persistence.objectstore.transaction.PojoAdapterBuilder.Persistence;
+import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
+import org.apache.isis.progmodels.dflt.ProgrammingModelFacetsJava5;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+
+public class PersistenceSessionTest {
+
+    @Rule
+    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+
+    private ServicesInjectorDefault servicesInjector;
+    private AdapterManagerSpi adapterManager;
+    private ObjectAdapterFactory adapterFactory;
+    
+    
+    private PersistenceSession persistenceSession;
+    private IsisTransactionManager transactionManager;
+    
+    private ObjectAdapter persistentAdapter;
+    private PojoAdapter transientAdapter;
+    
+    @Mock
+    private PersistenceSessionFactory mockPersistenceSessionFactory;
+    
+    @Mock
+    private AuthenticationSession mockAuthenticationSession;
+
+    @Mock
+    private ObjectStoreSpi mockObjectStore;
+    @Mock
+    private AuditingService3 mockAuditingService3;
+    @Mock
+    private PublishingServiceWithDefaultPayloadFactories mockPublishingService;
+
+    @Mock
+    private CreateObjectCommand createObjectCommand;
+    @Mock
+    private SaveObjectCommand saveObjectCommand;
+    @Mock
+    private DestroyObjectCommand destroyObjectCommand;
+
+    @Mock
+    private Version mockVersion;
+
+    @Mock
+    private RuntimeContext mockRuntimeContext;
+
+    @Mock
+    private IsisConfiguration mockConfiguration;
+    
+    @Mock
+    private MessageBroker mockMessageBroker;
+    
+    
+    private IsisMetaModel isisMetaModel;
+
+
+
+    public static class Customer {
+    }
+
+    public static class CustomerRepository {
+        public Customer x() {return null;}
+    }
+    
+    @Before
+    public void setUp() throws Exception {
+        org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.OFF);
+
+        context.ignoring(mockRuntimeContext);
+        context.ignoring(mockConfiguration);
+        context.ignoring(mockAuditingService3);
+
+        isisMetaModel = new IsisMetaModel(mockRuntimeContext, new ProgrammingModelFacetsJava5(), new CustomerRepository());
+        isisMetaModel.init();
+        
+        context.checking(new Expectations() {
+            {
+                ignoring(mockObjectStore).open();
+                ignoring(mockObjectStore).close();
+                ignoring(mockObjectStore).name();
+                ignoring(mockConfiguration);
+
+                ignoring(createObjectCommand);
+                ignoring(saveObjectCommand);
+                ignoring(destroyObjectCommand);
+                ignoring(mockVersion);
+                
+                allowing(mockAuthenticationSession).getMessageBroker();
+                will(returnValue(mockMessageBroker));
+            }
+        });
+
+        final RuntimeContextFromSession runtimeContext = new RuntimeContextFromSession();
+        final DomainObjectContainerDefault container = new DomainObjectContainerDefault();
+
+        runtimeContext.injectInto(container);
+
+        servicesInjector = new ServicesInjectorDefault(new InjectorMethodEvaluatorDefault());
+
+        adapterManager = new AdapterManagerDefault(new PojoRecreatorUnified(mockConfiguration));
+        adapterFactory = new PojoAdapterFactory();
+        persistenceSession = new PersistenceSession(mockPersistenceSessionFactory, servicesInjector, mockObjectStore, mockConfiguration) {
+            @Override
+            protected SpecificationLoaderSpi getSpecificationLoader() {
+                return isisMetaModel.getSpecificationLoader();
+            }
+            
+        };
+        
+        servicesInjector.setServices(Collections.<Object>singletonList(container));
+        
+        context.checking(new Expectations(){{
+            allowing(mockAuthenticationSession).getUserName();
+            will(returnValue("sven"));
+        }});
+
+        
+        transactionManager = new IsisTransactionManager(persistenceSession, mockObjectStore, servicesInjector) {
+            @Override
+            public AuthenticationSession getAuthenticationSession() {
+                return mockAuthenticationSession;
+            }
+        };
+        persistenceSession.setTransactionManager(transactionManager);
+
+        persistentAdapter = PojoAdapterBuilder.create().withOid("CUS|1").withPojo(new Customer()).with(Persistence.PERSISTENT).with(mockVersion).with(isisMetaModel.getSpecificationLoader()).build();
+        transientAdapter = PojoAdapterBuilder.create().withOid("CUS|2").withPojo(new Customer()).with(Persistence.TRANSIENT).with(isisMetaModel.getSpecificationLoader()).build();
+    }
+
+
+    @Test
+    public void destroyObjectThenAbort() {
+        
+        final Sequence tran = context.sequence("tran");
+        context.checking(new Expectations() {
+            {
+                one(mockObjectStore).startTransaction();
+                inSequence(tran);
+
+                one(mockObjectStore).createDestroyObjectCommand(persistentAdapter);
+                inSequence(tran);
+
+                one(mockObjectStore).abortTransaction();
+                inSequence(tran);
+            }
+        });
+        
+        transactionManager.startTransaction();
+        persistenceSession.destroyObject(persistentAdapter);
+        transactionManager.abortTransaction();
+    }
+
+    @Test
+    public void destroyObject_thenCommit() {
+
+        final Sequence tran = context.sequence("tran");
+        context.checking(new Expectations() {
+            {
+                oneOf(mockObjectStore).startTransaction();
+                inSequence(tran);
+
+                oneOf(mockObjectStore).createDestroyObjectCommand(persistentAdapter);
+                inSequence(tran);
+                will(returnValue(destroyObjectCommand));
+                
+                oneOf(mockObjectStore).execute(with(IsisMatchers.listContaining((PersistenceCommand)destroyObjectCommand)));
+                inSequence(tran);
+
+                // second flush after publish
+                oneOf(mockObjectStore).execute(with(equalTo(Collections.<PersistenceCommand>emptyList())));
+                inSequence(tran);
+
+                // third flush after commands
+                oneOf(mockObjectStore).execute(with(equalTo(Collections.<PersistenceCommand>emptyList())));
+                inSequence(tran);
+
+                oneOf(mockObjectStore).endTransaction();
+                inSequence(tran);
+            }
+
+        });
+
+        transactionManager.startTransaction();
+        persistenceSession.destroyObject(persistentAdapter);
+        transactionManager.endTransaction();
+    }
+
+    @Test
+    public void makePersistent_happyCase() {
+
+        final Sequence tran = context.sequence("tran");
+        context.checking(new Expectations() {
+            {
+                oneOf(mockObjectStore).startTransaction();
+                inSequence(tran);
+
+                oneOf(mockObjectStore).execute(with(equalTo(Collections.<PersistenceCommand>emptyList())));
+                inSequence(tran);
+                // second flush after publish
+                oneOf(mockObjectStore).execute(with(equalTo(Collections.<PersistenceCommand>emptyList())));
+                inSequence(tran);
+                // third flush after commands
+                oneOf(mockObjectStore).execute(with(equalTo(Collections.<PersistenceCommand>emptyList())));
+                inSequence(tran);
+
+                oneOf(mockObjectStore).endTransaction();
+                inSequence(tran);
+            }
+        });
+
+        transactionManager.startTransaction();
+        persistenceSession.makePersistent(transientAdapter);
+        transactionManager.endTransaction();
+    }
+}


[14/44] isis git commit: ISIS-537 Use .input-sm for the select2 input fields.

Posted by da...@apache.org.
ISIS-537 Use .input-sm for the select2 input fields.

https://trello.com/c/f60AAQps/116-tiny-adjustment-to-spacing-on-select2-drop-downs


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/8a2c825c
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/8a2c825c
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/8a2c825c

Branch: refs/heads/master
Commit: 8a2c825c3375ca305411a3930aa5091e6b1a1564
Parents: d905d38
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Fri Nov 7 13:25:00 2014 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Fri Nov 7 13:25:00 2014 +0200

----------------------------------------------------------------------
 .../components/widgets/valuechoices/ValueChoicesSelect2Panel.html  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/8a2c825c/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuechoices/ValueChoicesSelect2Panel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuechoices/ValueChoicesSelect2Panel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuechoices/ValueChoicesSelect2Panel.html
index 2dcef71..6722fb2 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuechoices/ValueChoicesSelect2Panel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/valuechoices/ValueChoicesSelect2Panel.html
@@ -29,7 +29,7 @@
                     <label wicket:id="scalarName" class="scalarName control-label">[Label text]</label>
                     <div class="scalarValueWrapper">
                         <div class="choicesPlaceholder">
-                            <input wicket:id="scalarValue" type="hidden" class="choices form-control select2-remote" style="width: 99.8%;"/>
+                            <input wicket:id="scalarValue" type="hidden" class="choices form-control input-sm select2-remote" style="width: 99.8%;"/>
                         </div>
                         <span wicket:id="feedback" class="help-block"></span>
                         <span wicket:id="additionalLinks"></span>


[09/44] isis git commit: ISIS-939: clear the MessageBroker's applicationError field once read (functionality lost in previous refactorings).

Posted by da...@apache.org.
ISIS-939: clear the MessageBroker's applicationError field once read (functionality lost in previous refactorings).


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/0ecd015c
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/0ecd015c
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/0ecd015c

Branch: refs/heads/master
Commit: 0ecd015ce25e71c9c4f7d2ca4d262600c9c5cc14
Parents: 5f8fca9
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Tue Nov 4 08:13:46 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Nov 6 16:19:01 2014 +0000

----------------------------------------------------------------------
 .../apache/isis/core/commons/authentication/MessageBroker.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/0ecd015c/core/metamodel/src/main/java/org/apache/isis/core/commons/authentication/MessageBroker.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/commons/authentication/MessageBroker.java b/core/metamodel/src/main/java/org/apache/isis/core/commons/authentication/MessageBroker.java
index dc36cce..52cd3a5 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/commons/authentication/MessageBroker.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/commons/authentication/MessageBroker.java
@@ -88,7 +88,9 @@ public class MessageBroker implements Serializable, DebuggableWithTitle {
     //endregion
 
     public String getApplicationError() {
-        return applicationError;
+        final String error = applicationError;
+        setApplicationError(null);
+        return error;
     }
 
     public void setApplicationError(String applicationError) {


[39/44] isis git commit: ISIS-537: cleaning up some old (commented out) HTML markup.

Posted by da...@apache.org.
ISIS-537: cleaning up some old (commented out) HTML markup.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/e20203ee
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/e20203ee
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/e20203ee

Branch: refs/heads/master
Commit: e20203ee92f18a2fcc9dc0c6d76bf1d7202bccb3
Parents: c1f5281
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Nov 10 20:38:28 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 20:38:28 2014 +0000

----------------------------------------------------------------------
 .../ajaxtable/CollectionContentsAsAjaxTablePanel.html          | 6 ------
 1 file changed, 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/e20203ee/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.html
index 694f262..cf45f34 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.html
@@ -21,16 +21,10 @@
     <body>
         <wicket:panel>
             <div class="collectionContentsAsAjaxTablePanel collectionContentsComponentType">
-                <!--
-                <div class="entityActions" xxxwicket:id="entityActions"></div>
-                -->
                 <div class="clearfix"></div>
                 <div class="table-responsive">
                     <table class="contents table table-striped table-condensed table-hover table-bordered" cellspacing="0" wicket:id="table">[table]</table>
                 </div>
-                <!--
-                <div xxxwicket:id="actionPromptModalWindow"></div>
-                -->
             </div>
         </wicket:panel>
     </body>


[16/44] isis git commit: ISIS-537 Change the name of the theme chooser cookie to be more inline with the names of the properties

Posted by da...@apache.org.
ISIS-537 Change the name of the theme chooser cookie to be more inline with the names of the properties


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/39027056
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/39027056
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/39027056

Branch: refs/heads/master
Commit: 390270568fa2520812414ad892039bb591354187
Parents: 8c0a5ac
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Sat Nov 8 23:38:27 2014 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Sat Nov 8 23:38:27 2014 +0200

----------------------------------------------------------------------
 .../wicket/ui/components/widgets/themepicker/ThemeChooser.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/39027056/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/themepicker/ThemeChooser.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/themepicker/ThemeChooser.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/themepicker/ThemeChooser.java
index bd951c1..7ea8b6c 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/themepicker/ThemeChooser.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/themepicker/ThemeChooser.java
@@ -56,7 +56,7 @@ public class ThemeChooser extends Panel {
     /**
      * The name of the cookie that stores the last user selection
      */
-    private static final String ISIS_THEME_COOKIE_NAME = "isis.themeChooser.theme";
+    private static final String ISIS_THEME_COOKIE_NAME = "isis.viewer.wicket.themes.selected";
 
     /**
      * Constructor


[20/44] isis git commit: ISIS-537: moved impl of LinksSelectorPanelAbstract (.java) to subclasses.

Posted by da...@apache.org.
ISIS-537: moved impl of LinksSelectorPanelAbstract (.java) to subclasses.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/b1677ca8
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/b1677ca8
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/b1677ca8

Branch: refs/heads/master
Commit: b1677ca880b7a27a831ecf84e387952aca12a241
Parents: 3b80b5e
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sun Nov 9 11:57:48 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 10:21:35 2014 +0000

----------------------------------------------------------------------
 .../CollectionContentsLinksSelectorPanel.java   | 408 ++++++++++++++++---
 .../links/EntityLinksSelectorPanel.java         | 352 +++++++++++++++-
 .../links/LinksSelectorPanelAbstract.java       |  40 +-
 3 files changed, 724 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/b1677ca8/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
index 81f7ece..096903c 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
@@ -19,26 +19,52 @@
 
 package org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.links;
 
-import java.util.List;
+import de.agilecoders.wicket.core.markup.html.bootstrap.button.Buttons;
 
+import java.util.ArrayList;
+import java.util.List;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
 import com.google.common.collect.Lists;
-
+import org.apache.wicket.AttributeModifier;
 import org.apache.wicket.Component;
+import org.apache.wicket.MarkupContainer;
 import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.AbstractLink;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
 import org.apache.wicket.model.IModel;
-
+import org.apache.wicket.model.Model;
 import org.apache.isis.applib.annotation.Render.Type;
+import org.apache.isis.core.commons.lang.StringExtensions;
 import org.apache.isis.core.metamodel.facets.members.render.RenderFacet;
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.viewer.wicket.model.hints.IsisUiHintEvent;
 import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
+import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
+import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
+import org.apache.isis.viewer.wicket.model.links.LinksProvider;
 import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+import org.apache.isis.viewer.wicket.ui.CollectionContentsAsFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.components.additionallinks.AdditionalLinksPanel;
 import org.apache.isis.viewer.wicket.ui.components.collection.CollectionCountProvider;
 import org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
 import org.apache.isis.viewer.wicket.ui.selector.links.LinksSelectorPanelAbstract;
+import org.apache.isis.viewer.wicket.ui.util.Components;
+import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
+import org.apache.isis.viewer.wicket.ui.util.CssClassRemover;
 
 /**
  * Provides a list of links for selecting other views that support
@@ -49,29 +75,317 @@ import org.apache.isis.viewer.wicket.ui.selector.links.LinksSelectorPanelAbstrac
  * Most of the heavy lifting is factored out into the superclass,
  * {@link LinksSelectorPanelAbstract}.
  */
-public class CollectionContentsLinksSelectorPanel extends LinksSelectorPanelAbstract<EntityCollectionModel> implements CollectionCountProvider {
+public class CollectionContentsLinksSelectorPanel
+        extends PanelAbstract<EntityCollectionModel> implements UiHintPathSignificant,  CollectionCountProvider {
 
     private static final long serialVersionUID = 1L;
 
+    private static final String INVISIBLE_CLASS = "link-selector-panel-invisible";
+    private static final int MAX_NUM_UNDERLYING_VIEWS = 10;
+
+    private static final String ID_ADDITIONAL_LINKS = "additionalLinks";
+
+    private static final String ID_VIEWS = "views";
+    private static final String ID_VIEW_LIST = "viewList";
+    private static final String ID_VIEW_LINK = "viewLink";
+    private static final String ID_VIEW_ITEM = "viewItem";
+    private static final String ID_VIEW_ITEM_TITLE = "viewItemTitle";
+    private static final String ID_VIEW_ITEM_ICON = "viewItemIcon";
+
+    private static final String UIHINT_VIEW = "view";
+    private static final String ID_VIEW_BUTTON_TITLE = "viewButtonTitle";
+    private static final String ID_VIEW_BUTTON_ICON = "viewButtonIcon";
+
+    private final ComponentType componentType;
+    private final String underlyingIdPrefix;
+
+    private ComponentFactory selectedComponentFactory;
+    protected Component selectedComponent;
+
+    /**
+     * May be <tt>null</tt>, depending upon the model implementation.
+     */
+    protected WebMarkupContainer additionalLinks;
+
     public CollectionContentsLinksSelectorPanel(final String id, final EntityCollectionModel model, final ComponentFactory factory) {
-        super(id, ComponentType.COLLECTION_CONTENTS.toString(), model, factory);
+        super(id, model);
+        this.underlyingIdPrefix = ComponentType.COLLECTION_CONTENTS.toString();
+        this.componentType = factory.getComponentType();
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.isis.viewer.wicket.ui.selector.links.LinksSelectorPanelAbstract#onInitialize()
+    /**
+     * Build UI only after added to parent.
      */
-    @Override
     public void onInitialize() {
         super.onInitialize();
+        ComponentFactory componentFactory = getComponentFactoryRegistry().findComponentFactoryElseFailFast(getComponentType(), getModel());
+        addAdditionalLinks(getModel());
+        addUnderlyingViews(underlyingIdPrefix, getModel(), componentFactory);
         applyCssVisibility(additionalLinks, selectedComponent instanceof CollectionCountProvider);
     }
-    
-    @Override
-    protected EntityCollectionModel dummyOf(EntityCollectionModel model) {
-        return model.asDummy();
+
+
+    protected void addAdditionalLinks(final EntityCollectionModel model) {
+        if(!(model instanceof LinksProvider)) {
+            permanentlyHide(ID_ADDITIONAL_LINKS);
+            return;
+        }
+        LinksProvider linksProvider = (LinksProvider) model;
+        List<LinkAndLabel> links = linksProvider.getLinks();
+
+        addAdditionalLinks(this, links);
+    }
+
+    protected void addAdditionalLinks(MarkupContainer markupContainer, List<LinkAndLabel> links) {
+        if(links == null || links.isEmpty()) {
+            Components.permanentlyHide(markupContainer, ID_ADDITIONAL_LINKS);
+            return;
+        }
+        links = Lists.newArrayList(links); // copy, to serialize any lazy evaluation
+
+        additionalLinks = new AdditionalLinksPanel(ID_ADDITIONAL_LINKS, links);
+        markupContainer.addOrReplace(additionalLinks);
+    }
+
+    private void addUnderlyingViews(final String underlyingIdPrefix, final EntityCollectionModel model, final ComponentFactory factory) {
+        final List<ComponentFactory> componentFactories = findOtherComponentFactories(model, factory);
+
+        final int selected = honourViewHintElseDefault(componentFactories, model);
+
+        final CollectionContentsLinksSelectorPanel selectorPanel = this;
+
+        // create all, hide the one not selected
+        final Component[] underlyingViews = new Component[MAX_NUM_UNDERLYING_VIEWS];
+        int i = 0;
+        final EntityCollectionModel emptyModel = dummyOf(model);
+        for (ComponentFactory componentFactory : componentFactories) {
+            final String underlyingId = underlyingIdPrefix + "-" + i;
+
+            Component underlyingView = componentFactory.createComponent(underlyingId,i==selected? model: emptyModel);
+            underlyingViews[i++] = underlyingView;
+            selectorPanel.addOrReplace(underlyingView);
+        }
+
+        // hide any unused placeholders
+        while(i<MAX_NUM_UNDERLYING_VIEWS) {
+            String underlyingId = underlyingIdPrefix + "-" + i;
+            permanentlyHide(underlyingId);
+            i++;
+        }
+
+        // selector
+        if (componentFactories.size() <= 1) {
+            permanentlyHide(ID_VIEWS);
+        } else {
+            final Model<ComponentFactory> componentFactoryModel = new Model<>();
+
+            selectorPanel.selectedComponentFactory = componentFactories.get(selected);
+            componentFactoryModel.setObject(selectorPanel.selectedComponentFactory);
+
+            final WebMarkupContainer views = new WebMarkupContainer(ID_VIEWS);
+
+            final Label viewButtonTitle = new Label(ID_VIEW_BUTTON_TITLE, "Hidden");
+            views.addOrReplace(viewButtonTitle);
+
+            final Label viewButtonIcon = new Label(ID_VIEW_BUTTON_ICON, "");
+            views.addOrReplace(viewButtonIcon);
+
+            final WebMarkupContainer container = new WebMarkupContainer(ID_VIEW_LIST);
+
+            views.addOrReplace(container);
+            views.setOutputMarkupId(true);
+
+            this.setOutputMarkupId(true);
+
+            final ListView<ComponentFactory> listView = new ListView<ComponentFactory>(ID_VIEW_ITEM, componentFactories) {
+
+                private static final long serialVersionUID = 1L;
+
+                @Override
+                protected void populateItem(ListItem<ComponentFactory> item) {
+
+                    final int underlyingViewNum = item.getIndex();
+
+                    final ComponentFactory componentFactory = item.getModelObject();
+                    final AbstractLink link = new AjaxLink<Void>(ID_VIEW_LINK) {
+                        private static final long serialVersionUID = 1L;
+                        @Override
+                        public void onClick(AjaxRequestTarget target) {
+                            CollectionContentsLinksSelectorPanel linksSelectorPanel = CollectionContentsLinksSelectorPanel.this;
+                            linksSelectorPanel.setViewHintAndBroadcast(underlyingViewNum, target);
+
+                            final EntityCollectionModel dummyModel = dummyOf(model);
+                            for(int i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
+                                final Component component = underlyingViews[i];
+                                if(component == null) {
+                                    continue;
+                                }
+                                final boolean isSelected = i == underlyingViewNum;
+                                applyCssVisibility(component, isSelected);
+                                component.setDefaultModel(isSelected? model: dummyModel);
+                            }
+
+                            selectorPanel.selectedComponentFactory = componentFactory;
+                            selectorPanel.selectedComponent = underlyingViews[underlyingViewNum];
+                            selectorPanel.onSelect(target);
+                            target.add(selectorPanel, views);
+                        }
+
+                        @Override
+                        protected void onComponentTag(ComponentTag tag) {
+                            super.onComponentTag(tag);
+                            Buttons.fixDisabledState(this, tag);
+                        }
+                    };
+
+                    IModel<String> title = nameFor(componentFactory);
+                    Label viewItemTitleLabel = new Label(ID_VIEW_ITEM_TITLE, title);
+                    link.add(viewItemTitleLabel);
+
+                    Label viewItemIcon = new Label(ID_VIEW_ITEM_ICON, "");
+                    link.add(viewItemIcon);
+
+                    boolean isEnabled = componentFactory != selectorPanel.selectedComponentFactory;
+                    if (!isEnabled) {
+                        viewButtonTitle.setDefaultModel(title);
+                        IModel<String> cssClass = cssClassFor(componentFactory, viewButtonIcon);
+                        viewButtonIcon.add(AttributeModifier.replace("class", "ViewLinkItem " + cssClass.getObject()));
+                        link.setVisible(false);
+                    } else {
+                        IModel<String> cssClass = cssClassFor(componentFactory, viewItemIcon);
+                        viewItemIcon.add(new CssClassAppender(cssClass));
+                    }
+
+                    item.add(link);
+                }
+
+                private IModel<String> cssClassFor(final ComponentFactory componentFactory, Label viewIcon) {
+                    IModel<String> cssClass = null;
+                    if (componentFactory instanceof CollectionContentsAsFactory) {
+                        CollectionContentsAsFactory collectionContentsAsFactory = (CollectionContentsAsFactory) componentFactory;
+                        cssClass = collectionContentsAsFactory.getCssClass();
+                        viewIcon.setDefaultModelObject("");
+                        viewIcon.setEscapeModelStrings(true);
+                    }
+                    if (cssClass == null) {
+                        String name = componentFactory.getName();
+                        cssClass = Model.of(StringExtensions.asLowerDashed(name));
+                        // Small hack: if there is no specific CSS class then we assume that background-image is used
+                        // the span.ViewItemLink should have some content to show it
+                        // FIX: find a way to do this with CSS (width and height don't seems to help)
+                        viewIcon.setDefaultModelObject("&#160;&#160;&#160;&#160;&#160;");
+                        viewIcon.setEscapeModelStrings(false);
+                    }
+                    return cssClass;
+                }
+
+                private IModel<String> nameFor(final ComponentFactory componentFactory) {
+                    IModel<String> name = null;
+                    if (componentFactory instanceof CollectionContentsAsFactory) {
+                        CollectionContentsAsFactory collectionContentsAsFactory = (CollectionContentsAsFactory) componentFactory;
+                        name = collectionContentsAsFactory.getTitleLabel();
+                    }
+                    if (name == null) {
+                        name = Model.of(componentFactory.getName());
+                    }
+                    return name;
+                }
+            };
+            container.add(listView);
+            addOrReplace(views);
+        }
+
+        for(i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
+            Component component = underlyingViews[i];
+            if(component != null) {
+                if(i != selected) {
+                    component.add(new CssClassAppender(INVISIBLE_CLASS));
+                } else {
+                    selectedComponent = component;
+                }
+            }
+        }
+    }
+
+
+
+    protected void setViewHintAndBroadcast(int viewNum, AjaxRequestTarget target) {
+        final UiHintContainer uiHintContainer = getUiHintContainer();
+        if(uiHintContainer == null) {
+            return;
+        }
+        uiHintContainer.setHint(CollectionContentsLinksSelectorPanel.this, UIHINT_VIEW, ""+viewNum);
+        send(getPage(), Broadcast.EXACT, new IsisUiHintEvent(uiHintContainer, target));
     }
 
-    
+    /**
+     * Iterates up the component hierarchy looking for a parent
+     * {@link org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel}, and if so adds to ajax target so that it'll
+     * be repainted.
+     *
+     * <p>
+     * Yeah, agreed, it's a little bit hacky doing it this way, because it bakes
+     * in knowledge that this component is created, somehow, by a parent {@link org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel}.
+     * Perhaps it could be refactored to use a more general purpose observer pattern?
+     *
+     * <p>
+     * In fact, I've since discovered that Wicket has an event bus, which is used by the
+     * {@link UiHintContainer hinting mechanism}.  So this ought to be relatively easy to do.
+     */
+    protected void onSelect(AjaxRequestTarget target) {
+        Component component = this;
+        while(component != null) {
+            if(component instanceof CollectionPanel) {
+                CollectionPanel collectionPanel = (CollectionPanel) component;
+                boolean hasCount = collectionPanel.hasCount();
+                if(hasCount) {
+                    collectionPanel.updateLabel(target);
+                }
+                if(additionalLinks != null) {
+                    applyCssVisibility(additionalLinks, hasCount);
+                }
+                return;
+            }
+            component = component.getParent();
+        }
+    }
+
+
+    protected static void applyCssVisibility(final Component component, final boolean visible) {
+        if(component == null) {
+            return;
+        }
+        AttributeModifier modifier = visible ? new CssClassRemover(INVISIBLE_CLASS) : new CssClassAppender(INVISIBLE_CLASS);
+        component.add(modifier);
+    }
+
+    protected int honourViewHintElseDefault(final List<ComponentFactory> componentFactories, final IModel<?> model) {
+        // honour hints ...
+        final UiHintContainer hintContainer = getUiHintContainer();
+        if(hintContainer != null) {
+            String viewStr = hintContainer.getHint(this, UIHINT_VIEW);
+            if(viewStr != null) {
+                try {
+                    int view = Integer.parseInt(viewStr);
+                    if(view >= 0 && view < componentFactories.size()) {
+                        return view;
+                    }
+                } catch(NumberFormatException ex) {
+                    // ignore
+                }
+            }
+        }
+
+        // ... else default
+        int initialFactory = determineInitialFactory(componentFactories, model);
+        if(hintContainer != null) {
+            hintContainer.setHint(this, UIHINT_VIEW, ""+initialFactory);
+            // don't broadcast (no AjaxRequestTarget, still configuring initial setup)
+        }
+        return initialFactory;
+    }
+
+
     /**
      * return the index of {@link CollectionContentsAsUnresolvedPanelFactory unresolved panel} if present and not eager loading;
      * else the index of {@link CollectionContentsAsAjaxTablePanelFactory ajax table} if present,
@@ -92,11 +406,44 @@ public class CollectionContentsLinksSelectorPanel extends LinksSelectorPanelAbst
         return 0;
     }
 
-    @Override
+    private List<ComponentFactory> findOtherComponentFactories(final EntityCollectionModel model, final ComponentFactory ignoreFactory) {
+        final List<ComponentFactory> componentFactories = getComponentFactoryRegistry().findComponentFactories(componentType, model);
+        ArrayList<ComponentFactory> otherFactories = Lists.newArrayList(Collections2.filter(componentFactories, new Predicate<ComponentFactory>() {
+            @Override
+            public boolean apply(final ComponentFactory input) {
+                return input != ignoreFactory;
+            }
+        }));
+        return ordered(otherFactories);
+    }
+
     protected List<ComponentFactory> ordered(List<ComponentFactory> componentFactories) {
         return orderAjaxTableToEnd(componentFactories);
     }
 
+
+    @Override
+    public void renderHead(final IHeaderResponse response) {
+        super.renderHead(response);
+        PanelUtil.renderHead(response, LinksSelectorPanelAbstract.class);
+    }
+
+
+
+
+
+
+
+    /**
+     * Ask for a dummy (empty) {@link Model} to pass into those components that are rendered but will be
+     * made invisible using CSS styling.
+     */
+    protected EntityCollectionModel dummyOf(EntityCollectionModel model) {
+        return model.asDummy();
+    }
+
+    
+
     static List<ComponentFactory> orderAjaxTableToEnd(List<ComponentFactory> componentFactories) {
         int ajaxTableIdx = findAjaxTable(componentFactories);
         if(ajaxTableIdx>=0) {
@@ -134,38 +481,6 @@ public class CollectionContentsLinksSelectorPanel extends LinksSelectorPanelAbst
         return renderFacet != null && renderFacet.value() == Type.EAGERLY;
     }
 
-    /**
-     * Iterates up the component hierarchy looking for a parent
-     * {@link CollectionPanel}, and if so adds to ajax target so that it'll
-     * be repainted.
-     * 
-     * <p>
-     * Yeah, agreed, it's a little bit hacky doing it this way, because it bakes
-     * in knowledge that this component is created, somehow, by a parent {@link CollectionPanel}.
-     * Perhaps it could be refactored to use a more general purpose observer pattern?
-     * 
-     * <p>
-     * In fact, I've since discovered that Wicket has an event bus, which is used by the 
-     * {@link UiHintContainer hinting mechanism}.  So this ought to be relatively easy to do.
-     */
-    protected void onSelect(AjaxRequestTarget target) {
-        super.onSelect(target);
-        Component component = this;
-        while(component != null) {
-            if(component instanceof CollectionPanel) {
-                CollectionPanel collectionPanel = (CollectionPanel) component;
-                boolean hasCount = collectionPanel.hasCount();
-                if(hasCount) {
-                    collectionPanel.updateLabel(target);
-                }
-                if(additionalLinks != null) {
-                    applyCssVisibility(additionalLinks, hasCount);
-                }
-                return;
-            }
-            component = component.getParent();
-        }
-    }
 
     @Override
     public Integer getCount() {
@@ -177,5 +492,4 @@ public class CollectionContentsLinksSelectorPanel extends LinksSelectorPanelAbst
         }
     }
 
-
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/b1677ca8/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.java
index 378f277..7cab8d8 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.java
@@ -19,15 +19,45 @@
 
 package org.apache.isis.viewer.wicket.ui.components.entity.selector.links;
 
-import java.util.List;
+import de.agilecoders.wicket.core.markup.html.bootstrap.button.Buttons;
 
+import java.util.ArrayList;
+import java.util.List;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
+import org.apache.wicket.AttributeModifier;
+import org.apache.wicket.Component;
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.AbstractLink;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
 import org.apache.wicket.model.IModel;
-
+import org.apache.wicket.model.Model;
+import org.apache.isis.core.commons.lang.StringExtensions;
+import org.apache.isis.viewer.wicket.model.hints.IsisUiHintEvent;
 import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
+import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
+import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
+import org.apache.isis.viewer.wicket.model.links.LinksProvider;
 import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.CollectionContentsAsFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.components.additionallinks.AdditionalLinksPanel;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
 import org.apache.isis.viewer.wicket.ui.selector.links.LinksSelectorPanelAbstract;
+import org.apache.isis.viewer.wicket.ui.util.Components;
+import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
+import org.apache.isis.viewer.wicket.ui.util.CssClassRemover;
 
 /**
  * Provides a list of links for selecting other views that support
@@ -37,20 +67,47 @@ import org.apache.isis.viewer.wicket.ui.selector.links.LinksSelectorPanelAbstrac
  * Most of the heavy lifting is factored out into the superclass,
  * {@link LinksSelectorPanelAbstract}.
  */
-public class EntityLinksSelectorPanel extends LinksSelectorPanelAbstract<EntityModel> {
+public class EntityLinksSelectorPanel extends PanelAbstract<EntityModel> implements UiHintPathSignificant {
+
 
     private static final long serialVersionUID = 1L;
 
+    private static final String INVISIBLE_CLASS = "link-selector-panel-invisible";
+    private static final int MAX_NUM_UNDERLYING_VIEWS = 10;
+
+    private static final String ID_ADDITIONAL_LINKS = "additionalLinks";
+    public static final String ID_ADDITIONAL_LINK = "additionalLink";
+
+    private static final String ID_VIEWS = "views";
+    private static final String ID_VIEW_LIST = "viewList";
+    private static final String ID_VIEW_LINK = "viewLink";
+    private static final String ID_VIEW_ITEM = "viewItem";
+    private static final String ID_VIEW_ITEM_TITLE = "viewItemTitle";
+    private static final String ID_VIEW_ITEM_ICON = "viewItemIcon";
+
+    private static final String UIHINT_VIEW = "view";
+    private static final String ID_VIEW_BUTTON_TITLE = "viewButtonTitle";
+    private static final String ID_VIEW_BUTTON_ICON = "viewButtonIcon";
+
+    private final ComponentType componentType;
+    private final String underlyingIdPrefix;
+
+    private ComponentFactory selectedComponentFactory;
+    protected Component selectedComponent;
+
+    /**
+     * May be <tt>null</tt>, depending upon the model implementation.
+     */
+    protected WebMarkupContainer additionalLinks;
+
+
     public EntityLinksSelectorPanel(final String id, final EntityModel model, final ComponentFactory factory) {
-        super(id, ComponentType.ENTITY.toString(), model, factory);
+        super(id, model);
+        this.underlyingIdPrefix = ComponentType.ENTITY.toString();
+        this.componentType = factory.getComponentType();
     }
 
-    @Override
-    protected EntityModel dummyOf(EntityModel model) {
-        return model;
-    }
 
-    @Override
     protected int determineInitialFactory(List<ComponentFactory> componentFactories, IModel<?> model) {
         return 0;
     }
@@ -61,4 +118,281 @@ public class EntityLinksSelectorPanel extends LinksSelectorPanelAbstract<EntityM
         return null;
     }
 
+
+    /**
+     * Build UI only after added to parent.
+     */
+    public void onInitialize() {
+        super.onInitialize();
+        ComponentFactory componentFactory = getComponentFactoryRegistry().findComponentFactoryElseFailFast(getComponentType(), getModel());
+        addAdditionalLinks(getModel());
+        addUnderlyingViews(underlyingIdPrefix, getModel(), componentFactory);
+    }
+
+    protected void addAdditionalLinks(final EntityModel model) {
+        if(!(model instanceof LinksProvider)) {
+            permanentlyHide(ID_ADDITIONAL_LINKS);
+            return;
+        }
+        LinksProvider linksProvider = (LinksProvider) model;
+        List<LinkAndLabel> links = linksProvider.getLinks();
+
+        addAdditionalLinks(this, links);
+    }
+
+    protected void addAdditionalLinks(MarkupContainer markupContainer, List<LinkAndLabel> links) {
+        if(links == null || links.isEmpty()) {
+            Components.permanentlyHide(markupContainer, ID_ADDITIONAL_LINKS);
+            return;
+        }
+        links = Lists.newArrayList(links); // copy, to serialize any lazy evaluation
+
+        additionalLinks = new AdditionalLinksPanel(ID_ADDITIONAL_LINKS, links);
+        markupContainer.addOrReplace(additionalLinks);
+    }
+
+    private void addUnderlyingViews(final String underlyingIdPrefix, final EntityModel model, final ComponentFactory factory) {
+        final List<ComponentFactory> componentFactories = findOtherComponentFactories(model, factory);
+
+        final int selected = honourViewHintElseDefault(componentFactories, model);
+
+        final EntityLinksSelectorPanel selectorPanel = this;
+
+        // create all, hide the one not selected
+        final Component[] underlyingViews = new Component[MAX_NUM_UNDERLYING_VIEWS];
+        int i = 0;
+        final EntityModel emptyModel = dummyOf(model);
+        for (ComponentFactory componentFactory : componentFactories) {
+            final String underlyingId = underlyingIdPrefix + "-" + i;
+
+            Component underlyingView = componentFactory.createComponent(underlyingId,i==selected? model: emptyModel);
+            underlyingViews[i++] = underlyingView;
+            selectorPanel.addOrReplace(underlyingView);
+        }
+
+        // hide any unused placeholders
+        while(i<MAX_NUM_UNDERLYING_VIEWS) {
+            String underlyingId = underlyingIdPrefix + "-" + i;
+            permanentlyHide(underlyingId);
+            i++;
+        }
+
+        // selector
+        if (componentFactories.size() <= 1) {
+            permanentlyHide(ID_VIEWS);
+        } else {
+            final Model<ComponentFactory> componentFactoryModel = new Model<>();
+
+            selectorPanel.selectedComponentFactory = componentFactories.get(selected);
+            componentFactoryModel.setObject(selectorPanel.selectedComponentFactory);
+
+            final WebMarkupContainer views = new WebMarkupContainer(ID_VIEWS);
+
+            final Label viewButtonTitle = new Label(ID_VIEW_BUTTON_TITLE, "Hidden");
+            views.addOrReplace(viewButtonTitle);
+
+            final Label viewButtonIcon = new Label(ID_VIEW_BUTTON_ICON, "");
+            views.addOrReplace(viewButtonIcon);
+
+            final WebMarkupContainer container = new WebMarkupContainer(ID_VIEW_LIST);
+
+            views.addOrReplace(container);
+            views.setOutputMarkupId(true);
+
+            this.setOutputMarkupId(true);
+
+            final ListView<ComponentFactory> listView = new ListView<ComponentFactory>(ID_VIEW_ITEM, componentFactories) {
+
+                private static final long serialVersionUID = 1L;
+
+                @Override
+                protected void populateItem(ListItem<ComponentFactory> item) {
+
+                    final int underlyingViewNum = item.getIndex();
+
+                    final ComponentFactory componentFactory = item.getModelObject();
+                    final AbstractLink link = new AjaxLink<Void>(ID_VIEW_LINK) {
+                        private static final long serialVersionUID = 1L;
+                        @Override
+                        public void onClick(AjaxRequestTarget target) {
+                            EntityLinksSelectorPanel linksSelectorPanel = EntityLinksSelectorPanel.this;
+                            linksSelectorPanel.setViewHintAndBroadcast(underlyingViewNum, target);
+
+                            final EntityModel dummyModel = dummyOf(model);
+                            for(int i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
+                                final Component component = underlyingViews[i];
+                                if(component == null) {
+                                    continue;
+                                }
+                                final boolean isSelected = i == underlyingViewNum;
+                                applyCssVisibility(component, isSelected);
+                                component.setDefaultModel(isSelected? model: dummyModel);
+                            }
+
+                            selectorPanel.selectedComponentFactory = componentFactory;
+                            selectorPanel.selectedComponent = underlyingViews[underlyingViewNum];
+                            selectorPanel.onSelect(target);
+                            target.add(selectorPanel, views);
+                        }
+
+                        @Override
+                        protected void onComponentTag(ComponentTag tag) {
+                            super.onComponentTag(tag);
+                            Buttons.fixDisabledState(this, tag);
+                        }
+                    };
+
+                    IModel<String> title = nameFor(componentFactory);
+                    Label viewItemTitleLabel = new Label(ID_VIEW_ITEM_TITLE, title);
+                    link.add(viewItemTitleLabel);
+
+                    Label viewItemIcon = new Label(ID_VIEW_ITEM_ICON, "");
+                    link.add(viewItemIcon);
+
+                    boolean isEnabled = componentFactory != selectorPanel.selectedComponentFactory;
+                    if (!isEnabled) {
+                        viewButtonTitle.setDefaultModel(title);
+                        IModel<String> cssClass = cssClassFor(componentFactory, viewButtonIcon);
+                        viewButtonIcon.add(AttributeModifier.replace("class", "ViewLinkItem " + cssClass.getObject()));
+                        link.setVisible(false);
+                    } else {
+                        IModel<String> cssClass = cssClassFor(componentFactory, viewItemIcon);
+                        viewItemIcon.add(new CssClassAppender(cssClass));
+                    }
+
+                    item.add(link);
+                }
+
+                private IModel<String> cssClassFor(final ComponentFactory componentFactory, Label viewIcon) {
+                    IModel<String> cssClass = null;
+                    if (componentFactory instanceof CollectionContentsAsFactory) {
+                        CollectionContentsAsFactory collectionContentsAsFactory = (CollectionContentsAsFactory) componentFactory;
+                        cssClass = collectionContentsAsFactory.getCssClass();
+                        viewIcon.setDefaultModelObject("");
+                        viewIcon.setEscapeModelStrings(true);
+                    }
+                    if (cssClass == null) {
+                        String name = componentFactory.getName();
+                        cssClass = Model.of(StringExtensions.asLowerDashed(name));
+                        // Small hack: if there is no specific CSS class then we assume that background-image is used
+                        // the span.ViewItemLink should have some content to show it
+                        // FIX: find a way to do this with CSS (width and height don't seems to help)
+                        viewIcon.setDefaultModelObject("&#160;&#160;&#160;&#160;&#160;");
+                        viewIcon.setEscapeModelStrings(false);
+                    }
+                    return cssClass;
+                }
+
+                private IModel<String> nameFor(final ComponentFactory componentFactory) {
+                    IModel<String> name = null;
+                    if (componentFactory instanceof CollectionContentsAsFactory) {
+                        CollectionContentsAsFactory collectionContentsAsFactory = (CollectionContentsAsFactory) componentFactory;
+                        name = collectionContentsAsFactory.getTitleLabel();
+                    }
+                    if (name == null) {
+                        name = Model.of(componentFactory.getName());
+                    }
+                    return name;
+                }
+            };
+            container.add(listView);
+            addOrReplace(views);
+        }
+
+        for(i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
+            Component component = underlyingViews[i];
+            if(component != null) {
+                if(i != selected) {
+                    component.add(new CssClassAppender(INVISIBLE_CLASS));
+                } else {
+                    selectedComponent = component;
+                }
+            }
+        }
+    }
+
+
+
+    protected void setViewHintAndBroadcast(int viewNum, AjaxRequestTarget target) {
+        final UiHintContainer uiHintContainer = getUiHintContainer();
+        if(uiHintContainer == null) {
+            return;
+        }
+        uiHintContainer.setHint(this, UIHINT_VIEW, ""+viewNum);
+        send(getPage(), Broadcast.EXACT, new IsisUiHintEvent(uiHintContainer, target));
+    }
+
+    /**
+     * Overrideable hook.
+     */
+    protected void onSelect(AjaxRequestTarget target) {
+    }
+
+    /**
+     * Ask for a dummy (empty) {@link Model} to pass into those components that are rendered but will be
+     * made invisible using CSS styling.
+     */
+    protected EntityModel dummyOf(EntityModel model) {
+        return model;
+    }
+
+    protected static void applyCssVisibility(final Component component, final boolean visible) {
+        if(component == null) {
+            return;
+        }
+        AttributeModifier modifier = visible ? new CssClassRemover(INVISIBLE_CLASS) : new CssClassAppender(INVISIBLE_CLASS);
+        component.add(modifier);
+    }
+
+    protected int honourViewHintElseDefault(final List<ComponentFactory> componentFactories, final IModel<?> model) {
+        // honour hints ...
+        final UiHintContainer hintContainer = getUiHintContainer();
+        if(hintContainer != null) {
+            String viewStr = hintContainer.getHint(this, UIHINT_VIEW);
+            if(viewStr != null) {
+                try {
+                    int view = Integer.parseInt(viewStr);
+                    if(view >= 0 && view < componentFactories.size()) {
+                        return view;
+                    }
+                } catch(NumberFormatException ex) {
+                    // ignore
+                }
+            }
+        }
+
+        // ... else default
+        int initialFactory = determineInitialFactory(componentFactories, model);
+        if(hintContainer != null) {
+            hintContainer.setHint(this, UIHINT_VIEW, ""+initialFactory);
+            // don't broadcast (no AjaxRequestTarget, still configuring initial setup)
+        }
+        return initialFactory;
+    }
+
+
+    private List<ComponentFactory> findOtherComponentFactories(final EntityModel model, final ComponentFactory ignoreFactory) {
+        final List<ComponentFactory> componentFactories = getComponentFactoryRegistry().findComponentFactories(componentType, model);
+        ArrayList<ComponentFactory> otherFactories = Lists.newArrayList(Collections2.filter(componentFactories, new Predicate<ComponentFactory>() {
+            @Override
+            public boolean apply(final ComponentFactory input) {
+                return input != ignoreFactory;
+            }
+        }));
+        return ordered(otherFactories);
+    }
+
+    protected List<ComponentFactory> ordered(List<ComponentFactory> otherFactories) {
+        return otherFactories;
+    }
+
+
+    @Override
+    public void renderHead(final IHeaderResponse response) {
+        super.renderHead(response);
+        PanelUtil.renderHead(response, LinksSelectorPanelAbstract.class);
+    }
+
+
+
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/b1677ca8/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.java
index e494ce8..2b6b96f 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.java
@@ -73,20 +73,20 @@ public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends Pa
     private static final String ID_VIEW_ITEM = "viewItem";
     private static final String ID_VIEW_ITEM_TITLE = "viewItemTitle";
     private static final String ID_VIEW_ITEM_ICON = "viewItemIcon";
-    
+
     private static final String UIHINT_VIEW = "view";
     private static final String ID_VIEW_BUTTON_TITLE = "viewButtonTitle";
     private static final String ID_VIEW_BUTTON_ICON = "viewButtonIcon";
 
     private final ComponentType componentType;
     private final String underlyingIdPrefix;
-    
+
     private ComponentFactory selectedComponentFactory;
     protected Component selectedComponent;
 
     /**
      * May be <tt>null</tt>, depending upon the model implementation.
-     * 
+     *
      * @see #addAdditionalLinks(IModel)
      */
     protected WebMarkupContainer additionalLinks;
@@ -97,7 +97,7 @@ public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends Pa
         this.underlyingIdPrefix = underlyingIdPrefix;
         this.componentType = factory.getComponentType();
     }
-    
+
     /**
      * Build UI only after added to parent.
      */
@@ -115,7 +115,7 @@ public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends Pa
         }
         LinksProvider linksProvider = (LinksProvider) model;
         List<LinkAndLabel> links = linksProvider.getLinks();
-        
+
         addAdditionalLinks(this, links);
     }
 
@@ -125,25 +125,25 @@ public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends Pa
             return;
         }
         links = Lists.newArrayList(links); // copy, to serialize any lazy evaluation
-        
+
         additionalLinks = new AdditionalLinksPanel(ID_ADDITIONAL_LINKS, links);
         markupContainer.addOrReplace(additionalLinks);
     }
-    
+
     private void addUnderlyingViews(final String underlyingIdPrefix, final T model, final ComponentFactory factory) {
         final List<ComponentFactory> componentFactories = findOtherComponentFactories(model, factory);
 
         final int selected = honourViewHintElseDefault(componentFactories, model);
 
         final LinksSelectorPanelAbstract<T> selectorPanel = LinksSelectorPanelAbstract.this;
-        
+
         // create all, hide the one not selected
         final Component[] underlyingViews = new Component[MAX_NUM_UNDERLYING_VIEWS];
         int i = 0;
         final T emptyModel = dummyOf(model);
         for (ComponentFactory componentFactory : componentFactories) {
             final String underlyingId = underlyingIdPrefix + "-" + i;
-            
+
             Component underlyingView = componentFactory.createComponent(underlyingId,i==selected? model: emptyModel);
             underlyingViews[i++] = underlyingView;
             selectorPanel.addOrReplace(underlyingView);
@@ -155,13 +155,13 @@ public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends Pa
             permanentlyHide(underlyingId);
             i++;
         }
-        
+
         // selector
         if (componentFactories.size() <= 1) {
             permanentlyHide(ID_VIEWS);
         } else {
             final Model<ComponentFactory> componentFactoryModel = new Model<>();
-            
+
             selectorPanel.selectedComponentFactory = componentFactories.get(selected);
             componentFactoryModel.setObject(selectorPanel.selectedComponentFactory);
 
@@ -174,21 +174,21 @@ public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends Pa
             views.addOrReplace(viewButtonIcon);
 
             final WebMarkupContainer container = new WebMarkupContainer(ID_VIEW_LIST);
-            
+
             views.addOrReplace(container);
             views.setOutputMarkupId(true);
-            
+
             this.setOutputMarkupId(true);
-            
+
             final ListView<ComponentFactory> listView = new ListView<ComponentFactory>(ID_VIEW_ITEM, componentFactories) {
 
                 private static final long serialVersionUID = 1L;
 
                 @Override
                 protected void populateItem(ListItem<ComponentFactory> item) {
-                    
+
                     final int underlyingViewNum = item.getIndex();
-                    
+
                     final ComponentFactory componentFactory = item.getModelObject();
                     final AbstractLink link = new AjaxLink<Void>(ID_VIEW_LINK) {
                         private static final long serialVersionUID = 1L;
@@ -196,7 +196,7 @@ public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends Pa
                         public void onClick(AjaxRequestTarget target) {
                             LinksSelectorPanelAbstract<T> linksSelectorPanel = LinksSelectorPanelAbstract.this;
                             linksSelectorPanel.setViewHintAndBroadcast(underlyingViewNum, target);
-                            
+
                             final T dummyModel = dummyOf(model);
                             for(int i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
                                 final Component component = underlyingViews[i];
@@ -207,7 +207,7 @@ public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends Pa
                                 applyCssVisibility(component, isSelected);
                                 component.setDefaultModel(isSelected? model: dummyModel);
                             }
-                            
+
                             selectorPanel.selectedComponentFactory = componentFactory;
                             selectorPanel.selectedComponent = underlyingViews[underlyingViewNum];
                             selectorPanel.onSelect(target);
@@ -277,7 +277,7 @@ public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends Pa
             container.add(listView);
             addOrReplace(views);
         }
-        
+
         for(i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
             Component component = underlyingViews[i];
             if(component != null) {
@@ -365,7 +365,7 @@ public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends Pa
         return otherFactories;
     }
 
-    
+
     @Override
     public void renderHead(final IHeaderResponse response) {
         super.renderHead(response);


[04/44] isis git commit: ISIS-939: deleted the UpdateNotifier subcomponent. Not used by any released code, and the same information (and better) is available in the IsisTransaction itself.

Posted by da...@apache.org.
ISIS-939: deleted the UpdateNotifier subcomponent.  Not used by any released code, and the same information (and better) is available in the IsisTransaction itself.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/30eb5146
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/30eb5146
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/30eb5146

Branch: refs/heads/master
Commit: 30eb514666c1968916a1e6f58d6b0de04a1efceb
Parents: fab4f47
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Nov 3 19:47:28 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Nov 6 16:18:56 2014 +0000

----------------------------------------------------------------------
 .../viewer/scimpi/dispatcher/Dispatcher.java    |   2 -
 .../scimpi/dispatcher/action/ActionAction.java  |   2 -
 .../scimpi/dispatcher/edit/EditAction.java      |   2 -
 .../scimpi/dispatcher/edit/RemoveAction.java    |   2 -
 .../scimpi/dispatcher/logon/LogoutAction.java   |   1 -
 .../internal/RuntimeContextFromSession.java     |   6 -
 .../runtime/system/context/IsisContext.java     |   9 -
 .../system/persistence/PersistenceSession.java  |  16 --
 .../system/session/IsisSessionDefault.java      |   9 -
 .../system/transaction/IsisTransaction.java     |  20 +--
 .../transaction/IsisTransactionManager.java     |  38 +----
 .../system/transaction/UpdateNotifier.java      |  79 ---------
 .../transaction/UpdateNotifierDefault.java      | 168 -------------------
 .../system/transaction/IsisTransactionTest.java |   4 +-
 .../rendering/ReprRendererAbstract.java         |  24 +--
 15 files changed, 24 insertions(+), 358 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/30eb5146/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
index 5f37318..82c67c1 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/Dispatcher.java
@@ -279,11 +279,9 @@ public class Dispatcher {
         try {
             request.processNextTag();
             noteIfMessagesHaveNotBeenDisplay(context);
-            IsisContext.getUpdateNotifier().clear();
         } catch (final RuntimeException e) {
             IsisContext.getMessageBroker().getMessages();
             IsisContext.getMessageBroker().getWarnings();
-            IsisContext.getUpdateNotifier().clear();
             throw e;
         }
         final String page = request.popBuffer();

http://git-wip-us.apache.org/repos/asf/isis/blob/30eb5146/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java
index f181cc9..c598ba3 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java
@@ -156,8 +156,6 @@ public class ActionAction implements Action {
         } catch (final RuntimeException e) {
             getMessageBroker().getMessages();
             getMessageBroker().getWarnings();
-            IsisContext.getUpdateNotifier().clear();
-            IsisContext.getUpdateNotifier().clear();
             throw e;
         }
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/30eb5146/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java
index d069ea3..3784472 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java
@@ -155,8 +155,6 @@ public class EditAction implements Action {
         } catch (final RuntimeException e) {
             IsisContext.getMessageBroker().getMessages();
             IsisContext.getMessageBroker().getWarnings();
-            IsisContext.getUpdateNotifier().clear();
-            IsisContext.getUpdateNotifier().clear();
             throw e;
         }
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/30eb5146/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java
index 1bd86a2..919ccc2 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/RemoveAction.java
@@ -100,8 +100,6 @@ public class RemoveAction implements Action {
         } catch (final RuntimeException e) {
             IsisContext.getMessageBroker().getMessages();
             IsisContext.getMessageBroker().getWarnings();
-            IsisContext.getUpdateNotifier().clear();
-            IsisContext.getUpdateNotifier().clear();
             throw e;
         }
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/30eb5146/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogoutAction.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogoutAction.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogoutAction.java
index 219b5b4..a6f4730 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogoutAction.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/logon/LogoutAction.java
@@ -35,7 +35,6 @@ public class LogoutAction implements Action {
         if (context.isUserAuthenticated()) {
             final AuthenticationSession session = context.getSession();
             if (session != null) {
-                IsisContext.getUpdateNotifier().clear();
                 UserManager.logoffUser(session);
             }
             context.endHttpSession();

http://git-wip-us.apache.org/repos/asf/isis/blob/30eb5146/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java
index d5b6d57..782e18b 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java
@@ -51,7 +51,6 @@ import org.apache.isis.core.runtime.system.session.IsisSession;
 import org.apache.isis.core.runtime.system.transaction.IsisTransaction;
 import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
 import org.apache.isis.core.runtime.system.transaction.MessageBroker;
-import org.apache.isis.core.runtime.system.transaction.UpdateNotifier;
 
 /**
  * Provides services to the metamodel based on the currently running
@@ -167,7 +166,6 @@ public class RuntimeContextFromSession extends RuntimeContextAbstract {
 
             @Override
             public void remove(final ObjectAdapter adapter) {
-                getUpdateNotifier().addDisposedObject(adapter);
                 getPersistenceSession().destroyObject(adapter);
             }
         };
@@ -399,10 +397,6 @@ public class RuntimeContextFromSession extends RuntimeContextAbstract {
         return getPersistenceSession().getAdapterManager();
     }
 
-    private static UpdateNotifier getUpdateNotifier() {
-        return IsisContext.getUpdateNotifier();
-    }
-
     private static IsisTransactionManager getTransactionManager() {
         return getPersistenceSession().getTransactionManager();
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/30eb5146/core/runtime/src/main/java/org/apache/isis/core/runtime/system/context/IsisContext.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/context/IsisContext.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/context/IsisContext.java
index 2b139a4..f145f89 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/context/IsisContext.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/context/IsisContext.java
@@ -42,7 +42,6 @@ import org.apache.isis.core.runtime.system.session.IsisSessionFactory;
 import org.apache.isis.core.runtime.system.transaction.IsisTransaction;
 import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
 import org.apache.isis.core.runtime.system.transaction.MessageBroker;
-import org.apache.isis.core.runtime.system.transaction.UpdateNotifier;
 
 /**
  * Provides singleton <i>access to</i> the current (session scoped)
@@ -468,14 +467,6 @@ public abstract class IsisContext implements DebuggableWithTitle {
         return (MessageBroker) getCurrentTransaction().getMessageBroker();
     }
 
-    /**
-     * Convenience method, returning the {@link UpdateNotifier} of the
-     * {@link #getCurrentTransaction() current transaction}.
-     */
-    public static UpdateNotifier getUpdateNotifier() {
-        return getCurrentTransaction().getUpdateNotifier();
-    }
-
     // ///////////////////////////////////////////////////////////
     // Debug
     // ///////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/isis/blob/30eb5146/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
index 294ef30..59887c0 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
@@ -788,7 +788,6 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
     public void objectChanged(final ObjectAdapter adapter) {
 
         if (adapter.isTransient() || (adapter.isParented() && adapter.getAggregateRoot().isTransient())) {
-            addObjectChangedForPresentationLayer(adapter);
             return;
         }
 
@@ -805,19 +804,9 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
             }
 
             addObjectChangedForPersistenceLayer(adapter);
-            addObjectChangedForPresentationLayer(adapter);
-        }
-        if (adapter.respondToChangesInPersistentObjects() || adapter.isTransient()) {
-            addObjectChangedForPresentationLayer(adapter);
         }
     }
 
-    private void addObjectChangedForPresentationLayer(final ObjectAdapter adapter) {
-        if(LOG.isDebugEnabled()) {
-            LOG.debug("object change to update presentation layer " + adapter.getOid());
-        }
-        getUpdateNotifier().addChangedObject(adapter);
-    }
 
     private void addObjectChangedForPersistenceLayer(final ObjectAdapter adapter) {
         if(LOG.isDebugEnabled()) {
@@ -847,7 +836,6 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
                 // should we do something here?
             }
         });
-        getUpdateNotifier().addChangedObject(adapter);
     }
 
     // ///////////////////////////////////////////////////////////////////////////
@@ -1078,10 +1066,6 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
     }
 
 
-    private UpdateNotifier getUpdateNotifier() {
-        return getTransactionManager().getTransaction().getUpdateNotifier();
-    }
-
     /**
      * The configured {@link ObjectAdapterFactory}.
      * 

http://git-wip-us.apache.org/repos/asf/isis/blob/30eb5146/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionDefault.java
index aaa6583..0f20891 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionDefault.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionDefault.java
@@ -309,7 +309,6 @@ public class IsisSessionDefault implements IsisSession {
 
         debug(debug, getPersistenceSession());
         if (getCurrentTransaction() != null) {
-            debug(debug, getCurrentTransaction().getUpdateNotifier());
             debug(debug, getCurrentTransaction().getMessageBroker());
         }
         debugSnapshot = debug.toString();
@@ -332,10 +331,6 @@ public class IsisSessionDefault implements IsisSession {
         asString.append("authenticationSession", getAuthenticationSession());
         asString.append("persistenceSession", getPersistenceSession());
         asString.append("transaction", getCurrentTransaction());
-        if (getCurrentTransaction() != null) {
-            asString.append("messageBroker", getCurrentTransaction().getMessageBroker());
-            asString.append("updateNotifier", getCurrentTransaction().getUpdateNotifier());
-        }
     }
 
     @Override
@@ -343,10 +338,6 @@ public class IsisSessionDefault implements IsisSession {
         debug.appendln("authenticationSession", getAuthenticationSession());
         debug.appendln("persistenceSession", getPersistenceSession());
         debug.appendln("transaction", getCurrentTransaction());
-        if (getCurrentTransaction() != null) {
-            debug.appendln("messageBroker", getCurrentTransaction().getMessageBroker());
-            debug.appendln("updateNotifier", getCurrentTransaction().getUpdateNotifier());
-        }
     }
 
     // /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/isis/blob/30eb5146/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
index f98c804..259269c 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
@@ -204,7 +204,6 @@ public class IsisTransaction implements TransactionScopedComponent {
     private final List<PersistenceCommand> commands = Lists.newArrayList();
     private final IsisTransactionManager transactionManager;
     private final org.apache.isis.core.commons.authentication.MessageBroker messageBroker;
-    private final UpdateNotifier updateNotifier;
 
     private final ServicesInjector servicesInjector;
 
@@ -238,20 +237,17 @@ public class IsisTransaction implements TransactionScopedComponent {
 
 
     public IsisTransaction(
-            final IsisTransactionManager transactionManager, 
-            final org.apache.isis.core.commons.authentication.MessageBroker messageBroker, 
-            final UpdateNotifier updateNotifier, 
-            final TransactionalResource objectStore, 
+            final IsisTransactionManager transactionManager,
+            final org.apache.isis.core.commons.authentication.MessageBroker messageBroker,
+            final TransactionalResource objectStore,
             final ServicesInjector servicesInjector) {
         
         ensureThatArg(transactionManager, is(not(nullValue())), "transaction manager is required");
         ensureThatArg(messageBroker, is(not(nullValue())), "message broker is required");
-        ensureThatArg(updateNotifier, is(not(nullValue())), "update notifier is required");
         ensureThatArg(servicesInjector, is(not(nullValue())), "services injector is required");
 
         this.transactionManager = transactionManager;
         this.messageBroker = messageBroker;
-        this.updateNotifier = updateNotifier;
         this.servicesInjector = servicesInjector;
         
         this.commandContext = servicesInjector.lookupService(CommandContext.class);
@@ -1047,16 +1043,6 @@ public class IsisTransaction implements TransactionScopedComponent {
         return (MessageBroker) messageBroker;
     }
 
-    /**
-     * The {@link UpdateNotifier} for this transaction.
-     * 
-     * <p>
-     * Injected in constructor
-     */
-    public UpdateNotifier getUpdateNotifier() {
-        return updateNotifier;
-    }
-
     public static class AdapterAndProperty {
         
         private final ObjectAdapter objectAdapter;

http://git-wip-us.apache.org/repos/asf/isis/blob/30eb5146/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
index e39337c..8c0e523 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
@@ -117,13 +117,6 @@ public class IsisTransactionManager implements SessionScopedComponent {
 
 
     
-    /**
-     * Convenience method returning the {@link UpdateNotifier} of the
-     * {@link #getTransaction() current transaction}.
-     */
-    protected UpdateNotifier getUpdateNotifier() {
-        return getTransaction().getUpdateNotifier();
-    }
 
     /**
      * Convenience method returning the {@link MessageBroker} of the
@@ -227,28 +220,23 @@ public class IsisTransactionManager implements SessionScopedComponent {
      */
     protected final IsisTransaction createTransaction() {
         org.apache.isis.core.commons.authentication.MessageBroker messageBroker = createMessageBroker();
-        UpdateNotifier updateNotifier = createUpdateNotifier();
-        return this.transaction = createTransaction(messageBroker, updateNotifier, transactionalResource);
+        return this.transaction = createTransaction(messageBroker, transactionalResource);
     }
 
 
     /**
-     * The provided {@link MessageBroker} and {@link UpdateNotifier} are
-     * obtained from the hook methods ( {@link #createMessageBroker()} and
-     * {@link #createUpdateNotifier()}).
-     * @param transactionalResource 
-     * 
+     * The provided {@link MessageBroker} is
+     * obtained from the {@link #createMessageBroker()} hook method.
+     * @param transactionalResource
+     *
      * @see #createMessageBroker()
-     * @see #createUpdateNotifier()
      */
     private IsisTransaction createTransaction(
-            final org.apache.isis.core.commons.authentication.MessageBroker messageBroker, 
-            final UpdateNotifier updateNotifier, 
+            final org.apache.isis.core.commons.authentication.MessageBroker messageBroker,
             final TransactionalResource transactionalResource) {
         ensureThatArg(messageBroker, is(not(nullValue())));
-        ensureThatArg(updateNotifier, is(not(nullValue())));
 
-        return new IsisTransaction(this, messageBroker, updateNotifier, transactionalResource, servicesInjector);
+        return new IsisTransaction(this, messageBroker, transactionalResource, servicesInjector);
     }
     
 
@@ -541,7 +529,7 @@ public class IsisTransactionManager implements SessionScopedComponent {
 
     /**
      * Overridable hook, used in
-     * {@link #createTransaction(org.apache.isis.core.commons.authentication.MessageBroker, UpdateNotifier, org.apache.isis.core.runtime.persistence.objectstore.transaction.TransactionalResource)}
+     * {@link #createTransaction(org.apache.isis.core.commons.authentication.MessageBroker, org.apache.isis.core.runtime.persistence.objectstore.transaction.TransactionalResource)}
      * 
      * <p> Called when a new {@link IsisTransaction} is created.
      */
@@ -549,16 +537,6 @@ public class IsisTransactionManager implements SessionScopedComponent {
         return MessageBrokerDefault.acquire(getAuthenticationSession());
     }
 
-    /**
-     * Overridable hook, used in
-     * {@link #createTransaction(org.apache.isis.core.commons.authentication.MessageBroker, UpdateNotifier, org.apache.isis.core.runtime.persistence.objectstore.transaction.TransactionalResource)}
-     * 
-     * <p> Called when a new {@link IsisTransaction} is created.
-     */
-    protected UpdateNotifier createUpdateNotifier() {
-        return new UpdateNotifierDefault();
-    }
-
     // ////////////////////////////////////////////////////////////////
     // helpers
     // ////////////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/isis/blob/30eb5146/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/UpdateNotifier.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/UpdateNotifier.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/UpdateNotifier.java
deleted file mode 100644
index 589e54e..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/UpdateNotifier.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.system.transaction;
-
-import java.util.List;
-
-import org.apache.isis.core.commons.components.TransactionScopedComponent;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-
-/**
- * UpdateNotifier provides updates to client making available lists of the
- * latest changed and disposed objects.
- */
-public interface UpdateNotifier extends TransactionScopedComponent {
-
-    // //////////////////////////////////////////////////
-    // Changed Objects
-    // //////////////////////////////////////////////////
-
-    /**
-     * Used by the framework to add objects that have just changed.
-     */
-    void addChangedObject(ObjectAdapter object);
-
-    /**
-     * Returns an immutable {@link List} of changed objects.
-     * 
-     * <p>
-     * Each changed object that was added is only ever provided during one call
-     * to this method so the list must be processed fully to avoid missing
-     * updates.
-     */
-    List<ObjectAdapter> getChangedObjects();
-
-    // //////////////////////////////////////////////////
-    // Disposed Objects
-    // //////////////////////////////////////////////////
-
-    /**
-     * Used by the framework to add objects that have just been disposed of.
-     */
-    void addDisposedObject(ObjectAdapter adapter);
-
-    /**
-     * Returns an immutable {@link List} of disposed objects.
-     * 
-     * <p>
-     * Each object that was disposed of is only ever provided during one call to
-     * this method so the list must be processed fully to avoid missing
-     * deletions.
-     */
-    public List<ObjectAdapter> getDisposedObjects();
-
-    // //////////////////////////////////////////////////
-    // Empty, Clear
-    // //////////////////////////////////////////////////
-
-    void ensureEmpty();
-
-    void clear();
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/30eb5146/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/UpdateNotifierDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/UpdateNotifierDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/UpdateNotifierDefault.java
deleted file mode 100644
index 9e92e0f..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/UpdateNotifierDefault.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.system.transaction;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.debug.DebuggableWithTitle;
-import org.apache.isis.core.commons.exceptions.IsisException;
-import org.apache.isis.core.commons.util.ToString;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-
-public class UpdateNotifierDefault implements UpdateNotifier, DebuggableWithTitle {
-
-    private static final Logger LOG = LoggerFactory.getLogger(UpdateNotifierDefault.class);
-    
-    private final List<ObjectAdapter> changes = new ArrayList<ObjectAdapter>();
-    private final List<ObjectAdapter> disposals = new ArrayList<ObjectAdapter>();
-
-    // //////////////////////////////////////////////////
-    // Constructor
-    // //////////////////////////////////////////////////
-
-    public UpdateNotifierDefault() {
-        // does nothing
-    }
-
-    // //////////////////////////////////////////////////
-    // Changed Objects
-    // //////////////////////////////////////////////////
-
-    @Override
-    public synchronized void addChangedObject(final ObjectAdapter adapter) {
-        if (!adapter.isResolved() && !adapter.isTransient()) {
-            return;
-        }
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("mark as changed " + adapter);
-        }
-        if (!changes.contains(adapter)) {
-            changes.add(adapter);
-        }
-    }
-
-    @Override
-    public List<ObjectAdapter> getChangedObjects() {
-        if (changes.size() > 0) {
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("dirty (changed) objects " + changes);
-            }
-        }
-        final List<ObjectAdapter> changedObjects = new ArrayList<ObjectAdapter>();
-        changedObjects.addAll(changes);
-
-        changes.clear();
-
-        return Collections.unmodifiableList(changedObjects);
-    }
-
-    // //////////////////////////////////////////////////
-    // Disposed Objects
-    // //////////////////////////////////////////////////
-
-    @Override
-    public void addDisposedObject(final ObjectAdapter adapter) {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("mark as disposed " + adapter);
-        }
-        if (!disposals.contains(adapter)) {
-            disposals.add(adapter);
-        }
-    }
-
-    @Override
-    public List<ObjectAdapter> getDisposedObjects() {
-        if (disposals.size() > 0) {
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("dirty (disposed) objects " + disposals);
-            }
-        }
-        final List<ObjectAdapter> disposedObjects = new ArrayList<ObjectAdapter>();
-        disposedObjects.addAll(disposals);
-
-        disposals.clear();
-
-        return Collections.unmodifiableList(disposedObjects);
-    }
-
-    // //////////////////////////////////////////////////
-    // Empty, Clear
-    // //////////////////////////////////////////////////
-
-    @Override
-    public void ensureEmpty() {
-        if (changes.size() > 0) {
-            throw new IsisException("Update notifier still has updates");
-        }
-    }
-
-    @Override
-    public void clear() {
-        changes.clear();
-        disposals.clear();
-    }
-
-    // //////////////////////////////////////////////////
-    // Debugging
-    // //////////////////////////////////////////////////
-
-    @Override
-    public void debugData(final DebugBuilder debug) {
-        debug.appendln("Changes");
-        debugList(debug, changes);
-
-        debug.appendln("Disposals");
-        debugList(debug, disposals);
-    }
-
-    @Override
-    public String debugTitle() {
-        return "Simple Update Notifier";
-    }
-
-    private void debugList(final DebugBuilder debug, final List<ObjectAdapter> list) {
-        debug.indent();
-        if (list.size() == 0) {
-            debug.appendln("none");
-        } else {
-            for (final ObjectAdapter adapter : list) {
-                debug.appendln(adapter.toString());
-            }
-        }
-        debug.unindent();
-    }
-
-    // //////////////////////////////////////////////////
-    // toString
-    // //////////////////////////////////////////////////
-
-    @Override
-    public String toString() {
-        return new ToString(this).append("changes", changes).toString();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/30eb5146/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java
index 2a66a8f..9f4c2c8 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java
@@ -70,8 +70,6 @@ public class IsisTransactionTest {
     @Mock
     private MessageBroker mockMessageBroker;
     @Mock
-    private UpdateNotifier mockUpdateNotifier;
-    @Mock
     private CommandContext mockCommandContext;
     @Mock
     private CommandService mockCommandService;
@@ -225,7 +223,7 @@ public class IsisTransactionTest {
             will(returnValue("sven"));
         }});
         
-        transaction = new IsisTransaction(mockTransactionManager, mockMessageBroker, mockUpdateNotifier, mockObjectStore, mockServicesInjector);
+        transaction = new IsisTransaction(mockTransactionManager, mockMessageBroker, mockObjectStore, mockServicesInjector);
         
         transientAdapter1 = PojoAdapterBuilder.create().with(Persistence.TRANSIENT).withIdentifier("1").build();
         transientAdapter2 = PojoAdapterBuilder.create().with(Persistence.TRANSIENT).withIdentifier("2").build();

http://git-wip-us.apache.org/repos/asf/isis/blob/30eb5146/core/viewer-restfulobjects-rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRendererAbstract.java
----------------------------------------------------------------------
diff --git a/core/viewer-restfulobjects-rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRendererAbstract.java b/core/viewer-restfulobjects-rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRendererAbstract.java
index 155eb96..8fe4620 100644
--- a/core/viewer-restfulobjects-rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRendererAbstract.java
+++ b/core/viewer-restfulobjects-rendering/src/main/java/org/apache/isis/viewer/restfulobjects/rendering/ReprRendererAbstract.java
@@ -20,21 +20,18 @@ package org.apache.isis.viewer.restfulobjects.rendering;
 
 import java.util.List;
 import java.util.Map;
-
 import javax.ws.rs.core.MediaType;
-
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.transaction.UpdateNotifier;
 import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
 import org.apache.isis.viewer.restfulobjects.applib.Rel;
 import org.apache.isis.viewer.restfulobjects.applib.RepresentationType;
 import org.apache.isis.viewer.restfulobjects.rendering.domainobjects.DomainObjectReprRenderer;
 import org.apache.isis.viewer.restfulobjects.rendering.domaintypes.DomainTypeReprRenderer;
 
-import com.google.common.collect.Maps;
-
 public abstract class ReprRendererAbstract<R extends ReprRendererAbstract<R, T>, T> implements ReprRenderer<R, T> {
 
     protected final RendererContext rendererContext;
@@ -163,13 +160,20 @@ public abstract class ReprRendererAbstract<R extends ReprRendererAbstract<R, T>,
      * mutate state.
      */
     protected final void addExtensionsIsisProprietaryChangedObjects() {
-        final UpdateNotifier updateNotifier = getUpdateNotifier();
 
-        addToExtensions("changed", updateNotifier.getChangedObjects());
-        addToExtensions("disposed", updateNotifier.getDisposedObjects());
+        // TODO: have removed UpdateNotifier, plan is to re-introduce using the IsisTransaction enlisted objects
+        // (which would also allow newly-created objects to be shown)
+        final List<ObjectAdapter> changedObjects = Lists.newArrayList(); // updateNotifier.getChangedObjects();
+        final List<ObjectAdapter> disposedObjects = Lists.newArrayList(); // updateNotifier.getDisposedObjects();
+
+        addToExtensions("changed", changedObjects);
+        addToExtensions("disposed", disposedObjects);
     }
 
     private void addToExtensions(final String key, final List<ObjectAdapter> adapters) {
+        if(adapters == null || adapters.isEmpty()) {
+            return;
+        }
         final JsonRepresentation adapterList = JsonRepresentation.newArray();
         getExtensions().mapPut(key, adapterList);
         for (final ObjectAdapter adapter : adapters) {
@@ -181,8 +185,4 @@ public abstract class ReprRendererAbstract<R extends ReprRendererAbstract<R, T>,
         return IsisContext.getPersistenceSession().getServices();
     }
 
-    protected UpdateNotifier getUpdateNotifier() {
-        return IsisContext.getCurrentTransaction().getUpdateNotifier();
-    }
-
 }


[29/44] isis git commit: ISIS-537: selector drop-down now moved to EntityCollectionsPanel (ie into the panel header).

Posted by da...@apache.org.
ISIS-537: selector drop-down now moved to EntityCollectionsPanel (ie into the panel header).


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/2909e644
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/2909e644
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/2909e644

Branch: refs/heads/master
Commit: 2909e644d354ed50d552aa1227fc3d7cb693cb86
Parents: f00d01f
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Nov 10 07:37:03 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 10:21:46 2014 +0000

----------------------------------------------------------------------
 .../components/collection/CollectionPanel.java  | 17 ++++-
 .../dropdown/HasSelectorDropdownPanel.java      | 23 +++++++
 .../CollectionContentsLinksSelectorPanel.html   |  1 -
 .../CollectionContentsLinksSelectorPanel.java   | 66 +++++++++++++-------
 .../collections/EntityCollectionsPanel.html     |  3 +
 .../collections/EntityCollectionsPanel.java     | 38 ++++++++++-
 6 files changed, 123 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/2909e644/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/CollectionPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/CollectionPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/CollectionPanel.java
index ec68145..0b10d9c 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/CollectionPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/CollectionPanel.java
@@ -38,6 +38,8 @@ import org.apache.isis.viewer.wicket.model.models.EntityModel;
 import org.apache.isis.viewer.wicket.ui.ComponentType;
 import org.apache.isis.viewer.wicket.ui.components.actionprompt.ActionPromptModalWindow;
 import org.apache.isis.viewer.wicket.ui.components.additionallinks.EntityActionUtil;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.CollectionContentsSelectorDropdownPanel;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.HasSelectorDropdownPanel;
 import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelAbstract;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
 
@@ -45,7 +47,7 @@ import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
  * Panel for rendering entity collection; analogous to (any concrete subclass
  * of) {@link ScalarPanelAbstract}.
  */
-public class CollectionPanel extends PanelAbstract<EntityCollectionModel> implements ActionPromptProvider {
+public class CollectionPanel extends PanelAbstract<EntityCollectionModel> implements ActionPromptProvider, HasSelectorDropdownPanel {
 
 
     private static final long serialVersionUID = 1L;
@@ -148,4 +150,17 @@ public class CollectionPanel extends PanelAbstract<EntityCollectionModel> implem
     }
 
 
+    //region > SelectorDropdownPanel (impl)
+
+    private CollectionContentsSelectorDropdownPanel selectorDropdownPanel;
+
+    @Override
+    public CollectionContentsSelectorDropdownPanel getSelectorDropdownPanel() {
+        return selectorDropdownPanel;
+    }
+    public void setSelectorDropdownPanel(CollectionContentsSelectorDropdownPanel selectorDropdownPanel) {
+        this.selectorDropdownPanel = selectorDropdownPanel;
+    }
+    //endregion
+
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/2909e644/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/HasSelectorDropdownPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/HasSelectorDropdownPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/HasSelectorDropdownPanel.java
new file mode 100644
index 0000000..9011edf
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/HasSelectorDropdownPanel.java
@@ -0,0 +1,23 @@
+/*
+ *  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.collectioncontents.selector.dropdown;
+
+public interface HasSelectorDropdownPanel {
+    CollectionContentsSelectorDropdownPanel getSelectorDropdownPanel();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/2909e644/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
index 853a400..0a6d242 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
@@ -22,7 +22,6 @@
 <body>
 <wicket:panel>
     <div class="linksSelectorPanel">
-        <span wicket:id="selectorDropdown"/>
 
         <div class="views">
             <div wicket:id="collectionContents-0" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>

http://git-wip-us.apache.org/repos/asf/isis/blob/2909e644/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
index 627adb5..42616ff 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
@@ -25,7 +25,6 @@ import org.apache.wicket.Component;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.event.IEvent;
 import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.model.Model;
 import org.apache.isis.viewer.wicket.model.hints.IsisEnvelopeEvent;
 import org.apache.isis.viewer.wicket.model.hints.IsisUiHintEvent;
 import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
@@ -36,6 +35,7 @@ import org.apache.isis.viewer.wicket.ui.ComponentType;
 import org.apache.isis.viewer.wicket.ui.components.collection.CollectionCountProvider;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.CollectionContentsSelectorDropdownPanel;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.CollectionContentsSelectorHelper;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.HasSelectorDropdownPanel;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
 import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
 import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
@@ -54,7 +54,7 @@ public class CollectionContentsLinksSelectorPanel
     private static final String INVISIBLE_CLASS = "link-selector-panel-invisible";
     private static final int MAX_NUM_UNDERLYING_VIEWS = 10;
 
-    private static final String ID_SELECTOR_DROPDOWN = "selectorDropdown";
+//    private static final String ID_SELECTOR_DROPDOWN = "selectorDropdown";
 
     private static final String UIHINT_VIEW = "view";
 
@@ -65,10 +65,9 @@ public class CollectionContentsLinksSelectorPanel
     private final CollectionContentsSelectorHelper selectorHelper;
 
     private ComponentFactory selectedComponentFactory;
-    protected Component selectedComponent;
+    private Component selectedComponent;
 
     private Component[] underlyingViews;
-    private List<ComponentFactory> componentFactories;
     private CollectionContentsSelectorDropdownPanel selectorDropdownPanel;
 
     public CollectionContentsLinksSelectorPanel(
@@ -81,7 +80,6 @@ public class CollectionContentsLinksSelectorPanel
         this.componentType = ignoreFactory.getComponentType();
         selectorHelper = new CollectionContentsSelectorHelper(model, getComponentFactoryRegistry(), ignoreFactory);
 
-        componentFactories = selectorHelper.findOtherComponentFactories();
     }
 
     /**
@@ -96,7 +94,8 @@ public class CollectionContentsLinksSelectorPanel
     private void addUnderlyingViews() {
         final EntityCollectionModel model = getModel();
 
-        final int selected = selectorHelper.honourViewHintElseDefault(selectorDropdownPanel);
+        final int selected = selectorHelper.honourViewHintElseDefault(getSelectorDropdownPanel());
+        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
 
         // create all, hide the one not selected
         underlyingViews = new Component[MAX_NUM_UNDERLYING_VIEWS];
@@ -118,19 +117,20 @@ public class CollectionContentsLinksSelectorPanel
         }
 
         // selector
-        if (componentFactories.size() <= 1) {
-            permanentlyHide(ID_SELECTOR_DROPDOWN);
-        } else {
-            final Model<ComponentFactory> componentFactoryModel = new Model<>();
-
-            this.selectedComponentFactory = componentFactories.get(selected);
-            componentFactoryModel.setObject(this.selectedComponentFactory);
-
-            selectorDropdownPanel = new CollectionContentsSelectorDropdownPanel(ID_SELECTOR_DROPDOWN, getModel(), ignoreFactory);
-
-            this.setOutputMarkupId(true);
-            addOrReplace(selectorDropdownPanel);
-        }
+//        if (componentFactories.size() <= 1) {
+//            permanentlyHide(ID_SELECTOR_DROPDOWN);
+//        } else {
+//            final Model<ComponentFactory> componentFactoryModel = new Model<>();
+//
+//            this.selectedComponentFactory = componentFactories.get(selected);
+//            componentFactoryModel.setObject(this.selectedComponentFactory);
+//
+//            selectorDropdownPanel = new CollectionContentsSelectorDropdownPanel(ID_SELECTOR_DROPDOWN, getModel(), ignoreFactory);
+//
+//            addOrReplace(selectorDropdownPanel);
+//        }
+
+        this.setOutputMarkupId(true);
 
         for(i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
             Component component = underlyingViews[i];
@@ -155,7 +155,10 @@ public class CollectionContentsLinksSelectorPanel
         final UiHintContainer uiHintContainer = uiHintEvent.getUiHintContainer();
 
         int underlyingViewNum = 0;
-        String viewStr = uiHintContainer.getHint(this.selectorDropdownPanel, UIHINT_VIEW);
+        String viewStr = uiHintContainer.getHint(this.getSelectorDropdownPanel(), UIHINT_VIEW);
+
+        List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
+
         if(viewStr != null) {
             try {
                 int view = Integer.parseInt(viewStr);
@@ -184,7 +187,7 @@ public class CollectionContentsLinksSelectorPanel
 
         final AjaxRequestTarget target = uiHintEvent.getTarget();
         if(target != null) {
-            target.add(this, selectorDropdownPanel);
+            target.add(this, getSelectorDropdownPanel());
         }
 
     }
@@ -216,4 +219,25 @@ public class CollectionContentsLinksSelectorPanel
         }
     }
 
+    /**
+     * Searches up the component hierarchy looking for a parent that implements
+     * {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.HasSelectorDropdownPanel}.
+     * @return
+     */
+    private CollectionContentsSelectorDropdownPanel getSelectorDropdownPanel() {
+        Component component = this;
+        while(component != null) {
+            if(component instanceof HasSelectorDropdownPanel) {
+                final CollectionContentsSelectorDropdownPanel selectorDropdownPanel1 = ((HasSelectorDropdownPanel) component).getSelectorDropdownPanel();
+                if(selectorDropdownPanel1 == null) {
+                    throw new IllegalStateException("Found parent that implements HasSelectorDropdownPanel, but no SelectorDropdownPanel available (is null)");
+
+                }
+                return selectorDropdownPanel1;
+            }
+            component = component.getParent();
+        }
+        throw new IllegalStateException("Could not locate parent that implements HasSelectorDropdownPanel");
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/2909e644/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
index 216d9c9..106afa7 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
@@ -39,6 +39,9 @@
                                 <div class="btn-group">
                                     <div wicket:id="additionalLinks"></div>
                                 </div>
+                                <div class="btn-group">
+                                    <span wicket:id="selectorDropdown"/>
+                                </div>
 
                                 <!--
                                 <div class="btn-group">

http://git-wip-us.apache.org/repos/asf/isis/blob/2909e644/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
index 55ad54b..1a8649c 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
@@ -20,9 +20,11 @@
 package org.apache.isis.viewer.wicket.ui.components.entity.collections;
 
 import java.util.List;
+import org.apache.wicket.Component;
 import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.repeater.RepeatingView;
+import org.apache.wicket.model.Model;
 import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.applib.filter.Filter;
 import org.apache.isis.applib.filter.Filters;
@@ -35,8 +37,12 @@ import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
 import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
 import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
 import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
 import org.apache.isis.viewer.wicket.ui.components.additionallinks.AdditionalLinksPanel;
 import org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.CollectionContentsSelectorDropdownPanel;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.CollectionContentsSelectorHelper;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.links.CollectionContentsLinksSelectorPanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.widgets.containers.UiHintPathSignificantWebMarkupContainer;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
 import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
@@ -57,11 +63,15 @@ public class EntityCollectionsPanel extends PanelAbstract<EntityModel> {
 
     private static final String ID_ADDITIONAL_LINKS = "additionalLinks";
 
-    private Label labelComponent;
+    private static final String ID_SELECTOR_DROPDOWN = "selectorDropdown";
 
 
+    private ComponentFactory selectedComponentFactory;
+    private Component selectedComponent;
+
     public EntityCollectionsPanel(final String id, final EntityModel entityModel) {
         super(id, entityModel);
+
         buildGui();
     }
 
@@ -114,13 +124,37 @@ public class EntityCollectionsPanel extends PanelAbstract<EntityModel> {
         final CollectionPanel collectionPanel = new CollectionPanel(ID_COLLECTION, entityModel, otma);
         fieldset.addOrReplace(collectionPanel);
 
-        labelComponent = collectionPanel.createLabel(ID_COLLECTION_NAME, association.getName());
+        Label labelComponent = collectionPanel.createLabel(ID_COLLECTION_NAME, association.getName());
+
         fieldset.add(labelComponent);
 
         final EntityCollectionModel entityCollectionModel = collectionPanel.getModel();
         List<LinkAndLabel> links = entityCollectionModel.getLinks();
         AdditionalLinksPanel additionalLinks = new AdditionalLinksPanel(ID_ADDITIONAL_LINKS, links);
         fieldset.addOrReplace(additionalLinks);
+
+        CollectionContentsSelectorHelper selectorHelper = new CollectionContentsSelectorHelper(entityCollectionModel, getComponentFactoryRegistry(), new CollectionContentsLinksSelectorPanelFactory());
+
+        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
+
+        if (componentFactories.size() <= 1) {
+            permanentlyHide(ID_SELECTOR_DROPDOWN);
+        } else {
+            CollectionContentsSelectorDropdownPanel selectorDropdownPanel;
+            selectorDropdownPanel = new CollectionContentsSelectorDropdownPanel(ID_SELECTOR_DROPDOWN, entityCollectionModel, new CollectionContentsLinksSelectorPanelFactory());
+
+            final Model<ComponentFactory> componentFactoryModel = new Model<>();
+
+            final int selected = selectorHelper.honourViewHintElseDefault(selectorDropdownPanel);
+            this.selectedComponentFactory = componentFactories.get(selected);
+            componentFactoryModel.setObject(this.selectedComponentFactory);
+
+            this.setOutputMarkupId(true);
+            fieldset.addOrReplace(selectorDropdownPanel);
+
+            collectionPanel.setSelectorDropdownPanel(selectorDropdownPanel);
+        }
+
     }
 
     private List<ObjectAssociation> visibleCollections(final ObjectAdapter adapter, final ObjectSpecification noSpec) {


[30/44] isis git commit: ISIS-943: Make ObjectContracts more resilient

Posted by da...@apache.org.
ISIS-943: Make ObjectContracts more resilient


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/b1a0f1de
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/b1a0f1de
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/b1a0f1de

Branch: refs/heads/master
Commit: b1a0f1de8685661366154b156d50466363804ee8
Parents: 2909e64
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Fri Nov 7 17:12:07 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 10:21:47 2014 +0000

----------------------------------------------------------------------
 .../isis/applib/util/ObjectContracts.java       | 11 ++-
 .../applib/util/ObjectContractsTest_equals.java | 91 ++++++++++++++++++++
 2 files changed, 100 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/b1a0f1de/core/applib/src/main/java/org/apache/isis/applib/util/ObjectContracts.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/util/ObjectContracts.java b/core/applib/src/main/java/org/apache/isis/applib/util/ObjectContracts.java
index 3e88c72..281fa52 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/util/ObjectContracts.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/util/ObjectContracts.java
@@ -16,13 +16,11 @@
  */
 package org.apache.isis.applib.util;
 
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.Comparator;
 import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-
 import com.google.common.base.Function;
 import com.google.common.base.Objects;
 import com.google.common.base.Objects.ToStringHelper;
@@ -73,6 +71,15 @@ public class ObjectContracts {
     }
 
     public static boolean equals(Object p, Object q, String propertyNames) {
+        if(p==null && q==null) {
+            return true;
+        }
+        if(p==null || q==null) {
+            return false;
+        }
+        if(p.getClass() != q.getClass()) {
+            return false;
+        }
         for (final Clause clause : iterable(propertyNames)) {
             final Object pValue = clause.getValueOf(p);
             final Object qValue = clause.getValueOf(q);

http://git-wip-us.apache.org/repos/asf/isis/blob/b1a0f1de/core/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_equals.java
----------------------------------------------------------------------
diff --git a/core/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_equals.java b/core/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_equals.java
new file mode 100644
index 0000000..5526e4f
--- /dev/null
+++ b/core/applib/src/test/java/org/apache/isis/applib/util/ObjectContractsTest_equals.java
@@ -0,0 +1,91 @@
+/**
+ *  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.applib.util;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class ObjectContractsTest_equals {
+
+    static class Invoice4 {
+        private static final String KEY_PROPERTIES = "number";
+
+        private String number;
+        public String getNumber() {
+            return number;
+        }
+        public void setNumber(String number) {
+            this.number = number;
+        }
+        @Override
+        public int hashCode() {
+            return ObjectContracts.hashCode(this, KEY_PROPERTIES);
+        }
+        @Override
+        public boolean equals(Object obj) {
+            return ObjectContracts.equals(this, obj, KEY_PROPERTIES);
+        }
+
+    }
+
+    private Invoice4 p;
+    private Invoice4 q;
+    private Invoice4 r;
+    private String x;
+
+    @Before
+    public void setUp() throws Exception {
+        p = new Invoice4();
+        p.setNumber("123");
+        q = new Invoice4();
+        q.setNumber("123");
+        r = new Invoice4();
+        r.setNumber("456");
+
+        x = "this is not an invoice";
+    }
+
+    @Test
+    public void happyCase() throws Exception {
+        assertTrue(ObjectContracts.equals(p, q, "number"));
+    }
+
+    @Test
+    public void nullsAreEqual() throws Exception {
+        assertTrue(ObjectContracts.equals(null, null, "number"));
+    }
+
+    @Test
+    public void notEqualDifferentValues() throws Exception {
+        assertFalse(ObjectContracts.equals(p, r, "number"));
+    }
+
+    @Test
+    public void notEqualDifferentTypes() throws Exception {
+        assertFalse(ObjectContracts.equals(p, x, "number"));
+    }
+
+    @Test
+    public void notEqualNull() throws Exception {
+        assertFalse(ObjectContracts.equals(p, null, "number"));
+    }
+
+
+}


[34/44] isis git commit: ISIS-537: starting work on moving bulk actions up to panel header (renders but looks nasty and the selector does nothing).

Posted by da...@apache.org.
ISIS-537: starting work on moving bulk actions up to panel header (renders but looks nasty and the selector does nothing).


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/5022f856
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/5022f856
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/5022f856

Branch: refs/heads/master
Commit: 5022f8563f2d72372ed9ba8b9e9924b481d2774c
Parents: 92ffe2d
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Nov 10 10:19:23 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 10:21:51 2014 +0000

----------------------------------------------------------------------
 .../ajaxtable/BulkActionsHelper.java            | 99 ++++++++++++++++++++
 .../CollectionContentsAsAjaxTablePanel.java     | 16 ++--
 2 files changed, 106 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/5022f856/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsHelper.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsHelper.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsHelper.java
new file mode 100644
index 0000000..e7b1b66
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsHelper.java
@@ -0,0 +1,99 @@
+/*
+ *  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.collectioncontents.ajaxtable;
+
+import java.util.Collections;
+import java.util.List;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import org.apache.isis.applib.filter.Filters;
+import org.apache.isis.core.metamodel.spec.ActionType;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+
+public class BulkActionsHelper {
+
+    private final EntityCollectionModel model;
+
+    public BulkActionsHelper(final EntityCollectionModel model) {
+        this.model = model;
+    }
+
+    private EntityCollectionModel getModel() {
+        return model;
+    }
+
+    public List<ObjectAction> getBulkActions() {
+        final EntityCollectionModel model = getModel();
+
+        if(model.isParented()) {
+            return Collections.emptyList();
+        }
+
+        final ObjectSpecification typeSpec = model.getTypeOfSpecification();
+
+        List<ObjectAction> objectActions = typeSpec.getObjectActions(ActionType.USER, Contributed.INCLUDED, Filters.<ObjectAction>any());
+
+        if ( isExploring() || isPrototyping()) {
+            List<ObjectAction> explorationActions = typeSpec.getObjectActions(ActionType.EXPLORATION, Contributed.INCLUDED, Filters.<ObjectAction>any());
+            List<ObjectAction> prototypeActions = typeSpec.getObjectActions(ActionType.PROTOTYPE, Contributed.INCLUDED, Filters.<ObjectAction>any());
+            objectActions.addAll(explorationActions);
+            objectActions.addAll(prototypeActions);
+        }
+        if (isDebugMode()) {
+            List<ObjectAction> debugActions = typeSpec.getObjectActions(ActionType.DEBUG, Contributed.INCLUDED, Filters.<ObjectAction>any());
+            objectActions.addAll(debugActions);
+        }
+
+        List<ObjectAction> flattenedActions = objectActions;
+
+        return Lists.newArrayList(Iterables.filter(flattenedActions, BULK));
+    }
+
+
+    @SuppressWarnings("deprecation")
+    private static final Predicate<ObjectAction> BULK = Filters.asPredicate(ObjectAction.Filters.bulk());
+
+
+    //region > from context
+
+    public boolean isExploring() {
+        return IsisContext.getDeploymentType().isExploring();
+    }
+    public boolean isPrototyping() {
+        return IsisContext.getDeploymentType().isPrototyping();
+    }
+
+    /**
+     * Protected so can be overridden in testing if required.
+     */
+    protected boolean isDebugMode() {
+        // TODO: need to figure out how to switch into debug mode;
+        // probably call a Debug toggle page, and stuff into
+        // Session.getMetaData()
+        return true;
+    }
+
+    //endregion
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/5022f856/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
index 803a053..aca3535 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
@@ -21,12 +21,10 @@ package org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable
 
 import java.util.Collections;
 import java.util.List;
-
 import com.google.common.base.Predicate;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 import com.google.inject.Inject;
-
 import org.apache.wicket.Component;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable;
@@ -34,7 +32,6 @@ import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
 import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
 import org.apache.wicket.markup.head.IHeaderResponse;
 import org.apache.wicket.model.Model;
-
 import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.applib.filter.Filter;
 import org.apache.isis.applib.filter.Filters;
@@ -76,9 +73,10 @@ public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityColl
     private static final long serialVersionUID = 1L;
 
     private static final String ID_TABLE = "table";
-    private static final String ID_ENTITY_ACTIONS = "entityActions";
     private static final String ID_ACTION_PROMPT_MODAL_WINDOW = "actionPromptModalWindow";
-    
+
+    private static final String ID_ENTITY_ACTIONS = "entityActions";
+
     @SuppressWarnings("deprecation")
     private static final Predicate<ObjectAction> BULK = Filters.asPredicate(ObjectAction.Filters.bulk());
     
@@ -106,7 +104,7 @@ public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityColl
         addPropertyColumnsIfRequired(columns);
 
         final SortableDataProvider<ObjectAdapter,String> dataProvider = new CollectionContentsSortableDataProvider(model);
-        dataTable = new IsisAjaxFallbackDataTable<ObjectAdapter,String>(ID_TABLE, columns, dataProvider, model.getPageSize());
+        dataTable = new IsisAjaxFallbackDataTable<>(ID_TABLE, columns, dataProvider, model.getPageSize());
         
         addActionPromptModalWindow();
         buildEntityActionsGui(bulkActions, this, toggleboxColumn);
@@ -152,16 +150,16 @@ public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityColl
     }
 
     private void buildEntityActionsGui(
-            final List<ObjectAction> bulkActions, 
+            final List<ObjectAction> bulkActions,
             final ActionPromptProvider actionPromptProvider,
             final ObjectAdapterToggleboxColumn toggleboxColumn) {
         final EntityCollectionModel model = getModel();
-        
+
         if(bulkActions.isEmpty() || model.isParented()) {
             permanentlyHide(ID_ENTITY_ACTIONS);
             return;
         }
-        
+
         if(!bulkActions.isEmpty()) {
             final ActionLinkFactory linkFactory = new BulkActionsLinkFactory(model, dataTable, toggleboxColumn);
 


[32/44] isis git commit: ISIS-537: tidy up of (entity) collections panel; standalone collections panel no longer failing (but still need to sort out CSS and bulk actions)

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/HasSelectorDropdownPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/HasSelectorDropdownPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/HasSelectorDropdownPanel.java
deleted file mode 100644
index 9011edf..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/HasSelectorDropdownPanel.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- *  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.collectioncontents.selector.dropdown;
-
-public interface HasSelectorDropdownPanel {
-    CollectionContentsSelectorDropdownPanel getSelectorDropdownPanel();
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.css
deleted file mode 100644
index 8c3902e..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.css
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *  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.
- */
-.linksSelectorPanel .viewLinks {
-    float:right;
-    display:block;
-}
-
-.linksSelectorPanel ul.dropdown-menu {
-    min-width: 0;
-}
-
-.linksSelectorPanel ul.dropdown-menu li.viewItem {
-    min-width: 0;
-}
-
-.linksSelectorPanel ul.viewList li.viewItem:first-child span {
-    border-radius:4px 0 0 4px;
-    -moz-border-radius:4px 0 0 4px;
-    -webkit-border-radius:4px 0 0 4px;
-}
-
-.linksSelectorPanel ul.viewList li.viewItem:last-child span {
-    border-radius:0 4px 4px 0;
-    -moz-border-radius:0 4px 4px 0;
-    -webkit-border-radius:0 4px 4px 0;
-}
-
-
-.linksSelectorPanel .link-selector-panel-invisible {
-    display:none;
-}
-
-.linksSelectorPanel .list-inline {
-    margin-left: 0;
-}
-
-.linksSelectorPanel .list-inline li {
-    padding-left: 0;
-}
-
-
-.collectionContentsLinksSelectorPanel select {
-	margin-bottom: 1em;
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
deleted file mode 100644
index 0a6d242..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied.  See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns:wicket="http://wicket.apache.org">
-<body>
-<wicket:panel>
-    <div class="linksSelectorPanel">
-
-        <div class="views">
-            <div wicket:id="collectionContents-0" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
-            <div wicket:id="collectionContents-1" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
-            <div wicket:id="collectionContents-2" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
-            <div wicket:id="collectionContents-3" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
-            <div wicket:id="collectionContents-4" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
-            <div wicket:id="collectionContents-5" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
-            <div wicket:id="collectionContents-6" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
-            <div wicket:id="collectionContents-7" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
-            <div wicket:id="collectionContents-8" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
-            <div wicket:id="collectionContents-9" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
-        </div>
-    </div>
-</wicket:panel>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
deleted file mode 100644
index 42616ff..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- *  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.collectioncontents.selector.links;
-
-import java.util.List;
-import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.event.IEvent;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.isis.viewer.wicket.model.hints.IsisEnvelopeEvent;
-import org.apache.isis.viewer.wicket.model.hints.IsisUiHintEvent;
-import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
-import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
-import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
-import org.apache.isis.viewer.wicket.ui.ComponentFactory;
-import org.apache.isis.viewer.wicket.ui.ComponentType;
-import org.apache.isis.viewer.wicket.ui.components.collection.CollectionCountProvider;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.CollectionContentsSelectorDropdownPanel;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.CollectionContentsSelectorHelper;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.HasSelectorDropdownPanel;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
-import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
-import org.apache.isis.viewer.wicket.ui.util.CssClassRemover;
-
-/**
- * Provides a list of links for selecting other views that support
- * {@link ComponentType#COLLECTION_CONTENTS} with a backing
- * {@link EntityCollectionModel}.
- */
-public class CollectionContentsLinksSelectorPanel
-        extends PanelAbstract<EntityCollectionModel> implements UiHintPathSignificant,  CollectionCountProvider {
-
-    private static final long serialVersionUID = 1L;
-
-    private static final String INVISIBLE_CLASS = "link-selector-panel-invisible";
-    private static final int MAX_NUM_UNDERLYING_VIEWS = 10;
-
-//    private static final String ID_SELECTOR_DROPDOWN = "selectorDropdown";
-
-    private static final String UIHINT_VIEW = "view";
-
-    private final ComponentFactory ignoreFactory;
-
-    private final ComponentType componentType;
-    private final String underlyingIdPrefix;
-    private final CollectionContentsSelectorHelper selectorHelper;
-
-    private ComponentFactory selectedComponentFactory;
-    private Component selectedComponent;
-
-    private Component[] underlyingViews;
-    private CollectionContentsSelectorDropdownPanel selectorDropdownPanel;
-
-    public CollectionContentsLinksSelectorPanel(
-            final String id,
-            final EntityCollectionModel model,
-            final ComponentFactory ignoreFactory) {
-        super(id, model);
-        this.ignoreFactory = ignoreFactory;
-        this.underlyingIdPrefix = ComponentType.COLLECTION_CONTENTS.toString();
-        this.componentType = ignoreFactory.getComponentType();
-        selectorHelper = new CollectionContentsSelectorHelper(model, getComponentFactoryRegistry(), ignoreFactory);
-
-    }
-
-    /**
-     * Build UI only after added to parent.
-     */
-    public void onInitialize() {
-        super.onInitialize();
-        addUnderlyingViews();
-    }
-
-
-    private void addUnderlyingViews() {
-        final EntityCollectionModel model = getModel();
-
-        final int selected = selectorHelper.honourViewHintElseDefault(getSelectorDropdownPanel());
-        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
-
-        // create all, hide the one not selected
-        underlyingViews = new Component[MAX_NUM_UNDERLYING_VIEWS];
-        int i = 0;
-        final EntityCollectionModel emptyModel = model.asDummy();
-        for (ComponentFactory componentFactory : componentFactories) {
-            final String underlyingId = underlyingIdPrefix + "-" + i;
-
-            Component underlyingView = componentFactory.createComponent(underlyingId,i==selected? model: emptyModel);
-            underlyingViews[i++] = underlyingView;
-            this.addOrReplace(underlyingView);
-        }
-
-        // hide any unused placeholders
-        while(i<MAX_NUM_UNDERLYING_VIEWS) {
-            String underlyingId = underlyingIdPrefix + "-" + i;
-            permanentlyHide(underlyingId);
-            i++;
-        }
-
-        // selector
-//        if (componentFactories.size() <= 1) {
-//            permanentlyHide(ID_SELECTOR_DROPDOWN);
-//        } else {
-//            final Model<ComponentFactory> componentFactoryModel = new Model<>();
-//
-//            this.selectedComponentFactory = componentFactories.get(selected);
-//            componentFactoryModel.setObject(this.selectedComponentFactory);
-//
-//            selectorDropdownPanel = new CollectionContentsSelectorDropdownPanel(ID_SELECTOR_DROPDOWN, getModel(), ignoreFactory);
-//
-//            addOrReplace(selectorDropdownPanel);
-//        }
-
-        this.setOutputMarkupId(true);
-
-        for(i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
-            Component component = underlyingViews[i];
-            if(component != null) {
-                if(i != selected) {
-                    component.add(new CssClassAppender(INVISIBLE_CLASS));
-                } else {
-                    selectedComponent = component;
-                }
-            }
-        }
-    }
-
-    @Override
-    public void onEvent(IEvent<?> event) {
-        super.onEvent(event);
-
-        final IsisUiHintEvent uiHintEvent = IsisEnvelopeEvent.openLetter(event, IsisUiHintEvent.class);
-        if(uiHintEvent == null) {
-            return;
-        }
-        final UiHintContainer uiHintContainer = uiHintEvent.getUiHintContainer();
-
-        int underlyingViewNum = 0;
-        String viewStr = uiHintContainer.getHint(this.getSelectorDropdownPanel(), UIHINT_VIEW);
-
-        List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
-
-        if(viewStr != null) {
-            try {
-                int view = Integer.parseInt(viewStr);
-                if(view >= 0 && view < componentFactories.size()) {
-                    underlyingViewNum = view;
-                }
-            } catch(NumberFormatException ex) {
-                // ignore
-            }
-        }
-
-        final EntityCollectionModel dummyModel = getModel().asDummy();
-        for(int i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
-            final Component component = underlyingViews[i];
-            if(component == null) {
-                continue;
-            }
-            final boolean isSelected = i == underlyingViewNum;
-            applyCssVisibility(component, isSelected);
-            component.setDefaultModel(isSelected? getModel(): dummyModel);
-        }
-
-        this.selectedComponentFactory = ignoreFactory;
-        this.selectedComponent = underlyingViews[underlyingViewNum];
-
-
-        final AjaxRequestTarget target = uiHintEvent.getTarget();
-        if(target != null) {
-            target.add(this, getSelectorDropdownPanel());
-        }
-
-    }
-
-
-    protected static void applyCssVisibility(final Component component, final boolean visible) {
-        if(component == null) {
-            return;
-        }
-        AttributeModifier modifier = visible ? new CssClassRemover(INVISIBLE_CLASS) : new CssClassAppender(INVISIBLE_CLASS);
-        component.add(modifier);
-    }
-
-    @Override
-    public void renderHead(final IHeaderResponse response) {
-        super.renderHead(response);
-        PanelUtil.renderHead(response, CollectionContentsLinksSelectorPanel.class);
-    }
-
-
-
-    @Override
-    public Integer getCount() {
-        if(selectedComponent instanceof CollectionCountProvider) {
-            final CollectionCountProvider collectionCountProvider = (CollectionCountProvider) selectedComponent;
-            return collectionCountProvider.getCount();
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Searches up the component hierarchy looking for a parent that implements
-     * {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.HasSelectorDropdownPanel}.
-     * @return
-     */
-    private CollectionContentsSelectorDropdownPanel getSelectorDropdownPanel() {
-        Component component = this;
-        while(component != null) {
-            if(component instanceof HasSelectorDropdownPanel) {
-                final CollectionContentsSelectorDropdownPanel selectorDropdownPanel1 = ((HasSelectorDropdownPanel) component).getSelectorDropdownPanel();
-                if(selectorDropdownPanel1 == null) {
-                    throw new IllegalStateException("Found parent that implements HasSelectorDropdownPanel, but no SelectorDropdownPanel available (is null)");
-
-                }
-                return selectorDropdownPanel1;
-            }
-            component = component.getParent();
-        }
-        throw new IllegalStateException("Could not locate parent that implements HasSelectorDropdownPanel");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanelFactory.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanelFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanelFactory.java
deleted file mode 100644
index a93790e..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanelFactory.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *  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.collectioncontents.selector.links;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.model.IModel;
-
-import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
-import org.apache.isis.viewer.wicket.ui.ComponentFactory;
-import org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract;
-import org.apache.isis.viewer.wicket.ui.ComponentType;
-
-/**
- * {@link ComponentFactory} for {@link CollectionContentsLinksSelectorPanel}.
- */
-public class CollectionContentsLinksSelectorPanelFactory extends ComponentFactoryAbstract {
-
-    private static final long serialVersionUID = 1L;
-
-    public CollectionContentsLinksSelectorPanelFactory() {
-        super(ComponentType.COLLECTION_CONTENTS, 
-                CollectionContentsLinksSelectorPanel.class);
-    }
-
-    @Override
-    public ApplicationAdvice appliesTo(final IModel<?> model) {
-        return appliesIf(model instanceof EntityCollectionModel);
-    }
-
-    @Override
-    public Component createComponent(final String id, final IModel<?> model) {
-        final EntityCollectionModel collectionModel = (EntityCollectionModel) model;
-        return new CollectionContentsLinksSelectorPanel(id, collectionModel, this);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummary.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummary.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummary.java
index 4d0bf49..32809e5 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummary.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/summary/CollectionContentsAsSummary.java
@@ -42,7 +42,7 @@ import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.Contributed;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
-import org.apache.isis.viewer.wicket.ui.components.collection.CollectionCountProvider;
+import org.apache.isis.viewer.wicket.ui.components.collection.count.CollectionCountProvider;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
 import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
 

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
index 106afa7..9d0ac51 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
@@ -28,14 +28,6 @@
                             <span wicket:id="collectionName" class="panel-title">[collection name]</span>
                             <div class="pull-right">
 
-                                <!--
-                                <div class="btn-group">
-                                    <a href="#" class="btn btn-default btn-sm">## Lock</a>
-                                    <a href="#" class="btn btn-default btn-sm">## Delete</a>
-                                    <a href="#" class="btn btn-default btn-sm">## Move</a>
-                                </div>
-                                -->
-
                                 <div class="btn-group">
                                     <div wicket:id="additionalLinks"></div>
                                 </div>
@@ -43,23 +35,9 @@
                                     <span wicket:id="selectorDropdown"/>
                                 </div>
 
-                                <!--
-                                <div class="btn-group">
-                                    <ul xxwicket:id="viewList" class="dropdown-menu dropdown-menu-right" role="menu">
-                                        <li xxwicket:id="viewItem" class="viewItem">
-                                            <a href="#" xxwicket:id="viewLink">
-                                                <span xxwicket:id="viewItemIcon" class="ViewLinkItem"></span> <span xxwicket:id="viewItemTitle" class="ViewLinkItemTitle">[link title]</span>
-                                            </a>
-                                        </li>
-                                    </ul>
-                                </div>
-                                -->
-
                             </div>
                         </div>
 
-
-
                         <div wicket:id="collection" class="collection panel-body">
                             [collection]
                         </div>

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
index 1a8649c..876177d 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
@@ -20,7 +20,6 @@
 package org.apache.isis.viewer.wicket.ui.components.entity.collections;
 
 import java.util.List;
-import org.apache.wicket.Component;
 import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.repeater.RepeatingView;
@@ -40,9 +39,9 @@ import org.apache.isis.viewer.wicket.model.models.EntityModel;
 import org.apache.isis.viewer.wicket.ui.ComponentFactory;
 import org.apache.isis.viewer.wicket.ui.components.additionallinks.AdditionalLinksPanel;
 import org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.CollectionContentsSelectorDropdownPanel;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.CollectionContentsSelectorHelper;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.links.CollectionContentsLinksSelectorPanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorHelper;
+import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorPanel;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.multiple.CollectionContentsMultipleViewsPanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.widgets.containers.UiHintPathSignificantWebMarkupContainer;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
 import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
@@ -62,13 +61,8 @@ public class EntityCollectionsPanel extends PanelAbstract<EntityModel> {
     private static final String ID_COLLECTION = "collection";
 
     private static final String ID_ADDITIONAL_LINKS = "additionalLinks";
-
     private static final String ID_SELECTOR_DROPDOWN = "selectorDropdown";
 
-
-    private ComponentFactory selectedComponentFactory;
-    private Component selectedComponent;
-
     public EntityCollectionsPanel(final String id, final EntityModel entityModel) {
         super(id, entityModel);
 
@@ -130,24 +124,26 @@ public class EntityCollectionsPanel extends PanelAbstract<EntityModel> {
 
         final EntityCollectionModel entityCollectionModel = collectionPanel.getModel();
         List<LinkAndLabel> links = entityCollectionModel.getLinks();
+
         AdditionalLinksPanel additionalLinks = new AdditionalLinksPanel(ID_ADDITIONAL_LINKS, links);
         fieldset.addOrReplace(additionalLinks);
 
-        CollectionContentsSelectorHelper selectorHelper = new CollectionContentsSelectorHelper(entityCollectionModel, getComponentFactoryRegistry(), new CollectionContentsLinksSelectorPanelFactory());
+        final CollectionSelectorHelper selectorHelper = new CollectionSelectorHelper(entityCollectionModel, getComponentFactoryRegistry(), new CollectionContentsMultipleViewsPanelFactory());
 
         final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
 
         if (componentFactories.size() <= 1) {
             permanentlyHide(ID_SELECTOR_DROPDOWN);
         } else {
-            CollectionContentsSelectorDropdownPanel selectorDropdownPanel;
-            selectorDropdownPanel = new CollectionContentsSelectorDropdownPanel(ID_SELECTOR_DROPDOWN, entityCollectionModel, new CollectionContentsLinksSelectorPanelFactory());
+            CollectionSelectorPanel selectorDropdownPanel;
+            selectorDropdownPanel = new CollectionSelectorPanel(ID_SELECTOR_DROPDOWN, entityCollectionModel, new CollectionContentsMultipleViewsPanelFactory());
 
             final Model<ComponentFactory> componentFactoryModel = new Model<>();
 
             final int selected = selectorHelper.honourViewHintElseDefault(selectorDropdownPanel);
-            this.selectedComponentFactory = componentFactories.get(selected);
-            componentFactoryModel.setObject(this.selectedComponentFactory);
+
+            ComponentFactory selectedComponentFactory = componentFactories.get(selected);
+            componentFactoryModel.setObject(selectedComponentFactory);
 
             this.setOutputMarkupId(true);
             fieldset.addOrReplace(selectorDropdownPanel);

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.css
index b88fe0c..eea4518 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.css
@@ -39,4 +39,4 @@ div.standaloneCollectionPanel .iconAndTitle {
 	line-height:150%;
 	clear:both;
 }
- 
\ No newline at end of file
+

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
index e664e3a..d09c0bd 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
@@ -24,12 +24,29 @@
       lang="en">
     <body>
         <wicket:panel>
+
             <div class="standaloneCollectionPanel actionComponentType myBlockContainer panel panel-default">
                 <div class="iconAndTitle panel-heading actionPanelHeaderNew">
                      <div wicket:id="actionName" class="actionName panel-title">[action name]</div>
+
+                    <div class="pull-right">
+
+                        <!--
+                        <div class="btn-group">
+                            <div xxxwicket:id="additionalLinks"></div>
+                        </div>
+                        -->
+                        <div class="btn-group">
+                            <span wicket:id="selectorDropdown"/>
+                        </div>
+
+                    </div>
+
                 </div>
+
                 <div wicket:id="collectionContents" class="panel-body"></div>
             </div>
+
         </wicket:panel>
     </body>
 </html>

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
index 80fd5fe..7ac4640 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
@@ -19,22 +19,32 @@
 
 package org.apache.isis.viewer.wicket.ui.components.standalonecollection;
 
+import java.util.List;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.model.Model;
 
 import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
 import org.apache.isis.viewer.wicket.model.models.ActionModel;
 import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentType;
 import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistry;
-import org.apache.isis.viewer.wicket.ui.components.collection.CollectionCountProvider;
+import org.apache.isis.viewer.wicket.ui.components.collection.count.CollectionCountProvider;
+import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorHelper;
+import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorPanel;
+import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorProvider;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.multiple.CollectionContentsMultipleViewsPanelFactory;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
 
-public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionModel> implements CollectionCountProvider {
+public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionModel>
+        implements CollectionCountProvider, CollectionSelectorProvider {
 
     private static final long serialVersionUID = 1L;
 
     private static final String ID_ACTION_NAME = "actionName";
+    private static final String ID_ADDITIONAL_LINKS = "additionalLinks";
+    private static final String ID_SELECTOR_DROPDOWN = "selectorDropdown";
+    private CollectionSelectorPanel selectorDropdownPanel;
 
     public StandaloneCollectionPanel(final String id, final EntityCollectionModel entityCollectionModel) {
         super(id, entityCollectionModel);
@@ -42,11 +52,34 @@ public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionMod
     }
 
     private void buildGui(final EntityCollectionModel entityCollectionModel) {
-        
+
         ActionModel actionModel = entityCollectionModel.getActionModelHint();
         ObjectAction action = actionModel.getActionMemento().getAction();
         addOrReplace(new Label(StandaloneCollectionPanel.ID_ACTION_NAME, Model.of(action.getName())));
-        
+
+        final CollectionSelectorHelper selectorHelper = new CollectionSelectorHelper(entityCollectionModel, getComponentFactoryRegistry(), new CollectionContentsMultipleViewsPanelFactory());
+
+        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
+
+        if (componentFactories.size() <= 1) {
+            permanentlyHide(ID_SELECTOR_DROPDOWN);
+        } else {
+            CollectionSelectorPanel selectorDropdownPanel;
+            selectorDropdownPanel = new CollectionSelectorPanel(ID_SELECTOR_DROPDOWN, entityCollectionModel, new CollectionContentsMultipleViewsPanelFactory());
+
+            final Model<ComponentFactory> componentFactoryModel = new Model<>();
+
+            final int selected = selectorHelper.honourViewHintElseDefault(selectorDropdownPanel);
+
+            ComponentFactory selectedComponentFactory = componentFactories.get(selected);
+            componentFactoryModel.setObject(selectedComponentFactory);
+
+            this.setOutputMarkupId(true);
+            addOrReplace(selectorDropdownPanel);
+
+            this.selectorDropdownPanel = selectorDropdownPanel;
+        }
+
         final ComponentFactoryRegistry componentFactoryRegistry = getComponentFactoryRegistry();
         componentFactoryRegistry.addOrReplaceComponent(this, ComponentType.COLLECTION_CONTENTS, entityCollectionModel);
     }
@@ -57,4 +90,8 @@ public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionMod
         return model.getCount();
     }
 
+    @Override
+    public CollectionSelectorPanel getSelectorDropdownPanel() {
+        return selectorDropdownPanel;
+    }
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionContentsSelectorDropdownPanelTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionContentsSelectorDropdownPanelTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionContentsSelectorDropdownPanelTest.java
new file mode 100644
index 0000000..408dd28
--- /dev/null
+++ b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionContentsSelectorDropdownPanelTest.java
@@ -0,0 +1,67 @@
+/*
+ *  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.collection.selector;
+
+import java.util.Arrays;
+import java.util.List;
+import org.jmock.auto.Mock;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class CollectionContentsSelectorDropdownPanelTest {
+
+    @Rule
+    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+
+    @Mock
+    private ComponentFactory one;
+    
+    @Mock
+    private ComponentFactory two;
+
+    private ComponentFactory ajaxTableComponentFactory;
+    
+    @Before
+    public void setUp() throws Exception {
+        ajaxTableComponentFactory = new CollectionContentsAsAjaxTablePanelFactory();
+    }
+    
+    @Test
+    public void testOrderAjaxTableToEnd() {
+        
+        List<ComponentFactory> componentFactories = 
+                Arrays.<ComponentFactory>asList(
+                        one,
+                        ajaxTableComponentFactory, 
+                        two);
+        List<ComponentFactory> orderAjaxTableToEnd = CollectionSelectorHelper.orderAjaxTableToEnd(componentFactories);
+        assertThat(orderAjaxTableToEnd.get(0), is(one));
+        assertThat(orderAjaxTableToEnd.get(1), is(two));
+        assertThat(orderAjaxTableToEnd.get(2), is(ajaxTableComponentFactory));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanelTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanelTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanelTest.java
deleted file mode 100644
index 6b94417..0000000
--- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanelTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *  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.collectioncontents.selector.dropdown;
-
-import java.util.Arrays;
-import java.util.List;
-import org.jmock.auto.Mock;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-import org.apache.isis.viewer.wicket.ui.ComponentFactory;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-public class CollectionContentsSelectorDropdownPanelTest {
-
-    @Rule
-    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
-    @Mock
-    private ComponentFactory one;
-    
-    @Mock
-    private ComponentFactory two;
-
-    private ComponentFactory ajaxTableComponentFactory;
-    
-    @Before
-    public void setUp() throws Exception {
-        ajaxTableComponentFactory = new CollectionContentsAsAjaxTablePanelFactory();
-    }
-    
-    @Test
-    public void testOrderAjaxTableToEnd() {
-        
-        List<ComponentFactory> componentFactories = 
-                Arrays.<ComponentFactory>asList(
-                        one,
-                        ajaxTableComponentFactory, 
-                        two);
-        List<ComponentFactory> orderAjaxTableToEnd = CollectionContentsSelectorHelper.orderAjaxTableToEnd(componentFactories);
-        assertThat(orderAjaxTableToEnd.get(0), is(one));
-        assertThat(orderAjaxTableToEnd.get(1), is(two));
-        assertThat(orderAjaxTableToEnd.get(2), is(ajaxTableComponentFactory));
-    }
-
-}


[37/44] isis git commit: ISIS-537: tidy up, fixing selector helper for when there is only one view.

Posted by da...@apache.org.
ISIS-537: tidy up, fixing selector helper for when there is only one view.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/cb2bea9a
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/cb2bea9a
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/cb2bea9a

Branch: refs/heads/master
Commit: cb2bea9ab22d60248e43e53aae9b21614e98286c
Parents: 9bad917
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Nov 10 20:26:22 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 20:26:22 2014 +0000

----------------------------------------------------------------------
 .../common/OnConcurrencyExceptionHandler.java   |  38 +++
 .../wicket/model/common/OnSelectionHandler.java |  37 +++
 .../wicket/model/common/SelectionHandler.java   |  44 ----
 .../collection/bulk/BulkActionsHelper.java      | 102 +++++++++
 .../collection/bulk/BulkActionsLinkFactory.java | 229 +++++++++++++++++++
 .../collection/bulk/BulkActionsProvider.java    |  28 +++
 .../selector/CollectionSelectorHelper.java      |  64 +++---
 .../selector/CollectionSelectorPanel.java       |   2 +-
 .../ajaxtable/BulkActionsHelper.java            | 102 ---------
 .../ajaxtable/BulkActionsLinkFactory.java       | 229 -------------------
 .../ajaxtable/BulkActionsProvider.java          |  28 ---
 .../CollectionContentsAsAjaxTablePanel.java     |  49 +---
 .../columns/ObjectAdapterToggleboxColumn.java   |  45 +++-
 .../CollectionContentsMultipleViewsPanel.java   |  38 +--
 .../collections/EntityCollectionsPanel.java     |   2 +-
 .../StandaloneCollectionPanel.java              | 167 +++++---------
 .../cssmenu/ActionLinkFactoryAbstract.java      |   3 +-
 17 files changed, 595 insertions(+), 612 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/cb2bea9a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/common/OnConcurrencyExceptionHandler.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/common/OnConcurrencyExceptionHandler.java b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/common/OnConcurrencyExceptionHandler.java
new file mode 100644
index 0000000..6b11659
--- /dev/null
+++ b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/common/OnConcurrencyExceptionHandler.java
@@ -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.model.common;
+
+import java.io.Serializable;
+import org.apache.wicket.Component;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
+
+/**
+ * Decouples the mechanism for selecting entities returned in collections.
+ */
+public interface OnConcurrencyExceptionHandler extends Serializable {
+
+    void onConcurrencyException(
+            Component context, ObjectAdapter selectedAdapter,
+            ConcurrencyException ex,
+            AjaxRequestTarget ajaxRequestTarget);
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/cb2bea9a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/common/OnSelectionHandler.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/common/OnSelectionHandler.java b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/common/OnSelectionHandler.java
new file mode 100644
index 0000000..17e1d4d
--- /dev/null
+++ b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/common/OnSelectionHandler.java
@@ -0,0 +1,37 @@
+/*
+ *  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.model.common;
+
+import java.io.Serializable;
+import org.apache.wicket.Component;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+
+/**
+ * Decouples the mechanism for selecting entities returned in collections.
+ */
+public interface OnSelectionHandler extends Serializable {
+
+    void onSelected(
+            Component context, ObjectAdapter selectedAdapter,
+            AjaxRequestTarget ajaxRequestTarget);
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/cb2bea9a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/common/SelectionHandler.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/common/SelectionHandler.java b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/common/SelectionHandler.java
deleted file mode 100644
index dfecf23..0000000
--- a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/common/SelectionHandler.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  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.model.common;
-
-import java.io.Serializable;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
-
-/**
- * Decouples the mechanism for selecting entities returned in collections.
- */
-public interface SelectionHandler extends Serializable {
-
-    void onSelected(
-            Component context, ObjectAdapter selectedAdapter,
-            AjaxRequestTarget ajaxRequestTarget);
-
-    void onConcurrencyException(
-            Component context, ObjectAdapter selectedAdapter, 
-            ConcurrencyException ex,
-            AjaxRequestTarget ajaxRequestTarget);
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/cb2bea9a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/bulk/BulkActionsHelper.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/bulk/BulkActionsHelper.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/bulk/BulkActionsHelper.java
new file mode 100644
index 0000000..b54a4d7
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/bulk/BulkActionsHelper.java
@@ -0,0 +1,102 @@
+/*
+ *  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.collection.bulk;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.List;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import org.apache.isis.applib.filter.Filters;
+import org.apache.isis.core.metamodel.spec.ActionType;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+
+public class BulkActionsHelper implements Serializable {
+
+    private final EntityCollectionModel model;
+
+    private static final long serialVersionUID = 1L;
+
+    public BulkActionsHelper(final EntityCollectionModel model) {
+        this.model = model;
+    }
+
+    private EntityCollectionModel getModel() {
+        return model;
+    }
+
+    public List<ObjectAction> getBulkActions() {
+        final EntityCollectionModel model = getModel();
+
+        if(model.isParented()) {
+            return Collections.emptyList();
+        }
+
+        final ObjectSpecification typeSpec = model.getTypeOfSpecification();
+
+        List<ObjectAction> objectActions = typeSpec.getObjectActions(ActionType.USER, Contributed.INCLUDED, Filters.<ObjectAction>any());
+
+        if ( isExploring() || isPrototyping()) {
+            List<ObjectAction> explorationActions = typeSpec.getObjectActions(ActionType.EXPLORATION, Contributed.INCLUDED, Filters.<ObjectAction>any());
+            List<ObjectAction> prototypeActions = typeSpec.getObjectActions(ActionType.PROTOTYPE, Contributed.INCLUDED, Filters.<ObjectAction>any());
+            objectActions.addAll(explorationActions);
+            objectActions.addAll(prototypeActions);
+        }
+        if (isDebugMode()) {
+            List<ObjectAction> debugActions = typeSpec.getObjectActions(ActionType.DEBUG, Contributed.INCLUDED, Filters.<ObjectAction>any());
+            objectActions.addAll(debugActions);
+        }
+
+        List<ObjectAction> flattenedActions = objectActions;
+
+        return Lists.newArrayList(Iterables.filter(flattenedActions, BULK));
+    }
+
+
+    @SuppressWarnings("deprecation")
+    private static final Predicate<ObjectAction> BULK = Filters.asPredicate(ObjectAction.Filters.bulk());
+
+
+    //region > from context
+
+    public boolean isExploring() {
+        return IsisContext.getDeploymentType().isExploring();
+    }
+    public boolean isPrototyping() {
+        return IsisContext.getDeploymentType().isPrototyping();
+    }
+
+    /**
+     * Protected so can be overridden in testing if required.
+     */
+    protected boolean isDebugMode() {
+        // TODO: need to figure out how to switch into debug mode;
+        // probably call a Debug toggle page, and stuff into
+        // Session.getMetaData()
+        return true;
+    }
+
+    //endregion
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cb2bea9a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/bulk/BulkActionsLinkFactory.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/bulk/BulkActionsLinkFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/bulk/BulkActionsLinkFactory.java
new file mode 100644
index 0000000..46f8642
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/bulk/BulkActionsLinkFactory.java
@@ -0,0 +1,229 @@
+/*
+ *  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.collection.bulk;
+
+import java.util.List;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import org.apache.wicket.Session;
+import org.apache.wicket.markup.html.link.AbstractLink;
+import org.apache.wicket.markup.html.link.Link;
+import org.apache.isis.applib.RecoverableException;
+import org.apache.isis.applib.annotation.Bulk;
+import org.apache.isis.applib.annotation.Bulk.InteractionContext.InvokedAs;
+import org.apache.isis.applib.services.command.Command;
+import org.apache.isis.applib.services.command.Command.Executor;
+import org.apache.isis.applib.services.command.CommandContext;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider;
+import org.apache.isis.core.commons.authentication.MessageBroker;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking;
+import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
+import org.apache.isis.viewer.wicket.model.mementos.ActionMemento;
+import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
+import org.apache.isis.viewer.wicket.model.models.ActionModel;
+import org.apache.isis.viewer.wicket.model.models.ActionPromptProvider;
+import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+import org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponse;
+import org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponseType;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ObjectAdapterToggleboxColumn;
+import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.ActionLinkFactory;
+import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.CssMenuItem;
+import org.apache.isis.viewer.wicket.ui.errors.JGrowlBehaviour;
+
+public final class BulkActionsLinkFactory implements ActionLinkFactory {
+    
+    private static final long serialVersionUID = 1L;
+    private final EntityCollectionModel model;
+    
+    private final ObjectAdapterToggleboxColumn toggleboxColumn;
+
+    public BulkActionsLinkFactory(
+            final EntityCollectionModel model,
+            final ObjectAdapterToggleboxColumn toggleboxColumn) {
+        this.model = model;
+        this.toggleboxColumn = toggleboxColumn;
+    }
+
+
+    @Override
+    public LinkAndLabel newLink(
+            final ObjectAdapterMemento serviceAdapterMemento,
+            final ObjectAction objectAction,
+            final String linkId,
+            final ActionPromptProvider actionPromptProvider) {
+        
+        final ActionMemento actionMemento = new ActionMemento(objectAction);
+        final AbstractLink link = new Link<Object>(linkId) {
+            
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public void onClick() {
+                final ObjectAction objectAction = actionMemento.getAction();
+                final ConcurrencyChecking concurrencyChecking = 
+                        ConcurrencyChecking.concurrencyCheckingFor(objectAction.getSemantics());
+
+                try {
+                    final List<ObjectAdapterMemento> toggleMementosList = model.getToggleMementosList();
+
+                    final Iterable<ObjectAdapter> toggledAdapters = 
+                            Iterables.transform(toggleMementosList, ObjectAdapterMemento.Functions.fromMemento(concurrencyChecking));
+                    
+                    final List<Object> domainObjects = Lists.newArrayList(Iterables.transform(toggledAdapters, ObjectAdapter.Functions.getObject()));
+                    
+                    
+                    final Bulk.InteractionContext bulkInteractionContext = Bulk.InteractionContext.current.get();
+                    if (bulkInteractionContext != null) {
+                        bulkInteractionContext.setInvokedAs(InvokedAs.BULK);
+                        bulkInteractionContext.setDomainObjects(domainObjects);
+                    }
+                    
+                    final CommandContext commandContext = getServicesInjector().lookupService(CommandContext.class);
+                    final Command command;
+                    if (commandContext != null) {
+                        command = commandContext.getCommand();
+                        command.setExecutor(Executor.USER);
+                    }
+
+
+                    ObjectAdapter lastReturnedAdapter = null;
+                    int i=0;
+                    for(final ObjectAdapter adapter : toggledAdapters) {
+    
+                        int numParameters = objectAction.getParameterCount();
+                        if(numParameters != 0) {
+                            return;
+                        }
+                        if (bulkInteractionContext != null) {
+                            bulkInteractionContext.setIndex(i++);
+                        }
+
+                        lastReturnedAdapter = objectAction.executeWithRuleChecking(adapter, new ObjectAdapter[]{}, getAuthenticationSession(), ActionModel.WHERE_FOR_ACTION_INVOCATION);
+                    }
+
+
+                    
+                    model.clearToggleMementosList();
+                    toggleboxColumn.clearToggles();
+                    final ActionModel actionModelHint = model.getActionModelHint();
+                    if(actionModelHint != null && actionModelHint.getActionMemento().getAction().getSemantics().isIdempotentInNature()) {
+                        ObjectAdapter resultAdapter = actionModelHint.getObject();
+                        model.setObjectList(resultAdapter);
+                    } else {
+                        model.setObject(persistentAdaptersWithin(model.getObject()));
+                    }
+                    
+                    if(lastReturnedAdapter != null) {
+                        final ActionResultResponse resultResponse = 
+                                ActionResultResponseType.determineAndInterpretResult(actionModelHint, null, lastReturnedAdapter);
+                        resultResponse.getHandlingStrategy().handleResults(this, resultResponse);
+                    }
+
+                } catch(final ConcurrencyException ex) {
+                    
+                    recover();
+                    // display a warning to the user so that they know that the action wasn't performed
+                    getMessageBroker().addWarning(ex.getMessage());
+                    return;
+
+                } catch(final RuntimeException ex) {
+                    
+                    final RecoverableException appEx = ActionModel.getApplicationExceptionIfAny(ex);
+                    if (appEx != null) {
+
+                        recover();
+                        
+                        getMessageBroker().setApplicationError(appEx.getMessage());
+                        
+                        // there's no need to abort the transaction, it will have already been done
+                        // (in IsisTransactionManager#executeWithinTransaction(...)). 
+                        return;
+                    } 
+                    throw ex;
+                }
+            }
+            
+            private void recover() {
+                // resync with the objectstore
+                final List<ObjectAdapterMemento> toggleMementosList = Lists.newArrayList(model.getToggleMementosList());
+                for (ObjectAdapterMemento oam : toggleMementosList) {
+                    // just requesting the adapter will sync the OAM's version with the objectstore
+                    oam.getObjectAdapter(ConcurrencyChecking.NO_CHECK);
+                }
+                
+                // discard any adapters that might have been deleted
+                model.setObject(persistentAdaptersWithin(model.getObject()));
+                
+                // attempt to preserve the toggled adapters
+                final List<ObjectAdapter> adapters = model.getObject();
+                model.clearToggleMementosList();
+                for (ObjectAdapterMemento oam : toggleMementosList) {
+                    final ObjectAdapter objectAdapter = oam.getObjectAdapter(ConcurrencyChecking.NO_CHECK);
+                    if(adapters.contains(objectAdapter)) {
+                        // in case it has been deleted...
+                        model.toggleSelectionOn(objectAdapter);
+                    }
+                }
+            }
+
+            private List<ObjectAdapter> persistentAdaptersWithin(List<ObjectAdapter> adapters) {
+                return Lists.newArrayList(Iterables.filter(adapters, new Predicate<ObjectAdapter>() {
+                    @Override
+                    public boolean apply(ObjectAdapter input) {
+                        return !input.isTransient() && !input.isDestroyed();
+                    }
+                }));
+            }
+
+        };
+        link.add(new JGrowlBehaviour());
+        final boolean explorationOrPrototype = CssMenuItem.isExplorationOrPrototype(objectAction);
+        final String actionIdentifier = CssMenuItem.actionIdentifierFor(objectAction);
+        final String cssClass = CssMenuItem.cssClassFor(objectAction);
+        final String cssClassFa = CssMenuItem.cssClassFaFor(objectAction);
+
+        return new LinkAndLabel(link, objectAction.getName(), null, false, explorationOrPrototype, actionIdentifier, cssClass, cssClassFa);
+    }
+    
+    
+    ///////////////////////////////////////////////////////
+    // Dependencies (from context)
+    ///////////////////////////////////////////////////////
+
+    public AuthenticationSession getAuthenticationSession() {
+        final AuthenticationSessionProvider asa = (AuthenticationSessionProvider) Session.get();
+        return asa.getAuthenticationSession();
+    }
+
+    protected MessageBroker getMessageBroker() {
+        return getAuthenticationSession().getMessageBroker();
+    }
+
+    protected ServicesInjector getServicesInjector() {
+        return IsisContext.getPersistenceSession().getServicesInjector();
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/cb2bea9a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/bulk/BulkActionsProvider.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/bulk/BulkActionsProvider.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/bulk/BulkActionsProvider.java
new file mode 100644
index 0000000..39f2b96
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/bulk/BulkActionsProvider.java
@@ -0,0 +1,28 @@
+/*
+ *  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.collection.bulk;
+
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ObjectAdapterToggleboxColumn;
+
+public interface BulkActionsProvider {
+
+    void configureBulkActions(ObjectAdapterToggleboxColumn toggleboxColumn);
+
+    ObjectAdapterToggleboxColumn createToggleboxColumn();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/cb2bea9a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorHelper.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorHelper.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorHelper.java
index eed5607..8261496 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorHelper.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorHelper.java
@@ -20,7 +20,6 @@
 package org.apache.isis.viewer.wicket.ui.components.collection.selector;
 
 import java.io.Serializable;
-import java.util.ArrayList;
 import java.util.List;
 import com.google.common.base.Predicate;
 import com.google.common.collect.Collections2;
@@ -45,9 +44,6 @@ public class CollectionSelectorHelper implements Serializable {
 
     static final String UIHINT_EVENT_VIEW_KEY = "view";
 
-    private static final ComponentFactory ignoreFactory = new CollectionContentsMultipleViewsPanelFactory();
-    private static final ComponentType componentType = ComponentType.COLLECTION_CONTENTS; // this.ignoreFactory.getComponentType();;
-
     private final EntityCollectionModel model;
     private final List<ComponentFactory> componentFactories;
 
@@ -55,23 +51,24 @@ public class CollectionSelectorHelper implements Serializable {
             final EntityCollectionModel model,
             final ComponentFactoryRegistry componentFactoryRegistry) {
         this.model = model;
-        this.componentFactories = findOtherComponentFactories(componentFactoryRegistry);
+        this.componentFactories = locateComponentFactories(componentFactoryRegistry);
     }
 
-    public List<ComponentFactory> findOtherComponentFactories(ComponentFactoryRegistry componentFactoryRegistry) {
-        if(componentFactories != null) {
-            return componentFactories;
-        }
-        final List<ComponentFactory> componentFactories = componentFactoryRegistry.findComponentFactories(componentType, model);
-        ArrayList<ComponentFactory> otherFactories = Lists.newArrayList(Collections2.filter(componentFactories, new Predicate<ComponentFactory>() {
+    private List<ComponentFactory> locateComponentFactories(ComponentFactoryRegistry componentFactoryRegistry) {
+        final List<ComponentFactory> componentFactories = componentFactoryRegistry.findComponentFactories(ComponentType.COLLECTION_CONTENTS, model);
+        List<ComponentFactory> otherFactories = Lists.newArrayList(Collections2.filter(componentFactories, new Predicate<ComponentFactory>() {
             @Override
             public boolean apply(final ComponentFactory input) {
-                return input != ignoreFactory && input.getClass() != CollectionContentsMultipleViewsPanelFactory.class;
+                return input.getClass() != CollectionContentsMultipleViewsPanelFactory.class;
             }
         }));
         return ordered(otherFactories);
     }
 
+    public List<ComponentFactory> getComponentFactories() {
+        return componentFactories;
+    }
+
     public int honourViewHintElseDefault(final Component component) {
         // honour hints ...
         final UiHintContainer hintContainer = getUiHintContainer(component);
@@ -100,6 +97,26 @@ public class CollectionSelectorHelper implements Serializable {
 
     //region > helpers
 
+    /**
+     * return the index of {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory unresolved panel} if present and not eager loading;
+     * else the index of {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory ajax table} if present,
+     * otherwise first factory.
+     */
+    private int determineInitialFactory() {
+        if(!hasRenderEagerlyFacet(model)) {
+            for(int i=0; i<componentFactories.size(); i++) {
+                if(componentFactories.get(i) instanceof CollectionContentsAsUnresolvedPanelFactory) {
+                    return i;
+                }
+            }
+        }
+        int ajaxTableIdx = findAjaxTable(componentFactories);
+        if(ajaxTableIdx>=0) {
+            return ajaxTableIdx;
+        }
+        return 0;
+    }
+
     private static List<ComponentFactory> ordered(List<ComponentFactory> componentFactories) {
         return orderAjaxTableToEnd(componentFactories);
     }
@@ -126,29 +143,6 @@ public class CollectionSelectorHelper implements Serializable {
     }
 
 
-
-
-
-    /**
-     * return the index of {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory unresolved panel} if present and not eager loading;
-     * else the index of {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory ajax table} if present,
-     * otherwise first factory.
-     */
-    protected int determineInitialFactory() {
-        if(!hasRenderEagerlyFacet(model)) {
-            for(int i=0; i<componentFactories.size(); i++) {
-                if(componentFactories.get(i) instanceof CollectionContentsAsUnresolvedPanelFactory) {
-                    return i;
-                }
-            }
-        }
-        int ajaxTableIdx = CollectionSelectorHelper.findAjaxTable(componentFactories);
-        if(ajaxTableIdx>=0) {
-            return ajaxTableIdx;
-        }
-        return 0;
-    }
-
     private static UiHintContainer getUiHintContainer(final Component component) {
         return UiHintContainer.Util.hintContainerOf(component);
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/cb2bea9a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorPanel.java
index 8cdc710..2033f3d 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorPanel.java
@@ -88,7 +88,7 @@ public class CollectionSelectorPanel
 
 
     private void addDropdown() {
-        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories(getComponentFactoryRegistry());
+        final List<ComponentFactory> componentFactories = selectorHelper.getComponentFactories();
         final int selected = selectorHelper.honourViewHintElseDefault(this);
 
         // selector

http://git-wip-us.apache.org/repos/asf/isis/blob/cb2bea9a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsHelper.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsHelper.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsHelper.java
deleted file mode 100644
index 0c2822f..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsHelper.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- *  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.collectioncontents.ajaxtable;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.List;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import org.apache.isis.applib.filter.Filters;
-import org.apache.isis.core.metamodel.spec.ActionType;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
-
-public class BulkActionsHelper implements Serializable {
-
-    private final EntityCollectionModel model;
-
-    private static final long serialVersionUID = 1L;
-
-    public BulkActionsHelper(final EntityCollectionModel model) {
-        this.model = model;
-    }
-
-    private EntityCollectionModel getModel() {
-        return model;
-    }
-
-    public List<ObjectAction> getBulkActions() {
-        final EntityCollectionModel model = getModel();
-
-        if(model.isParented()) {
-            return Collections.emptyList();
-        }
-
-        final ObjectSpecification typeSpec = model.getTypeOfSpecification();
-
-        List<ObjectAction> objectActions = typeSpec.getObjectActions(ActionType.USER, Contributed.INCLUDED, Filters.<ObjectAction>any());
-
-        if ( isExploring() || isPrototyping()) {
-            List<ObjectAction> explorationActions = typeSpec.getObjectActions(ActionType.EXPLORATION, Contributed.INCLUDED, Filters.<ObjectAction>any());
-            List<ObjectAction> prototypeActions = typeSpec.getObjectActions(ActionType.PROTOTYPE, Contributed.INCLUDED, Filters.<ObjectAction>any());
-            objectActions.addAll(explorationActions);
-            objectActions.addAll(prototypeActions);
-        }
-        if (isDebugMode()) {
-            List<ObjectAction> debugActions = typeSpec.getObjectActions(ActionType.DEBUG, Contributed.INCLUDED, Filters.<ObjectAction>any());
-            objectActions.addAll(debugActions);
-        }
-
-        List<ObjectAction> flattenedActions = objectActions;
-
-        return Lists.newArrayList(Iterables.filter(flattenedActions, BULK));
-    }
-
-
-    @SuppressWarnings("deprecation")
-    private static final Predicate<ObjectAction> BULK = Filters.asPredicate(ObjectAction.Filters.bulk());
-
-
-    //region > from context
-
-    public boolean isExploring() {
-        return IsisContext.getDeploymentType().isExploring();
-    }
-    public boolean isPrototyping() {
-        return IsisContext.getDeploymentType().isPrototyping();
-    }
-
-    /**
-     * Protected so can be overridden in testing if required.
-     */
-    protected boolean isDebugMode() {
-        // TODO: need to figure out how to switch into debug mode;
-        // probably call a Debug toggle page, and stuff into
-        // Session.getMetaData()
-        return true;
-    }
-
-    //endregion
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/cb2bea9a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsLinkFactory.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsLinkFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsLinkFactory.java
deleted file mode 100644
index efc68c1..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsLinkFactory.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- *  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.collectioncontents.ajaxtable;
-
-import java.util.List;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import org.apache.wicket.Session;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.link.Link;
-import org.apache.isis.applib.RecoverableException;
-import org.apache.isis.applib.annotation.Bulk;
-import org.apache.isis.applib.annotation.Bulk.InteractionContext.InvokedAs;
-import org.apache.isis.applib.services.command.Command;
-import org.apache.isis.applib.services.command.Command.Executor;
-import org.apache.isis.applib.services.command.CommandContext;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider;
-import org.apache.isis.core.commons.authentication.MessageBroker;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking;
-import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
-import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
-import org.apache.isis.viewer.wicket.model.mementos.ActionMemento;
-import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
-import org.apache.isis.viewer.wicket.model.models.ActionModel;
-import org.apache.isis.viewer.wicket.model.models.ActionPromptProvider;
-import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
-import org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponse;
-import org.apache.isis.viewer.wicket.ui.actionresponse.ActionResultResponseType;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ObjectAdapterToggleboxColumn;
-import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.ActionLinkFactory;
-import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.CssMenuItem;
-import org.apache.isis.viewer.wicket.ui.errors.JGrowlBehaviour;
-
-public final class BulkActionsLinkFactory implements ActionLinkFactory {
-    
-    private static final long serialVersionUID = 1L;
-    private final EntityCollectionModel model;
-    
-    private final ObjectAdapterToggleboxColumn toggleboxColumn;
-
-    public BulkActionsLinkFactory(
-            final EntityCollectionModel model,
-            final ObjectAdapterToggleboxColumn toggleboxColumn) {
-        this.model = model;
-        this.toggleboxColumn = toggleboxColumn;
-    }
-
-
-    @Override
-    public LinkAndLabel newLink(
-            final ObjectAdapterMemento serviceAdapterMemento,
-            final ObjectAction objectAction,
-            final String linkId,
-            final ActionPromptProvider actionPromptProvider) {
-        
-        final ActionMemento actionMemento = new ActionMemento(objectAction);
-        final AbstractLink link = new Link<Object>(linkId) {
-            
-            private static final long serialVersionUID = 1L;
-
-            @Override
-            public void onClick() {
-                final ObjectAction objectAction = actionMemento.getAction();
-                final ConcurrencyChecking concurrencyChecking = 
-                        ConcurrencyChecking.concurrencyCheckingFor(objectAction.getSemantics());
-
-                try {
-                    final List<ObjectAdapterMemento> toggleMementosList = model.getToggleMementosList();
-
-                    final Iterable<ObjectAdapter> toggledAdapters = 
-                            Iterables.transform(toggleMementosList, ObjectAdapterMemento.Functions.fromMemento(concurrencyChecking));
-                    
-                    final List<Object> domainObjects = Lists.newArrayList(Iterables.transform(toggledAdapters, ObjectAdapter.Functions.getObject()));
-                    
-                    
-                    final Bulk.InteractionContext bulkInteractionContext = Bulk.InteractionContext.current.get();
-                    if (bulkInteractionContext != null) {
-                        bulkInteractionContext.setInvokedAs(InvokedAs.BULK);
-                        bulkInteractionContext.setDomainObjects(domainObjects);
-                    }
-                    
-                    final CommandContext commandContext = getServicesInjector().lookupService(CommandContext.class);
-                    final Command command;
-                    if (commandContext != null) {
-                        command = commandContext.getCommand();
-                        command.setExecutor(Executor.USER);
-                    }
-
-
-                    ObjectAdapter lastReturnedAdapter = null;
-                    int i=0;
-                    for(final ObjectAdapter adapter : toggledAdapters) {
-    
-                        int numParameters = objectAction.getParameterCount();
-                        if(numParameters != 0) {
-                            return;
-                        }
-                        if (bulkInteractionContext != null) {
-                            bulkInteractionContext.setIndex(i++);
-                        }
-
-                        lastReturnedAdapter = objectAction.executeWithRuleChecking(adapter, new ObjectAdapter[]{}, getAuthenticationSession(), ActionModel.WHERE_FOR_ACTION_INVOCATION);
-                    }
-
-
-                    
-                    model.clearToggleMementosList();
-                    toggleboxColumn.clearToggles();
-                    final ActionModel actionModelHint = model.getActionModelHint();
-                    if(actionModelHint != null && actionModelHint.getActionMemento().getAction().getSemantics().isIdempotentInNature()) {
-                        ObjectAdapter resultAdapter = actionModelHint.getObject();
-                        model.setObjectList(resultAdapter);
-                    } else {
-                        model.setObject(persistentAdaptersWithin(model.getObject()));
-                    }
-                    
-                    if(lastReturnedAdapter != null) {
-                        final ActionResultResponse resultResponse = 
-                                ActionResultResponseType.determineAndInterpretResult(actionModelHint, null, lastReturnedAdapter);
-                        resultResponse.getHandlingStrategy().handleResults(this, resultResponse);
-                    }
-
-                } catch(final ConcurrencyException ex) {
-                    
-                    recover();
-                    // display a warning to the user so that they know that the action wasn't performed
-                    getMessageBroker().addWarning(ex.getMessage());
-                    return;
-
-                } catch(final RuntimeException ex) {
-                    
-                    final RecoverableException appEx = ActionModel.getApplicationExceptionIfAny(ex);
-                    if (appEx != null) {
-
-                        recover();
-                        
-                        getMessageBroker().setApplicationError(appEx.getMessage());
-                        
-                        // there's no need to abort the transaction, it will have already been done
-                        // (in IsisTransactionManager#executeWithinTransaction(...)). 
-                        return;
-                    } 
-                    throw ex;
-                }
-            }
-            
-            private void recover() {
-                // resync with the objectstore
-                final List<ObjectAdapterMemento> toggleMementosList = Lists.newArrayList(model.getToggleMementosList());
-                for (ObjectAdapterMemento oam : toggleMementosList) {
-                    // just requesting the adapter will sync the OAM's version with the objectstore
-                    oam.getObjectAdapter(ConcurrencyChecking.NO_CHECK);
-                }
-                
-                // discard any adapters that might have been deleted
-                model.setObject(persistentAdaptersWithin(model.getObject()));
-                
-                // attempt to preserve the toggled adapters
-                final List<ObjectAdapter> adapters = model.getObject();
-                model.clearToggleMementosList();
-                for (ObjectAdapterMemento oam : toggleMementosList) {
-                    final ObjectAdapter objectAdapter = oam.getObjectAdapter(ConcurrencyChecking.NO_CHECK);
-                    if(adapters.contains(objectAdapter)) {
-                        // in case it has been deleted...
-                        model.toggleSelectionOn(objectAdapter);
-                    }
-                }
-            }
-
-            private List<ObjectAdapter> persistentAdaptersWithin(List<ObjectAdapter> adapters) {
-                return Lists.newArrayList(Iterables.filter(adapters, new Predicate<ObjectAdapter>() {
-                    @Override
-                    public boolean apply(ObjectAdapter input) {
-                        return !input.isTransient() && !input.isDestroyed();
-                    }
-                }));
-            }
-
-        };
-        link.add(new JGrowlBehaviour());
-        final boolean explorationOrPrototype = CssMenuItem.isExplorationOrPrototype(objectAction);
-        final String actionIdentifier = CssMenuItem.actionIdentifierFor(objectAction);
-        final String cssClass = CssMenuItem.cssClassFor(objectAction);
-        final String cssClassFa = CssMenuItem.cssClassFaFor(objectAction);
-
-        return new LinkAndLabel(link, objectAction.getName(), null, false, explorationOrPrototype, actionIdentifier, cssClass, cssClassFa);
-    }
-    
-    
-    ///////////////////////////////////////////////////////
-    // Dependencies (from context)
-    ///////////////////////////////////////////////////////
-
-    public AuthenticationSession getAuthenticationSession() {
-        final AuthenticationSessionProvider asa = (AuthenticationSessionProvider) Session.get();
-        return asa.getAuthenticationSession();
-    }
-
-    protected MessageBroker getMessageBroker() {
-        return getAuthenticationSession().getMessageBroker();
-    }
-
-    protected ServicesInjector getServicesInjector() {
-        return IsisContext.getPersistenceSession().getServicesInjector();
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/cb2bea9a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsProvider.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsProvider.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsProvider.java
deleted file mode 100644
index 2ab87a3..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsProvider.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  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.collectioncontents.ajaxtable;
-
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ObjectAdapterToggleboxColumn;
-
-public interface BulkActionsProvider {
-
-    void configureBulkActionsProvider(ObjectAdapterToggleboxColumn toggleboxColumn);
-
-    ObjectAdapterToggleboxColumn createToggleboxColumn();
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/cb2bea9a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
index b53427b..6158ba3 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
@@ -40,11 +40,13 @@ import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.Contributed;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.viewer.wicket.model.common.SelectionHandler;
+import org.apache.isis.viewer.wicket.model.common.OnConcurrencyExceptionHandler;
 import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
 import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings;
 import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
 import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+import org.apache.isis.viewer.wicket.ui.components.collection.bulk.BulkActionsHelper;
+import org.apache.isis.viewer.wicket.ui.components.collection.bulk.BulkActionsProvider;
 import org.apache.isis.viewer.wicket.ui.components.collection.count.CollectionCountProvider;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ColumnAbstract;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ObjectAdapterPropertyColumn;
@@ -91,41 +93,13 @@ public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityColl
         ObjectAdapterToggleboxColumn toggleboxColumn = null;
         if(bulkActionsProvider != null) {
 
-//            List<ObjectAction> bulkActions = bulkActionsProvider.getBulkActions();
-//            if(!bulkActions.isEmpty()) {
-
             toggleboxColumn = bulkActionsProvider.createToggleboxColumn();
             if(toggleboxColumn != null) {
                 columns.add(toggleboxColumn);
             }
-            bulkActionsProvider.configureBulkActionsProvider(toggleboxColumn);
-
-//            }
-
+            bulkActionsProvider.configureBulkActions(toggleboxColumn);
         }
 
-//        } else {
-//        if(bulkActions.isEmpty() || getModel().isParented()) {
-//            //permanentlyHide(ID_ENTITY_ACTIONS);
-//            getBulkActionsProvider().configureBulkActionsProvider(null, null);
-//        } else {
-
-//            actionLinkFactoryDelegating = new ActionLinkFactoryDelegating();
-//            actionPromptProviderDelegating = new ActionPromptProviderDelegating();
-
-            //getBulkActionsProvider().configureBulkActionsProvider(linkFactory, this);
-//            getBulkActionsProvider().configureBulkActionsProvider(linkFactory, null);
-
-//            final CssMenuBuilder cssMenuBuilder = new CssMenuBuilder(null, bulkActions, actionLinkFactoryDelegating, actionPromptProviderDelegating, null);
-//            final CssMenuPanel cssMenuPanel = cssMenuBuilder.buildPanel(ID_ENTITY_ACTIONS, "Actions");
-//
-//            this.addOrReplace(cssMenuPanel);
-
-  //      }
-
-        //List<ObjectAction> bulkActions = bulkActionsHelper.getBulkActions();
-
-
         final EntityCollectionModel model = getModel();
         addTitleColumn(columns, model.getParentObjectAdapterMemento(), getSettings().getMaxTitleLengthInStandaloneTables(), getSettings().getMaxTitleLengthInStandaloneTables());
         addPropertyColumnsIfRequired(columns);
@@ -136,19 +110,11 @@ public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityColl
         dataTable.honourHints();
 
         if(toggleboxColumn != null) {
-            final SelectionHandler handler = new SelectionHandler() {
+            final OnConcurrencyExceptionHandler handler2 = new OnConcurrencyExceptionHandler() {
 
                 private static final long serialVersionUID = 1L;
 
                 @Override
-                public void onSelected(
-                        final Component context,
-                        final ObjectAdapter selectedAdapter,
-                        final AjaxRequestTarget ajaxRequestTarget) {
-                    model.toggleSelectionOn(selectedAdapter);
-                }
-
-                @Override
                 public void onConcurrencyException(
                         final Component context,
                         final ObjectAdapter selectedAdapter,
@@ -164,11 +130,8 @@ public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityColl
                     ajaxRequestTarget.add(dataTable);
                 }
             };
-            toggleboxColumn.setHandler(handler);
+            toggleboxColumn.setOnConcurrencyExceptionHandler(handler2);
         }
-
-        //addActionPromptModalWindow();
-
     }
 
     private BulkActionsProvider getBulkActionsProvider() {

http://git-wip-us.apache.org/repos/asf/isis/blob/cb2bea9a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/columns/ObjectAdapterToggleboxColumn.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/columns/ObjectAdapterToggleboxColumn.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/columns/ObjectAdapterToggleboxColumn.java
index 31bb8ce..612abcd 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/columns/ObjectAdapterToggleboxColumn.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/columns/ObjectAdapterToggleboxColumn.java
@@ -30,7 +30,8 @@ import org.apache.wicket.model.IModel;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking;
 import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
-import org.apache.isis.viewer.wicket.model.common.SelectionHandler;
+import org.apache.isis.viewer.wicket.model.common.OnConcurrencyExceptionHandler;
+import org.apache.isis.viewer.wicket.model.common.OnSelectionHandler;
 import org.apache.isis.viewer.wicket.model.models.EntityModel;
 import org.apache.isis.viewer.wicket.ui.components.widgets.checkbox.ContainedToggleboxPanel;
 import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
@@ -39,21 +40,43 @@ public final class ObjectAdapterToggleboxColumn extends ColumnAbstract<ObjectAda
 
     private static final long serialVersionUID = 1L;
 
-    private SelectionHandler handler;
 
     public ObjectAdapterToggleboxColumn() {
-        this(null);
+        this(null, null);
     }
     
-    public ObjectAdapterToggleboxColumn(final SelectionHandler handler) {
+    public ObjectAdapterToggleboxColumn(
+            final OnSelectionHandler onSelectionHandler,
+            final OnConcurrencyExceptionHandler onConcurrencyExceptionHandler) {
         super("");
-        this.handler = handler;
+        this.onSelectionHandler = onSelectionHandler;
+        this.onConcurrencyExceptionHandler = onConcurrencyExceptionHandler;
     }
 
-    public void setHandler(SelectionHandler handler) {
-        this.handler = handler;
+    //region > OnSelectionHandler
+    private OnSelectionHandler onSelectionHandler;
+    public OnSelectionHandler getOnSelectionHandler() {
+        return onSelectionHandler;
     }
 
+    public void setOnSelectionHandler(OnSelectionHandler onSelectionHandler) {
+        this.onSelectionHandler = onSelectionHandler;
+    }
+    //endregion
+
+    //region > OnConcurrencyExceptionHandler
+
+    private OnConcurrencyExceptionHandler onConcurrencyExceptionHandler;
+    public OnConcurrencyExceptionHandler getOnConcurrencyExceptionHandler() {
+        return onConcurrencyExceptionHandler;
+    }
+
+    public void setOnConcurrencyExceptionHandler(OnConcurrencyExceptionHandler onConcurrencyExceptionHandler) {
+        this.onConcurrencyExceptionHandler = onConcurrencyExceptionHandler;
+    }
+    //endregion
+
+
     @Override
     public Component getHeader(String componentId) {
         
@@ -90,15 +113,15 @@ public final class ObjectAdapterToggleboxColumn extends ColumnAbstract<ObjectAda
                 ObjectAdapter selectedAdapter = null;
                 try {
                     selectedAdapter = entityModel.load(ConcurrencyChecking.CHECK);
-                    if(handler != null) {
-                        handler.onSelected(this, selectedAdapter, target);
+                    if(onSelectionHandler != null) {
+                        onSelectionHandler.onSelected(this, selectedAdapter, target);
                     }
                 } catch(ConcurrencyException ex) {
 
                     // should work second time, because the previous attempt will have updated the OAM's OIDs version.
                     selectedAdapter = entityModel.load(ConcurrencyChecking.CHECK);
-                    if(handler != null) {
-                        handler.onConcurrencyException(this, selectedAdapter, ex, target);
+                    if(onConcurrencyExceptionHandler != null) {
+                        onConcurrencyExceptionHandler.onConcurrencyException(this, selectedAdapter, ex, target);
                     }
                     
                     entityModel.setException(ex);

http://git-wip-us.apache.org/repos/asf/isis/blob/cb2bea9a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java
index e4a37b3..0a7019e 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java
@@ -91,12 +91,15 @@ public class CollectionContentsMultipleViewsPanel
     private void addUnderlyingViews() {
         final EntityCollectionModel model = getModel();
 
-        final int selected = selectorHelper.honourViewHintElseDefault(getSelectorDropdownPanel());
-        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories(getComponentFactoryRegistry());
+        final CollectionSelectorPanel selectorDropdownPanelIfAny = getSelectorDropdownPanel();
+        final int selected = selectorDropdownPanelIfAny != null
+                ? selectorHelper.honourViewHintElseDefault(selectorDropdownPanelIfAny)
+                : 0;
+        final List<ComponentFactory> componentFactories = selectorHelper.getComponentFactories();
 
         // create all, hide the one not selected
-        underlyingViews = new Component[MAX_NUM_UNDERLYING_VIEWS];
         int i = 0;
+        underlyingViews = new Component[MAX_NUM_UNDERLYING_VIEWS];
         final EntityCollectionModel emptyModel = model.asDummy();
         for (ComponentFactory componentFactory : componentFactories) {
             final String underlyingId = underlyingIdPrefix + "-" + i;
@@ -106,6 +109,12 @@ public class CollectionContentsMultipleViewsPanel
             this.addOrReplace(underlyingView);
         }
 
+        if(selectorDropdownPanelIfAny != null) {
+
+        } else {
+
+        }
+
         // hide any unused placeholders
         while(i<MAX_NUM_UNDERLYING_VIEWS) {
             String underlyingId = underlyingIdPrefix + "-" + i;
@@ -138,9 +147,15 @@ public class CollectionContentsMultipleViewsPanel
         final UiHintContainer uiHintContainer = uiHintEvent.getUiHintContainer();
 
         int underlyingViewNum = 0;
-        String viewStr = uiHintContainer.getHint(this.getSelectorDropdownPanel(), UIHINT_VIEW);
+        final CollectionSelectorPanel selectorDropdownPanel = this.getSelectorDropdownPanel();
+        if(selectorDropdownPanel == null) {
+            // not expected, because this event shouldn't be called.
+            // but no harm in simply returning...
+            return;
+        }
+        String viewStr = uiHintContainer.getHint(selectorDropdownPanel, UIHINT_VIEW);
 
-        List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories(getComponentFactoryRegistry());
+        List<ComponentFactory> componentFactories = selectorHelper.getComponentFactories();
 
         if(viewStr != null) {
             try {
@@ -170,7 +185,7 @@ public class CollectionContentsMultipleViewsPanel
 
         final AjaxRequestTarget target = uiHintEvent.getTarget();
         if(target != null) {
-            target.add(this, getSelectorDropdownPanel());
+            target.add(this, selectorDropdownPanel);
         }
 
     }
@@ -205,18 +220,15 @@ public class CollectionContentsMultipleViewsPanel
     /**
      * Searches up the component hierarchy looking for a parent that implements
      * {@link org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorProvider}.
-     * @return
+     *
+     * @return the panel, or null (if there are no alternative views)
      */
     private CollectionSelectorPanel getSelectorDropdownPanel() {
         Component component = this;
         while(component != null) {
             if(component instanceof CollectionSelectorProvider) {
-                final CollectionSelectorPanel selectorDropdownPanel1 = ((CollectionSelectorProvider) component).getSelectorDropdownPanel();
-                if(selectorDropdownPanel1 == null) {
-                    throw new IllegalStateException("Found parent that implements HasSelectorDropdownPanel, but no SelectorDropdownPanel available (is null)");
-
-                }
-                return selectorDropdownPanel1;
+                final CollectionSelectorPanel selectorDropdownPanelIfAny = ((CollectionSelectorProvider) component).getSelectorDropdownPanel();
+                return selectorDropdownPanelIfAny;
             }
             component = component.getParent();
         }

http://git-wip-us.apache.org/repos/asf/isis/blob/cb2bea9a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
index beee965..93288b1 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
@@ -130,7 +130,7 @@ public class EntityCollectionsPanel extends PanelAbstract<EntityModel> {
 
         final CollectionSelectorHelper selectorHelper = new CollectionSelectorHelper(entityCollectionModel, getComponentFactoryRegistry());
 
-        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories(getComponentFactoryRegistry());
+        final List<ComponentFactory> componentFactories = selectorHelper.getComponentFactories();
 
         if (componentFactories.size() <= 1) {
             permanentlyHide(ID_SELECTOR_DROPDOWN);

http://git-wip-us.apache.org/repos/asf/isis/blob/cb2bea9a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
index a4e76ce..0473974 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
@@ -20,9 +20,13 @@
 package org.apache.isis.viewer.wicket.ui.components.standalonecollection;
 
 import java.util.List;
+import org.apache.wicket.Component;
+import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.model.Model;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.viewer.wicket.model.common.OnSelectionHandler;
 import org.apache.isis.viewer.wicket.model.models.ActionModel;
 import org.apache.isis.viewer.wicket.model.models.ActionPromptProvider;
 import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
@@ -34,12 +38,11 @@ import org.apache.isis.viewer.wicket.ui.components.collection.count.CollectionCo
 import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorHelper;
 import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorPanel;
 import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorProvider;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.BulkActionsHelper;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.BulkActionsLinkFactory;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.BulkActionsProvider;
+import org.apache.isis.viewer.wicket.ui.components.collection.bulk.BulkActionsHelper;
+import org.apache.isis.viewer.wicket.ui.components.collection.bulk.BulkActionsLinkFactory;
+import org.apache.isis.viewer.wicket.ui.components.collection.bulk.BulkActionsProvider;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ObjectAdapterToggleboxColumn;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.multiple.CollectionContentsMultipleViewsPanelFactory;
-import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.ActionLinkFactory;
 import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.CssMenuBuilder;
 import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.CssMenuPanel;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
@@ -66,30 +69,23 @@ public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionMod
         bulkActionsHelper = new BulkActionsHelper(entityCollectionModel);
     }
 
+    /**
+     * note that the bulk actions components are added in {@link #configureBulkActions(org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ObjectAdapterToggleboxColumn)}.
+     */
     private void buildGui(final EntityCollectionModel entityCollectionModel) {
 
         ActionModel actionModel = entityCollectionModel.getActionModelHint();
         ObjectAction action = actionModel.getActionMemento().getAction();
         addOrReplace(new Label(StandaloneCollectionPanel.ID_ACTION_NAME, Model.of(action.getName())));
 
-        final CollectionSelectorHelper selectorHelper = new CollectionSelectorHelper(entityCollectionModel, getComponentFactoryRegistry());
-
-        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories(getComponentFactoryRegistry());
-
-
-
-        addActionPromptModalWindow();
-
-        // bulkactions ... in configureBulkActionsProvider
+        // action prompt
+        this.actionPromptModalWindow = ActionPromptModalWindow.newModalWindow(ID_ACTION_PROMPT_MODAL_WINDOW);
+        addOrReplace(actionPromptModalWindow);
 
-//        List<ObjectAction> bulkActions = bulkActionsHelper.getBulkActions();
-//
-//        if(bulkActions.isEmpty() || getModel().isParented()) {
-//            permanentlyHide(ID_ENTITY_ACTIONS);
-//        } else {
-//
-//        }
+        // selector
+        final CollectionSelectorHelper selectorHelper = new CollectionSelectorHelper(entityCollectionModel, getComponentFactoryRegistry());
 
+        final List<ComponentFactory> componentFactories = selectorHelper.getComponentFactories();
 
         if (componentFactories.size() <= 1) {
             permanentlyHide(ID_SELECTOR_DROPDOWN);
@@ -114,19 +110,6 @@ public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionMod
         componentFactoryRegistry.addOrReplaceComponent(this, ComponentType.COLLECTION_CONTENTS, entityCollectionModel);
     }
 
-    @Override
-    public Integer getCount() {
-        final EntityCollectionModel model = getModel();
-        return model.getCount();
-    }
-
-    @Override
-    public CollectionSelectorPanel getSelectorDropdownPanel() {
-        return selectorDropdownPanel;
-    }
-
-
-
     //region > ActionPromptModalWindowProvider
 
     private ActionPromptModalWindow actionPromptModalWindow;
@@ -134,97 +117,73 @@ public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionMod
         return ActionPromptModalWindow.getActionPromptModalWindowIfEnabled(actionPromptModalWindow);
     }
 
-    private void addActionPromptModalWindow() {
-        this.actionPromptModalWindow = ActionPromptModalWindow.newModalWindow(ID_ACTION_PROMPT_MODAL_WINDOW);
-        addOrReplace(actionPromptModalWindow);
-    }
-
     //endregion
 
-
-
+    //region > BulkActionsProvider
 
     @Override
-    public void configureBulkActionsProvider(ObjectAdapterToggleboxColumn toggleboxColumn) {
-        BulkActionsLinkFactory linkFactory = new BulkActionsLinkFactory(getModel(), toggleboxColumn);
-        configureBulkActionsProvider(linkFactory, this);
-    }
+    public ObjectAdapterToggleboxColumn createToggleboxColumn() {
 
-    private void configureBulkActionsProvider(
-            final ActionLinkFactory linkFactory,
-            final ActionPromptProvider actionPromptProvider) {
+        final List<ObjectAction> bulkActions = bulkActionsHelper.getBulkActions();
 
-        if(linkFactory != null) {
-            final List<ObjectAction> bulkActions = bulkActionsHelper.getBulkActions();
+        final EntityCollectionModel entityCollectionModel = getModel();
+        if(bulkActions.isEmpty() || entityCollectionModel.isParented()) {
+            return null;
+        }
 
-            final CssMenuBuilder cssMenuBuilder = new CssMenuBuilder(null, bulkActions, linkFactory, actionPromptProvider != null? actionPromptProvider: this, null);
-            final CssMenuPanel cssMenuPanel = cssMenuBuilder.buildPanel(ID_ENTITY_ACTIONS, "Actions");
+        final ObjectAdapterToggleboxColumn toggleboxColumn = new ObjectAdapterToggleboxColumn();
+        final OnSelectionHandler handler = new OnSelectionHandler() {
 
-            addOrReplace(cssMenuPanel);
+            private static final long serialVersionUID = 1L;
 
-        } else {
-            permanentlyHide(ID_ENTITY_ACTIONS);
+            @Override
+            public void onSelected(
+                    final Component context,
+                    final ObjectAdapter selectedAdapter,
+                    final AjaxRequestTarget ajaxRequestTarget) {
+                getModel().toggleSelectionOn(selectedAdapter);
+            }
 
-        }
+        };
+        toggleboxColumn.setOnSelectionHandler(handler);
+
+        return toggleboxColumn;
     }
 
+    @Override
+    public void configureBulkActions(final ObjectAdapterToggleboxColumn toggleboxColumn) {
 
-    private List<ObjectAction> getBulkActions() {
-        return bulkActionsHelper.getBulkActions();
-    }
+        final BulkActionsLinkFactory linkFactory =
+                new BulkActionsLinkFactory(getModel(), toggleboxColumn);
+
+        final List<ObjectAction> bulkActions = bulkActionsHelper.getBulkActions();
 
-//    public static class ActionLinkFactoryDelegating implements ActionLinkFactory {
-//
-//        private ActionLinkFactory delegate;
-//
-//        public ActionLinkFactory getDelegate() {
-//            return delegate;
-//        }
-//
-//        public void setDelegate(ActionLinkFactory delegate) {
-//            this.delegate = delegate;
-//        }
-//
-//        @Override
-//        public LinkAndLabel newLink(
-//                final ObjectAdapterMemento adapter,
-//                final ObjectAction noAction,
-//                final String linkId,
-//                final ActionPromptProvider actionPromptProvider) {
-//            return delegate.newLink(adapter, noAction, linkId, actionPromptProvider);
-//        }
-//    }
-//
-//    public static class ActionPromptProviderDelegating implements ActionPromptProvider {
-//
-//        private ActionPromptProvider delegate;
-//
-//        public ActionPromptProvider getDelegate() {
-//            return delegate;
-//        }
-//
-//        public void setDelegate(ActionPromptProvider delegate) {
-//            this.delegate = delegate;
-//        }
-//
-//        @Override
-//        public ActionPrompt getActionPrompt() {
-//            return delegate.getActionPrompt();
-//        }
-//    }
+        final CssMenuBuilder cssMenuBuilder =
+                new CssMenuBuilder(null, bulkActions, linkFactory, this, null);
+        final CssMenuPanel cssMenuPanel = cssMenuBuilder.buildPanel(ID_ENTITY_ACTIONS, "Actions");
 
+        addOrReplace(cssMenuPanel);
+
+    }
+    //endregion
+
+    //region > CollectionSelectorProvider
 
     @Override
-    public ObjectAdapterToggleboxColumn createToggleboxColumn() {
+    public CollectionSelectorPanel getSelectorDropdownPanel() {
+        return selectorDropdownPanel;
+    }
 
-        final List<ObjectAction> bulkActions = getBulkActions();
+    //endregion
 
-        final EntityCollectionModel entityCollectionModel = getModel();
-        if(bulkActions.isEmpty() || entityCollectionModel.isParented()) {
-            return null;
-        }
+    //region > CollectionCountProvider
 
-        return new ObjectAdapterToggleboxColumn();
+    @Override
+    public Integer getCount() {
+        final EntityCollectionModel model = getModel();
+        return model.getCount();
     }
 
+    //endregion
+
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/cb2bea9a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/ActionLinkFactoryAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/ActionLinkFactoryAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/ActionLinkFactoryAbstract.java
index 1a19d48..1cced6d 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/ActionLinkFactoryAbstract.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/ActionLinkFactoryAbstract.java
@@ -86,7 +86,8 @@ public abstract class ActionLinkFactoryAbstract implements ActionLinkFactory {
      */
     protected AbstractLink newLink(
             final String linkId,
-            final ObjectAdapter objectAdapter, final ObjectAction action,
+            final ObjectAdapter objectAdapter,
+            final ObjectAction action,
             final ActionPromptProvider actionPromptProvider) {
         
         final ActionPrompt actionPrompt = actionPromptProvider.getActionPrompt();


[38/44] isis git commit: ISIS-537: can now select different views for standalone collections.

Posted by da...@apache.org.
ISIS-537: can now select different views for standalone collections.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/c1f5281d
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/c1f5281d
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/c1f5281d

Branch: refs/heads/master
Commit: c1f5281d97ba77fa9055f99ec650654f977cf641
Parents: cb2bea9
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Nov 10 20:37:13 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 20:37:13 2014 +0000

----------------------------------------------------------------------
 .../model/models/EntityCollectionModel.java     |  2 -
 .../viewer/wicket/model/models/EntityModel.java | 72 +------------------
 .../wicket/model/models/ModelAbstract.java      | 76 +++++++++++++++++++-
 3 files changed, 78 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/c1f5281d/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityCollectionModel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityCollectionModel.java b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityCollectionModel.java
index 41c831b..6afdecd 100644
--- a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityCollectionModel.java
+++ b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityCollectionModel.java
@@ -23,11 +23,9 @@ import java.io.Serializable;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
-
 import com.google.common.base.Function;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
-
 import org.apache.isis.core.commons.factory.InstanceUtil;
 import org.apache.isis.core.commons.lang.ClassUtil;
 import org.apache.isis.core.commons.lang.Closure;

http://git-wip-us.apache.org/repos/asf/isis/blob/c1f5281d/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
index 6c66859..e293e9b 100644
--- a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
+++ b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
@@ -23,11 +23,8 @@ import java.io.Serializable;
 import java.util.Map;
 import java.util.Set;
 import com.google.common.collect.Maps;
-import org.apache.wicket.Component;
 import org.apache.wicket.model.Model;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.util.string.PrependingStringBuffer;
-import org.apache.wicket.util.string.Strings;
 import org.apache.isis.applib.annotation.BookmarkPolicy;
 import org.apache.isis.applib.services.memento.MementoService.Memento;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -46,8 +43,6 @@ import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
 import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
 import org.apache.isis.core.runtime.services.memento.MementoServiceDefault;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
-import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
 import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
 import org.apache.isis.viewer.wicket.model.mementos.PageParameterNames;
 import org.apache.isis.viewer.wicket.model.mementos.PropertyMemento;
@@ -59,7 +54,7 @@ import org.apache.isis.viewer.wicket.model.mementos.PropertyMemento;
  * So that the model is {@link Serializable}, the {@link ObjectAdapter} is
  * stored as a {@link ObjectAdapterMemento}.
  */
-public class EntityModel extends BookmarkableModel<ObjectAdapter> implements UiHintContainer {
+public class EntityModel extends BookmarkableModel<ObjectAdapter> {
 
     private static final long serialVersionUID = 1L;
     
@@ -154,7 +149,7 @@ public class EntityModel extends BookmarkableModel<ObjectAdapter> implements UiH
 
     public EntityModel(final PageParameters pageParameters) {
         this(ObjectAdapterMemento.createPersistent(rootOidFrom(pageParameters)));
-        hintPageParameterSerializer.pageParametersToHints(pageParameters, this.hints);
+        hintPageParameterSerializer.pageParametersToHints(pageParameters, getHints());
     }
     public EntityModel(final ObjectAdapter adapter) {
         this(ObjectAdapterMemento.createOrNull(adapter));
@@ -183,7 +178,7 @@ public class EntityModel extends BookmarkableModel<ObjectAdapter> implements UiH
     @Override
     public PageParameters getPageParameters() {
         PageParameters pageParameters = createPageParameters(getObject());
-        hintPageParameterSerializer.hintsToPageParameters(hints, pageParameters);
+        hintPageParameterSerializer.hintsToPageParameters(getHints(), pageParameters);
         return pageParameters;
     }
 
@@ -466,67 +461,6 @@ public class EntityModel extends BookmarkableModel<ObjectAdapter> implements UiH
 
     
     
-    // //////////////////////////////////////////////////////////
-    // Hint support
-    // //////////////////////////////////////////////////////////
-    
-    private final Map<String, String> hints = Maps.newTreeMap();
-    
-    public String getHint(final Component component, final String key) {
-        if(component == null) {
-            return null;
-        }
-        String hintKey = hintKey(component, key);
-        return hints.get(hintKey);
-    }
-    
-    @Override
-    public void setHint(Component component, String key, String value) {
-        if(component == null) {
-            return;
-        }
-        String hintKey = hintKey(component, key);
-        if(value != null) {
-            hints.put(hintKey, value);
-        } else {
-            clearHint(component, hintKey);
-        }
-    }
-
-    @Override
-    public void clearHint(Component component, String key) {
-        if(component == null) {
-            return;
-        }
-        String hintKey = hintKey(component, key);
-        hints.remove(hintKey);
-    }
-
-    
-    private static String hintKey(Component component, String key) {
-        return hintPathFor(component) + "-" + key;
-    }
-
-    private static String hintPathFor(Component component)
-    {
-        return Strings.afterFirstPathComponent(fullHintPathFor(component), Component.PATH_SEPARATOR);
-    }
-
-    private static String fullHintPathFor(Component component)
-    {
-        final PrependingStringBuffer buffer = new PrependingStringBuffer(32);
-        for (Component c = component; c != null; c = c.getParent())
-        {
-            if(c instanceof UiHintPathSignificant) {
-                if (buffer.length() > 0)
-                {
-                    buffer.prepend(Component.PATH_SEPARATOR);
-                }
-                buffer.prepend(c.getId());
-            }
-        }
-        return buffer.toString();
-    }
 
     
     // //////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/isis/blob/c1f5281d/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ModelAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ModelAbstract.java b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ModelAbstract.java
index 4556cd2..8e65177 100644
--- a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ModelAbstract.java
+++ b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ModelAbstract.java
@@ -20,18 +20,25 @@
 package org.apache.isis.viewer.wicket.model.models;
 
 import java.util.List;
+import java.util.Map;
+import com.google.common.collect.Maps;
+import org.apache.wicket.Component;
 import org.apache.wicket.model.LoadableDetachableModel;
+import org.apache.wicket.util.string.PrependingStringBuffer;
+import org.apache.wicket.util.string.Strings;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
+import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
+import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
 
 /**
  * Adapter for {@link LoadableDetachableModel}s, providing access to some of the
  * Isis' dependencies.
  */
-public abstract class ModelAbstract<T> extends LoadableDetachableModel<T> {
+public abstract class ModelAbstract<T> extends LoadableDetachableModel<T> implements UiHintContainer {
 
     private static final long serialVersionUID = 1L;
 
@@ -42,6 +49,73 @@ public abstract class ModelAbstract<T> extends LoadableDetachableModel<T> {
         super(t);
     }
 
+
+    // //////////////////////////////////////////////////////////
+    // Hint support
+    // //////////////////////////////////////////////////////////
+
+    private final Map<String, String> hints = Maps.newTreeMap();
+
+    public String getHint(final Component component, final String key) {
+        if(component == null) {
+            return null;
+        }
+        String hintKey = hintKey(component, key);
+        return hints.get(hintKey);
+    }
+
+    @Override
+    public void setHint(Component component, String key, String value) {
+        if(component == null) {
+            return;
+        }
+        String hintKey = hintKey(component, key);
+        if(value != null) {
+            hints.put(hintKey, value);
+        } else {
+            clearHint(component, hintKey);
+        }
+    }
+
+    @Override
+    public void clearHint(Component component, String key) {
+        if(component == null) {
+            return;
+        }
+        String hintKey = hintKey(component, key);
+        hints.remove(hintKey);
+    }
+
+
+    private static String hintKey(Component component, String key) {
+        return hintPathFor(component) + "-" + key;
+    }
+
+    private static String hintPathFor(Component component)
+    {
+        return Strings.afterFirstPathComponent(fullHintPathFor(component), Component.PATH_SEPARATOR);
+    }
+
+    private static String fullHintPathFor(Component component)
+    {
+        final PrependingStringBuffer buffer = new PrependingStringBuffer(32);
+        for (Component c = component; c != null; c = c.getParent())
+        {
+            if(c instanceof UiHintPathSignificant) {
+                if (buffer.length() > 0)
+                {
+                    buffer.prepend(Component.PATH_SEPARATOR);
+                }
+                buffer.prepend(c.getId());
+            }
+        }
+        return buffer.toString();
+    }
+
+    protected Map<String, String> getHints() {
+        return hints;
+    }
+
     // //////////////////////////////////////////////////////////////
     // Dependencies
     // //////////////////////////////////////////////////////////////


[12/44] isis git commit: ISIS-537 Write the 'type' HTML attribute even for invisible buttons with placeholder

Posted by da...@apache.org.
ISIS-537 Write the 'type' HTML attribute even for invisible buttons with placeholder

https://trello.com/c/JwALpbYI/113-bootlint-error-always-set-a-type-on-buttons


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/bbdf17bb
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/bbdf17bb
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/bbdf17bb

Branch: refs/heads/master
Commit: bbdf17bb84b7146e09e3c86ee5d67af95f3bf818
Parents: ee4fe8b
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Fri Nov 7 12:20:22 2014 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Fri Nov 7 12:20:22 2014 +0200

----------------------------------------------------------------------
 .../entity/properties/EntityPropertiesForm.java | 37 ++++++++++++++++++++
 1 file changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/bbdf17bb/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/properties/EntityPropertiesForm.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/properties/EntityPropertiesForm.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/properties/EntityPropertiesForm.java
index cbfe092..6dc5cd6 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/properties/EntityPropertiesForm.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/properties/EntityPropertiesForm.java
@@ -40,6 +40,8 @@ import org.apache.wicket.markup.html.panel.FeedbackPanel;
 import org.apache.wicket.markup.repeater.RepeatingView;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.request.Response;
+import org.apache.wicket.util.string.Strings;
 import org.apache.wicket.util.visit.IVisit;
 import org.apache.wicket.util.visit.IVisitor;
 import org.apache.isis.applib.annotation.MemberGroupLayout.ColumnSpans;
@@ -278,6 +280,41 @@ public class EntityPropertiesForm extends FormAbstract<ObjectAdapter> {
             super.onError(target, form);
             toEditMode(target);
         }
+
+        /**
+         * Render the 'type' attribute even for invisible buttons to avoid
+         * <a href="https://github.com/twbs/bootlint/wiki/W007">Bootlint W007</a>
+         *
+         * @param tag The component tag to render
+         * @param response The response to write to
+         */
+        // TODO mgrigorov Move this to Wicket Bootstrap project
+        @Override
+        protected void renderPlaceholderTag(ComponentTag tag, Response response) {
+            String ns = Strings.isEmpty(tag.getNamespace()) ? null : tag.getNamespace() + ':';
+
+            response.write("<");
+            if (ns != null)
+            {
+                response.write(ns);
+            }
+            response.write(tag.getName());
+            response.write(" id=\"");
+            response.write(getAjaxRegionMarkupId());
+
+            String type = tag.getAttribute("type");
+            if (!Strings.isEmpty(type)) {
+                response.write("\" type=\""+type);
+            }
+
+            response.write("\" style=\"display:none\"></");
+            if (ns != null)
+            {
+                response.write(ns);
+            }
+            response.write(tag.getName());
+            response.write(">");
+        }
     }
 
     public class AjaxButtonForValidate extends AjaxButtonWithOnError implements IFormSubmitterWithPreValidateHook {


[22/44] isis git commit: ISIS-537: render selector panel-specific CSS to ensure that unselected views are not shown.

Posted by da...@apache.org.
ISIS-537: render selector panel-specific CSS to ensure that unselected views are not shown.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/49126416
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/49126416
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/49126416

Branch: refs/heads/master
Commit: 49126416efaffabed867565917927ccb11ea6611
Parents: f8a8ea4
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sun Nov 9 12:17:15 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 10:21:38 2014 +0000

----------------------------------------------------------------------
 .../selector/links/CollectionContentsLinksSelectorPanel.java     | 4 ++--
 .../entity/selector/links/EntityLinksSelectorPanel.java          | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/49126416/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
index d935b64..c68bf71 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
@@ -60,6 +60,7 @@ import org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
 import org.apache.isis.viewer.wicket.ui.util.Components;
 import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
 import org.apache.isis.viewer.wicket.ui.util.CssClassRemover;
@@ -419,8 +420,7 @@ public class CollectionContentsLinksSelectorPanel
     @Override
     public void renderHead(final IHeaderResponse response) {
         super.renderHead(response);
-        // TODO: mgrigorov remove this stuff once happy no longer needed at all.
-        // PanelUtil.renderHead(response, CollectionContentsLinksSelectorPanel.class);
+        PanelUtil.renderHead(response, CollectionContentsLinksSelectorPanel.class);
     }
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/49126416/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.java
index 2adb5ca..459b692 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.java
@@ -53,6 +53,7 @@ import org.apache.isis.viewer.wicket.ui.ComponentFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentType;
 import org.apache.isis.viewer.wicket.ui.components.additionallinks.AdditionalLinksPanel;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
 import org.apache.isis.viewer.wicket.ui.util.Components;
 import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
 import org.apache.isis.viewer.wicket.ui.util.CssClassRemover;
@@ -384,8 +385,7 @@ public class EntityLinksSelectorPanel extends PanelAbstract<EntityModel> impleme
     @Override
     public void renderHead(final IHeaderResponse response) {
         super.renderHead(response);
-        // TODO: mgrigorov remove this stuff once happy no longer needed at all.
-        // PanelUtil.renderHead(response, LinksSelectorPanelAbstract.class);
+        PanelUtil.renderHead(response, EntityLinksSelectorPanel.class);
     }
 
 


[21/44] isis git commit: ISIS-537: deleting LinksSelectorPanelAbstract, no longer used.

Posted by da...@apache.org.
ISIS-537: deleting LinksSelectorPanelAbstract, no longer used.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/f8a8ea4f
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/f8a8ea4f
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/f8a8ea4f

Branch: refs/heads/master
Commit: f8a8ea4f2e626361ccf727e979b590ee49615f3a
Parents: b1677ca
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sun Nov 9 12:05:27 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 10:21:36 2014 +0000

----------------------------------------------------------------------
 .../wicket/ui/CollectionContentsAsFactory.java  |   2 +-
 .../ui/components/about/AboutPanelFactory.java  |   4 -
 .../additionallinks/EntityActionUtil.java       |   7 +-
 .../CollectionContentsLinksSelectorPanel.java   |   9 +-
 .../links/EntityLinksSelectorPanel.java         |   9 +-
 .../viewer/wicket/ui/panels/PanelAbstract.java  |   1 +
 .../isis/viewer/wicket/ui/panels/PanelUtil.java |   6 -
 .../links/LinksSelectorPanelAbstract.css        |  19 -
 .../links/LinksSelectorPanelAbstract.html       |  50 ---
 .../links/LinksSelectorPanelAbstract.java       | 376 -------------------
 10 files changed, 10 insertions(+), 473 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/f8a8ea4f/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/CollectionContentsAsFactory.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/CollectionContentsAsFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/CollectionContentsAsFactory.java
index ed5e1cf..0e98a3f 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/CollectionContentsAsFactory.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/CollectionContentsAsFactory.java
@@ -24,7 +24,7 @@ import org.apache.wicket.model.IModel;
  * <p>
  * An interface for all {@link org.apache.isis.viewer.wicket.ui.ComponentFactory component factories}
  * (e.g. CollectionContentAsXyzFactory-ies) which want to provide specific title and CSS class(es)
- * for their representation in {@link org.apache.isis.viewer.wicket.ui.selector.links.LinksSelectorPanelAbstract}.
+ * for their representation in {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.links.CollectionContentsLinksSelectorPanel}.
  * </p>
  * <p>
  * If the {@link org.apache.isis.viewer.wicket.ui.ComponentFactory} doesn't implement this interface or the implementation

http://git-wip-us.apache.org/repos/asf/isis/blob/f8a8ea4f/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/AboutPanelFactory.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/AboutPanelFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/AboutPanelFactory.java
index 91775d9..3439855 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/AboutPanelFactory.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/about/AboutPanelFactory.java
@@ -21,13 +21,9 @@ package org.apache.isis.viewer.wicket.ui.components.about;
 
 import org.apache.wicket.Component;
 import org.apache.wicket.model.IModel;
-import org.apache.wicket.request.resource.CssResourceReference;
-
 import org.apache.isis.viewer.wicket.ui.ComponentFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract;
 import org.apache.isis.viewer.wicket.ui.ComponentType;
-import org.apache.isis.viewer.wicket.ui.components.entity.selector.links.EntityLinksSelectorPanel;
-import org.apache.isis.viewer.wicket.ui.selector.links.LinksSelectorPanelAbstract;
 
 /**
  * {@link ComponentFactory} for {@link AboutPanel}.

http://git-wip-us.apache.org/repos/asf/isis/blob/f8a8ea4f/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/EntityActionUtil.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/EntityActionUtil.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/EntityActionUtil.java
index 5c2d62c..e6d86cb 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/EntityActionUtil.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/EntityActionUtil.java
@@ -45,10 +45,11 @@ import org.apache.isis.viewer.wicket.model.models.ActionPromptProvider;
 import org.apache.isis.viewer.wicket.model.models.EntityModel;
 import org.apache.isis.viewer.wicket.ui.components.entity.EntityActionLinkFactory;
 import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.ActionLinkFactory;
-import org.apache.isis.viewer.wicket.ui.selector.links.LinksSelectorPanelAbstract;
 
 public final class EntityActionUtil {
-    
+
+    public static final String ID_ADDITIONAL_LINK = "additionalLink";
+
     private EntityActionUtil(){}
 
     private final static MemberOrderFacetComparator memberOrderFacetComparator = new MemberOrderFacetComparator(false);
@@ -83,7 +84,7 @@ public final class EntityActionUtil {
     
             @Override
             public LinkAndLabel apply(ObjectAction objectAction) {
-                return linkFactory.newLink(adapterMemento, objectAction, LinksSelectorPanelAbstract.ID_ADDITIONAL_LINK, actionPromptProvider);
+                return linkFactory.newLink(adapterMemento, objectAction, ID_ADDITIONAL_LINK, actionPromptProvider);
             }});
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/f8a8ea4f/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
index 096903c..d935b64 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
@@ -60,8 +60,6 @@ import org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
-import org.apache.isis.viewer.wicket.ui.selector.links.LinksSelectorPanelAbstract;
 import org.apache.isis.viewer.wicket.ui.util.Components;
 import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
 import org.apache.isis.viewer.wicket.ui.util.CssClassRemover;
@@ -70,10 +68,6 @@ import org.apache.isis.viewer.wicket.ui.util.CssClassRemover;
  * Provides a list of links for selecting other views that support
  * {@link ComponentType#COLLECTION_CONTENTS} with a backing
  * {@link EntityCollectionModel}.
- * 
- * <p>
- * Most of the heavy lifting is factored out into the superclass,
- * {@link LinksSelectorPanelAbstract}.
  */
 public class CollectionContentsLinksSelectorPanel
         extends PanelAbstract<EntityCollectionModel> implements UiHintPathSignificant,  CollectionCountProvider {
@@ -425,7 +419,8 @@ public class CollectionContentsLinksSelectorPanel
     @Override
     public void renderHead(final IHeaderResponse response) {
         super.renderHead(response);
-        PanelUtil.renderHead(response, LinksSelectorPanelAbstract.class);
+        // TODO: mgrigorov remove this stuff once happy no longer needed at all.
+        // PanelUtil.renderHead(response, CollectionContentsLinksSelectorPanel.class);
     }
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/f8a8ea4f/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.java
index 7cab8d8..2adb5ca 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.java
@@ -53,8 +53,6 @@ import org.apache.isis.viewer.wicket.ui.ComponentFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentType;
 import org.apache.isis.viewer.wicket.ui.components.additionallinks.AdditionalLinksPanel;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
-import org.apache.isis.viewer.wicket.ui.selector.links.LinksSelectorPanelAbstract;
 import org.apache.isis.viewer.wicket.ui.util.Components;
 import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
 import org.apache.isis.viewer.wicket.ui.util.CssClassRemover;
@@ -62,10 +60,6 @@ import org.apache.isis.viewer.wicket.ui.util.CssClassRemover;
 /**
  * Provides a list of links for selecting other views that support
  * {@link ComponentType#ENTITY} with a backing {@link EntityModel}.
- * 
- * <p>
- * Most of the heavy lifting is factored out into the superclass,
- * {@link LinksSelectorPanelAbstract}.
  */
 public class EntityLinksSelectorPanel extends PanelAbstract<EntityModel> implements UiHintPathSignificant {
 
@@ -390,7 +384,8 @@ public class EntityLinksSelectorPanel extends PanelAbstract<EntityModel> impleme
     @Override
     public void renderHead(final IHeaderResponse response) {
         super.renderHead(response);
-        PanelUtil.renderHead(response, LinksSelectorPanelAbstract.class);
+        // TODO: mgrigorov remove this stuff once happy no longer needed at all.
+        // PanelUtil.renderHead(response, LinksSelectorPanelAbstract.class);
     }
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/f8a8ea4f/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java
index 690a0ff..daa7029 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java
@@ -124,6 +124,7 @@ public abstract class PanelAbstract<T extends IModel<?>> extends Panel implement
      */
     @Override
     public void renderHead(final IHeaderResponse response) {
+        // TODO: mgrigorov remove this stuff once happy no longer needed at all.
 //        PanelUtil.renderHead(response, this.getClass());
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/f8a8ea4f/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelUtil.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelUtil.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelUtil.java
index 0d46366..4c7af42 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelUtil.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelUtil.java
@@ -19,23 +19,17 @@
 package org.apache.isis.viewer.wicket.ui.panels;
 
 import com.google.common.base.Strings;
-
 import org.apache.wicket.markup.head.CssHeaderItem;
 import org.apache.wicket.markup.head.CssReferenceHeaderItem;
 import org.apache.wicket.markup.head.IHeaderResponse;
 import org.apache.wicket.request.resource.CssResourceReference;
 
-import org.apache.isis.viewer.wicket.ui.selector.links.LinksSelectorPanelAbstract;
-
 public final class PanelUtil {
 
     private PanelUtil(){}
 
     /**
      * The contribution to the header performed implicitly by {@link PanelAbstract}.
-     * 
-     * <p>
-     * Factored out for reuse by {@link LinksSelectorPanelAbstract}.
      */
     public static void renderHead(final IHeaderResponse response, final Class<?> cls) {
         final CssResourceReference cssResourceReference = cssResourceReferenceFor(cls);

http://git-wip-us.apache.org/repos/asf/isis/blob/f8a8ea4f/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.css
deleted file mode 100644
index 9f1612a..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.css
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- *  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.
- */
-

http://git-wip-us.apache.org/repos/asf/isis/blob/f8a8ea4f/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.html
deleted file mode 100644
index 14418d1..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-  
-         http://www.apache.org/licenses/LICENSE-2.0
-         
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied.  See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns:wicket="http://wicket.apache.org">
-    <body>
-        <wicket:panel>
-            <div class="linksSelectorPanel">
-                <div class="btn-group viewLinks" wicket:id="views">
-                    <button type="button" class="btn btn-xs btn-info">
-                        <span wicket:id="viewButtonIcon" class="ViewLinkItem"></span>
-                        <span wicket:id="viewButtonTitle" class="ViewLinkItemTitle"></span>
-                    </button>
-                    <button type="button" class="btn btn-xs btn-info dropdown-toggle" data-toggle="dropdown">
-                        <span class="caret"></span>
-                    </button>
-                    <ul wicket:id="viewList" class="dropdown-menu dropdown-menu-right" role="menu">
-                        <li wicket:id="viewItem" class="viewItem">
-                            <a href="#" wicket:id="viewLink">
-                                <span wicket:id="viewItemIcon" class="ViewLinkItem"></span> <span wicket:id="viewItemTitle" class="ViewLinkItemTitle">[link title]</span>
-                            </a>
-                        </li>
-                    </ul>
-                </div>
-
-                <span wicket:id="additionalLinks"></span>
-
-                <div class="views">
-                    <wicket:child/>
-                </div>
-            </div>
-        </wicket:panel>
-    </body>
-</html>

http://git-wip-us.apache.org/repos/asf/isis/blob/f8a8ea4f/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.java
deleted file mode 100644
index 2b6b96f..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.java
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- *  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.selector.links;
-
-import de.agilecoders.wicket.core.markup.html.bootstrap.button.Buttons;
-
-import java.util.ArrayList;
-import java.util.List;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.Lists;
-import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.Component;
-import org.apache.wicket.MarkupContainer;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.event.Broadcast;
-import org.apache.wicket.markup.ComponentTag;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.apache.isis.core.commons.lang.StringExtensions;
-import org.apache.isis.viewer.wicket.model.hints.IsisUiHintEvent;
-import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
-import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
-import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
-import org.apache.isis.viewer.wicket.model.links.LinksProvider;
-import org.apache.isis.viewer.wicket.ui.CollectionContentsAsFactory;
-import org.apache.isis.viewer.wicket.ui.ComponentFactory;
-import org.apache.isis.viewer.wicket.ui.ComponentType;
-import org.apache.isis.viewer.wicket.ui.components.additionallinks.AdditionalLinksPanel;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
-import org.apache.isis.viewer.wicket.ui.util.Components;
-import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
-import org.apache.isis.viewer.wicket.ui.util.CssClassRemover;
-
-public abstract class LinksSelectorPanelAbstract<T extends IModel<?>> extends PanelAbstract<T> implements UiHintPathSignificant {
-
-    private static final long serialVersionUID = 1L;
-
-    private static final String INVISIBLE_CLASS = "link-selector-panel-invisible";
-    private static final int MAX_NUM_UNDERLYING_VIEWS = 10;
-
-    private static final String ID_ADDITIONAL_LINKS = "additionalLinks";
-    public static final String ID_ADDITIONAL_LINK = "additionalLink";
-
-    private static final String ID_VIEWS = "views";
-    private static final String ID_VIEW_LIST = "viewList";
-    private static final String ID_VIEW_LINK = "viewLink";
-    private static final String ID_VIEW_ITEM = "viewItem";
-    private static final String ID_VIEW_ITEM_TITLE = "viewItemTitle";
-    private static final String ID_VIEW_ITEM_ICON = "viewItemIcon";
-
-    private static final String UIHINT_VIEW = "view";
-    private static final String ID_VIEW_BUTTON_TITLE = "viewButtonTitle";
-    private static final String ID_VIEW_BUTTON_ICON = "viewButtonIcon";
-
-    private final ComponentType componentType;
-    private final String underlyingIdPrefix;
-
-    private ComponentFactory selectedComponentFactory;
-    protected Component selectedComponent;
-
-    /**
-     * May be <tt>null</tt>, depending upon the model implementation.
-     *
-     * @see #addAdditionalLinks(IModel)
-     */
-    protected WebMarkupContainer additionalLinks;
-
-
-    public LinksSelectorPanelAbstract(final String id, final String underlyingIdPrefix, final T model, final ComponentFactory factory) {
-        super(id, model);
-        this.underlyingIdPrefix = underlyingIdPrefix;
-        this.componentType = factory.getComponentType();
-    }
-
-    /**
-     * Build UI only after added to parent.
-     */
-    public void onInitialize() {
-        super.onInitialize();
-        ComponentFactory componentFactory = getComponentFactoryRegistry().findComponentFactoryElseFailFast(getComponentType(), getModel());
-        addAdditionalLinks(getModel());
-        addUnderlyingViews(underlyingIdPrefix, getModel(), componentFactory);
-    }
-
-    protected void addAdditionalLinks(final T model) {
-        if(!(model instanceof LinksProvider)) {
-            permanentlyHide(ID_ADDITIONAL_LINKS);
-            return;
-        }
-        LinksProvider linksProvider = (LinksProvider) model;
-        List<LinkAndLabel> links = linksProvider.getLinks();
-
-        addAdditionalLinks(this, links);
-    }
-
-    protected void addAdditionalLinks(MarkupContainer markupContainer, List<LinkAndLabel> links) {
-        if(links == null || links.isEmpty()) {
-            Components.permanentlyHide(markupContainer, ID_ADDITIONAL_LINKS);
-            return;
-        }
-        links = Lists.newArrayList(links); // copy, to serialize any lazy evaluation
-
-        additionalLinks = new AdditionalLinksPanel(ID_ADDITIONAL_LINKS, links);
-        markupContainer.addOrReplace(additionalLinks);
-    }
-
-    private void addUnderlyingViews(final String underlyingIdPrefix, final T model, final ComponentFactory factory) {
-        final List<ComponentFactory> componentFactories = findOtherComponentFactories(model, factory);
-
-        final int selected = honourViewHintElseDefault(componentFactories, model);
-
-        final LinksSelectorPanelAbstract<T> selectorPanel = LinksSelectorPanelAbstract.this;
-
-        // create all, hide the one not selected
-        final Component[] underlyingViews = new Component[MAX_NUM_UNDERLYING_VIEWS];
-        int i = 0;
-        final T emptyModel = dummyOf(model);
-        for (ComponentFactory componentFactory : componentFactories) {
-            final String underlyingId = underlyingIdPrefix + "-" + i;
-
-            Component underlyingView = componentFactory.createComponent(underlyingId,i==selected? model: emptyModel);
-            underlyingViews[i++] = underlyingView;
-            selectorPanel.addOrReplace(underlyingView);
-        }
-
-        // hide any unused placeholders
-        while(i<MAX_NUM_UNDERLYING_VIEWS) {
-            String underlyingId = underlyingIdPrefix + "-" + i;
-            permanentlyHide(underlyingId);
-            i++;
-        }
-
-        // selector
-        if (componentFactories.size() <= 1) {
-            permanentlyHide(ID_VIEWS);
-        } else {
-            final Model<ComponentFactory> componentFactoryModel = new Model<>();
-
-            selectorPanel.selectedComponentFactory = componentFactories.get(selected);
-            componentFactoryModel.setObject(selectorPanel.selectedComponentFactory);
-
-            final WebMarkupContainer views = new WebMarkupContainer(ID_VIEWS);
-
-            final Label viewButtonTitle = new Label(ID_VIEW_BUTTON_TITLE, "Hidden");
-            views.addOrReplace(viewButtonTitle);
-
-            final Label viewButtonIcon = new Label(ID_VIEW_BUTTON_ICON, "");
-            views.addOrReplace(viewButtonIcon);
-
-            final WebMarkupContainer container = new WebMarkupContainer(ID_VIEW_LIST);
-
-            views.addOrReplace(container);
-            views.setOutputMarkupId(true);
-
-            this.setOutputMarkupId(true);
-
-            final ListView<ComponentFactory> listView = new ListView<ComponentFactory>(ID_VIEW_ITEM, componentFactories) {
-
-                private static final long serialVersionUID = 1L;
-
-                @Override
-                protected void populateItem(ListItem<ComponentFactory> item) {
-
-                    final int underlyingViewNum = item.getIndex();
-
-                    final ComponentFactory componentFactory = item.getModelObject();
-                    final AbstractLink link = new AjaxLink<Void>(ID_VIEW_LINK) {
-                        private static final long serialVersionUID = 1L;
-                        @Override
-                        public void onClick(AjaxRequestTarget target) {
-                            LinksSelectorPanelAbstract<T> linksSelectorPanel = LinksSelectorPanelAbstract.this;
-                            linksSelectorPanel.setViewHintAndBroadcast(underlyingViewNum, target);
-
-                            final T dummyModel = dummyOf(model);
-                            for(int i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
-                                final Component component = underlyingViews[i];
-                                if(component == null) {
-                                    continue;
-                                }
-                                final boolean isSelected = i == underlyingViewNum;
-                                applyCssVisibility(component, isSelected);
-                                component.setDefaultModel(isSelected? model: dummyModel);
-                            }
-
-                            selectorPanel.selectedComponentFactory = componentFactory;
-                            selectorPanel.selectedComponent = underlyingViews[underlyingViewNum];
-                            selectorPanel.onSelect(target);
-                            target.add(selectorPanel, views);
-                        }
-
-                        @Override
-                        protected void onComponentTag(ComponentTag tag) {
-                            super.onComponentTag(tag);
-                            Buttons.fixDisabledState(this, tag);
-                        }
-                    };
-
-                    IModel<String> title = nameFor(componentFactory);
-                    Label viewItemTitleLabel = new Label(ID_VIEW_ITEM_TITLE, title);
-                    link.add(viewItemTitleLabel);
-
-                    Label viewItemIcon = new Label(ID_VIEW_ITEM_ICON, "");
-                    link.add(viewItemIcon);
-
-                    boolean isEnabled = componentFactory != selectorPanel.selectedComponentFactory;
-                    if (!isEnabled) {
-                        viewButtonTitle.setDefaultModel(title);
-                        IModel<String> cssClass = cssClassFor(componentFactory, viewButtonIcon);
-                        viewButtonIcon.add(AttributeModifier.replace("class", "ViewLinkItem " + cssClass.getObject()));
-                        link.setVisible(false);
-                    } else {
-                        IModel<String> cssClass = cssClassFor(componentFactory, viewItemIcon);
-                        viewItemIcon.add(new CssClassAppender(cssClass));
-                    }
-
-                    item.add(link);
-                }
-
-                private IModel<String> cssClassFor(final ComponentFactory componentFactory, Label viewIcon) {
-                    IModel<String> cssClass = null;
-                    if (componentFactory instanceof CollectionContentsAsFactory) {
-                        CollectionContentsAsFactory collectionContentsAsFactory = (CollectionContentsAsFactory) componentFactory;
-                        cssClass = collectionContentsAsFactory.getCssClass();
-                        viewIcon.setDefaultModelObject("");
-                        viewIcon.setEscapeModelStrings(true);
-                    }
-                    if (cssClass == null) {
-                        String name = componentFactory.getName();
-                        cssClass = Model.of(StringExtensions.asLowerDashed(name));
-                        // Small hack: if there is no specific CSS class then we assume that background-image is used
-                        // the span.ViewItemLink should have some content to show it
-                        // FIX: find a way to do this with CSS (width and height don't seems to help)
-                        viewIcon.setDefaultModelObject("&#160;&#160;&#160;&#160;&#160;");
-                        viewIcon.setEscapeModelStrings(false);
-                    }
-                    return cssClass;
-                }
-
-                private IModel<String> nameFor(final ComponentFactory componentFactory) {
-                    IModel<String> name = null;
-                    if (componentFactory instanceof CollectionContentsAsFactory) {
-                        CollectionContentsAsFactory collectionContentsAsFactory = (CollectionContentsAsFactory) componentFactory;
-                        name = collectionContentsAsFactory.getTitleLabel();
-                    }
-                    if (name == null) {
-                        name = Model.of(componentFactory.getName());
-                    }
-                    return name;
-                }
-            };
-            container.add(listView);
-            addOrReplace(views);
-        }
-
-        for(i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
-            Component component = underlyingViews[i];
-            if(component != null) {
-                if(i != selected) {
-                    component.add(new CssClassAppender(INVISIBLE_CLASS));
-                } else {
-                    selectedComponent = component;
-                }
-            }
-        }
-    }
-
-
-
-    protected void setViewHintAndBroadcast(int viewNum, AjaxRequestTarget target) {
-        final UiHintContainer uiHintContainer = getUiHintContainer();
-        if(uiHintContainer == null) {
-            return;
-        }
-        uiHintContainer.setHint(LinksSelectorPanelAbstract.this, UIHINT_VIEW, ""+viewNum);
-        send(getPage(), Broadcast.EXACT, new IsisUiHintEvent(uiHintContainer, target));
-    }
-
-    /**
-     * Overrideable hook.
-     */
-    protected void onSelect(AjaxRequestTarget target) {
-    }
-
-    /**
-     * Ask for a dummy (empty) {@link Model} to pass into those components that are rendered but will be
-     * made invisible using CSS styling.
-     */
-    protected abstract T dummyOf(T model);
-
-    protected static void applyCssVisibility(final Component component, final boolean visible) {
-        if(component == null) {
-            return;
-        }
-        AttributeModifier modifier = visible ? new CssClassRemover(INVISIBLE_CLASS) : new CssClassAppender(INVISIBLE_CLASS);
-        component.add(modifier);
-    }
-
-    protected int honourViewHintElseDefault(final List<ComponentFactory> componentFactories, final IModel<?> model) {
-        // honour hints ...
-        final UiHintContainer hintContainer = getUiHintContainer();
-        if(hintContainer != null) {
-            String viewStr = hintContainer.getHint(this, UIHINT_VIEW);
-            if(viewStr != null) {
-                try {
-                    int view = Integer.parseInt(viewStr);
-                    if(view >= 0 && view < componentFactories.size()) {
-                        return view;
-                    }
-                } catch(NumberFormatException ex) {
-                    // ignore
-                }
-            }
-        }
-
-        // ... else default
-        int initialFactory = determineInitialFactory(componentFactories, model);
-        if(hintContainer != null) {
-            hintContainer.setHint(this, UIHINT_VIEW, ""+initialFactory);
-            // don't broadcast (no AjaxRequestTarget, still configuring initial setup)
-        }
-        return initialFactory;
-    }
-
-
-    protected abstract int determineInitialFactory(final List<ComponentFactory> componentFactories, final IModel<?> model);
-
-    private List<ComponentFactory> findOtherComponentFactories(final T model, final ComponentFactory ignoreFactory) {
-        final List<ComponentFactory> componentFactories = getComponentFactoryRegistry().findComponentFactories(componentType, model);
-        ArrayList<ComponentFactory> otherFactories = Lists.newArrayList(Collections2.filter(componentFactories, new Predicate<ComponentFactory>() {
-            @Override
-            public boolean apply(final ComponentFactory input) {
-                return input != ignoreFactory;
-            }
-        }));
-        return ordered(otherFactories);
-    }
-
-    protected List<ComponentFactory> ordered(List<ComponentFactory> otherFactories) {
-        return otherFactories;
-    }
-
-
-    @Override
-    public void renderHead(final IHeaderResponse response) {
-        super.renderHead(response);
-        PanelUtil.renderHead(response, LinksSelectorPanelAbstract.class);
-    }
-
-
-}


[33/44] isis git commit: ISIS-537: tidy up of (entity) collections panel; standalone collections panel no longer failing (but still need to sort out CSS and bulk actions)

Posted by da...@apache.org.
ISIS-537: tidy up of (entity) collections panel; standalone collections panel no longer failing (but still need to sort out CSS and bulk actions)


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/92ffe2d2
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/92ffe2d2
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/92ffe2d2

Branch: refs/heads/master
Commit: 92ffe2d2c1a0a7771c5c822f94d1d60111a55e77
Parents: 3b39738
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Nov 10 09:59:43 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 10:21:50 2014 +0000

----------------------------------------------------------------------
 .../ComponentFactoryRegistrarDefault.java       |   4 +-
 .../wicket/ui/CollectionContentsAsFactory.java  |   2 +-
 .../collection/CollectionCountProvider.java     |  21 --
 .../components/collection/CollectionPanel.java  |  67 ++---
 .../count/CollectionCountProvider.java          |  21 ++
 .../selector/CollectionSelectorHelper.java      | 174 +++++++++++++
 .../selector/CollectionSelectorPanel.html       |  44 ++++
 .../selector/CollectionSelectorPanel.java       | 220 +++++++++++++++++
 .../selector/CollectionSelectorProvider.java    |  23 ++
 .../selector/UNUSED_CollectionSelectorPanel.css |  60 +++++
 .../CollectionContentsAsAjaxTablePanel.java     |   2 +-
 .../CollectionContentsMultipleViewsPanel.css    |  60 +++++
 .../CollectionContentsMultipleViewsPanel.html   |  41 ++++
 .../CollectionContentsMultipleViewsPanel.java   | 226 +++++++++++++++++
 ...ectionContentsMultipleViewsPanelFactory.java |  53 ++++
 ...CollectionContentsSelectorDropdownPanel.html |  44 ----
 ...CollectionContentsSelectorDropdownPanel.java | 222 -----------------
 .../CollectionContentsSelectorHelper.java       | 176 --------------
 ...ionContentsSelectorSelectorDropdownPanel.css |  60 -----
 .../dropdown/HasSelectorDropdownPanel.java      |  23 --
 .../CollectionContentsLinksSelectorPanel.css    |  60 -----
 .../CollectionContentsLinksSelectorPanel.html   |  41 ----
 .../CollectionContentsLinksSelectorPanel.java   | 243 -------------------
 ...ectionContentsLinksSelectorPanelFactory.java |  53 ----
 .../summary/CollectionContentsAsSummary.java    |   2 +-
 .../collections/EntityCollectionsPanel.html     |  22 --
 .../collections/EntityCollectionsPanel.java     |  24 +-
 .../StandaloneCollectionPanel.css               |   2 +-
 .../StandaloneCollectionPanel.html              |  17 ++
 .../StandaloneCollectionPanel.java              |  45 +++-
 ...ectionContentsSelectorDropdownPanelTest.java |  67 +++++
 ...ectionContentsSelectorDropdownPanelTest.java |  67 -----
 32 files changed, 1081 insertions(+), 1105 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java b/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java
index 21a3f2c..ed48dea 100644
--- a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java
+++ b/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java
@@ -32,7 +32,7 @@ import org.apache.isis.viewer.wicket.ui.components.appactions.cssmenu.AppActions
 import org.apache.isis.viewer.wicket.ui.components.bookmarkedpages.BookmarkedPagesPanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.links.CollectionContentsLinksSelectorPanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.multiple.CollectionContentsMultipleViewsPanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.summary.CollectionContentsAsSummaryFactory;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.empty.EmptyCollectionPanelFactory;
@@ -96,7 +96,7 @@ public class ComponentFactoryRegistrarDefault implements ComponentFactoryRegistr
 
     protected void addLinksSelectorFactories(final ComponentFactoryList componentFactories) {
         componentFactories.add(new EntityLinksSelectorPanelFactory());
-        componentFactories.add(new CollectionContentsLinksSelectorPanelFactory());
+        componentFactories.add(new CollectionContentsMultipleViewsPanelFactory());
     }
 
     protected void addComponentFactoriesUsingServiceLoader(final ComponentFactoryList componentFactories) {

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/CollectionContentsAsFactory.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/CollectionContentsAsFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/CollectionContentsAsFactory.java
index 0e98a3f..440b0ff 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/CollectionContentsAsFactory.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/CollectionContentsAsFactory.java
@@ -24,7 +24,7 @@ import org.apache.wicket.model.IModel;
  * <p>
  * An interface for all {@link org.apache.isis.viewer.wicket.ui.ComponentFactory component factories}
  * (e.g. CollectionContentAsXyzFactory-ies) which want to provide specific title and CSS class(es)
- * for their representation in {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.links.CollectionContentsLinksSelectorPanel}.
+ * for their representation in {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.multiple.CollectionContentsMultipleViewsPanel}.
  * </p>
  * <p>
  * If the {@link org.apache.isis.viewer.wicket.ui.ComponentFactory} doesn't implement this interface or the implementation

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/CollectionCountProvider.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/CollectionCountProvider.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/CollectionCountProvider.java
deleted file mode 100644
index dd4beca..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/CollectionCountProvider.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- *  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.collection;
-
-public interface CollectionCountProvider {
-    Integer getCount();
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/CollectionPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/CollectionPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/CollectionPanel.java
index 0b10d9c..02e9ced 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/CollectionPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/CollectionPanel.java
@@ -22,12 +22,9 @@ package org.apache.isis.viewer.wicket.ui.components.collection;
 import de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationPanel;
 
 import java.util.List;
-
 import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
 import org.apache.wicket.markup.html.basic.Label;
-
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.context.IsisContext;
@@ -38,8 +35,8 @@ import org.apache.isis.viewer.wicket.model.models.EntityModel;
 import org.apache.isis.viewer.wicket.ui.ComponentType;
 import org.apache.isis.viewer.wicket.ui.components.actionprompt.ActionPromptModalWindow;
 import org.apache.isis.viewer.wicket.ui.components.additionallinks.EntityActionUtil;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.CollectionContentsSelectorDropdownPanel;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.HasSelectorDropdownPanel;
+import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorPanel;
+import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorProvider;
 import org.apache.isis.viewer.wicket.ui.components.scalars.ScalarPanelAbstract;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
 
@@ -47,7 +44,7 @@ import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
  * Panel for rendering entity collection; analogous to (any concrete subclass
  * of) {@link ScalarPanelAbstract}.
  */
-public class CollectionPanel extends PanelAbstract<EntityCollectionModel> implements ActionPromptProvider, HasSelectorDropdownPanel {
+public class CollectionPanel extends PanelAbstract<EntityCollectionModel> implements ActionPromptProvider, CollectionSelectorProvider {
 
 
     private static final long serialVersionUID = 1L;
@@ -57,7 +54,6 @@ public class CollectionPanel extends PanelAbstract<EntityCollectionModel> implem
 
     private Component collectionContents;
 
-    private String collectionName;
     private Label label;
 
     public CollectionPanel(final String id, final EntityModel entityModel, OneToManyAssociation otma) {
@@ -95,42 +91,26 @@ public class CollectionPanel extends PanelAbstract<EntityCollectionModel> implem
     }
 
     public Label createLabel(final String id, final String collectionName) {
-        this.collectionName = collectionName;
         this.label = new Label(id, collectionName);
-    	label.setOutputMarkupId(true);
-    	return this.label;
+        label.setOutputMarkupId(true);
+        return this.label;
     }
 
-    public void updateLabel(AjaxRequestTarget target) {
-        target.add(label);
-    }
+    //region > SelectorDropdownPanel (impl)
 
-    /**
-     * Returns true if a collection count is available from the rendered component 
-     * (ie an eagerly rendered/expanded view).
-     */
-    public boolean hasCount() {
-        if(label == null) {
-            return false;
-        }
-        final Integer count = getCount();
-        label.setDefaultModelObject(collectionName);
-        return count != null;
-    }
+    private CollectionSelectorPanel selectorDropdownPanel;
 
-    private Integer getCount() {
-        if(collectionContents instanceof CollectionCountProvider) {
-            final CollectionCountProvider collectionCountProvider = (CollectionCountProvider) collectionContents;
-            return collectionCountProvider.getCount();
-        } else {
-            return null;
-        }
+    @Override
+    public CollectionSelectorPanel getSelectorDropdownPanel() {
+        return selectorDropdownPanel;
+    }
+    public void setSelectorDropdownPanel(CollectionSelectorPanel selectorDropdownPanel) {
+        this.selectorDropdownPanel = selectorDropdownPanel;
     }
+    //endregion
+
 
-    
-    // ///////////////////////////////////////////////////////////////////
-    // ActionPromptModalWindowProvider
-    // ///////////////////////////////////////////////////////////////////
+    //region > ActionPromptModalWindowProvider
 
     private ActionPromptModalWindow actionPromptModalWindow;
     public ActionPromptModalWindow getActionPrompt() {
@@ -141,26 +121,15 @@ public class CollectionPanel extends PanelAbstract<EntityCollectionModel> implem
         this.actionPromptModalWindow = ActionPromptModalWindow.newModalWindow(ID_ACTION_PROMPT_MODAL_WINDOW);
         addOrReplace(actionPromptModalWindow);
     }
+    //endregion
 
 
-    // ///////////////////////////////////////////////////////////////////
+    //region > dependencies
 
     protected DeploymentType getDeploymentType() {
         return IsisContext.getDeploymentType();
     }
 
-
-    //region > SelectorDropdownPanel (impl)
-
-    private CollectionContentsSelectorDropdownPanel selectorDropdownPanel;
-
-    @Override
-    public CollectionContentsSelectorDropdownPanel getSelectorDropdownPanel() {
-        return selectorDropdownPanel;
-    }
-    public void setSelectorDropdownPanel(CollectionContentsSelectorDropdownPanel selectorDropdownPanel) {
-        this.selectorDropdownPanel = selectorDropdownPanel;
-    }
     //endregion
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/count/CollectionCountProvider.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/count/CollectionCountProvider.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/count/CollectionCountProvider.java
new file mode 100644
index 0000000..0ff411f
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/count/CollectionCountProvider.java
@@ -0,0 +1,21 @@
+/**
+ *  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.collection.count;
+
+public interface CollectionCountProvider {
+    Integer getCount();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorHelper.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorHelper.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorHelper.java
new file mode 100644
index 0000000..dfcdbf5
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorHelper.java
@@ -0,0 +1,174 @@
+/*
+ *  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.collection.selector;
+
+import java.util.ArrayList;
+import java.util.List;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+import org.apache.isis.applib.annotation.Render;
+import org.apache.isis.core.metamodel.facets.members.render.RenderFacet;
+import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
+import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistry;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.multiple.CollectionContentsMultipleViewsPanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory;
+
+public class CollectionSelectorHelper {
+
+    static final String UIHINT_EVENT_VIEW_KEY = "view";
+
+    private final ComponentType componentType;
+    private final ComponentFactoryRegistry componentFactoryRegistry;
+    private final EntityCollectionModel model;
+    private final ComponentFactory ignoreFactory;
+    private final List<ComponentFactory> componentFactories;
+
+
+    public CollectionSelectorHelper(
+            final EntityCollectionModel model,
+            final ComponentFactoryRegistry componentFactoryRegistry,
+            final ComponentFactory ignoreFactory) {
+        this.componentFactoryRegistry = componentFactoryRegistry;
+        this.model = model;
+        this.ignoreFactory = ignoreFactory;
+        this.componentType = ignoreFactory.getComponentType();
+
+        componentFactories = findOtherComponentFactories();
+    }
+
+    public List<ComponentFactory> findOtherComponentFactories() {
+        final List<ComponentFactory> componentFactories = componentFactoryRegistry.findComponentFactories(componentType, model);
+        ArrayList<ComponentFactory> otherFactories = Lists.newArrayList(Collections2.filter(componentFactories, new Predicate<ComponentFactory>() {
+            @Override
+            public boolean apply(final ComponentFactory input) {
+                return input != ignoreFactory && input.getClass() != CollectionContentsMultipleViewsPanelFactory.class;
+            }
+        }));
+        return ordered(otherFactories);
+    }
+
+    public int honourViewHintElseDefault(final Component component) {
+        // honour hints ...
+        final UiHintContainer hintContainer = getUiHintContainer(component);
+        if(hintContainer != null) {
+            String viewStr = hintContainer.getHint(component, UIHINT_EVENT_VIEW_KEY);
+            if(viewStr != null) {
+                try {
+                    int view = Integer.parseInt(viewStr);
+                    if(view >= 0 && view < componentFactories.size()) {
+                        return view;
+                    }
+                } catch(NumberFormatException ex) {
+                    // ignore
+                }
+            }
+        }
+
+        // ... else default
+        int initialFactory = determineInitialFactory();
+        if(hintContainer != null) {
+            hintContainer.setHint(component, UIHINT_EVENT_VIEW_KEY, ""+initialFactory);
+            // don't broadcast (no AjaxRequestTarget, still configuring initial setup)
+        }
+        return initialFactory;
+    }
+
+    //region > helpers
+
+    private static List<ComponentFactory> ordered(List<ComponentFactory> componentFactories) {
+        return orderAjaxTableToEnd(componentFactories);
+    }
+
+    static List<ComponentFactory> orderAjaxTableToEnd(List<ComponentFactory> componentFactories) {
+        int ajaxTableIdx = findAjaxTable(componentFactories);
+        if(ajaxTableIdx>=0) {
+            List<ComponentFactory> orderedFactories = Lists.newArrayList(componentFactories);
+            ComponentFactory ajaxTableFactory = orderedFactories.remove(ajaxTableIdx);
+            orderedFactories.add(ajaxTableFactory);
+            return orderedFactories;
+        } else {
+            return componentFactories;
+        }
+    }
+
+    private static int findAjaxTable(List<ComponentFactory> componentFactories) {
+        for(int i=0; i<componentFactories.size(); i++) {
+            if(componentFactories.get(i) instanceof CollectionContentsAsAjaxTablePanelFactory) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
+
+
+
+
+    /**
+     * return the index of {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory unresolved panel} if present and not eager loading;
+     * else the index of {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory ajax table} if present,
+     * otherwise first factory.
+     */
+    protected int determineInitialFactory() {
+        if(!hasRenderEagerlyFacet(model)) {
+            for(int i=0; i<componentFactories.size(); i++) {
+                if(componentFactories.get(i) instanceof CollectionContentsAsUnresolvedPanelFactory) {
+                    return i;
+                }
+            }
+        }
+        int ajaxTableIdx = CollectionSelectorHelper.findAjaxTable(componentFactories);
+        if(ajaxTableIdx>=0) {
+            return ajaxTableIdx;
+        }
+        return 0;
+    }
+
+    private static UiHintContainer getUiHintContainer(final Component component) {
+        return UiHintContainer.Util.hintContainerOf(component);
+    }
+
+
+    private static boolean hasRenderEagerlyFacet(IModel<?> model) {
+        if(!(model instanceof EntityCollectionModel)) {
+            return false;
+        }
+        final EntityCollectionModel entityCollectionModel = (EntityCollectionModel) model;
+        if(!entityCollectionModel.isParented()) {
+            return false;
+        }
+
+        final OneToManyAssociation collection =
+                entityCollectionModel.getCollectionMemento().getCollection();
+        RenderFacet renderFacet = collection.getFacet(RenderFacet.class);
+        return renderFacet != null && renderFacet.value() == Render.Type.EAGERLY;
+    }
+
+    //endregion
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorPanel.html
new file mode 100644
index 0000000..8bec51a
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorPanel.html
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns:wicket="http://wicket.apache.org">
+<body>
+<wicket:panel>
+    <div class="linksSelectorPanel">
+        <div class="btn-group viewLinks" wicket:id="views">
+            <button type="button" class="btn btn-sm btn-info">
+                <span wicket:id="viewButtonIcon" class="ViewLinkItem"></span>
+                <span wicket:id="viewButtonTitle" class="ViewLinkItemTitle"></span>
+            </button>
+            <button type="button" class="btn btn-sm btn-info dropdown-toggle" data-toggle="dropdown">
+                <span class="caret"></span>
+            </button>
+            <ul wicket:id="viewList" class="dropdown-menu dropdown-menu-right" role="menu">
+                <li wicket:id="viewItem" class="viewItem">
+                    <a href="#" wicket:id="viewLink">
+                        <span wicket:id="viewItemIcon" class="ViewLinkItem"></span> <span wicket:id="viewItemTitle" class="ViewLinkItemTitle">[link title]</span>
+                    </a>
+                </li>
+            </ul>
+        </div>
+    </div>
+</wicket:panel>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorPanel.java
new file mode 100644
index 0000000..cb8d0f2
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorPanel.java
@@ -0,0 +1,220 @@
+/*
+ *  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.collection.selector;
+
+import de.agilecoders.wicket.core.markup.html.bootstrap.button.Buttons;
+
+import java.util.List;
+import org.apache.wicket.AttributeModifier;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.AbstractLink;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.isis.core.commons.lang.StringExtensions;
+import org.apache.isis.viewer.wicket.model.hints.IsisUiHintEvent;
+import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
+import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
+import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+import org.apache.isis.viewer.wicket.ui.CollectionContentsAsFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
+
+/**
+ * Provides a list of links for selecting other views that support
+ * {@link org.apache.isis.viewer.wicket.ui.ComponentType#COLLECTION_CONTENTS} with a backing
+ * {@link org.apache.isis.viewer.wicket.model.models.EntityCollectionModel}.
+ */
+public class CollectionSelectorPanel
+        extends PanelAbstract<EntityCollectionModel> implements UiHintPathSignificant /*,  CollectionCountProvider*/ {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final String ID_VIEWS = "views";
+    private static final String ID_VIEW_LIST = "viewList";
+    private static final String ID_VIEW_LINK = "viewLink";
+    private static final String ID_VIEW_ITEM = "viewItem";
+    private static final String ID_VIEW_ITEM_TITLE = "viewItemTitle";
+    private static final String ID_VIEW_ITEM_ICON = "viewItemIcon";
+
+    private static final String ID_VIEW_BUTTON_TITLE = "viewButtonTitle";
+    private static final String ID_VIEW_BUTTON_ICON = "viewButtonIcon";
+
+    private final ComponentType componentType;
+    private final CollectionSelectorHelper selectorHelper;
+
+    private ComponentFactory selectedComponentFactory;
+
+    public CollectionSelectorPanel(final String id, final EntityCollectionModel model, final ComponentFactory ignoreFactory) {
+        super(id, model);
+        this.componentType = ignoreFactory.getComponentType();
+        selectorHelper = new CollectionSelectorHelper(model, getComponentFactoryRegistry(), ignoreFactory);
+    }
+
+    /**
+     * Build UI only after added to parent.
+     */
+    public void onInitialize() {
+        super.onInitialize();
+        addDropdown();
+    }
+
+
+
+    private void addDropdown() {
+        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
+        final int selected = selectorHelper.honourViewHintElseDefault(this);
+
+        // selector
+        if (componentFactories.size() <= 1) {
+            permanentlyHide(ID_VIEWS);
+        } else {
+            final Model<ComponentFactory> componentFactoryModel = new Model<>();
+
+            this.selectedComponentFactory = componentFactories.get(selected);
+            componentFactoryModel.setObject(this.selectedComponentFactory);
+
+            final WebMarkupContainer views = new WebMarkupContainer(ID_VIEWS);
+
+            final Label viewButtonTitle = new Label(ID_VIEW_BUTTON_TITLE, "Hidden");
+            views.addOrReplace(viewButtonTitle);
+
+            final Label viewButtonIcon = new Label(ID_VIEW_BUTTON_ICON, "");
+            views.addOrReplace(viewButtonIcon);
+
+            final WebMarkupContainer container = new WebMarkupContainer(ID_VIEW_LIST);
+
+            views.addOrReplace(container);
+            views.setOutputMarkupId(true);
+
+            this.setOutputMarkupId(true);
+
+            final ListView<ComponentFactory> listView = new ListView<ComponentFactory>(ID_VIEW_ITEM, componentFactories) {
+
+                private static final long serialVersionUID = 1L;
+
+                @Override
+                protected void populateItem(ListItem<ComponentFactory> item) {
+
+                    final int underlyingViewNum = item.getIndex();
+
+                    final ComponentFactory componentFactory = item.getModelObject();
+                    final AbstractLink link = new AjaxLink<Void>(ID_VIEW_LINK) {
+                        private static final long serialVersionUID = 1L;
+                        @Override
+                        public void onClick(AjaxRequestTarget target) {
+                            CollectionSelectorPanel linksSelectorPanel = CollectionSelectorPanel.this;
+                            linksSelectorPanel.setViewHintAndBroadcast(underlyingViewNum, target);
+
+                            CollectionSelectorPanel.this.selectedComponentFactory = componentFactory;
+                            target.add(CollectionSelectorPanel.this, views);
+                        }
+
+                        @Override
+                        protected void onComponentTag(ComponentTag tag) {
+                            super.onComponentTag(tag);
+                            Buttons.fixDisabledState(this, tag);
+                        }
+                    };
+
+                    IModel<String> title = nameFor(componentFactory);
+                    Label viewItemTitleLabel = new Label(ID_VIEW_ITEM_TITLE, title);
+                    link.add(viewItemTitleLabel);
+
+                    Label viewItemIcon = new Label(ID_VIEW_ITEM_ICON, "");
+                    link.add(viewItemIcon);
+
+                    boolean isEnabled = componentFactory != CollectionSelectorPanel.this.selectedComponentFactory;
+                    if (!isEnabled) {
+                        viewButtonTitle.setDefaultModel(title);
+                        IModel<String> cssClass = cssClassFor(componentFactory, viewButtonIcon);
+                        viewButtonIcon.add(AttributeModifier.replace("class", "ViewLinkItem " + cssClass.getObject()));
+                        link.setVisible(false);
+                    } else {
+                        IModel<String> cssClass = cssClassFor(componentFactory, viewItemIcon);
+                        viewItemIcon.add(new CssClassAppender(cssClass));
+                    }
+
+                    item.add(link);
+                }
+
+                private IModel<String> cssClassFor(final ComponentFactory componentFactory, Label viewIcon) {
+                    IModel<String> cssClass = null;
+                    if (componentFactory instanceof CollectionContentsAsFactory) {
+                        CollectionContentsAsFactory collectionContentsAsFactory = (CollectionContentsAsFactory) componentFactory;
+                        cssClass = collectionContentsAsFactory.getCssClass();
+                        viewIcon.setDefaultModelObject("");
+                        viewIcon.setEscapeModelStrings(true);
+                    }
+                    if (cssClass == null) {
+                        String name = componentFactory.getName();
+                        cssClass = Model.of(StringExtensions.asLowerDashed(name));
+                        // Small hack: if there is no specific CSS class then we assume that background-image is used
+                        // the span.ViewItemLink should have some content to show it
+                        // FIX: find a way to do this with CSS (width and height don't seems to help)
+                        viewIcon.setDefaultModelObject("&#160;&#160;&#160;&#160;&#160;");
+                        viewIcon.setEscapeModelStrings(false);
+                    }
+                    return cssClass;
+                }
+
+                private IModel<String> nameFor(final ComponentFactory componentFactory) {
+                    IModel<String> name = null;
+                    if (componentFactory instanceof CollectionContentsAsFactory) {
+                        CollectionContentsAsFactory collectionContentsAsFactory = (CollectionContentsAsFactory) componentFactory;
+                        name = collectionContentsAsFactory.getTitleLabel();
+                    }
+                    if (name == null) {
+                        name = Model.of(componentFactory.getName());
+                    }
+                    return name;
+                }
+            };
+            container.add(listView);
+            addOrReplace(views);
+        }
+    }
+
+
+    protected void setViewHintAndBroadcast(int viewNum, AjaxRequestTarget target) {
+        final UiHintContainer uiHintContainer = getUiHintContainer();
+        if(uiHintContainer == null) {
+            return;
+        }
+        uiHintContainer.setHint(CollectionSelectorPanel.this, CollectionSelectorHelper.UIHINT_EVENT_VIEW_KEY, ""+viewNum);
+        send(getPage(), Broadcast.EXACT, new IsisUiHintEvent(uiHintContainer, target));
+    }
+
+    @Override
+    public void renderHead(final IHeaderResponse response) {
+        super.renderHead(response);
+        //PanelUtil.renderHead(response, CollectionSelectorPanel.class);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorProvider.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorProvider.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorProvider.java
new file mode 100644
index 0000000..08132ec
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorProvider.java
@@ -0,0 +1,23 @@
+/*
+ *  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.collection.selector;
+
+public interface CollectionSelectorProvider {
+    CollectionSelectorPanel getSelectorDropdownPanel();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/UNUSED_CollectionSelectorPanel.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/UNUSED_CollectionSelectorPanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/UNUSED_CollectionSelectorPanel.css
new file mode 100644
index 0000000..8c3902e
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/UNUSED_CollectionSelectorPanel.css
@@ -0,0 +1,60 @@
+/*
+ *  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.
+ */
+.linksSelectorPanel .viewLinks {
+    float:right;
+    display:block;
+}
+
+.linksSelectorPanel ul.dropdown-menu {
+    min-width: 0;
+}
+
+.linksSelectorPanel ul.dropdown-menu li.viewItem {
+    min-width: 0;
+}
+
+.linksSelectorPanel ul.viewList li.viewItem:first-child span {
+    border-radius:4px 0 0 4px;
+    -moz-border-radius:4px 0 0 4px;
+    -webkit-border-radius:4px 0 0 4px;
+}
+
+.linksSelectorPanel ul.viewList li.viewItem:last-child span {
+    border-radius:0 4px 4px 0;
+    -moz-border-radius:0 4px 4px 0;
+    -webkit-border-radius:0 4px 4px 0;
+}
+
+
+.linksSelectorPanel .link-selector-panel-invisible {
+    display:none;
+}
+
+.linksSelectorPanel .list-inline {
+    margin-left: 0;
+}
+
+.linksSelectorPanel .list-inline li {
+    padding-left: 0;
+}
+
+
+.collectionContentsLinksSelectorPanel select {
+	margin-bottom: 1em;
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
index 498751c..803a053 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
@@ -56,7 +56,7 @@ import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
 import org.apache.isis.viewer.wicket.model.models.ActionPromptProvider;
 import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
 import org.apache.isis.viewer.wicket.ui.components.actionprompt.ActionPromptModalWindow;
-import org.apache.isis.viewer.wicket.ui.components.collection.CollectionCountProvider;
+import org.apache.isis.viewer.wicket.ui.components.collection.count.CollectionCountProvider;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ColumnAbstract;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ObjectAdapterPropertyColumn;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ObjectAdapterTitleColumn;

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.css
new file mode 100644
index 0000000..8c3902e
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.css
@@ -0,0 +1,60 @@
+/*
+ *  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.
+ */
+.linksSelectorPanel .viewLinks {
+    float:right;
+    display:block;
+}
+
+.linksSelectorPanel ul.dropdown-menu {
+    min-width: 0;
+}
+
+.linksSelectorPanel ul.dropdown-menu li.viewItem {
+    min-width: 0;
+}
+
+.linksSelectorPanel ul.viewList li.viewItem:first-child span {
+    border-radius:4px 0 0 4px;
+    -moz-border-radius:4px 0 0 4px;
+    -webkit-border-radius:4px 0 0 4px;
+}
+
+.linksSelectorPanel ul.viewList li.viewItem:last-child span {
+    border-radius:0 4px 4px 0;
+    -moz-border-radius:0 4px 4px 0;
+    -webkit-border-radius:0 4px 4px 0;
+}
+
+
+.linksSelectorPanel .link-selector-panel-invisible {
+    display:none;
+}
+
+.linksSelectorPanel .list-inline {
+    margin-left: 0;
+}
+
+.linksSelectorPanel .list-inline li {
+    padding-left: 0;
+}
+
+
+.collectionContentsLinksSelectorPanel select {
+	margin-bottom: 1em;
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.html
new file mode 100644
index 0000000..0a6d242
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.html
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns:wicket="http://wicket.apache.org">
+<body>
+<wicket:panel>
+    <div class="linksSelectorPanel">
+
+        <div class="views">
+            <div wicket:id="collectionContents-0" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
+            <div wicket:id="collectionContents-1" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
+            <div wicket:id="collectionContents-2" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
+            <div wicket:id="collectionContents-3" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
+            <div wicket:id="collectionContents-4" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
+            <div wicket:id="collectionContents-5" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
+            <div wicket:id="collectionContents-6" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
+            <div wicket:id="collectionContents-7" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
+            <div wicket:id="collectionContents-8" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
+            <div wicket:id="collectionContents-9" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
+        </div>
+    </div>
+</wicket:panel>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java
new file mode 100644
index 0000000..49db84a
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java
@@ -0,0 +1,226 @@
+/*
+ *  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.collectioncontents.multiple;
+
+import java.util.List;
+import org.apache.wicket.AttributeModifier;
+import org.apache.wicket.Component;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.event.IEvent;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.isis.viewer.wicket.model.hints.IsisEnvelopeEvent;
+import org.apache.isis.viewer.wicket.model.hints.IsisUiHintEvent;
+import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
+import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
+import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.components.collection.count.CollectionCountProvider;
+import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorPanel;
+import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorHelper;
+import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorProvider;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
+import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
+import org.apache.isis.viewer.wicket.ui.util.CssClassRemover;
+
+/**
+ * Subscribes to events generated by {@link org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorPanel}, rendering the appropriate {@link ComponentType#COLLECTION_CONTENTS}
+ * view for a backing {@link EntityCollectionModel}.
+ */
+public class CollectionContentsMultipleViewsPanel
+        extends PanelAbstract<EntityCollectionModel> implements UiHintPathSignificant,  CollectionCountProvider {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final String INVISIBLE_CLASS = "link-selector-panel-invisible";
+    private static final int MAX_NUM_UNDERLYING_VIEWS = 10;
+
+    private static final String UIHINT_VIEW = "view";
+
+    private final ComponentFactory ignoreFactory;
+
+    private final ComponentType componentType;
+    private final String underlyingIdPrefix;
+    private final CollectionSelectorHelper selectorHelper;
+
+    private ComponentFactory selectedComponentFactory;
+    private Component selectedComponent;
+
+    private Component[] underlyingViews;
+    private CollectionSelectorPanel selectorDropdownPanel;
+
+    public CollectionContentsMultipleViewsPanel(
+            final String id,
+            final EntityCollectionModel model,
+            final ComponentFactory ignoreFactory) {
+        super(id, model);
+        this.ignoreFactory = ignoreFactory;
+        this.underlyingIdPrefix = ComponentType.COLLECTION_CONTENTS.toString();
+        this.componentType = ignoreFactory.getComponentType();
+        selectorHelper = new CollectionSelectorHelper(model, getComponentFactoryRegistry(), ignoreFactory);
+
+    }
+
+    /**
+     * Build UI only after added to parent.
+     */
+    public void onInitialize() {
+        super.onInitialize();
+        addUnderlyingViews();
+    }
+
+
+    private void addUnderlyingViews() {
+        final EntityCollectionModel model = getModel();
+
+        final int selected = selectorHelper.honourViewHintElseDefault(getSelectorDropdownPanel());
+        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
+
+        // create all, hide the one not selected
+        underlyingViews = new Component[MAX_NUM_UNDERLYING_VIEWS];
+        int i = 0;
+        final EntityCollectionModel emptyModel = model.asDummy();
+        for (ComponentFactory componentFactory : componentFactories) {
+            final String underlyingId = underlyingIdPrefix + "-" + i;
+
+            Component underlyingView = componentFactory.createComponent(underlyingId,i==selected? model: emptyModel);
+            underlyingViews[i++] = underlyingView;
+            this.addOrReplace(underlyingView);
+        }
+
+        // hide any unused placeholders
+        while(i<MAX_NUM_UNDERLYING_VIEWS) {
+            String underlyingId = underlyingIdPrefix + "-" + i;
+            permanentlyHide(underlyingId);
+            i++;
+        }
+
+        this.setOutputMarkupId(true);
+
+        for(i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
+            Component component = underlyingViews[i];
+            if(component != null) {
+                if(i != selected) {
+                    component.add(new CssClassAppender(INVISIBLE_CLASS));
+                } else {
+                    selectedComponent = component;
+                }
+            }
+        }
+    }
+
+    @Override
+    public void onEvent(IEvent<?> event) {
+        super.onEvent(event);
+
+        final IsisUiHintEvent uiHintEvent = IsisEnvelopeEvent.openLetter(event, IsisUiHintEvent.class);
+        if(uiHintEvent == null) {
+            return;
+        }
+        final UiHintContainer uiHintContainer = uiHintEvent.getUiHintContainer();
+
+        int underlyingViewNum = 0;
+        String viewStr = uiHintContainer.getHint(this.getSelectorDropdownPanel(), UIHINT_VIEW);
+
+        List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
+
+        if(viewStr != null) {
+            try {
+                int view = Integer.parseInt(viewStr);
+                if(view >= 0 && view < componentFactories.size()) {
+                    underlyingViewNum = view;
+                }
+            } catch(NumberFormatException ex) {
+                // ignore
+            }
+        }
+
+        final EntityCollectionModel dummyModel = getModel().asDummy();
+        for(int i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
+            final Component component = underlyingViews[i];
+            if(component == null) {
+                continue;
+            }
+            final boolean isSelected = i == underlyingViewNum;
+            applyCssVisibility(component, isSelected);
+            component.setDefaultModel(isSelected? getModel(): dummyModel);
+        }
+
+        this.selectedComponentFactory = ignoreFactory;
+        this.selectedComponent = underlyingViews[underlyingViewNum];
+
+
+        final AjaxRequestTarget target = uiHintEvent.getTarget();
+        if(target != null) {
+            target.add(this, getSelectorDropdownPanel());
+        }
+
+    }
+
+
+    protected static void applyCssVisibility(final Component component, final boolean visible) {
+        if(component == null) {
+            return;
+        }
+        AttributeModifier modifier = visible ? new CssClassRemover(INVISIBLE_CLASS) : new CssClassAppender(INVISIBLE_CLASS);
+        component.add(modifier);
+    }
+
+    @Override
+    public void renderHead(final IHeaderResponse response) {
+        super.renderHead(response);
+        PanelUtil.renderHead(response, CollectionContentsMultipleViewsPanel.class);
+    }
+
+
+
+    @Override
+    public Integer getCount() {
+        if(selectedComponent instanceof CollectionCountProvider) {
+            final CollectionCountProvider collectionCountProvider = (CollectionCountProvider) selectedComponent;
+            return collectionCountProvider.getCount();
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Searches up the component hierarchy looking for a parent that implements
+     * {@link org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorProvider}.
+     * @return
+     */
+    private CollectionSelectorPanel getSelectorDropdownPanel() {
+        Component component = this;
+        while(component != null) {
+            if(component instanceof CollectionSelectorProvider) {
+                final CollectionSelectorPanel selectorDropdownPanel1 = ((CollectionSelectorProvider) component).getSelectorDropdownPanel();
+                if(selectorDropdownPanel1 == null) {
+                    throw new IllegalStateException("Found parent that implements HasSelectorDropdownPanel, but no SelectorDropdownPanel available (is null)");
+
+                }
+                return selectorDropdownPanel1;
+            }
+            component = component.getParent();
+        }
+        throw new IllegalStateException("Could not locate parent that implements HasSelectorDropdownPanel");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanelFactory.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanelFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanelFactory.java
new file mode 100644
index 0000000..53b8092
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanelFactory.java
@@ -0,0 +1,53 @@
+/*
+ *  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.collectioncontents.multiple;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+
+import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentFactoryAbstract;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+
+/**
+ * {@link ComponentFactory} for {@link CollectionContentsMultipleViewsPanel}.
+ */
+public class CollectionContentsMultipleViewsPanelFactory extends ComponentFactoryAbstract {
+
+    private static final long serialVersionUID = 1L;
+
+    public CollectionContentsMultipleViewsPanelFactory() {
+        super(ComponentType.COLLECTION_CONTENTS, 
+                CollectionContentsMultipleViewsPanel.class);
+    }
+
+    @Override
+    public ApplicationAdvice appliesTo(final IModel<?> model) {
+        return appliesIf(model instanceof EntityCollectionModel);
+    }
+
+    @Override
+    public Component createComponent(final String id, final IModel<?> model) {
+        final EntityCollectionModel collectionModel = (EntityCollectionModel) model;
+        return new CollectionContentsMultipleViewsPanel(id, collectionModel, this);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.html
deleted file mode 100644
index 8bec51a..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied.  See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns:wicket="http://wicket.apache.org">
-<body>
-<wicket:panel>
-    <div class="linksSelectorPanel">
-        <div class="btn-group viewLinks" wicket:id="views">
-            <button type="button" class="btn btn-sm btn-info">
-                <span wicket:id="viewButtonIcon" class="ViewLinkItem"></span>
-                <span wicket:id="viewButtonTitle" class="ViewLinkItemTitle"></span>
-            </button>
-            <button type="button" class="btn btn-sm btn-info dropdown-toggle" data-toggle="dropdown">
-                <span class="caret"></span>
-            </button>
-            <ul wicket:id="viewList" class="dropdown-menu dropdown-menu-right" role="menu">
-                <li wicket:id="viewItem" class="viewItem">
-                    <a href="#" wicket:id="viewLink">
-                        <span wicket:id="viewItemIcon" class="ViewLinkItem"></span> <span wicket:id="viewItemTitle" class="ViewLinkItemTitle">[link title]</span>
-                    </a>
-                </li>
-            </ul>
-        </div>
-    </div>
-</wicket:panel>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.java
deleted file mode 100644
index 37797c5..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- *  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.collectioncontents.selector.dropdown;
-
-import de.agilecoders.wicket.core.markup.html.bootstrap.button.Buttons;
-
-import java.util.List;
-import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.event.Broadcast;
-import org.apache.wicket.markup.ComponentTag;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.apache.isis.core.commons.lang.StringExtensions;
-import org.apache.isis.viewer.wicket.model.hints.IsisUiHintEvent;
-import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
-import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
-import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
-import org.apache.isis.viewer.wicket.ui.CollectionContentsAsFactory;
-import org.apache.isis.viewer.wicket.ui.ComponentFactory;
-import org.apache.isis.viewer.wicket.ui.ComponentType;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
-import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
-
-/**
- * Provides a list of links for selecting other views that support
- * {@link org.apache.isis.viewer.wicket.ui.ComponentType#COLLECTION_CONTENTS} with a backing
- * {@link org.apache.isis.viewer.wicket.model.models.EntityCollectionModel}.
- */
-public class CollectionContentsSelectorDropdownPanel
-        extends PanelAbstract<EntityCollectionModel> implements UiHintPathSignificant /*,  CollectionCountProvider*/ {
-
-    private static final long serialVersionUID = 1L;
-
-    private static final String ID_VIEWS = "views";
-    private static final String ID_VIEW_LIST = "viewList";
-    private static final String ID_VIEW_LINK = "viewLink";
-    private static final String ID_VIEW_ITEM = "viewItem";
-    private static final String ID_VIEW_ITEM_TITLE = "viewItemTitle";
-    private static final String ID_VIEW_ITEM_ICON = "viewItemIcon";
-
-    private static final String ID_VIEW_BUTTON_TITLE = "viewButtonTitle";
-    private static final String ID_VIEW_BUTTON_ICON = "viewButtonIcon";
-
-    private final ComponentType componentType;
-    private final CollectionContentsSelectorHelper selectorHelper;
-
-    private ComponentFactory selectedComponentFactory;
-
-    public CollectionContentsSelectorDropdownPanel(final String id, final EntityCollectionModel model, final ComponentFactory ignoreFactory) {
-        super(id, model);
-        this.componentType = ignoreFactory.getComponentType();
-        selectorHelper = new CollectionContentsSelectorHelper(model, getComponentFactoryRegistry(), ignoreFactory);
-    }
-
-    /**
-     * Build UI only after added to parent.
-     */
-    public void onInitialize() {
-        super.onInitialize();
-        addDropdown();
-    }
-
-
-
-    private void addDropdown() {
-        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
-        final int selected = selectorHelper.honourViewHintElseDefault(this);
-
-        // selector
-        if (componentFactories.size() <= 1) {
-            permanentlyHide(ID_VIEWS);
-        } else {
-            final Model<ComponentFactory> componentFactoryModel = new Model<>();
-
-            this.selectedComponentFactory = componentFactories.get(selected);
-            componentFactoryModel.setObject(this.selectedComponentFactory);
-
-            final WebMarkupContainer views = new WebMarkupContainer(ID_VIEWS);
-
-            final Label viewButtonTitle = new Label(ID_VIEW_BUTTON_TITLE, "Hidden");
-            views.addOrReplace(viewButtonTitle);
-
-            final Label viewButtonIcon = new Label(ID_VIEW_BUTTON_ICON, "");
-            views.addOrReplace(viewButtonIcon);
-
-            final WebMarkupContainer container = new WebMarkupContainer(ID_VIEW_LIST);
-
-            views.addOrReplace(container);
-            views.setOutputMarkupId(true);
-
-            this.setOutputMarkupId(true);
-
-            final ListView<ComponentFactory> listView = new ListView<ComponentFactory>(ID_VIEW_ITEM, componentFactories) {
-
-                private static final long serialVersionUID = 1L;
-
-                @Override
-                protected void populateItem(ListItem<ComponentFactory> item) {
-
-                    final int underlyingViewNum = item.getIndex();
-
-                    final ComponentFactory componentFactory = item.getModelObject();
-                    final AbstractLink link = new AjaxLink<Void>(ID_VIEW_LINK) {
-                        private static final long serialVersionUID = 1L;
-                        @Override
-                        public void onClick(AjaxRequestTarget target) {
-                            CollectionContentsSelectorDropdownPanel linksSelectorPanel = CollectionContentsSelectorDropdownPanel.this;
-                            linksSelectorPanel.setViewHintAndBroadcast(underlyingViewNum, target);
-
-                            CollectionContentsSelectorDropdownPanel.this.selectedComponentFactory = componentFactory;
-                            target.add(CollectionContentsSelectorDropdownPanel.this, views);
-                        }
-
-                        @Override
-                        protected void onComponentTag(ComponentTag tag) {
-                            super.onComponentTag(tag);
-                            Buttons.fixDisabledState(this, tag);
-                        }
-                    };
-
-                    IModel<String> title = nameFor(componentFactory);
-                    Label viewItemTitleLabel = new Label(ID_VIEW_ITEM_TITLE, title);
-                    link.add(viewItemTitleLabel);
-
-                    Label viewItemIcon = new Label(ID_VIEW_ITEM_ICON, "");
-                    link.add(viewItemIcon);
-
-                    boolean isEnabled = componentFactory != CollectionContentsSelectorDropdownPanel.this.selectedComponentFactory;
-                    if (!isEnabled) {
-                        viewButtonTitle.setDefaultModel(title);
-                        IModel<String> cssClass = cssClassFor(componentFactory, viewButtonIcon);
-                        viewButtonIcon.add(AttributeModifier.replace("class", "ViewLinkItem " + cssClass.getObject()));
-                        link.setVisible(false);
-                    } else {
-                        IModel<String> cssClass = cssClassFor(componentFactory, viewItemIcon);
-                        viewItemIcon.add(new CssClassAppender(cssClass));
-                    }
-
-                    item.add(link);
-                }
-
-                private IModel<String> cssClassFor(final ComponentFactory componentFactory, Label viewIcon) {
-                    IModel<String> cssClass = null;
-                    if (componentFactory instanceof CollectionContentsAsFactory) {
-                        CollectionContentsAsFactory collectionContentsAsFactory = (CollectionContentsAsFactory) componentFactory;
-                        cssClass = collectionContentsAsFactory.getCssClass();
-                        viewIcon.setDefaultModelObject("");
-                        viewIcon.setEscapeModelStrings(true);
-                    }
-                    if (cssClass == null) {
-                        String name = componentFactory.getName();
-                        cssClass = Model.of(StringExtensions.asLowerDashed(name));
-                        // Small hack: if there is no specific CSS class then we assume that background-image is used
-                        // the span.ViewItemLink should have some content to show it
-                        // FIX: find a way to do this with CSS (width and height don't seems to help)
-                        viewIcon.setDefaultModelObject("&#160;&#160;&#160;&#160;&#160;");
-                        viewIcon.setEscapeModelStrings(false);
-                    }
-                    return cssClass;
-                }
-
-                private IModel<String> nameFor(final ComponentFactory componentFactory) {
-                    IModel<String> name = null;
-                    if (componentFactory instanceof CollectionContentsAsFactory) {
-                        CollectionContentsAsFactory collectionContentsAsFactory = (CollectionContentsAsFactory) componentFactory;
-                        name = collectionContentsAsFactory.getTitleLabel();
-                    }
-                    if (name == null) {
-                        name = Model.of(componentFactory.getName());
-                    }
-                    return name;
-                }
-            };
-            container.add(listView);
-            addOrReplace(views);
-        }
-    }
-
-
-
-    protected void setViewHintAndBroadcast(int viewNum, AjaxRequestTarget target) {
-        final UiHintContainer uiHintContainer = getUiHintContainer();
-        if(uiHintContainer == null) {
-            return;
-        }
-        uiHintContainer.setHint(CollectionContentsSelectorDropdownPanel.this, CollectionContentsSelectorHelper.UIHINT_VIEW, ""+viewNum);
-        send(getPage(), Broadcast.EXACT, new IsisUiHintEvent(uiHintContainer, target));
-    }
-
-    @Override
-    public void renderHead(final IHeaderResponse response) {
-        super.renderHead(response);
-        PanelUtil.renderHead(response, CollectionContentsSelectorDropdownPanel.class);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorHelper.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorHelper.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorHelper.java
deleted file mode 100644
index 06eed95..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorHelper.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- *  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.collectioncontents.selector.dropdown;
-
-import java.util.ArrayList;
-import java.util.List;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.Lists;
-import org.apache.wicket.Component;
-import org.apache.wicket.model.IModel;
-import org.apache.isis.applib.annotation.Render;
-import org.apache.isis.core.metamodel.facets.members.render.RenderFacet;
-import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
-import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
-import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
-import org.apache.isis.viewer.wicket.ui.ComponentFactory;
-import org.apache.isis.viewer.wicket.ui.ComponentType;
-import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistry;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.links.CollectionContentsLinksSelectorPanelFactory;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory;
-
-public class CollectionContentsSelectorHelper {
-
-    static final String UIHINT_VIEW = "view";
-    private static final long serialVersionUID = 1L;
-
-    private final ComponentType componentType;
-    private final ComponentFactoryRegistry componentFactoryRegistry;
-    private final EntityCollectionModel model;
-    private final ComponentFactory ignoreFactory;
-    private final List<ComponentFactory> componentFactories;
-
-
-    public CollectionContentsSelectorHelper(
-            final EntityCollectionModel model,
-            final ComponentFactoryRegistry componentFactoryRegistry,
-            final ComponentFactory ignoreFactory) {
-        this.componentFactoryRegistry = componentFactoryRegistry;
-        this.model = model;
-        this.ignoreFactory = ignoreFactory;
-        this.componentType = ignoreFactory.getComponentType();
-
-        componentFactories = findOtherComponentFactories();
-
-    }
-
-    public ComponentFactory getComponentFactory() {
-        return componentFactoryRegistry.findComponentFactoryElseFailFast(componentType, model);
-    }
-
-    public List<ComponentFactory> findOtherComponentFactories() {
-        final List<ComponentFactory> componentFactories = componentFactoryRegistry.findComponentFactories(componentType, model);
-        ArrayList<ComponentFactory> otherFactories = Lists.newArrayList(Collections2.filter(componentFactories, new Predicate<ComponentFactory>() {
-            @Override
-            public boolean apply(final ComponentFactory input) {
-                return input != ignoreFactory && input.getClass() != CollectionContentsLinksSelectorPanelFactory.class;
-            }
-        }));
-        return ordered(otherFactories);
-    }
-
-    public int honourViewHintElseDefault(final Component component) {
-        // honour hints ...
-        final UiHintContainer hintContainer = getUiHintContainer(component);
-        if(hintContainer != null) {
-            String viewStr = hintContainer.getHint(component, UIHINT_VIEW);
-            if(viewStr != null) {
-                try {
-                    int view = Integer.parseInt(viewStr);
-                    if(view >= 0 && view < componentFactories.size()) {
-                        return view;
-                    }
-                } catch(NumberFormatException ex) {
-                    // ignore
-                }
-            }
-        }
-
-        // ... else default
-        int initialFactory = determineInitialFactory();
-        if(hintContainer != null) {
-            hintContainer.setHint(component, UIHINT_VIEW, ""+initialFactory);
-            // don't broadcast (no AjaxRequestTarget, still configuring initial setup)
-        }
-        return initialFactory;
-    }
-
-    private static List<ComponentFactory> ordered(List<ComponentFactory> componentFactories) {
-        return orderAjaxTableToEnd(componentFactories);
-    }
-
-    static List<ComponentFactory> orderAjaxTableToEnd(List<ComponentFactory> componentFactories) {
-        int ajaxTableIdx = findAjaxTable(componentFactories);
-        if(ajaxTableIdx>=0) {
-            List<ComponentFactory> orderedFactories = Lists.newArrayList(componentFactories);
-            ComponentFactory ajaxTableFactory = orderedFactories.remove(ajaxTableIdx);
-            orderedFactories.add(ajaxTableFactory);
-            return orderedFactories;
-        } else {
-            return componentFactories;
-        }
-    }
-
-    private static int findAjaxTable(List<ComponentFactory> componentFactories) {
-        for(int i=0; i<componentFactories.size(); i++) {
-            if(componentFactories.get(i) instanceof CollectionContentsAsAjaxTablePanelFactory) {
-                return i;
-            }
-        }
-        return -1;
-    }
-
-
-
-
-
-    /**
-     * return the index of {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory unresolved panel} if present and not eager loading;
-     * else the index of {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory ajax table} if present,
-     * otherwise first factory.
-     */
-    protected int determineInitialFactory() {
-        if(!hasRenderEagerlyFacet(model)) {
-            for(int i=0; i<componentFactories.size(); i++) {
-                if(componentFactories.get(i) instanceof CollectionContentsAsUnresolvedPanelFactory) {
-                    return i;
-                }
-            }
-        }
-        int ajaxTableIdx = CollectionContentsSelectorHelper.findAjaxTable(componentFactories);
-        if(ajaxTableIdx>=0) {
-            return ajaxTableIdx;
-        }
-        return 0;
-    }
-
-    private static UiHintContainer getUiHintContainer(final Component component) {
-        return UiHintContainer.Util.hintContainerOf(component);
-    }
-
-
-    private static boolean hasRenderEagerlyFacet(IModel<?> model) {
-        if(!(model instanceof EntityCollectionModel)) {
-            return false;
-        }
-        final EntityCollectionModel entityCollectionModel = (EntityCollectionModel) model;
-        if(!entityCollectionModel.isParented()) {
-            return false;
-        }
-
-        final OneToManyAssociation collection =
-                entityCollectionModel.getCollectionMemento().getCollection();
-        RenderFacet renderFacet = collection.getFacet(RenderFacet.class);
-        return renderFacet != null && renderFacet.value() == Render.Type.EAGERLY;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/92ffe2d2/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorSelectorDropdownPanel.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorSelectorDropdownPanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorSelectorDropdownPanel.css
deleted file mode 100644
index 8c3902e..0000000
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorSelectorDropdownPanel.css
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *  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.
- */
-.linksSelectorPanel .viewLinks {
-    float:right;
-    display:block;
-}
-
-.linksSelectorPanel ul.dropdown-menu {
-    min-width: 0;
-}
-
-.linksSelectorPanel ul.dropdown-menu li.viewItem {
-    min-width: 0;
-}
-
-.linksSelectorPanel ul.viewList li.viewItem:first-child span {
-    border-radius:4px 0 0 4px;
-    -moz-border-radius:4px 0 0 4px;
-    -webkit-border-radius:4px 0 0 4px;
-}
-
-.linksSelectorPanel ul.viewList li.viewItem:last-child span {
-    border-radius:0 4px 4px 0;
-    -moz-border-radius:0 4px 4px 0;
-    -webkit-border-radius:0 4px 4px 0;
-}
-
-
-.linksSelectorPanel .link-selector-panel-invisible {
-    display:none;
-}
-
-.linksSelectorPanel .list-inline {
-    margin-left: 0;
-}
-
-.linksSelectorPanel .list-inline li {
-    padding-left: 0;
-}
-
-
-.collectionContentsLinksSelectorPanel select {
-	margin-bottom: 1em;
-}


[27/44] isis git commit: ISIS-537: completed factoring out of CollectionContentsSelectorHelper.

Posted by da...@apache.org.
ISIS-537: completed factoring out of CollectionContentsSelectorHelper.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/7087fc25
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/7087fc25
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/7087fc25

Branch: refs/heads/master
Commit: 7087fc25ece5113839975db3b83ae4d1c78d041a
Parents: 457b365
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sun Nov 9 15:52:49 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 10:21:43 2014 +0000

----------------------------------------------------------------------
 ...CollectionContentsSelectorDropdownPanel.java | 247 +--------------
 .../CollectionContentsSelectorHelper.java       |  97 +++++-
 .../CollectionContentsLinksSelectorPanel.java   | 315 +------------------
 ...ectionContentsSelectorDropdownPanelTest.java |   2 +-
 4 files changed, 122 insertions(+), 539 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/7087fc25/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.java
index 0903d2a..37797c5 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.java
@@ -21,13 +21,8 @@ package org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.
 
 import de.agilecoders.wicket.core.markup.html.bootstrap.button.Buttons;
 
-import java.util.ArrayList;
 import java.util.List;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.Lists;
 import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.Component;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
 import org.apache.wicket.event.Broadcast;
@@ -40,10 +35,7 @@ import org.apache.wicket.markup.html.list.ListItem;
 import org.apache.wicket.markup.html.list.ListView;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.Model;
-import org.apache.isis.applib.annotation.Render.Type;
 import org.apache.isis.core.commons.lang.StringExtensions;
-import org.apache.isis.core.metamodel.facets.members.render.RenderFacet;
-import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
 import org.apache.isis.viewer.wicket.model.hints.IsisUiHintEvent;
 import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
 import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
@@ -51,13 +43,9 @@ import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
 import org.apache.isis.viewer.wicket.ui.CollectionContentsAsFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentType;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.links.CollectionContentsLinksSelectorPanelFactory;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
 import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
 import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
-import org.apache.isis.viewer.wicket.ui.util.CssClassRemover;
 
 /**
  * Provides a list of links for selecting other views that support
@@ -69,9 +57,6 @@ public class CollectionContentsSelectorDropdownPanel
 
     private static final long serialVersionUID = 1L;
 
-    private static final String INVISIBLE_CLASS = "link-selector-panel-invisible";
-//    private static final int MAX_NUM_UNDERLYING_VIEWS = 10;
-
     private static final String ID_VIEWS = "views";
     private static final String ID_VIEW_LIST = "viewList";
     private static final String ID_VIEW_LINK = "viewLink";
@@ -79,23 +64,18 @@ public class CollectionContentsSelectorDropdownPanel
     private static final String ID_VIEW_ITEM_TITLE = "viewItemTitle";
     private static final String ID_VIEW_ITEM_ICON = "viewItemIcon";
 
-    private static final String UIHINT_VIEW = "view";
     private static final String ID_VIEW_BUTTON_TITLE = "viewButtonTitle";
     private static final String ID_VIEW_BUTTON_ICON = "viewButtonIcon";
 
     private final ComponentType componentType;
+    private final CollectionContentsSelectorHelper selectorHelper;
 
     private ComponentFactory selectedComponentFactory;
-//    private Component selectedComponent;
-
-//    /**
-//     * May be <tt>null</tt>, depending upon the model implementation.
-//     */
-//    protected WebMarkupContainer additionalLinks;
 
-    public CollectionContentsSelectorDropdownPanel(final String id, final EntityCollectionModel model, final ComponentFactory factory) {
+    public CollectionContentsSelectorDropdownPanel(final String id, final EntityCollectionModel model, final ComponentFactory ignoreFactory) {
         super(id, model);
-        this.componentType = factory.getComponentType();
+        this.componentType = ignoreFactory.getComponentType();
+        selectorHelper = new CollectionContentsSelectorHelper(model, getComponentFactoryRegistry(), ignoreFactory);
     }
 
     /**
@@ -103,36 +83,14 @@ public class CollectionContentsSelectorDropdownPanel
      */
     public void onInitialize() {
         super.onInitialize();
-        ComponentFactory componentFactory = getComponentFactoryRegistry().findComponentFactoryElseFailFast(getComponentType(), getModel());
-        addUnderlyingViews(getModel(), componentFactory);
+        addDropdown();
     }
 
 
-    private void addUnderlyingViews(final EntityCollectionModel model, final ComponentFactory factory) {
-        final List<ComponentFactory> componentFactories = findOtherComponentFactories(model, factory);
-
-        final int selected = honourViewHintElseDefault(componentFactories, model);
 
-        final CollectionContentsSelectorDropdownPanel selectorPanel = this;
-
-        // create all, hide the one not selected
-//        final Component[] underlyingViews = new Component[MAX_NUM_UNDERLYING_VIEWS];
-//        int i = 0;
-//        final EntityCollectionModel emptyModel = model.asDummy();
-//        for (ComponentFactory componentFactory : componentFactories) {
-//            final String underlyingId = underlyingIdPrefix + "-" + i;
-//
-//            Component underlyingView = componentFactory.createComponent(underlyingId,i==selected? model: emptyModel);
-//            underlyingViews[i++] = underlyingView;
-//            selectorPanel.addOrReplace(underlyingView);
-//        }
-
-//        // hide any unused placeholders
-//        while(i<MAX_NUM_UNDERLYING_VIEWS) {
-//            String underlyingId = underlyingIdPrefix + "-" + i;
-//            permanentlyHide(underlyingId);
-//            i++;
-//        }
+    private void addDropdown() {
+        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
+        final int selected = selectorHelper.honourViewHintElseDefault(this);
 
         // selector
         if (componentFactories.size() <= 1) {
@@ -140,8 +98,8 @@ public class CollectionContentsSelectorDropdownPanel
         } else {
             final Model<ComponentFactory> componentFactoryModel = new Model<>();
 
-            selectorPanel.selectedComponentFactory = componentFactories.get(selected);
-            componentFactoryModel.setObject(selectorPanel.selectedComponentFactory);
+            this.selectedComponentFactory = componentFactories.get(selected);
+            componentFactoryModel.setObject(this.selectedComponentFactory);
 
             final WebMarkupContainer views = new WebMarkupContainer(ID_VIEWS);
 
@@ -175,21 +133,8 @@ public class CollectionContentsSelectorDropdownPanel
                             CollectionContentsSelectorDropdownPanel linksSelectorPanel = CollectionContentsSelectorDropdownPanel.this;
                             linksSelectorPanel.setViewHintAndBroadcast(underlyingViewNum, target);
 
-//                            final EntityCollectionModel dummyModel = model.asDummy();
-//                            for(int i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
-//                                final Component component = underlyingViews[i];
-//                                if(component == null) {
-//                                    continue;
-//                                }
-//                                final boolean isSelected = i == underlyingViewNum;
-//                                applyCssVisibility(component, isSelected);
-//                                component.setDefaultModel(isSelected? model: dummyModel);
-//                            }
-
-                            selectorPanel.selectedComponentFactory = componentFactory;
-//                            selectorPanel.selectedComponent = underlyingViews[underlyingViewNum];
-//                            selectorPanel.onSelect(target);
-                            target.add(selectorPanel, views);
+                            CollectionContentsSelectorDropdownPanel.this.selectedComponentFactory = componentFactory;
+                            target.add(CollectionContentsSelectorDropdownPanel.this, views);
                         }
 
                         @Override
@@ -206,7 +151,7 @@ public class CollectionContentsSelectorDropdownPanel
                     Label viewItemIcon = new Label(ID_VIEW_ITEM_ICON, "");
                     link.add(viewItemIcon);
 
-                    boolean isEnabled = componentFactory != selectorPanel.selectedComponentFactory;
+                    boolean isEnabled = componentFactory != CollectionContentsSelectorDropdownPanel.this.selectedComponentFactory;
                     if (!isEnabled) {
                         viewButtonTitle.setDefaultModel(title);
                         IModel<String> cssClass = cssClassFor(componentFactory, viewButtonIcon);
@@ -255,17 +200,6 @@ public class CollectionContentsSelectorDropdownPanel
             container.add(listView);
             addOrReplace(views);
         }
-
-//        for(i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
-//            Component component = underlyingViews[i];
-//            if(component != null) {
-//                if(i != selected) {
-//                    component.add(new CssClassAppender(INVISIBLE_CLASS));
-//                } else {
-//                    selectedComponent = component;
-//                }
-//            }
-//        }
     }
 
 
@@ -275,167 +209,14 @@ public class CollectionContentsSelectorDropdownPanel
         if(uiHintContainer == null) {
             return;
         }
-        uiHintContainer.setHint(CollectionContentsSelectorDropdownPanel.this, UIHINT_VIEW, ""+viewNum);
+        uiHintContainer.setHint(CollectionContentsSelectorDropdownPanel.this, CollectionContentsSelectorHelper.UIHINT_VIEW, ""+viewNum);
         send(getPage(), Broadcast.EXACT, new IsisUiHintEvent(uiHintContainer, target));
     }
 
-//    /**
-//     * Iterates up the component hierarchy looking for a parent
-//     * {@link org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel}, and if so adds to ajax target so that it'll
-//     * be repainted.
-//     *
-//     * <p>
-//     * Yeah, agreed, it's a little bit hacky doing it this way, because it bakes
-//     * in knowledge that this component is created, somehow, by a parent {@link org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel}.
-//     * Perhaps it could be refactored to use a more general purpose observer pattern?
-//     *
-//     * <p>
-//     * In fact, I've since discovered that Wicket has an event bus, which is used by the
-//     * {@link org.apache.isis.viewer.wicket.model.hints.UiHintContainer hinting mechanism}.  So this ought to be relatively easy to do.
-//     */
-//    public void onSelect(AjaxRequestTarget target) {
-//        Component component = this;
-//        while(component != null) {
-//            if(component instanceof CollectionPanel) {
-//                CollectionPanel collectionPanel = (CollectionPanel) component;
-//                boolean hasCount = collectionPanel.hasCount();
-//                if(hasCount) {
-//                    collectionPanel.updateLabel(target);
-//                }
-////                if(additionalLinks != null) {
-////                    applyCssVisibility(additionalLinks, hasCount);
-////                }
-//                return;
-//            }
-//            component = component.getParent();
-//        }
-//    }
-
-
-    protected static void applyCssVisibility(final Component component, final boolean visible) {
-        if(component == null) {
-            return;
-        }
-        AttributeModifier modifier = visible ? new CssClassRemover(INVISIBLE_CLASS) : new CssClassAppender(INVISIBLE_CLASS);
-        component.add(modifier);
-    }
-
-    protected int honourViewHintElseDefault(final List<ComponentFactory> componentFactories, final IModel<?> model) {
-        // honour hints ...
-        final UiHintContainer hintContainer = getUiHintContainer();
-        if(hintContainer != null) {
-            String viewStr = hintContainer.getHint(this, UIHINT_VIEW);
-            if(viewStr != null) {
-                try {
-                    int view = Integer.parseInt(viewStr);
-                    if(view >= 0 && view < componentFactories.size()) {
-                        return view;
-                    }
-                } catch(NumberFormatException ex) {
-                    // ignore
-                }
-            }
-        }
-
-        // ... else default
-        int initialFactory = determineInitialFactory(componentFactories, model);
-        if(hintContainer != null) {
-            hintContainer.setHint(this, UIHINT_VIEW, ""+initialFactory);
-            // don't broadcast (no AjaxRequestTarget, still configuring initial setup)
-        }
-        return initialFactory;
-    }
-
-
-    /**
-     * return the index of {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory unresolved panel} if present and not eager loading;
-     * else the index of {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory ajax table} if present,
-     * otherwise first factory.
-     */
-    protected int determineInitialFactory(final List<ComponentFactory> componentFactories, final IModel<?> model) {
-        if(!hasRenderEagerlyFacet(model)) {
-            for(int i=0; i<componentFactories.size(); i++) {
-                if(componentFactories.get(i) instanceof CollectionContentsAsUnresolvedPanelFactory) {
-                    return i;
-                }
-            }
-        }
-        int ajaxTableIdx = findAjaxTable(componentFactories);
-        if(ajaxTableIdx>=0) {
-            return ajaxTableIdx;
-        }
-        return 0;
-    }
-
-    private List<ComponentFactory> findOtherComponentFactories(final EntityCollectionModel model, final ComponentFactory ignoreFactory) {
-        final List<ComponentFactory> componentFactories = getComponentFactoryRegistry().findComponentFactories(componentType, model);
-        ArrayList<ComponentFactory> otherFactories = Lists.newArrayList(Collections2.filter(componentFactories, new Predicate<ComponentFactory>() {
-            @Override
-            public boolean apply(final ComponentFactory input) {
-                return input != ignoreFactory && input.getClass() != CollectionContentsLinksSelectorPanelFactory.class;
-            }
-        }));
-        return ordered(otherFactories);
-    }
-
-    protected List<ComponentFactory> ordered(List<ComponentFactory> componentFactories) {
-        return orderAjaxTableToEnd(componentFactories);
-    }
-
-
     @Override
     public void renderHead(final IHeaderResponse response) {
         super.renderHead(response);
         PanelUtil.renderHead(response, CollectionContentsSelectorDropdownPanel.class);
     }
 
-
-    static List<ComponentFactory> orderAjaxTableToEnd(List<ComponentFactory> componentFactories) {
-        int ajaxTableIdx = findAjaxTable(componentFactories);
-        if(ajaxTableIdx>=0) {
-            List<ComponentFactory> orderedFactories = Lists.newArrayList(componentFactories);
-            ComponentFactory ajaxTableFactory = orderedFactories.remove(ajaxTableIdx);
-            orderedFactories.add(ajaxTableFactory);
-            return orderedFactories;
-        } else {
-            return componentFactories;
-        }
-    }
-    
-    private static int findAjaxTable(List<ComponentFactory> componentFactories) {
-        for(int i=0; i<componentFactories.size(); i++) {
-            if(componentFactories.get(i) instanceof CollectionContentsAsAjaxTablePanelFactory) {
-                return i;
-            }
-        }
-        return -1;
-    }
-
-
-    private static boolean hasRenderEagerlyFacet(IModel<?> model) {
-        if(!(model instanceof EntityCollectionModel)) {
-            return false;
-        }
-        final EntityCollectionModel entityCollectionModel = (EntityCollectionModel) model;
-        if(!entityCollectionModel.isParented()) {
-            return false;
-        }
-
-        final OneToManyAssociation collection = 
-                entityCollectionModel.getCollectionMemento().getCollection();
-        RenderFacet renderFacet = collection.getFacet(RenderFacet.class);
-        return renderFacet != null && renderFacet.value() == Type.EAGERLY;
-    }
-
-
-//    @Override
-//    public Integer getCount() {
-//        if(selectedComponent instanceof CollectionCountProvider) {
-//            final CollectionCountProvider collectionCountProvider = (CollectionCountProvider) selectedComponent;
-//            return collectionCountProvider.getCount();
-//        } else {
-//            return null;
-//        }
-//    }
-
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/7087fc25/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorHelper.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorHelper.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorHelper.java
index 6b796b5..1e3706c 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorHelper.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorHelper.java
@@ -24,34 +24,51 @@ import java.util.List;
 import com.google.common.base.Predicate;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.Lists;
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+import org.apache.isis.applib.annotation.Render;
+import org.apache.isis.core.metamodel.facets.members.render.RenderFacet;
+import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
 import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
 import org.apache.isis.viewer.wicket.ui.ComponentFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentType;
 import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistry;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.links.CollectionContentsLinksSelectorPanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory;
 
 public class CollectionContentsSelectorHelper {
 
+    static final String UIHINT_VIEW = "view";
     private static final long serialVersionUID = 1L;
 
     private final ComponentType componentType;
     private final ComponentFactoryRegistry componentFactoryRegistry;
     private final EntityCollectionModel model;
     private final ComponentFactory ignoreFactory;
+    private final List<ComponentFactory> componentFactories;
 
 
     public CollectionContentsSelectorHelper(
-            final ComponentType componentType,
-            final ComponentFactoryRegistry componentFactoryRegistry,
             final EntityCollectionModel model,
+            final ComponentFactoryRegistry componentFactoryRegistry,
             final ComponentFactory ignoreFactory) {
-        this.componentType = componentType;
         this.componentFactoryRegistry = componentFactoryRegistry;
         this.model = model;
         this.ignoreFactory = ignoreFactory;
+        this.componentType = ignoreFactory.getComponentType();
+
+        componentFactories = findOtherComponentFactories();
+
     }
 
+    public ComponentFactory getComponentFactory() {
+        return componentFactoryRegistry.findComponentFactoryElseFailFast(componentType, model);
+    }
+
+
+
 
     public List<ComponentFactory> findOtherComponentFactories() {
         final List<ComponentFactory> componentFactories = componentFactoryRegistry.findComponentFactories(componentType, model);
@@ -64,12 +81,10 @@ public class CollectionContentsSelectorHelper {
         return ordered(otherFactories);
     }
 
-    private static List<ComponentFactory> ordered(List<ComponentFactory> componentFactories) {
+    protected List<ComponentFactory> ordered(List<ComponentFactory> componentFactories) {
         return orderAjaxTableToEnd(componentFactories);
     }
 
-
-
     static List<ComponentFactory> orderAjaxTableToEnd(List<ComponentFactory> componentFactories) {
         int ajaxTableIdx = findAjaxTable(componentFactories);
         if(ajaxTableIdx>=0) {
@@ -82,7 +97,7 @@ public class CollectionContentsSelectorHelper {
         }
     }
 
-    public static int findAjaxTable(List<ComponentFactory> componentFactories) {
+    static int findAjaxTable(List<ComponentFactory> componentFactories) {
         for(int i=0; i<componentFactories.size(); i++) {
             if(componentFactories.get(i) instanceof CollectionContentsAsAjaxTablePanelFactory) {
                 return i;
@@ -93,4 +108,72 @@ public class CollectionContentsSelectorHelper {
 
 
 
+
+
+    public int honourViewHintElseDefault(final Component component) {
+        // honour hints ...
+        final UiHintContainer hintContainer = getUiHintContainer(component);
+        if(hintContainer != null) {
+            String viewStr = hintContainer.getHint(component, UIHINT_VIEW);
+            if(viewStr != null) {
+                try {
+                    int view = Integer.parseInt(viewStr);
+                    if(view >= 0 && view < componentFactories.size()) {
+                        return view;
+                    }
+                } catch(NumberFormatException ex) {
+                    // ignore
+                }
+            }
+        }
+
+        // ... else default
+        int initialFactory = determineInitialFactory(componentFactories, model);
+        if(hintContainer != null) {
+            hintContainer.setHint(component, UIHINT_VIEW, ""+initialFactory);
+            // don't broadcast (no AjaxRequestTarget, still configuring initial setup)
+        }
+        return initialFactory;
+    }
+
+    public static UiHintContainer getUiHintContainer(final Component component) {
+        return UiHintContainer.Util.hintContainerOf(component);
+    }
+
+
+    /**
+     * return the index of {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory unresolved panel} if present and not eager loading;
+     * else the index of {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory ajax table} if present,
+     * otherwise first factory.
+     */
+    protected int determineInitialFactory(final List<ComponentFactory> componentFactories, final IModel<?> model) {
+        if(!hasRenderEagerlyFacet(model)) {
+            for(int i=0; i<componentFactories.size(); i++) {
+                if(componentFactories.get(i) instanceof CollectionContentsAsUnresolvedPanelFactory) {
+                    return i;
+                }
+            }
+        }
+        int ajaxTableIdx = CollectionContentsSelectorHelper.findAjaxTable(componentFactories);
+        if(ajaxTableIdx>=0) {
+            return ajaxTableIdx;
+        }
+        return 0;
+    }
+
+    private static boolean hasRenderEagerlyFacet(IModel<?> model) {
+        if(!(model instanceof EntityCollectionModel)) {
+            return false;
+        }
+        final EntityCollectionModel entityCollectionModel = (EntityCollectionModel) model;
+        if(!entityCollectionModel.isParented()) {
+            return false;
+        }
+
+        final OneToManyAssociation collection =
+                entityCollectionModel.getCollectionMemento().getCollection();
+        RenderFacet renderFacet = collection.getFacet(RenderFacet.class);
+        return renderFacet != null && renderFacet.value() == Render.Type.EAGERLY;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/7087fc25/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
index f29244f..fd0a3da 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
@@ -19,21 +19,13 @@
 
 package org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.links;
 
-import java.util.ArrayList;
 import java.util.List;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.Lists;
 import org.apache.wicket.AttributeModifier;
 import org.apache.wicket.Component;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.event.IEvent;
 import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.Model;
-import org.apache.isis.applib.annotation.Render.Type;
-import org.apache.isis.core.metamodel.facets.members.render.RenderFacet;
-import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
 import org.apache.isis.viewer.wicket.model.hints.IsisEnvelopeEvent;
 import org.apache.isis.viewer.wicket.model.hints.IsisUiHintEvent;
 import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
@@ -42,9 +34,8 @@ import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
 import org.apache.isis.viewer.wicket.ui.ComponentFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentType;
 import org.apache.isis.viewer.wicket.ui.components.collection.CollectionCountProvider;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.CollectionContentsSelectorDropdownPanel;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.CollectionContentsSelectorHelper;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
 import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
 import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
@@ -65,30 +56,17 @@ public class CollectionContentsLinksSelectorPanel
 
     private static final String ID_SELECTOR_DROPDOWN = "selectorDropdown";
 
-//    private static final String ID_VIEWS = "views";
-//    private static final String ID_VIEW_LIST = "viewList";
-//    private static final String ID_VIEW_LINK = "viewLink";
-//    private static final String ID_VIEW_ITEM = "viewItem";
-//    private static final String ID_VIEW_ITEM_TITLE = "viewItemTitle";
-//    private static final String ID_VIEW_ITEM_ICON = "viewItemIcon";
-
     private static final String UIHINT_VIEW = "view";
-//    private static final String ID_VIEW_BUTTON_TITLE = "viewButtonTitle";
-//    private static final String ID_VIEW_BUTTON_ICON = "viewButtonIcon";
 
-    private final ComponentFactory componentFactory;
+    private final ComponentFactory ignoreFactory;
 
     private final ComponentType componentType;
     private final String underlyingIdPrefix;
+    private final CollectionContentsSelectorHelper selectorHelper;
 
     private ComponentFactory selectedComponentFactory;
     protected Component selectedComponent;
 
-//    /**
-//     * May be <tt>null</tt>, depending upon the model implementation.
-//     */
-//    protected WebMarkupContainer additionalLinks;
-
     private Component[] underlyingViews;
     private List<ComponentFactory> componentFactories;
     private CollectionContentsSelectorDropdownPanel selectorDropdownPanel;
@@ -96,11 +74,14 @@ public class CollectionContentsLinksSelectorPanel
     public CollectionContentsLinksSelectorPanel(
             final String id,
             final EntityCollectionModel model,
-            final ComponentFactory factory) {
+            final ComponentFactory ignoreFactory) {
         super(id, model);
-        componentFactory = factory;
+        this.ignoreFactory = ignoreFactory;
         this.underlyingIdPrefix = ComponentType.COLLECTION_CONTENTS.toString();
-        this.componentType = factory.getComponentType();
+        this.componentType = ignoreFactory.getComponentType();
+        selectorHelper = new CollectionContentsSelectorHelper(model, getComponentFactoryRegistry(), ignoreFactory);
+
+        componentFactories = selectorHelper.findOtherComponentFactories();
     }
 
     /**
@@ -108,18 +89,14 @@ public class CollectionContentsLinksSelectorPanel
      */
     public void onInitialize() {
         super.onInitialize();
-        ComponentFactory componentFactory = getComponentFactoryRegistry().findComponentFactoryElseFailFast(getComponentType(), getModel());
-        addUnderlyingViews(componentFactory);
+        addUnderlyingViews();
     }
 
 
-    private void addUnderlyingViews(final ComponentFactory factory) {
+    private void addUnderlyingViews() {
         final EntityCollectionModel model = getModel();
-        componentFactories = findOtherComponentFactories(model, factory);
 
-        final int selected = honourViewHintElseDefault(componentFactories, model);
-
-        final CollectionContentsLinksSelectorPanel selectorPanel = this;
+        final int selected = selectorHelper.honourViewHintElseDefault(this);
 
         // create all, hide the one not selected
         underlyingViews = new Component[MAX_NUM_UNDERLYING_VIEWS];
@@ -130,7 +107,7 @@ public class CollectionContentsLinksSelectorPanel
 
             Component underlyingView = componentFactory.createComponent(underlyingId,i==selected? model: emptyModel);
             underlyingViews[i++] = underlyingView;
-            selectorPanel.addOrReplace(underlyingView);
+            this.addOrReplace(underlyingView);
         }
 
         // hide any unused placeholders
@@ -142,129 +119,16 @@ public class CollectionContentsLinksSelectorPanel
 
         // selector
         if (componentFactories.size() <= 1) {
-            //permanentlyHide(ID_VIEWS);
-
             permanentlyHide(ID_SELECTOR_DROPDOWN);
         } else {
             final Model<ComponentFactory> componentFactoryModel = new Model<>();
 
-            selectorPanel.selectedComponentFactory = componentFactories.get(selected);
-            componentFactoryModel.setObject(selectorPanel.selectedComponentFactory);
+            this.selectedComponentFactory = componentFactories.get(selected);
+            componentFactoryModel.setObject(this.selectedComponentFactory);
 
-            selectorDropdownPanel = new CollectionContentsSelectorDropdownPanel(ID_SELECTOR_DROPDOWN, getModel(), componentFactory);
+            selectorDropdownPanel = new CollectionContentsSelectorDropdownPanel(ID_SELECTOR_DROPDOWN, getModel(), ignoreFactory);
 
             this.setOutputMarkupId(true);
-
-//            final WebMarkupContainer views = new WebMarkupContainer(ID_VIEWS);
-//
-//            final Label viewButtonTitle = new Label(ID_VIEW_BUTTON_TITLE, "Hidden");
-//            views.addOrReplace(viewButtonTitle);
-//
-//            final Label viewButtonIcon = new Label(ID_VIEW_BUTTON_ICON, "");
-//            views.addOrReplace(viewButtonIcon);
-//
-//            final WebMarkupContainer container = new WebMarkupContainer(ID_VIEW_LIST);
-//
-//            views.addOrReplace(container);
-//            views.setOutputMarkupId(true);
-//
-//            this.setOutputMarkupId(true);
-
-//            final ListView<ComponentFactory> listView = new ListView<ComponentFactory>(ID_VIEW_ITEM, componentFactories) {
-//
-//                private static final long serialVersionUID = 1L;
-//
-//                @Override
-//                protected void populateItem(ListItem<ComponentFactory> item) {
-//
-//                    final int underlyingViewNum = item.getIndex();
-//
-//                    final ComponentFactory componentFactory = item.getModelObject();
-//                    final AbstractLink link = new AjaxLink<Void>(ID_VIEW_LINK) {
-//                        private static final long serialVersionUID = 1L;
-//                        @Override
-//                        public void onClick(AjaxRequestTarget target) {
-//                            CollectionContentsLinksSelectorPanel linksSelectorPanel = CollectionContentsLinksSelectorPanel.this;
-//                            linksSelectorPanel.setViewHintAndBroadcast(underlyingViewNum, target);
-//
-//                            final EntityCollectionModel dummyModel = model.asDummy();
-//                            for(int i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
-//                                final Component component = underlyingViews[i];
-//                                if(component == null) {
-//                                    continue;
-//                                }
-//                                final boolean isSelected = i == underlyingViewNum;
-//                                applyCssVisibility(component, isSelected);
-//                                component.setDefaultModel(isSelected? model: dummyModel);
-//                            }
-//
-//                            selectorPanel.selectedComponentFactory = componentFactory;
-//                            selectorPanel.selectedComponent = underlyingViews[underlyingViewNum];
-//                            selectorPanel.onSelect(target);
-//                            target.add(selectorPanel, views);
-//                        }
-//
-//                        @Override
-//                        protected void onComponentTag(ComponentTag tag) {
-//                            super.onComponentTag(tag);
-//                            Buttons.fixDisabledState(this, tag);
-//                        }
-//                    };
-//
-//                    IModel<String> title = nameFor(componentFactory);
-//                    Label viewItemTitleLabel = new Label(ID_VIEW_ITEM_TITLE, title);
-//                    link.add(viewItemTitleLabel);
-//
-//                    Label viewItemIcon = new Label(ID_VIEW_ITEM_ICON, "");
-//                    link.add(viewItemIcon);
-//
-//                    boolean isEnabled = componentFactory != selectorPanel.selectedComponentFactory;
-//                    if (!isEnabled) {
-//                        viewButtonTitle.setDefaultModel(title);
-//                        IModel<String> cssClass = cssClassFor(componentFactory, viewButtonIcon);
-//                        viewButtonIcon.add(AttributeModifier.replace("class", "ViewLinkItem " + cssClass.getObject()));
-//                        link.setVisible(false);
-//                    } else {
-//                        IModel<String> cssClass = cssClassFor(componentFactory, viewItemIcon);
-//                        viewItemIcon.add(new CssClassAppender(cssClass));
-//                    }
-//
-//                    item.add(link);
-//                }
-//
-//                private IModel<String> cssClassFor(final ComponentFactory componentFactory, Label viewIcon) {
-//                    IModel<String> cssClass = null;
-//                    if (componentFactory instanceof CollectionContentsAsFactory) {
-//                        CollectionContentsAsFactory collectionContentsAsFactory = (CollectionContentsAsFactory) componentFactory;
-//                        cssClass = collectionContentsAsFactory.getCssClass();
-//                        viewIcon.setDefaultModelObject("");
-//                        viewIcon.setEscapeModelStrings(true);
-//                    }
-//                    if (cssClass == null) {
-//                        String name = componentFactory.getName();
-//                        cssClass = Model.of(StringExtensions.asLowerDashed(name));
-//                        // Small hack: if there is no specific CSS class then we assume that background-image is used
-//                        // the span.ViewItemLink should have some content to show it
-//                        // FIX: find a way to do this with CSS (width and height don't seems to help)
-//                        viewIcon.setDefaultModelObject("&#160;&#160;&#160;&#160;&#160;");
-//                        viewIcon.setEscapeModelStrings(false);
-//                    }
-//                    return cssClass;
-//                }
-//
-//                private IModel<String> nameFor(final ComponentFactory componentFactory) {
-//                    IModel<String> name = null;
-//                    if (componentFactory instanceof CollectionContentsAsFactory) {
-//                        CollectionContentsAsFactory collectionContentsAsFactory = (CollectionContentsAsFactory) componentFactory;
-//                        name = collectionContentsAsFactory.getTitleLabel();
-//                    }
-//                    if (name == null) {
-//                        name = Model.of(componentFactory.getName());
-//                    }
-//                    return name;
-//                }
-//            };
-//            container.add(listView);
             addOrReplace(selectorDropdownPanel);
         }
 
@@ -314,63 +178,18 @@ public class CollectionContentsLinksSelectorPanel
             component.setDefaultModel(isSelected? getModel(): dummyModel);
         }
 
-        this.selectedComponentFactory = componentFactory;
+        this.selectedComponentFactory = ignoreFactory;
         this.selectedComponent = underlyingViews[underlyingViewNum];
 
 
         final AjaxRequestTarget target = uiHintEvent.getTarget();
         if(target != null) {
-//            selectorDropdownPanel.onSelect(target);
             target.add(this, selectorDropdownPanel);
         }
 
-
     }
 
 
-
-//    protected void setViewHintAndBroadcast(int viewNum, AjaxRequestTarget target) {
-//        final UiHintContainer uiHintContainer = getUiHintContainer();
-//        if(uiHintContainer == null) {
-//            return;
-//        }
-//        uiHintContainer.setHint(CollectionContentsLinksSelectorPanel.this, UIHINT_VIEW, ""+viewNum);
-//        send(getPage(), Broadcast.EXACT, new IsisUiHintEvent(uiHintContainer, target));
-//    }
-
-//    /**
-//     * Iterates up the component hierarchy looking for a parent
-//     * {@link org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel}, and if so adds to ajax target so that it'll
-//     * be repainted.
-//     *
-//     * <p>
-//     * Yeah, agreed, it's a little bit hacky doing it this way, because it bakes
-//     * in knowledge that this component is created, somehow, by a parent {@link org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel}.
-//     * Perhaps it could be refactored to use a more general purpose observer pattern?
-//     *
-//     * <p>
-//     * In fact, I've since discovered that Wicket has an event bus, which is used by the
-//     * {@link UiHintContainer hinting mechanism}.  So this ought to be relatively easy to do.
-//     */
-//    protected void onSelect(AjaxRequestTarget target) {
-//        Component component = this;
-//        while(component != null) {
-//            if(component instanceof CollectionPanel) {
-//                CollectionPanel collectionPanel = (CollectionPanel) component;
-//                boolean hasCount = collectionPanel.hasCount();
-//                if(hasCount) {
-//                    collectionPanel.updateLabel(target);
-//                }
-//                if(additionalLinks != null) {
-//                    applyCssVisibility(additionalLinks, hasCount);
-//                }
-//                return;
-//            }
-//            component = component.getParent();
-//        }
-//    }
-
-
     protected static void applyCssVisibility(final Component component, final boolean visible) {
         if(component == null) {
             return;
@@ -379,69 +198,6 @@ public class CollectionContentsLinksSelectorPanel
         component.add(modifier);
     }
 
-    protected int honourViewHintElseDefault(final List<ComponentFactory> componentFactories, final IModel<?> model) {
-        // honour hints ...
-        final UiHintContainer hintContainer = getUiHintContainer();
-        if(hintContainer != null) {
-            String viewStr = hintContainer.getHint(this, UIHINT_VIEW);
-            if(viewStr != null) {
-                try {
-                    int view = Integer.parseInt(viewStr);
-                    if(view >= 0 && view < componentFactories.size()) {
-                        return view;
-                    }
-                } catch(NumberFormatException ex) {
-                    // ignore
-                }
-            }
-        }
-
-        // ... else default
-        int initialFactory = determineInitialFactory(componentFactories, model);
-        if(hintContainer != null) {
-            hintContainer.setHint(this, UIHINT_VIEW, ""+initialFactory);
-            // don't broadcast (no AjaxRequestTarget, still configuring initial setup)
-        }
-        return initialFactory;
-    }
-
-
-    /**
-     * return the index of {@link CollectionContentsAsUnresolvedPanelFactory unresolved panel} if present and not eager loading;
-     * else the index of {@link CollectionContentsAsAjaxTablePanelFactory ajax table} if present,
-     * otherwise first factory.
-     */
-    protected int determineInitialFactory(final List<ComponentFactory> componentFactories, final IModel<?> model) {
-        if(!hasRenderEagerlyFacet(model)) {
-            for(int i=0; i<componentFactories.size(); i++) {
-                if(componentFactories.get(i) instanceof CollectionContentsAsUnresolvedPanelFactory) {
-                    return i;
-                }
-            }
-        }
-        int ajaxTableIdx = findAjaxTable(componentFactories);
-        if(ajaxTableIdx>=0) {
-            return ajaxTableIdx;
-        }
-        return 0;
-    }
-
-    private List<ComponentFactory> findOtherComponentFactories(final EntityCollectionModel model, final ComponentFactory ignoreFactory) {
-        final List<ComponentFactory> componentFactories = getComponentFactoryRegistry().findComponentFactories(componentType, model);
-        ArrayList<ComponentFactory> otherFactories = Lists.newArrayList(Collections2.filter(componentFactories, new Predicate<ComponentFactory>() {
-            @Override
-            public boolean apply(final ComponentFactory input) {
-                return input != ignoreFactory && input.getClass() != CollectionContentsLinksSelectorPanelFactory.class;
-            }
-        }));
-        return ordered(otherFactories);
-    }
-
-    protected List<ComponentFactory> ordered(List<ComponentFactory> componentFactories) {
-        return orderAjaxTableToEnd(componentFactories);
-    }
-
-
     @Override
     public void renderHead(final IHeaderResponse response) {
         super.renderHead(response);
@@ -449,43 +205,6 @@ public class CollectionContentsLinksSelectorPanel
     }
 
 
-    static List<ComponentFactory> orderAjaxTableToEnd(List<ComponentFactory> componentFactories) {
-        int ajaxTableIdx = findAjaxTable(componentFactories);
-        if(ajaxTableIdx>=0) {
-            List<ComponentFactory> orderedFactories = Lists.newArrayList(componentFactories);
-            ComponentFactory ajaxTableFactory = orderedFactories.remove(ajaxTableIdx);
-            orderedFactories.add(ajaxTableFactory);
-            return orderedFactories;
-        } else {
-            return componentFactories;
-        }
-    }
-    
-    private static int findAjaxTable(List<ComponentFactory> componentFactories) {
-        for(int i=0; i<componentFactories.size(); i++) {
-            if(componentFactories.get(i) instanceof CollectionContentsAsAjaxTablePanelFactory) {
-                return i;
-            }
-        }
-        return -1;
-    }
-
-
-    private static boolean hasRenderEagerlyFacet(IModel<?> model) {
-        if(!(model instanceof EntityCollectionModel)) {
-            return false;
-        }
-        final EntityCollectionModel entityCollectionModel = (EntityCollectionModel) model;
-        if(!entityCollectionModel.isParented()) {
-            return false;
-        }
-
-        final OneToManyAssociation collection = 
-                entityCollectionModel.getCollectionMemento().getCollection();
-        RenderFacet renderFacet = collection.getFacet(RenderFacet.class);
-        return renderFacet != null && renderFacet.value() == Type.EAGERLY;
-    }
-
 
     @Override
     public Integer getCount() {

http://git-wip-us.apache.org/repos/asf/isis/blob/7087fc25/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanelTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanelTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanelTest.java
index d116be4..6b94417 100644
--- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanelTest.java
+++ b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanelTest.java
@@ -58,7 +58,7 @@ public class CollectionContentsSelectorDropdownPanelTest {
                         one,
                         ajaxTableComponentFactory, 
                         two);
-        List<ComponentFactory> orderAjaxTableToEnd = CollectionContentsSelectorDropdownPanel.orderAjaxTableToEnd(componentFactories);
+        List<ComponentFactory> orderAjaxTableToEnd = CollectionContentsSelectorHelper.orderAjaxTableToEnd(componentFactories);
         assertThat(orderAjaxTableToEnd.get(0), is(one));
         assertThat(orderAjaxTableToEnd.get(1), is(two));
         assertThat(orderAjaxTableToEnd.get(2), is(ajaxTableComponentFactory));


[25/44] isis git commit: ISIS-537: factored out CollectionContentsSelectorDropdownPanel from CollectionContentsLinksSelectorPanel.

Posted by da...@apache.org.
ISIS-537: factored out CollectionContentsSelectorDropdownPanel from CollectionContentsLinksSelectorPanel.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/70af3c32
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/70af3c32
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/70af3c32

Branch: refs/heads/master
Commit: 70af3c3238d90badefcb512cc733cf3e8ac3a294
Parents: 5918dd6
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sun Nov 9 15:05:51 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 10:21:41 2014 +0000

----------------------------------------------------------------------
 ...CollectionContentsSelectorDropdownPanel.html |  44 ++
 ...CollectionContentsSelectorDropdownPanel.java | 441 +++++++++++++++++++
 ...ionContentsSelectorSelectorDropdownPanel.css |  60 +++
 .../CollectionContentsLinksSelectorPanel.html   |  18 +-
 .../CollectionContentsLinksSelectorPanel.java   | 406 +++++++++--------
 .../java/dom/todo/ToDoItemContributions.java    |   1 +
 6 files changed, 788 insertions(+), 182 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/70af3c32/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.html
new file mode 100644
index 0000000..ea2a4d8
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.html
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns:wicket="http://wicket.apache.org">
+<body>
+<wicket:panel>
+    <div class="linksSelectorPanel">
+        <div class="btn-group viewLinks" wicket:id="views">
+            <button type="button" class="btn btn-xs btn-info">
+                <span wicket:id="viewButtonIcon" class="ViewLinkItem"></span>
+                <span wicket:id="viewButtonTitle" class="ViewLinkItemTitle"></span>
+            </button>
+            <button type="button" class="btn btn-xs btn-info dropdown-toggle" data-toggle="dropdown">
+                <span class="caret"></span>
+            </button>
+            <ul wicket:id="viewList" class="dropdown-menu dropdown-menu-right" role="menu">
+                <li wicket:id="viewItem" class="viewItem">
+                    <a href="#" wicket:id="viewLink">
+                        <span wicket:id="viewItemIcon" class="ViewLinkItem"></span> <span wicket:id="viewItemTitle" class="ViewLinkItemTitle">[link title]</span>
+                    </a>
+                </li>
+            </ul>
+        </div>
+    </div>
+</wicket:panel>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/isis/blob/70af3c32/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.java
new file mode 100644
index 0000000..0903d2a
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.java
@@ -0,0 +1,441 @@
+/*
+ *  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.collectioncontents.selector.dropdown;
+
+import de.agilecoders.wicket.core.markup.html.bootstrap.button.Buttons;
+
+import java.util.ArrayList;
+import java.util.List;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
+import org.apache.wicket.AttributeModifier;
+import org.apache.wicket.Component;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.markup.head.IHeaderResponse;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.link.AbstractLink;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.isis.applib.annotation.Render.Type;
+import org.apache.isis.core.commons.lang.StringExtensions;
+import org.apache.isis.core.metamodel.facets.members.render.RenderFacet;
+import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.viewer.wicket.model.hints.IsisUiHintEvent;
+import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
+import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
+import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+import org.apache.isis.viewer.wicket.ui.CollectionContentsAsFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.links.CollectionContentsLinksSelectorPanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
+import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
+import org.apache.isis.viewer.wicket.ui.util.CssClassRemover;
+
+/**
+ * Provides a list of links for selecting other views that support
+ * {@link org.apache.isis.viewer.wicket.ui.ComponentType#COLLECTION_CONTENTS} with a backing
+ * {@link org.apache.isis.viewer.wicket.model.models.EntityCollectionModel}.
+ */
+public class CollectionContentsSelectorDropdownPanel
+        extends PanelAbstract<EntityCollectionModel> implements UiHintPathSignificant /*,  CollectionCountProvider*/ {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final String INVISIBLE_CLASS = "link-selector-panel-invisible";
+//    private static final int MAX_NUM_UNDERLYING_VIEWS = 10;
+
+    private static final String ID_VIEWS = "views";
+    private static final String ID_VIEW_LIST = "viewList";
+    private static final String ID_VIEW_LINK = "viewLink";
+    private static final String ID_VIEW_ITEM = "viewItem";
+    private static final String ID_VIEW_ITEM_TITLE = "viewItemTitle";
+    private static final String ID_VIEW_ITEM_ICON = "viewItemIcon";
+
+    private static final String UIHINT_VIEW = "view";
+    private static final String ID_VIEW_BUTTON_TITLE = "viewButtonTitle";
+    private static final String ID_VIEW_BUTTON_ICON = "viewButtonIcon";
+
+    private final ComponentType componentType;
+
+    private ComponentFactory selectedComponentFactory;
+//    private Component selectedComponent;
+
+//    /**
+//     * May be <tt>null</tt>, depending upon the model implementation.
+//     */
+//    protected WebMarkupContainer additionalLinks;
+
+    public CollectionContentsSelectorDropdownPanel(final String id, final EntityCollectionModel model, final ComponentFactory factory) {
+        super(id, model);
+        this.componentType = factory.getComponentType();
+    }
+
+    /**
+     * Build UI only after added to parent.
+     */
+    public void onInitialize() {
+        super.onInitialize();
+        ComponentFactory componentFactory = getComponentFactoryRegistry().findComponentFactoryElseFailFast(getComponentType(), getModel());
+        addUnderlyingViews(getModel(), componentFactory);
+    }
+
+
+    private void addUnderlyingViews(final EntityCollectionModel model, final ComponentFactory factory) {
+        final List<ComponentFactory> componentFactories = findOtherComponentFactories(model, factory);
+
+        final int selected = honourViewHintElseDefault(componentFactories, model);
+
+        final CollectionContentsSelectorDropdownPanel selectorPanel = this;
+
+        // create all, hide the one not selected
+//        final Component[] underlyingViews = new Component[MAX_NUM_UNDERLYING_VIEWS];
+//        int i = 0;
+//        final EntityCollectionModel emptyModel = model.asDummy();
+//        for (ComponentFactory componentFactory : componentFactories) {
+//            final String underlyingId = underlyingIdPrefix + "-" + i;
+//
+//            Component underlyingView = componentFactory.createComponent(underlyingId,i==selected? model: emptyModel);
+//            underlyingViews[i++] = underlyingView;
+//            selectorPanel.addOrReplace(underlyingView);
+//        }
+
+//        // hide any unused placeholders
+//        while(i<MAX_NUM_UNDERLYING_VIEWS) {
+//            String underlyingId = underlyingIdPrefix + "-" + i;
+//            permanentlyHide(underlyingId);
+//            i++;
+//        }
+
+        // selector
+        if (componentFactories.size() <= 1) {
+            permanentlyHide(ID_VIEWS);
+        } else {
+            final Model<ComponentFactory> componentFactoryModel = new Model<>();
+
+            selectorPanel.selectedComponentFactory = componentFactories.get(selected);
+            componentFactoryModel.setObject(selectorPanel.selectedComponentFactory);
+
+            final WebMarkupContainer views = new WebMarkupContainer(ID_VIEWS);
+
+            final Label viewButtonTitle = new Label(ID_VIEW_BUTTON_TITLE, "Hidden");
+            views.addOrReplace(viewButtonTitle);
+
+            final Label viewButtonIcon = new Label(ID_VIEW_BUTTON_ICON, "");
+            views.addOrReplace(viewButtonIcon);
+
+            final WebMarkupContainer container = new WebMarkupContainer(ID_VIEW_LIST);
+
+            views.addOrReplace(container);
+            views.setOutputMarkupId(true);
+
+            this.setOutputMarkupId(true);
+
+            final ListView<ComponentFactory> listView = new ListView<ComponentFactory>(ID_VIEW_ITEM, componentFactories) {
+
+                private static final long serialVersionUID = 1L;
+
+                @Override
+                protected void populateItem(ListItem<ComponentFactory> item) {
+
+                    final int underlyingViewNum = item.getIndex();
+
+                    final ComponentFactory componentFactory = item.getModelObject();
+                    final AbstractLink link = new AjaxLink<Void>(ID_VIEW_LINK) {
+                        private static final long serialVersionUID = 1L;
+                        @Override
+                        public void onClick(AjaxRequestTarget target) {
+                            CollectionContentsSelectorDropdownPanel linksSelectorPanel = CollectionContentsSelectorDropdownPanel.this;
+                            linksSelectorPanel.setViewHintAndBroadcast(underlyingViewNum, target);
+
+//                            final EntityCollectionModel dummyModel = model.asDummy();
+//                            for(int i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
+//                                final Component component = underlyingViews[i];
+//                                if(component == null) {
+//                                    continue;
+//                                }
+//                                final boolean isSelected = i == underlyingViewNum;
+//                                applyCssVisibility(component, isSelected);
+//                                component.setDefaultModel(isSelected? model: dummyModel);
+//                            }
+
+                            selectorPanel.selectedComponentFactory = componentFactory;
+//                            selectorPanel.selectedComponent = underlyingViews[underlyingViewNum];
+//                            selectorPanel.onSelect(target);
+                            target.add(selectorPanel, views);
+                        }
+
+                        @Override
+                        protected void onComponentTag(ComponentTag tag) {
+                            super.onComponentTag(tag);
+                            Buttons.fixDisabledState(this, tag);
+                        }
+                    };
+
+                    IModel<String> title = nameFor(componentFactory);
+                    Label viewItemTitleLabel = new Label(ID_VIEW_ITEM_TITLE, title);
+                    link.add(viewItemTitleLabel);
+
+                    Label viewItemIcon = new Label(ID_VIEW_ITEM_ICON, "");
+                    link.add(viewItemIcon);
+
+                    boolean isEnabled = componentFactory != selectorPanel.selectedComponentFactory;
+                    if (!isEnabled) {
+                        viewButtonTitle.setDefaultModel(title);
+                        IModel<String> cssClass = cssClassFor(componentFactory, viewButtonIcon);
+                        viewButtonIcon.add(AttributeModifier.replace("class", "ViewLinkItem " + cssClass.getObject()));
+                        link.setVisible(false);
+                    } else {
+                        IModel<String> cssClass = cssClassFor(componentFactory, viewItemIcon);
+                        viewItemIcon.add(new CssClassAppender(cssClass));
+                    }
+
+                    item.add(link);
+                }
+
+                private IModel<String> cssClassFor(final ComponentFactory componentFactory, Label viewIcon) {
+                    IModel<String> cssClass = null;
+                    if (componentFactory instanceof CollectionContentsAsFactory) {
+                        CollectionContentsAsFactory collectionContentsAsFactory = (CollectionContentsAsFactory) componentFactory;
+                        cssClass = collectionContentsAsFactory.getCssClass();
+                        viewIcon.setDefaultModelObject("");
+                        viewIcon.setEscapeModelStrings(true);
+                    }
+                    if (cssClass == null) {
+                        String name = componentFactory.getName();
+                        cssClass = Model.of(StringExtensions.asLowerDashed(name));
+                        // Small hack: if there is no specific CSS class then we assume that background-image is used
+                        // the span.ViewItemLink should have some content to show it
+                        // FIX: find a way to do this with CSS (width and height don't seems to help)
+                        viewIcon.setDefaultModelObject("&#160;&#160;&#160;&#160;&#160;");
+                        viewIcon.setEscapeModelStrings(false);
+                    }
+                    return cssClass;
+                }
+
+                private IModel<String> nameFor(final ComponentFactory componentFactory) {
+                    IModel<String> name = null;
+                    if (componentFactory instanceof CollectionContentsAsFactory) {
+                        CollectionContentsAsFactory collectionContentsAsFactory = (CollectionContentsAsFactory) componentFactory;
+                        name = collectionContentsAsFactory.getTitleLabel();
+                    }
+                    if (name == null) {
+                        name = Model.of(componentFactory.getName());
+                    }
+                    return name;
+                }
+            };
+            container.add(listView);
+            addOrReplace(views);
+        }
+
+//        for(i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
+//            Component component = underlyingViews[i];
+//            if(component != null) {
+//                if(i != selected) {
+//                    component.add(new CssClassAppender(INVISIBLE_CLASS));
+//                } else {
+//                    selectedComponent = component;
+//                }
+//            }
+//        }
+    }
+
+
+
+    protected void setViewHintAndBroadcast(int viewNum, AjaxRequestTarget target) {
+        final UiHintContainer uiHintContainer = getUiHintContainer();
+        if(uiHintContainer == null) {
+            return;
+        }
+        uiHintContainer.setHint(CollectionContentsSelectorDropdownPanel.this, UIHINT_VIEW, ""+viewNum);
+        send(getPage(), Broadcast.EXACT, new IsisUiHintEvent(uiHintContainer, target));
+    }
+
+//    /**
+//     * Iterates up the component hierarchy looking for a parent
+//     * {@link org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel}, and if so adds to ajax target so that it'll
+//     * be repainted.
+//     *
+//     * <p>
+//     * Yeah, agreed, it's a little bit hacky doing it this way, because it bakes
+//     * in knowledge that this component is created, somehow, by a parent {@link org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel}.
+//     * Perhaps it could be refactored to use a more general purpose observer pattern?
+//     *
+//     * <p>
+//     * In fact, I've since discovered that Wicket has an event bus, which is used by the
+//     * {@link org.apache.isis.viewer.wicket.model.hints.UiHintContainer hinting mechanism}.  So this ought to be relatively easy to do.
+//     */
+//    public void onSelect(AjaxRequestTarget target) {
+//        Component component = this;
+//        while(component != null) {
+//            if(component instanceof CollectionPanel) {
+//                CollectionPanel collectionPanel = (CollectionPanel) component;
+//                boolean hasCount = collectionPanel.hasCount();
+//                if(hasCount) {
+//                    collectionPanel.updateLabel(target);
+//                }
+////                if(additionalLinks != null) {
+////                    applyCssVisibility(additionalLinks, hasCount);
+////                }
+//                return;
+//            }
+//            component = component.getParent();
+//        }
+//    }
+
+
+    protected static void applyCssVisibility(final Component component, final boolean visible) {
+        if(component == null) {
+            return;
+        }
+        AttributeModifier modifier = visible ? new CssClassRemover(INVISIBLE_CLASS) : new CssClassAppender(INVISIBLE_CLASS);
+        component.add(modifier);
+    }
+
+    protected int honourViewHintElseDefault(final List<ComponentFactory> componentFactories, final IModel<?> model) {
+        // honour hints ...
+        final UiHintContainer hintContainer = getUiHintContainer();
+        if(hintContainer != null) {
+            String viewStr = hintContainer.getHint(this, UIHINT_VIEW);
+            if(viewStr != null) {
+                try {
+                    int view = Integer.parseInt(viewStr);
+                    if(view >= 0 && view < componentFactories.size()) {
+                        return view;
+                    }
+                } catch(NumberFormatException ex) {
+                    // ignore
+                }
+            }
+        }
+
+        // ... else default
+        int initialFactory = determineInitialFactory(componentFactories, model);
+        if(hintContainer != null) {
+            hintContainer.setHint(this, UIHINT_VIEW, ""+initialFactory);
+            // don't broadcast (no AjaxRequestTarget, still configuring initial setup)
+        }
+        return initialFactory;
+    }
+
+
+    /**
+     * return the index of {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory unresolved panel} if present and not eager loading;
+     * else the index of {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory ajax table} if present,
+     * otherwise first factory.
+     */
+    protected int determineInitialFactory(final List<ComponentFactory> componentFactories, final IModel<?> model) {
+        if(!hasRenderEagerlyFacet(model)) {
+            for(int i=0; i<componentFactories.size(); i++) {
+                if(componentFactories.get(i) instanceof CollectionContentsAsUnresolvedPanelFactory) {
+                    return i;
+                }
+            }
+        }
+        int ajaxTableIdx = findAjaxTable(componentFactories);
+        if(ajaxTableIdx>=0) {
+            return ajaxTableIdx;
+        }
+        return 0;
+    }
+
+    private List<ComponentFactory> findOtherComponentFactories(final EntityCollectionModel model, final ComponentFactory ignoreFactory) {
+        final List<ComponentFactory> componentFactories = getComponentFactoryRegistry().findComponentFactories(componentType, model);
+        ArrayList<ComponentFactory> otherFactories = Lists.newArrayList(Collections2.filter(componentFactories, new Predicate<ComponentFactory>() {
+            @Override
+            public boolean apply(final ComponentFactory input) {
+                return input != ignoreFactory && input.getClass() != CollectionContentsLinksSelectorPanelFactory.class;
+            }
+        }));
+        return ordered(otherFactories);
+    }
+
+    protected List<ComponentFactory> ordered(List<ComponentFactory> componentFactories) {
+        return orderAjaxTableToEnd(componentFactories);
+    }
+
+
+    @Override
+    public void renderHead(final IHeaderResponse response) {
+        super.renderHead(response);
+        PanelUtil.renderHead(response, CollectionContentsSelectorDropdownPanel.class);
+    }
+
+
+    static List<ComponentFactory> orderAjaxTableToEnd(List<ComponentFactory> componentFactories) {
+        int ajaxTableIdx = findAjaxTable(componentFactories);
+        if(ajaxTableIdx>=0) {
+            List<ComponentFactory> orderedFactories = Lists.newArrayList(componentFactories);
+            ComponentFactory ajaxTableFactory = orderedFactories.remove(ajaxTableIdx);
+            orderedFactories.add(ajaxTableFactory);
+            return orderedFactories;
+        } else {
+            return componentFactories;
+        }
+    }
+    
+    private static int findAjaxTable(List<ComponentFactory> componentFactories) {
+        for(int i=0; i<componentFactories.size(); i++) {
+            if(componentFactories.get(i) instanceof CollectionContentsAsAjaxTablePanelFactory) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
+
+    private static boolean hasRenderEagerlyFacet(IModel<?> model) {
+        if(!(model instanceof EntityCollectionModel)) {
+            return false;
+        }
+        final EntityCollectionModel entityCollectionModel = (EntityCollectionModel) model;
+        if(!entityCollectionModel.isParented()) {
+            return false;
+        }
+
+        final OneToManyAssociation collection = 
+                entityCollectionModel.getCollectionMemento().getCollection();
+        RenderFacet renderFacet = collection.getFacet(RenderFacet.class);
+        return renderFacet != null && renderFacet.value() == Type.EAGERLY;
+    }
+
+
+//    @Override
+//    public Integer getCount() {
+//        if(selectedComponent instanceof CollectionCountProvider) {
+//            final CollectionCountProvider collectionCountProvider = (CollectionCountProvider) selectedComponent;
+//            return collectionCountProvider.getCount();
+//        } else {
+//            return null;
+//        }
+//    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/70af3c32/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorSelectorDropdownPanel.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorSelectorDropdownPanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorSelectorDropdownPanel.css
new file mode 100644
index 0000000..8c3902e
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorSelectorDropdownPanel.css
@@ -0,0 +1,60 @@
+/*
+ *  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.
+ */
+.linksSelectorPanel .viewLinks {
+    float:right;
+    display:block;
+}
+
+.linksSelectorPanel ul.dropdown-menu {
+    min-width: 0;
+}
+
+.linksSelectorPanel ul.dropdown-menu li.viewItem {
+    min-width: 0;
+}
+
+.linksSelectorPanel ul.viewList li.viewItem:first-child span {
+    border-radius:4px 0 0 4px;
+    -moz-border-radius:4px 0 0 4px;
+    -webkit-border-radius:4px 0 0 4px;
+}
+
+.linksSelectorPanel ul.viewList li.viewItem:last-child span {
+    border-radius:0 4px 4px 0;
+    -moz-border-radius:0 4px 4px 0;
+    -webkit-border-radius:0 4px 4px 0;
+}
+
+
+.linksSelectorPanel .link-selector-panel-invisible {
+    display:none;
+}
+
+.linksSelectorPanel .list-inline {
+    margin-left: 0;
+}
+
+.linksSelectorPanel .list-inline li {
+    padding-left: 0;
+}
+
+
+.collectionContentsLinksSelectorPanel select {
+	margin-bottom: 1em;
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/70af3c32/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
index 1fbf7df..2903711 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
@@ -22,22 +22,26 @@
 <body>
 <wicket:panel>
     <div class="linksSelectorPanel">
-        <div class="btn-group viewLinks" wicket:id="views">
+        <span wicket:id="selectorDropdown"/>
+
+        <!--
+        <div class="btn-group viewLinks" xxwicket:id="views">
             <button type="button" class="btn btn-xs btn-info">
-                <span wicket:id="viewButtonIcon" class="ViewLinkItem"></span>
-                <span wicket:id="viewButtonTitle" class="ViewLinkItemTitle"></span>
+                <span xxwicket:id="viewButtonIcon" class="ViewLinkItem"></span>
+                <span xxwicket:id="viewButtonTitle" class="ViewLinkItemTitle"></span>
             </button>
             <button type="button" class="btn btn-xs btn-info dropdown-toggle" data-toggle="dropdown">
                 <span class="caret"></span>
             </button>
-            <ul wicket:id="viewList" class="dropdown-menu dropdown-menu-right" role="menu">
-                <li wicket:id="viewItem" class="viewItem">
-                    <a href="#" wicket:id="viewLink">
-                        <span wicket:id="viewItemIcon" class="ViewLinkItem"></span> <span wicket:id="viewItemTitle" class="ViewLinkItemTitle">[link title]</span>
+            <ul xxwicket:id="viewList" class="dropdown-menu dropdown-menu-right" role="menu">
+                <li xxwicket:id="viewItem" class="viewItem">
+                    <a href="#" xxwicket:id="viewLink">
+                        <span xxwicket:id="viewItemIcon" class="ViewLinkItem"></span> <span xxwicket:id="viewItemTitle" class="ViewLinkItemTitle">[link title]</span>
                     </a>
                 </li>
             </ul>
         </div>
+        -->
 
         <div class="views">
             <div wicket:id="collectionContents-0" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>

http://git-wip-us.apache.org/repos/asf/isis/blob/70af3c32/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
index d0d987b..f29244f 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
@@ -19,8 +19,6 @@
 
 package org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.links;
 
-import de.agilecoders.wicket.core.markup.html.bootstrap.button.Buttons;
-
 import java.util.ArrayList;
 import java.util.List;
 import com.google.common.base.Predicate;
@@ -29,31 +27,23 @@ import com.google.common.collect.Lists;
 import org.apache.wicket.AttributeModifier;
 import org.apache.wicket.Component;
 import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.event.Broadcast;
-import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.event.IEvent;
 import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.Model;
 import org.apache.isis.applib.annotation.Render.Type;
-import org.apache.isis.core.commons.lang.StringExtensions;
 import org.apache.isis.core.metamodel.facets.members.render.RenderFacet;
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.viewer.wicket.model.hints.IsisEnvelopeEvent;
 import org.apache.isis.viewer.wicket.model.hints.IsisUiHintEvent;
 import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
 import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
 import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
-import org.apache.isis.viewer.wicket.ui.CollectionContentsAsFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentType;
 import org.apache.isis.viewer.wicket.ui.components.collection.CollectionCountProvider;
-import org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.dropdown.CollectionContentsSelectorDropdownPanel;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
 import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
@@ -73,16 +63,20 @@ public class CollectionContentsLinksSelectorPanel
     private static final String INVISIBLE_CLASS = "link-selector-panel-invisible";
     private static final int MAX_NUM_UNDERLYING_VIEWS = 10;
 
-    private static final String ID_VIEWS = "views";
-    private static final String ID_VIEW_LIST = "viewList";
-    private static final String ID_VIEW_LINK = "viewLink";
-    private static final String ID_VIEW_ITEM = "viewItem";
-    private static final String ID_VIEW_ITEM_TITLE = "viewItemTitle";
-    private static final String ID_VIEW_ITEM_ICON = "viewItemIcon";
+    private static final String ID_SELECTOR_DROPDOWN = "selectorDropdown";
+
+//    private static final String ID_VIEWS = "views";
+//    private static final String ID_VIEW_LIST = "viewList";
+//    private static final String ID_VIEW_LINK = "viewLink";
+//    private static final String ID_VIEW_ITEM = "viewItem";
+//    private static final String ID_VIEW_ITEM_TITLE = "viewItemTitle";
+//    private static final String ID_VIEW_ITEM_ICON = "viewItemIcon";
 
     private static final String UIHINT_VIEW = "view";
-    private static final String ID_VIEW_BUTTON_TITLE = "viewButtonTitle";
-    private static final String ID_VIEW_BUTTON_ICON = "viewButtonIcon";
+//    private static final String ID_VIEW_BUTTON_TITLE = "viewButtonTitle";
+//    private static final String ID_VIEW_BUTTON_ICON = "viewButtonIcon";
+
+    private final ComponentFactory componentFactory;
 
     private final ComponentType componentType;
     private final String underlyingIdPrefix;
@@ -90,13 +84,21 @@ public class CollectionContentsLinksSelectorPanel
     private ComponentFactory selectedComponentFactory;
     protected Component selectedComponent;
 
-    /**
-     * May be <tt>null</tt>, depending upon the model implementation.
-     */
-    protected WebMarkupContainer additionalLinks;
+//    /**
+//     * May be <tt>null</tt>, depending upon the model implementation.
+//     */
+//    protected WebMarkupContainer additionalLinks;
+
+    private Component[] underlyingViews;
+    private List<ComponentFactory> componentFactories;
+    private CollectionContentsSelectorDropdownPanel selectorDropdownPanel;
 
-    public CollectionContentsLinksSelectorPanel(final String id, final EntityCollectionModel model, final ComponentFactory factory) {
+    public CollectionContentsLinksSelectorPanel(
+            final String id,
+            final EntityCollectionModel model,
+            final ComponentFactory factory) {
         super(id, model);
+        componentFactory = factory;
         this.underlyingIdPrefix = ComponentType.COLLECTION_CONTENTS.toString();
         this.componentType = factory.getComponentType();
     }
@@ -107,19 +109,20 @@ public class CollectionContentsLinksSelectorPanel
     public void onInitialize() {
         super.onInitialize();
         ComponentFactory componentFactory = getComponentFactoryRegistry().findComponentFactoryElseFailFast(getComponentType(), getModel());
-        addUnderlyingViews(underlyingIdPrefix, getModel(), componentFactory);
+        addUnderlyingViews(componentFactory);
     }
 
 
-    private void addUnderlyingViews(final String underlyingIdPrefix, final EntityCollectionModel model, final ComponentFactory factory) {
-        final List<ComponentFactory> componentFactories = findOtherComponentFactories(model, factory);
+    private void addUnderlyingViews(final ComponentFactory factory) {
+        final EntityCollectionModel model = getModel();
+        componentFactories = findOtherComponentFactories(model, factory);
 
         final int selected = honourViewHintElseDefault(componentFactories, model);
 
         final CollectionContentsLinksSelectorPanel selectorPanel = this;
 
         // create all, hide the one not selected
-        final Component[] underlyingViews = new Component[MAX_NUM_UNDERLYING_VIEWS];
+        underlyingViews = new Component[MAX_NUM_UNDERLYING_VIEWS];
         int i = 0;
         final EntityCollectionModel emptyModel = model.asDummy();
         for (ComponentFactory componentFactory : componentFactories) {
@@ -139,124 +142,130 @@ public class CollectionContentsLinksSelectorPanel
 
         // selector
         if (componentFactories.size() <= 1) {
-            permanentlyHide(ID_VIEWS);
+            //permanentlyHide(ID_VIEWS);
+
+            permanentlyHide(ID_SELECTOR_DROPDOWN);
         } else {
             final Model<ComponentFactory> componentFactoryModel = new Model<>();
 
             selectorPanel.selectedComponentFactory = componentFactories.get(selected);
             componentFactoryModel.setObject(selectorPanel.selectedComponentFactory);
 
-            final WebMarkupContainer views = new WebMarkupContainer(ID_VIEWS);
-
-            final Label viewButtonTitle = new Label(ID_VIEW_BUTTON_TITLE, "Hidden");
-            views.addOrReplace(viewButtonTitle);
-
-            final Label viewButtonIcon = new Label(ID_VIEW_BUTTON_ICON, "");
-            views.addOrReplace(viewButtonIcon);
-
-            final WebMarkupContainer container = new WebMarkupContainer(ID_VIEW_LIST);
-
-            views.addOrReplace(container);
-            views.setOutputMarkupId(true);
+            selectorDropdownPanel = new CollectionContentsSelectorDropdownPanel(ID_SELECTOR_DROPDOWN, getModel(), componentFactory);
 
             this.setOutputMarkupId(true);
 
-            final ListView<ComponentFactory> listView = new ListView<ComponentFactory>(ID_VIEW_ITEM, componentFactories) {
-
-                private static final long serialVersionUID = 1L;
-
-                @Override
-                protected void populateItem(ListItem<ComponentFactory> item) {
-
-                    final int underlyingViewNum = item.getIndex();
-
-                    final ComponentFactory componentFactory = item.getModelObject();
-                    final AbstractLink link = new AjaxLink<Void>(ID_VIEW_LINK) {
-                        private static final long serialVersionUID = 1L;
-                        @Override
-                        public void onClick(AjaxRequestTarget target) {
-                            CollectionContentsLinksSelectorPanel linksSelectorPanel = CollectionContentsLinksSelectorPanel.this;
-                            linksSelectorPanel.setViewHintAndBroadcast(underlyingViewNum, target);
-
-                            final EntityCollectionModel dummyModel = model.asDummy();
-                            for(int i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
-                                final Component component = underlyingViews[i];
-                                if(component == null) {
-                                    continue;
-                                }
-                                final boolean isSelected = i == underlyingViewNum;
-                                applyCssVisibility(component, isSelected);
-                                component.setDefaultModel(isSelected? model: dummyModel);
-                            }
-
-                            selectorPanel.selectedComponentFactory = componentFactory;
-                            selectorPanel.selectedComponent = underlyingViews[underlyingViewNum];
-                            selectorPanel.onSelect(target);
-                            target.add(selectorPanel, views);
-                        }
-
-                        @Override
-                        protected void onComponentTag(ComponentTag tag) {
-                            super.onComponentTag(tag);
-                            Buttons.fixDisabledState(this, tag);
-                        }
-                    };
-
-                    IModel<String> title = nameFor(componentFactory);
-                    Label viewItemTitleLabel = new Label(ID_VIEW_ITEM_TITLE, title);
-                    link.add(viewItemTitleLabel);
-
-                    Label viewItemIcon = new Label(ID_VIEW_ITEM_ICON, "");
-                    link.add(viewItemIcon);
-
-                    boolean isEnabled = componentFactory != selectorPanel.selectedComponentFactory;
-                    if (!isEnabled) {
-                        viewButtonTitle.setDefaultModel(title);
-                        IModel<String> cssClass = cssClassFor(componentFactory, viewButtonIcon);
-                        viewButtonIcon.add(AttributeModifier.replace("class", "ViewLinkItem " + cssClass.getObject()));
-                        link.setVisible(false);
-                    } else {
-                        IModel<String> cssClass = cssClassFor(componentFactory, viewItemIcon);
-                        viewItemIcon.add(new CssClassAppender(cssClass));
-                    }
-
-                    item.add(link);
-                }
-
-                private IModel<String> cssClassFor(final ComponentFactory componentFactory, Label viewIcon) {
-                    IModel<String> cssClass = null;
-                    if (componentFactory instanceof CollectionContentsAsFactory) {
-                        CollectionContentsAsFactory collectionContentsAsFactory = (CollectionContentsAsFactory) componentFactory;
-                        cssClass = collectionContentsAsFactory.getCssClass();
-                        viewIcon.setDefaultModelObject("");
-                        viewIcon.setEscapeModelStrings(true);
-                    }
-                    if (cssClass == null) {
-                        String name = componentFactory.getName();
-                        cssClass = Model.of(StringExtensions.asLowerDashed(name));
-                        // Small hack: if there is no specific CSS class then we assume that background-image is used
-                        // the span.ViewItemLink should have some content to show it
-                        // FIX: find a way to do this with CSS (width and height don't seems to help)
-                        viewIcon.setDefaultModelObject("&#160;&#160;&#160;&#160;&#160;");
-                        viewIcon.setEscapeModelStrings(false);
-                    }
-                    return cssClass;
-                }
-
-                private IModel<String> nameFor(final ComponentFactory componentFactory) {
-                    IModel<String> name = null;
-                    if (componentFactory instanceof CollectionContentsAsFactory) {
-                        CollectionContentsAsFactory collectionContentsAsFactory = (CollectionContentsAsFactory) componentFactory;
-                        name = collectionContentsAsFactory.getTitleLabel();
-                    }
-                    if (name == null) {
-                        name = Model.of(componentFactory.getName());
-                    }
-                    return name;
-                }
-            };
-            container.add(listView);
-            addOrReplace(views);
+//            final WebMarkupContainer views = new WebMarkupContainer(ID_VIEWS);
+//
+//            final Label viewButtonTitle = new Label(ID_VIEW_BUTTON_TITLE, "Hidden");
+//            views.addOrReplace(viewButtonTitle);
+//
+//            final Label viewButtonIcon = new Label(ID_VIEW_BUTTON_ICON, "");
+//            views.addOrReplace(viewButtonIcon);
+//
+//            final WebMarkupContainer container = new WebMarkupContainer(ID_VIEW_LIST);
+//
+//            views.addOrReplace(container);
+//            views.setOutputMarkupId(true);
+//
+//            this.setOutputMarkupId(true);
+
+//            final ListView<ComponentFactory> listView = new ListView<ComponentFactory>(ID_VIEW_ITEM, componentFactories) {
+//
+//                private static final long serialVersionUID = 1L;
+//
+//                @Override
+//                protected void populateItem(ListItem<ComponentFactory> item) {
+//
+//                    final int underlyingViewNum = item.getIndex();
+//
+//                    final ComponentFactory componentFactory = item.getModelObject();
+//                    final AbstractLink link = new AjaxLink<Void>(ID_VIEW_LINK) {
+//                        private static final long serialVersionUID = 1L;
+//                        @Override
+//                        public void onClick(AjaxRequestTarget target) {
+//                            CollectionContentsLinksSelectorPanel linksSelectorPanel = CollectionContentsLinksSelectorPanel.this;
+//                            linksSelectorPanel.setViewHintAndBroadcast(underlyingViewNum, target);
+//
+//                            final EntityCollectionModel dummyModel = model.asDummy();
+//                            for(int i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
+//                                final Component component = underlyingViews[i];
+//                                if(component == null) {
+//                                    continue;
+//                                }
+//                                final boolean isSelected = i == underlyingViewNum;
+//                                applyCssVisibility(component, isSelected);
+//                                component.setDefaultModel(isSelected? model: dummyModel);
+//                            }
+//
+//                            selectorPanel.selectedComponentFactory = componentFactory;
+//                            selectorPanel.selectedComponent = underlyingViews[underlyingViewNum];
+//                            selectorPanel.onSelect(target);
+//                            target.add(selectorPanel, views);
+//                        }
+//
+//                        @Override
+//                        protected void onComponentTag(ComponentTag tag) {
+//                            super.onComponentTag(tag);
+//                            Buttons.fixDisabledState(this, tag);
+//                        }
+//                    };
+//
+//                    IModel<String> title = nameFor(componentFactory);
+//                    Label viewItemTitleLabel = new Label(ID_VIEW_ITEM_TITLE, title);
+//                    link.add(viewItemTitleLabel);
+//
+//                    Label viewItemIcon = new Label(ID_VIEW_ITEM_ICON, "");
+//                    link.add(viewItemIcon);
+//
+//                    boolean isEnabled = componentFactory != selectorPanel.selectedComponentFactory;
+//                    if (!isEnabled) {
+//                        viewButtonTitle.setDefaultModel(title);
+//                        IModel<String> cssClass = cssClassFor(componentFactory, viewButtonIcon);
+//                        viewButtonIcon.add(AttributeModifier.replace("class", "ViewLinkItem " + cssClass.getObject()));
+//                        link.setVisible(false);
+//                    } else {
+//                        IModel<String> cssClass = cssClassFor(componentFactory, viewItemIcon);
+//                        viewItemIcon.add(new CssClassAppender(cssClass));
+//                    }
+//
+//                    item.add(link);
+//                }
+//
+//                private IModel<String> cssClassFor(final ComponentFactory componentFactory, Label viewIcon) {
+//                    IModel<String> cssClass = null;
+//                    if (componentFactory instanceof CollectionContentsAsFactory) {
+//                        CollectionContentsAsFactory collectionContentsAsFactory = (CollectionContentsAsFactory) componentFactory;
+//                        cssClass = collectionContentsAsFactory.getCssClass();
+//                        viewIcon.setDefaultModelObject("");
+//                        viewIcon.setEscapeModelStrings(true);
+//                    }
+//                    if (cssClass == null) {
+//                        String name = componentFactory.getName();
+//                        cssClass = Model.of(StringExtensions.asLowerDashed(name));
+//                        // Small hack: if there is no specific CSS class then we assume that background-image is used
+//                        // the span.ViewItemLink should have some content to show it
+//                        // FIX: find a way to do this with CSS (width and height don't seems to help)
+//                        viewIcon.setDefaultModelObject("&#160;&#160;&#160;&#160;&#160;");
+//                        viewIcon.setEscapeModelStrings(false);
+//                    }
+//                    return cssClass;
+//                }
+//
+//                private IModel<String> nameFor(final ComponentFactory componentFactory) {
+//                    IModel<String> name = null;
+//                    if (componentFactory instanceof CollectionContentsAsFactory) {
+//                        CollectionContentsAsFactory collectionContentsAsFactory = (CollectionContentsAsFactory) componentFactory;
+//                        name = collectionContentsAsFactory.getTitleLabel();
+//                    }
+//                    if (name == null) {
+//                        name = Model.of(componentFactory.getName());
+//                    }
+//                    return name;
+//                }
+//            };
+//            container.add(listView);
+            addOrReplace(selectorDropdownPanel);
         }
 
         for(i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
@@ -271,50 +280,97 @@ public class CollectionContentsLinksSelectorPanel
         }
     }
 
+    @Override
+    public void onEvent(IEvent<?> event) {
+        super.onEvent(event);
 
-
-    protected void setViewHintAndBroadcast(int viewNum, AjaxRequestTarget target) {
-        final UiHintContainer uiHintContainer = getUiHintContainer();
-        if(uiHintContainer == null) {
+        final IsisUiHintEvent uiHintEvent = IsisEnvelopeEvent.openLetter(event, IsisUiHintEvent.class);
+        if(uiHintEvent == null) {
             return;
         }
-        uiHintContainer.setHint(CollectionContentsLinksSelectorPanel.this, UIHINT_VIEW, ""+viewNum);
-        send(getPage(), Broadcast.EXACT, new IsisUiHintEvent(uiHintContainer, target));
-    }
-
-    /**
-     * Iterates up the component hierarchy looking for a parent
-     * {@link org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel}, and if so adds to ajax target so that it'll
-     * be repainted.
-     *
-     * <p>
-     * Yeah, agreed, it's a little bit hacky doing it this way, because it bakes
-     * in knowledge that this component is created, somehow, by a parent {@link org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel}.
-     * Perhaps it could be refactored to use a more general purpose observer pattern?
-     *
-     * <p>
-     * In fact, I've since discovered that Wicket has an event bus, which is used by the
-     * {@link UiHintContainer hinting mechanism}.  So this ought to be relatively easy to do.
-     */
-    protected void onSelect(AjaxRequestTarget target) {
-        Component component = this;
-        while(component != null) {
-            if(component instanceof CollectionPanel) {
-                CollectionPanel collectionPanel = (CollectionPanel) component;
-                boolean hasCount = collectionPanel.hasCount();
-                if(hasCount) {
-                    collectionPanel.updateLabel(target);
-                }
-                if(additionalLinks != null) {
-                    applyCssVisibility(additionalLinks, hasCount);
+        final UiHintContainer uiHintContainer = uiHintEvent.getUiHintContainer();
+
+        int underlyingViewNum = 0;
+        String viewStr = uiHintContainer.getHint(this.selectorDropdownPanel, UIHINT_VIEW);
+        if(viewStr != null) {
+            try {
+                int view = Integer.parseInt(viewStr);
+                if(view >= 0 && view < componentFactories.size()) {
+                    underlyingViewNum = view;
                 }
-                return;
+            } catch(NumberFormatException ex) {
+                // ignore
+            }
+        }
+
+        final EntityCollectionModel dummyModel = getModel().asDummy();
+        for(int i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
+            final Component component = underlyingViews[i];
+            if(component == null) {
+                continue;
             }
-            component = component.getParent();
+            final boolean isSelected = i == underlyingViewNum;
+            applyCssVisibility(component, isSelected);
+            component.setDefaultModel(isSelected? getModel(): dummyModel);
+        }
+
+        this.selectedComponentFactory = componentFactory;
+        this.selectedComponent = underlyingViews[underlyingViewNum];
+
+
+        final AjaxRequestTarget target = uiHintEvent.getTarget();
+        if(target != null) {
+//            selectorDropdownPanel.onSelect(target);
+            target.add(this, selectorDropdownPanel);
         }
+
+
     }
 
 
+
+//    protected void setViewHintAndBroadcast(int viewNum, AjaxRequestTarget target) {
+//        final UiHintContainer uiHintContainer = getUiHintContainer();
+//        if(uiHintContainer == null) {
+//            return;
+//        }
+//        uiHintContainer.setHint(CollectionContentsLinksSelectorPanel.this, UIHINT_VIEW, ""+viewNum);
+//        send(getPage(), Broadcast.EXACT, new IsisUiHintEvent(uiHintContainer, target));
+//    }
+
+//    /**
+//     * Iterates up the component hierarchy looking for a parent
+//     * {@link org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel}, and if so adds to ajax target so that it'll
+//     * be repainted.
+//     *
+//     * <p>
+//     * Yeah, agreed, it's a little bit hacky doing it this way, because it bakes
+//     * in knowledge that this component is created, somehow, by a parent {@link org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel}.
+//     * Perhaps it could be refactored to use a more general purpose observer pattern?
+//     *
+//     * <p>
+//     * In fact, I've since discovered that Wicket has an event bus, which is used by the
+//     * {@link UiHintContainer hinting mechanism}.  So this ought to be relatively easy to do.
+//     */
+//    protected void onSelect(AjaxRequestTarget target) {
+//        Component component = this;
+//        while(component != null) {
+//            if(component instanceof CollectionPanel) {
+//                CollectionPanel collectionPanel = (CollectionPanel) component;
+//                boolean hasCount = collectionPanel.hasCount();
+//                if(hasCount) {
+//                    collectionPanel.updateLabel(target);
+//                }
+//                if(additionalLinks != null) {
+//                    applyCssVisibility(additionalLinks, hasCount);
+//                }
+//                return;
+//            }
+//            component = component.getParent();
+//        }
+//    }
+
+
     protected static void applyCssVisibility(final Component component, final boolean visible) {
         if(component == null) {
             return;
@@ -375,7 +431,7 @@ public class CollectionContentsLinksSelectorPanel
         ArrayList<ComponentFactory> otherFactories = Lists.newArrayList(Collections2.filter(componentFactories, new Predicate<ComponentFactory>() {
             @Override
             public boolean apply(final ComponentFactory input) {
-                return input != ignoreFactory;
+                return input != ignoreFactory && input.getClass() != CollectionContentsLinksSelectorPanelFactory.class;
             }
         }));
         return ordered(otherFactories);

http://git-wip-us.apache.org/repos/asf/isis/blob/70af3c32/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItemContributions.java
----------------------------------------------------------------------
diff --git a/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItemContributions.java b/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItemContributions.java
index e30378c..1b758f8 100644
--- a/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItemContributions.java
+++ b/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItemContributions.java
@@ -159,6 +159,7 @@ public class ToDoItemContributions extends AbstractFactoryAndRepository {
     @NotInServiceMenu
     @ActionSemantics(Of.SAFE)
     @NotContributed(As.ACTION)
+    @Programmatic
     public List<ToDoItem> similarTo(final ToDoItem toDoItem) {
         final List<ToDoItem> similarToDoItems = allMatches(
                 new QueryDefault<ToDoItem>(ToDoItem.class, 


[02/44] isis git commit: ISIS-939: more simplified of persistence sessions and object stores.

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
index 9ab3529..cb3b320 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
@@ -20,43 +20,212 @@
 package org.apache.isis.core.runtime.system.persistence;
 
 import java.util.List;
+import java.util.Properties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.isis.applib.clock.Clock;
+import org.apache.isis.applib.fixtures.FixtureClock;
 import org.apache.isis.core.commons.components.ApplicationScopedComponent;
+import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
+import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
+import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.metamodel.services.ServicesInjectorDefault;
 import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
+import org.apache.isis.core.runtime.persistence.FixturesInstalledFlag;
+import org.apache.isis.core.runtime.persistence.ObjectStoreFactory;
+import org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession;
 import org.apache.isis.core.runtime.system.DeploymentType;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
+
+import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
+import static org.apache.isis.core.commons.ensure.Ensure.ensureThatState;
+import static org.hamcrest.CoreMatchers.*;
 
 /**
- * @see org.apache.isis.core.runtime.persistence.PersistenceSessionFactoryDelegate
+ * Implementation that just delegates to a supplied
+ * {@link org.apache.isis.core.runtime.persistence.ObjectStoreFactory}.
  */
-public interface PersistenceSessionFactory extends MetaModelRefiner, ApplicationScopedComponent {
+public class PersistenceSessionFactory implements MetaModelRefiner, ApplicationScopedComponent, FixturesInstalledFlag {
+
+    private static final Logger LOG = LoggerFactory.getLogger(PersistenceSessionFactory.class);
+
+    private final DeploymentType deploymentType;
+    private final IsisConfiguration configuration;
+    private final ObjectStoreFactory objectStoreFactory;
+
+    /**
+     * @see #setServices(List)
+     */
+    private List<Object> serviceList;
+
+    private Boolean fixturesInstalled;
+
+    private final ServicesInjectorSpi servicesInjector = new ServicesInjectorDefault();
+    private RuntimeContext runtimeContext;
+
+    public PersistenceSessionFactory(
+            final DeploymentType deploymentType,
+            final IsisConfiguration isisConfiguration,
+            final ObjectStoreFactory objectStoreFactory) {
+        this.deploymentType = deploymentType;
+        this.configuration = isisConfiguration;
+        this.objectStoreFactory = objectStoreFactory;
+    }
+
+    public DeploymentType getDeploymentType() {
+        return deploymentType;
+    }
+
+    public ObjectStoreFactory getDelegate() {
+        return objectStoreFactory;
+    }
+
+    public PersistenceSession createPersistenceSession() {
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("installing " + this.getClass().getName());
+        }
+
+        ServicesInjectorSpi servicesInjector = getServicesInjector();
+
+        final ObjectStore objectStore = objectStoreFactory.createObjectStore(getConfiguration());
+
+        ensureThatArg(objectStore, is(not(nullValue())));
+
+        final PersistenceSession persistenceSession =new PersistenceSession(this, servicesInjector, objectStore, getConfiguration());
+
+        final IsisTransactionManager transactionManager = new IsisTransactionManager(persistenceSession, objectStore, servicesInjector);
+
+        persistenceSession.setDirtiableSupport(true);
+        persistenceSession.setTransactionManager(transactionManager);
+
+        return persistenceSession;
+    }
+
+    public final void init() {
+
+        // check prereq dependencies injected
+        ensureThatState(serviceList, is(notNullValue()));
+
+        // a bit of a workaround, but required if anything in the metamodel (for
+        // example, a
+        // ValueSemanticsProvider for a date value type) needs to use the Clock
+        // singleton
+        // we do this after loading the services to allow a service to prime a
+        // different clock
+        // implementation (eg to use an NTP time service).
+        if (!deploymentType.isProduction() && !Clock.isInitialized()) {
+            FixtureClock.initialize();
+        }
+
+        runtimeContext = createRuntimeContext(getConfiguration());
+        ensureThatState(runtimeContext, is(not(nullValue())));
+
+        // inject the specification loader etc.
+        runtimeContext.injectInto(servicesInjector);
+        
+        // wire up components
 
-    DeploymentType getDeploymentType();
+        getSpecificationLoader().injectInto(runtimeContext);
+        for (Object service : serviceList) {
+            runtimeContext.injectInto(service);
+        }
 
+        servicesInjector.setServices(serviceList);
+        servicesInjector.init();
+    }
 
+    private RuntimeContext createRuntimeContext(final IsisConfiguration configuration) {
+        final RuntimeContextFromSession runtimeContext = new RuntimeContextFromSession();
+        final Properties properties = applicationPropertiesFrom(configuration);
+        runtimeContext.setProperties(properties);
+        return runtimeContext;
+    }
+
+    private static Properties applicationPropertiesFrom(final IsisConfiguration configuration) {
+        final Properties properties = new Properties();
+        final IsisConfiguration applicationConfiguration = configuration.getProperties("application");
+        for (final String key : applicationConfiguration) {
+            final String value = applicationConfiguration.getString(key);
+            final String newKey = key.substring("application.".length());
+            properties.setProperty(newKey, value);
+        }
+        return properties;
+    }
+
+
+
+    public final void shutdown() {
+        doShutdown();
+    }
+
+    /**
+     * Optional hook method for implementation-specific shutdown.
+     */
+    protected void doShutdown() {
+    }
+
+    
     // //////////////////////////////////////////////////////
-    // Singleton threadsafe components
+    // Components (setup during init...)
     // //////////////////////////////////////////////////////
 
-    ServicesInjectorSpi getServicesInjector();
+    public ServicesInjectorSpi getServicesInjector() {
+        return servicesInjector;
+    }
 
-    
     // //////////////////////////////////////////////////////
-    // main API
+    // MetaModelAdjuster impl
     // //////////////////////////////////////////////////////
 
-    /**
-     * Creates a {@link PersistenceSession} with the implementing object as the
-     * {@link PersistenceSession}'s
-     * {@link PersistenceSession#getPersistenceSessionFactory() owning factory}.
-     */
-    PersistenceSession createPersistenceSession();
+    public void refineMetaModelValidator(MetaModelValidatorComposite metaModelValidator, IsisConfiguration configuration) {
+        objectStoreFactory.refineMetaModelValidator(metaModelValidator, configuration);
+    }
+
+    public void refineProgrammingModel(ProgrammingModel baseProgrammingModel, IsisConfiguration configuration) {
+        objectStoreFactory.refineProgrammingModel(baseProgrammingModel, configuration);
+    }
+
+    // //////////////////////////////////////////////////////
+    // FixturesInstalledFlag impl
+    // //////////////////////////////////////////////////////
+
+    @Override
+    public Boolean isFixturesInstalled() {
+        return fixturesInstalled;
+    }
+
+    @Override
+    public void setFixturesInstalled(final Boolean fixturesInstalled) {
+        this.fixturesInstalled = fixturesInstalled;
+    }
 
     // //////////////////////////////////////////////////////
-    // Services
+    // Dependencies (injected from constructor)
     // //////////////////////////////////////////////////////
 
-    public void setServices(List<Object> servicesList);
+    public IsisConfiguration getConfiguration() {
+        return configuration;
+    }
+    
+    // //////////////////////////////////////////////////////
+    // Dependencies (injected via setters)
+    // //////////////////////////////////////////////////////
 
+    public void setServices(final List<Object> serviceList) {
+        this.serviceList = serviceList;
+    }
+
+    // //////////////////////////////////////////////////////
+    // Dependencies (from context)
+    // //////////////////////////////////////////////////////
 
+    protected SpecificationLoaderSpi getSpecificationLoader() {
+        return IsisContext.getSpecificationLoader();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/Persistor.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/Persistor.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/Persistor.java
index 6f4ba73..11b4091 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/Persistor.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/Persistor.java
@@ -187,7 +187,7 @@ public interface Persistor {
      * Makes an {@link ObjectAdapter} persistent. The specified object should be
      * stored away via this object store's persistence mechanism, and have an
      * new and unique OID assigned to it. The object, should also be added to
-     * the {@link AdapterManagerSpi} as the object is implicitly 'in use'.
+     * the {@link org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault} as the object is implicitly 'in use'.
      * 
      * <p>
      * If the object has any associations then each of these, where they aren't

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactory.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactory.java
index 62704da..e62ce4d 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactory.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactory.java
@@ -20,8 +20,6 @@
 package org.apache.isis.core.runtime.system.session;
 
 import java.util.List;
-
-import org.apache.isis.applib.DomainObjectContainer;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.components.ApplicationScopedComponent;
 import org.apache.isis.core.commons.config.IsisConfiguration;
@@ -30,9 +28,9 @@ import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
 import org.apache.isis.core.runtime.authentication.AuthenticationManager;
 import org.apache.isis.core.runtime.authorization.AuthorizationManager;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 
 /**
  * Analogous (and in essence a wrapper for) a JDO <code>PersistenceManagerFactory</code>
@@ -79,7 +77,7 @@ public interface IsisSessionFactory extends ApplicationScopedComponent {
     public AuthorizationManager getAuthorizationManager();
 
     /**
-     * The {@link PersistenceSessionFactory} that will be used to create
+     * The {@link org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory} that will be used to create
      * {@link PersistenceSession} {@link IsisSession#getPersistenceSession()
      * within} the {@link IsisSession}.
      */

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryDefault.java
index 442bf45..31b7b3b 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryDefault.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryDefault.java
@@ -30,7 +30,6 @@ import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.ListMultimap;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.isis.applib.DomainObjectContainer;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.components.ApplicationScopedComponent;
 import org.apache.isis.core.commons.config.IsisConfiguration;
@@ -41,9 +40,9 @@ import org.apache.isis.core.metamodel.specloader.ServiceInitializer;
 import org.apache.isis.core.runtime.authentication.AuthenticationManager;
 import org.apache.isis.core.runtime.authorization.AuthorizationManager;
 import org.apache.isis.core.runtime.installerregistry.InstallerLookup;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 
 import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
 import static org.hamcrest.CoreMatchers.*;

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemAbstract.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemAbstract.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemAbstract.java
index fa1475b..5cfcd50 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemAbstract.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemAbstract.java
@@ -22,10 +22,8 @@ package org.apache.isis.core.runtime.systemusinginstallers;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.apache.isis.applib.fixtures.LogonFixture;
 import org.apache.isis.core.commons.components.Installer;
 import org.apache.isis.core.commons.components.Noop;
@@ -40,6 +38,7 @@ import org.apache.isis.core.runtime.authentication.exploration.ExplorationSessio
 import org.apache.isis.core.runtime.authorization.AuthorizationManager;
 import org.apache.isis.core.runtime.fixtures.FixturesInstaller;
 import org.apache.isis.core.runtime.installerregistry.InstallerLookup;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.IsisSystemException;
@@ -48,7 +47,6 @@ import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.internal.InitialisationSession;
 import org.apache.isis.core.runtime.system.internal.IsisLocaleInitializer;
 import org.apache.isis.core.runtime.system.internal.IsisTimeZoneInitializer;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.core.runtime.system.session.IsisSessionFactory;
 import org.apache.isis.core.runtime.system.session.IsisSessionFactoryDefault;
 

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemUsingInstallers.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemUsingInstallers.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemUsingInstallers.java
index 5a01f72..a14f917 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemUsingInstallers.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemUsingInstallers.java
@@ -34,11 +34,11 @@ import org.apache.isis.core.runtime.authorization.AuthorizationManagerInstaller;
 import org.apache.isis.core.runtime.fixtures.FixturesInstaller;
 import org.apache.isis.core.runtime.installerregistry.InstallerLookup;
 import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.core.runtime.services.ServicesInstaller;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.IsisSystemException;
 import org.apache.isis.core.runtime.system.SystemConstants;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.core.runtime.systemdependencyinjector.SystemDependencyInjector;
 import org.apache.isis.core.runtime.transaction.facetdecorator.standard.TransactionFacetDecoratorInstaller;
 

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusObjectStore.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusObjectStore.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusObjectStore.java
index edccfa1..0098d29 100644
--- a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusObjectStore.java
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusObjectStore.java
@@ -49,7 +49,7 @@ import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
 import org.apache.isis.core.runtime.persistence.PojoRefreshException;
 import org.apache.isis.core.runtime.persistence.UnsupportedFindException;
 import org.apache.isis.core.runtime.persistence.adapter.PojoAdapterFactory;
-import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
+import org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.CreateObjectCommand;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.DestroyObjectCommand;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.PersistenceCommand;
@@ -59,7 +59,7 @@ import org.apache.isis.core.runtime.persistence.query.PersistenceQueryFindByPatt
 import org.apache.isis.core.runtime.persistence.query.PersistenceQueryFindByTitle;
 import org.apache.isis.core.runtime.persistence.query.PersistenceQueryFindUsingApplibQueryDefault;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.AdapterManagerSpi;
+import org.apache.isis.core.runtime.system.persistence.ObjectStore;
 import org.apache.isis.core.runtime.system.persistence.PersistenceQuery;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.core.runtime.system.transaction.IsisTransaction;
@@ -77,7 +77,7 @@ import static org.apache.isis.core.commons.ensure.Ensure.*;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.notNullValue;
 
-public class DataNucleusObjectStore implements ObjectStoreSpi {
+public class DataNucleusObjectStore implements ObjectStore {
 
     private static final Logger LOG = LoggerFactory.getLogger(DataNucleusObjectStore.class);
 
@@ -565,7 +565,7 @@ public class DataNucleusObjectStore implements ObjectStoreSpi {
     // ///////////////////////////////////////////////////////////////////////
 
     @SuppressWarnings("unused")
-    private List<ObjectAdapter> loadObjects(final ObjectSpecification specification, final List<?> listOfPojs, final AdapterManagerSpi adapterManager) {
+    private List<ObjectAdapter> loadObjects(final ObjectSpecification specification, final List<?> listOfPojs, final AdapterManagerDefault adapterManager) {
         final List<ObjectAdapter> adapters = Lists.newArrayList();
         int i = 0;
         for (final Object pojo : listOfPojs) {

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
index adffadc..1b7ca82 100644
--- a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
@@ -32,8 +32,8 @@ import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
 import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
 import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstallerAbstract;
-import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
 import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.ObjectStore;
 import org.apache.isis.objectstore.jdo.metamodel.facets.object.auditable.AuditableAnnotationInJdoApplibFacetFactory;
 import org.apache.isis.objectstore.jdo.metamodel.facets.object.auditable.AuditableMarkerInterfaceInJdoApplibFacetFactory;
 import org.apache.isis.objectstore.jdo.metamodel.facets.object.datastoreidentity.JdoDatastoreIdentityAnnotationFacetFactory;
@@ -85,7 +85,7 @@ public class DataNucleusPersistenceMechanismInstaller extends PersistenceMechani
     //region > createObjectStore
 
     @Override
-    public ObjectStoreSpi createObjectStore(final IsisConfiguration configuration) {
+    public ObjectStore createObjectStore(final IsisConfiguration configuration) {
         final DataNucleusApplicationComponents applicationComponents = createDataNucleusApplicationComponentsIfRequired(configuration);
         return new DataNucleusObjectStore(applicationComponents);
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStoreInstances_findInstancesAndAdd.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStoreInstances_findInstancesAndAdd.java b/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStoreInstances_findInstancesAndAdd.java
index e1835b6..45294aa 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStoreInstances_findInstancesAndAdd.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStoreInstances_findInstancesAndAdd.java
@@ -19,30 +19,26 @@
 
 package org.apache.isis.core.objectstore.internal;
 
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
 import java.util.List;
-
 import com.google.common.collect.Lists;
-
 import org.jmock.Expectations;
 import org.jmock.auto.Mock;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
-
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.matchers.IsisMatchers;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.ObjectSpecId;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault;
 import org.apache.isis.core.runtime.persistence.query.PersistenceQueryBuiltIn;
-import org.apache.isis.core.runtime.system.persistence.AdapterManagerSpi;
 import org.apache.isis.core.unittestsupport.jmocking.IsisActions;
 import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
 import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
 
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
 public class ObjectStoreInstances_findInstancesAndAdd {
 
     private ObjectStoreInstances instances;
@@ -57,7 +53,7 @@ public class ObjectStoreInstances_findInstancesAndAdd {
     @Mock
     private AuthenticationSession mockAuthSession;
     @Mock
-    private AdapterManagerSpi mockAdapterManager;
+    private AdapterManagerDefault mockAdapterManager;
 
     @Mock
     private ObjectAdapter mockAdapter1;
@@ -72,7 +68,7 @@ public class ObjectStoreInstances_findInstancesAndAdd {
                 return mockAuthSession;
             }
             @Override
-            protected AdapterManagerSpi getAdapterManager() {
+            protected AdapterManagerDefault getAdapterManager() {
                 return mockAdapterManager;
             }
         };

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjectsDefault_instances.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjectsDefault_instances.java b/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjectsDefault_instances.java
index 9227c14..4274613 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjectsDefault_instances.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjectsDefault_instances.java
@@ -31,12 +31,11 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 
 import org.apache.isis.core.metamodel.spec.ObjectSpecId;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 
 @RunWith(JMock.class)
 public class ObjectStorePersistedObjectsDefault_instances {
 
-    private ObjectStorePersistedObjectsDefault persistedObjects;
+    private ObjectStorePersistedObjects persistedObjects;
 
     private final Mockery context = new JUnit4Mockery();
 
@@ -44,7 +43,7 @@ public class ObjectStorePersistedObjectsDefault_instances {
 
     @Before
     public void setUp() throws Exception {
-        persistedObjects = new ObjectStorePersistedObjectsDefault();
+        persistedObjects = new ObjectStorePersistedObjects();
         mockSpec = context.mock(ObjectSpecId.class);
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjectsDefault_savesOidGeneratorAsMemento.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjectsDefault_savesOidGeneratorAsMemento.java b/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjectsDefault_savesOidGeneratorAsMemento.java
index e41d2f8..8514db2 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjectsDefault_savesOidGeneratorAsMemento.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjectsDefault_savesOidGeneratorAsMemento.java
@@ -31,7 +31,7 @@ import static org.junit.Assert.assertThat;
 
 public class ObjectStorePersistedObjectsDefault_savesOidGeneratorAsMemento {
 
-    private ObjectStorePersistedObjectsDefault persistedObjects;
+    private ObjectStorePersistedObjects persistedObjects;
 
     @Rule
     public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(JUnitRuleMockery2.Mode.INTERFACES_AND_CLASSES);
@@ -40,7 +40,7 @@ public class ObjectStorePersistedObjectsDefault_savesOidGeneratorAsMemento {
 
     @Before
     public void setUp() throws Exception {
-        persistedObjects = new ObjectStorePersistedObjectsDefault();
+        persistedObjects = new ObjectStorePersistedObjects();
         mockMemento = context.mock(IdentifierGeneratorDefault.Memento.class);
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjectsDefault_services.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjectsDefault_services.java b/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjectsDefault_services.java
index df849ac..83bf511 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjectsDefault_services.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjectsDefault_services.java
@@ -43,11 +43,11 @@ public class ObjectStorePersistedObjectsDefault_services {
     @Mock
     private Oid mockOidForBarService;
     
-    private ObjectStorePersistedObjectsDefault persistedObjects;
+    private ObjectStorePersistedObjects persistedObjects;
 
     @Before
     public void setUp() throws Exception {
-        persistedObjects = new ObjectStorePersistedObjectsDefault();
+        persistedObjects = new ObjectStorePersistedObjects();
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/test/java/org/apache/isis/core/runtime/context/IsisContextTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/context/IsisContextTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/context/IsisContextTest.java
index 4ce18da..73cf1be 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/context/IsisContextTest.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/context/IsisContextTest.java
@@ -21,15 +21,9 @@ package org.apache.isis.core.runtime.context;
 
 import java.util.Collections;
 import java.util.List;
-
 import org.jmock.Expectations;
 import org.jmock.auto.Mock;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
+import org.junit.*;
 import org.apache.isis.applib.DomainObjectContainer;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.config.IsisConfiguration;
@@ -39,11 +33,11 @@ import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
 import org.apache.isis.core.runtime.authentication.AuthenticationManager;
 import org.apache.isis.core.runtime.authentication.standard.SimpleSession;
 import org.apache.isis.core.runtime.authorization.AuthorizationManager;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.context.IsisContextStatic;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.core.runtime.system.session.IsisSessionFactory;
 import org.apache.isis.core.runtime.system.session.IsisSessionFactoryDefault;
 import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/test/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionTest.java
index 2d67115..f9645c8 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionTest.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionTest.java
@@ -45,7 +45,6 @@ import org.apache.isis.core.runtime.persistence.adapter.PojoAdapterFactory;
 import org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault;
 import org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorUnified;
 import org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession;
-import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.*;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.PojoAdapterBuilder.Persistence;
 import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
@@ -61,7 +60,7 @@ public class PersistenceSessionTest {
     public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
 
     private ServicesInjectorDefault servicesInjector;
-    private AdapterManagerSpi adapterManager;
+    private AdapterManagerDefault adapterManager;
     private ObjectAdapterFactory adapterFactory;
     
     
@@ -78,7 +77,7 @@ public class PersistenceSessionTest {
     private AuthenticationSession mockAuthenticationSession;
 
     @Mock
-    private ObjectStoreSpi mockObjectStore;
+    private ObjectStore mockObjectStore;
     @Mock
     private AuditingService3 mockAuditingService3;
     @Mock

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/test/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryAbstractTest_init_and_shutdown.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryAbstractTest_init_and_shutdown.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryAbstractTest_init_and_shutdown.java
index 198c824..2ba697e 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryAbstractTest_init_and_shutdown.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryAbstractTest_init_and_shutdown.java
@@ -31,8 +31,8 @@ import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
 import org.apache.isis.core.runtime.authentication.AuthenticationManager;
 import org.apache.isis.core.runtime.authorization.AuthorizationManager;
-import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
+import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
 import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
 

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java
index 543f1b8..2a66a8f 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java
@@ -19,16 +19,12 @@
 
 package org.apache.isis.core.runtime.system.transaction;
 
-import static org.hamcrest.CoreMatchers.equalTo;
-
 import java.util.Collections;
-
 import org.jmock.Expectations;
 import org.jmock.auto.Mock;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
-
 import org.apache.isis.applib.annotation.Bulk;
 import org.apache.isis.applib.annotation.PublishedAction;
 import org.apache.isis.applib.annotation.PublishedObject;
@@ -42,19 +38,15 @@ import org.apache.isis.core.commons.matchers.IsisMatchers;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
 import org.apache.isis.core.runtime.persistence.ObjectPersistenceException;
-import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.CreateObjectCommand;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.DestroyObjectCommand;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.PersistenceCommand;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.PersistenceCommandContext;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.PojoAdapterBuilder;
+import org.apache.isis.core.runtime.persistence.objectstore.transaction.*;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.PojoAdapterBuilder.Persistence;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.PublishingServiceWithDefaultPayloadFactories;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.SaveObjectCommand;
 import org.apache.isis.core.runtime.services.eventbus.EventBusServiceDefault;
+import org.apache.isis.core.runtime.system.persistence.ObjectStore;
 import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
 import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
 
+import static org.hamcrest.CoreMatchers.equalTo;
+
 public class IsisTransactionTest {
 
     @Rule
@@ -69,7 +61,7 @@ public class IsisTransactionTest {
     private ObjectAdapter persistentAdapter2;
 
     @Mock
-    private ObjectStoreSpi mockObjectStore;
+    private ObjectStore mockObjectStore;
 
     @Mock
     private IsisTransactionManager mockTransactionManager;

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/IsisSystemWithFixtures.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/IsisSystemWithFixtures.java b/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/IsisSystemWithFixtures.java
index 0dc3c61..131c418 100644
--- a/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/IsisSystemWithFixtures.java
+++ b/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/IsisSystemWithFixtures.java
@@ -42,9 +42,9 @@ import org.apache.isis.core.objectstore.InMemoryPersistenceMechanismInstaller;
 import org.apache.isis.core.runtime.authentication.AuthenticationManager;
 import org.apache.isis.core.runtime.authentication.AuthenticationRequest;
 import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
-import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.ObjectStore;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.core.runtime.system.persistence.Persistor;
 import org.apache.isis.core.runtime.system.transaction.IsisTransaction;
@@ -532,7 +532,7 @@ public class IsisSystemWithFixtures implements org.junit.rules.TestRule {
     }
 
     @SuppressWarnings("unchecked")
-    public <T extends ObjectStoreSpi> T getObjectStore(Class<T> cls) {
+    public <T extends ObjectStore> T getObjectStore(Class<T> cls) {
         final PersistenceSession persistenceSession = getPersistenceSession();
         return (T) persistenceSession.getObjectStore();
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/tck/ObjectStoreContractTest_persist.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/tck/ObjectStoreContractTest_persist.java b/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/tck/ObjectStoreContractTest_persist.java
index 55ce125..933b6d6 100644
--- a/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/tck/ObjectStoreContractTest_persist.java
+++ b/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/tck/ObjectStoreContractTest_persist.java
@@ -29,9 +29,9 @@ import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.oid.RootOid;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
-import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
 import org.apache.isis.core.runtime.persistence.query.PersistenceQueryFindByTitle;
 import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.ObjectStore;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.core.tck.dom.refs.SimpleEntity;
 
@@ -63,9 +63,9 @@ public abstract class ObjectStoreContractTest_persist {
     protected ObjectAdapter epv2Adapter;
     protected ObjectSpecification epvSpecification;
 
-    protected ObjectStoreSpi getStore() {
+    protected ObjectStore getStore() {
         PersistenceSession psos = IsisContext.getPersistenceSession();
-        return (ObjectStoreSpi) psos.getObjectStore();
+        return psos.getObjectStore();
     }
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/tck/tck-integtests/src/test/java/org/apache/isis/core/objectstore/InMemoryObjectStoreTest_openAndClose.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/core/objectstore/InMemoryObjectStoreTest_openAndClose.java b/tck/tck-integtests/src/test/java/org/apache/isis/core/objectstore/InMemoryObjectStoreTest_openAndClose.java
index c1cdc3f..241a5ae 100644
--- a/tck/tck-integtests/src/test/java/org/apache/isis/core/objectstore/InMemoryObjectStoreTest_openAndClose.java
+++ b/tck/tck-integtests/src/test/java/org/apache/isis/core/objectstore/InMemoryObjectStoreTest_openAndClose.java
@@ -19,20 +19,19 @@
 
 package org.apache.isis.core.objectstore;
 
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
 import org.jmock.Expectations;
 import org.jmock.auto.Mock;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
-
 import org.apache.isis.core.objectstore.internal.ObjectStorePersistedObjects;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
 import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
 
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
 /**
  * Tested in style of <i>Working Effectively with Legacy Code</i> (Feathers) and
  * <i>Growing Object-Oriented Software</i> (Freeman &amp; Pryce).


[18/44] isis git commit: ISIS-537: removing a TODO:mgrigorov (comments only)

Posted by da...@apache.org.
ISIS-537: removing a TODO:mgrigorov (comments only)


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/27545b0b
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/27545b0b
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/27545b0b

Branch: refs/heads/master
Commit: 27545b0b7882d13f471a76b0c30027ad9ffec131
Parents: f4321ae
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Fri Nov 7 17:14:24 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 10:21:33 2014 +0000

----------------------------------------------------------------------
 .../links/CollectionContentsLinksSelectorPanelFactory.java      | 5 -----
 1 file changed, 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/27545b0b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanelFactory.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanelFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanelFactory.java
index 6dff6d9..a93790e 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanelFactory.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanelFactory.java
@@ -29,12 +29,7 @@ import org.apache.isis.viewer.wicket.ui.ComponentType;
 
 /**
  * {@link ComponentFactory} for {@link CollectionContentsLinksSelectorPanel}.
- * 
- * <p>
- * Either this class or {@link CollectionContentsDropDownSelectorPanelFactory} should be
- * registered, but not both.
  */
-// TODO mgrigorov: there is no more CollectionContentsDropDownSelectorPanelFactory. Fix the javadoc
 public class CollectionContentsLinksSelectorPanelFactory extends ComponentFactoryAbstract {
 
     private static final long serialVersionUID = 1L;


[28/44] isis git commit: ISIS-537: mostly refactored, however hints not honoured for LinkSelectorPanel.

Posted by da...@apache.org.
ISIS-537: mostly refactored, however hints not honoured for LinkSelectorPanel.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/f00d01fa
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/f00d01fa
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/f00d01fa

Branch: refs/heads/master
Commit: f00d01fa28a35a4cf7ea8ac69950e5e9cb5c9d3c
Parents: 7087fc2
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sun Nov 9 16:05:49 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 10:21:45 2014 +0000

----------------------------------------------------------------------
 ...CollectionContentsSelectorDropdownPanel.html |  4 +-
 .../CollectionContentsSelectorHelper.java       | 69 ++++++++++----------
 .../CollectionContentsLinksSelectorPanel.html   | 19 ------
 .../CollectionContentsLinksSelectorPanel.java   |  2 +-
 4 files changed, 36 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/f00d01fa/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.html
index ea2a4d8..8bec51a 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanel.html
@@ -23,11 +23,11 @@
 <wicket:panel>
     <div class="linksSelectorPanel">
         <div class="btn-group viewLinks" wicket:id="views">
-            <button type="button" class="btn btn-xs btn-info">
+            <button type="button" class="btn btn-sm btn-info">
                 <span wicket:id="viewButtonIcon" class="ViewLinkItem"></span>
                 <span wicket:id="viewButtonTitle" class="ViewLinkItemTitle"></span>
             </button>
-            <button type="button" class="btn btn-xs btn-info dropdown-toggle" data-toggle="dropdown">
+            <button type="button" class="btn btn-sm btn-info dropdown-toggle" data-toggle="dropdown">
                 <span class="caret"></span>
             </button>
             <ul wicket:id="viewList" class="dropdown-menu dropdown-menu-right" role="menu">

http://git-wip-us.apache.org/repos/asf/isis/blob/f00d01fa/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorHelper.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorHelper.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorHelper.java
index 1e3706c..06eed95 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorHelper.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorHelper.java
@@ -67,9 +67,6 @@ public class CollectionContentsSelectorHelper {
         return componentFactoryRegistry.findComponentFactoryElseFailFast(componentType, model);
     }
 
-
-
-
     public List<ComponentFactory> findOtherComponentFactories() {
         final List<ComponentFactory> componentFactories = componentFactoryRegistry.findComponentFactories(componentType, model);
         ArrayList<ComponentFactory> otherFactories = Lists.newArrayList(Collections2.filter(componentFactories, new Predicate<ComponentFactory>() {
@@ -81,35 +78,6 @@ public class CollectionContentsSelectorHelper {
         return ordered(otherFactories);
     }
 
-    protected List<ComponentFactory> ordered(List<ComponentFactory> componentFactories) {
-        return orderAjaxTableToEnd(componentFactories);
-    }
-
-    static List<ComponentFactory> orderAjaxTableToEnd(List<ComponentFactory> componentFactories) {
-        int ajaxTableIdx = findAjaxTable(componentFactories);
-        if(ajaxTableIdx>=0) {
-            List<ComponentFactory> orderedFactories = Lists.newArrayList(componentFactories);
-            ComponentFactory ajaxTableFactory = orderedFactories.remove(ajaxTableIdx);
-            orderedFactories.add(ajaxTableFactory);
-            return orderedFactories;
-        } else {
-            return componentFactories;
-        }
-    }
-
-    static int findAjaxTable(List<ComponentFactory> componentFactories) {
-        for(int i=0; i<componentFactories.size(); i++) {
-            if(componentFactories.get(i) instanceof CollectionContentsAsAjaxTablePanelFactory) {
-                return i;
-            }
-        }
-        return -1;
-    }
-
-
-
-
-
     public int honourViewHintElseDefault(final Component component) {
         // honour hints ...
         final UiHintContainer hintContainer = getUiHintContainer(component);
@@ -128,7 +96,7 @@ public class CollectionContentsSelectorHelper {
         }
 
         // ... else default
-        int initialFactory = determineInitialFactory(componentFactories, model);
+        int initialFactory = determineInitialFactory();
         if(hintContainer != null) {
             hintContainer.setHint(component, UIHINT_VIEW, ""+initialFactory);
             // don't broadcast (no AjaxRequestTarget, still configuring initial setup)
@@ -136,17 +104,41 @@ public class CollectionContentsSelectorHelper {
         return initialFactory;
     }
 
-    public static UiHintContainer getUiHintContainer(final Component component) {
-        return UiHintContainer.Util.hintContainerOf(component);
+    private static List<ComponentFactory> ordered(List<ComponentFactory> componentFactories) {
+        return orderAjaxTableToEnd(componentFactories);
     }
 
+    static List<ComponentFactory> orderAjaxTableToEnd(List<ComponentFactory> componentFactories) {
+        int ajaxTableIdx = findAjaxTable(componentFactories);
+        if(ajaxTableIdx>=0) {
+            List<ComponentFactory> orderedFactories = Lists.newArrayList(componentFactories);
+            ComponentFactory ajaxTableFactory = orderedFactories.remove(ajaxTableIdx);
+            orderedFactories.add(ajaxTableFactory);
+            return orderedFactories;
+        } else {
+            return componentFactories;
+        }
+    }
+
+    private static int findAjaxTable(List<ComponentFactory> componentFactories) {
+        for(int i=0; i<componentFactories.size(); i++) {
+            if(componentFactories.get(i) instanceof CollectionContentsAsAjaxTablePanelFactory) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
+
+
+
 
     /**
      * return the index of {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory unresolved panel} if present and not eager loading;
      * else the index of {@link org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory ajax table} if present,
      * otherwise first factory.
      */
-    protected int determineInitialFactory(final List<ComponentFactory> componentFactories, final IModel<?> model) {
+    protected int determineInitialFactory() {
         if(!hasRenderEagerlyFacet(model)) {
             for(int i=0; i<componentFactories.size(); i++) {
                 if(componentFactories.get(i) instanceof CollectionContentsAsUnresolvedPanelFactory) {
@@ -161,6 +153,11 @@ public class CollectionContentsSelectorHelper {
         return 0;
     }
 
+    private static UiHintContainer getUiHintContainer(final Component component) {
+        return UiHintContainer.Util.hintContainerOf(component);
+    }
+
+
     private static boolean hasRenderEagerlyFacet(IModel<?> model) {
         if(!(model instanceof EntityCollectionModel)) {
             return false;

http://git-wip-us.apache.org/repos/asf/isis/blob/f00d01fa/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
index 2903711..853a400 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
@@ -24,25 +24,6 @@
     <div class="linksSelectorPanel">
         <span wicket:id="selectorDropdown"/>
 
-        <!--
-        <div class="btn-group viewLinks" xxwicket:id="views">
-            <button type="button" class="btn btn-xs btn-info">
-                <span xxwicket:id="viewButtonIcon" class="ViewLinkItem"></span>
-                <span xxwicket:id="viewButtonTitle" class="ViewLinkItemTitle"></span>
-            </button>
-            <button type="button" class="btn btn-xs btn-info dropdown-toggle" data-toggle="dropdown">
-                <span class="caret"></span>
-            </button>
-            <ul xxwicket:id="viewList" class="dropdown-menu dropdown-menu-right" role="menu">
-                <li xxwicket:id="viewItem" class="viewItem">
-                    <a href="#" xxwicket:id="viewLink">
-                        <span xxwicket:id="viewItemIcon" class="ViewLinkItem"></span> <span xxwicket:id="viewItemTitle" class="ViewLinkItemTitle">[link title]</span>
-                    </a>
-                </li>
-            </ul>
-        </div>
-        -->
-
         <div class="views">
             <div wicket:id="collectionContents-0" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
             <div wicket:id="collectionContents-1" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>

http://git-wip-us.apache.org/repos/asf/isis/blob/f00d01fa/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
index fd0a3da..627adb5 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
@@ -96,7 +96,7 @@ public class CollectionContentsLinksSelectorPanel
     private void addUnderlyingViews() {
         final EntityCollectionModel model = getModel();
 
-        final int selected = selectorHelper.honourViewHintElseDefault(this);
+        final int selected = selectorHelper.honourViewHintElseDefault(selectorDropdownPanel);
 
         // create all, hide the one not selected
         underlyingViews = new Component[MAX_NUM_UNDERLYING_VIEWS];


[19/44] isis git commit: ISIS-537: moved markup and CSS for LinksSelectorPanelAbstract into its subclasses (CollectionContentsLinkSelectorPanel and EntityLinksSelectorPanel).

Posted by da...@apache.org.
ISIS-537: moved markup and CSS for LinksSelectorPanelAbstract into its subclasses (CollectionContentsLinkSelectorPanel and EntityLinksSelectorPanel).


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/3b80b5e3
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/3b80b5e3
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/3b80b5e3

Branch: refs/heads/master
Commit: 3b80b5e374c0ebf617ad72fa0f1ac9f7efac4688
Parents: 27545b0
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sun Nov 9 11:37:24 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 10:21:34 2014 +0000

----------------------------------------------------------------------
 .../CollectionContentsLinksSelectorPanel.css    | 39 ++++++++++++++++++
 .../CollectionContentsLinksSelectorPanel.html   | 42 +++++++++++++++-----
 .../selector/links/EntityLinksSelectorPanel.css | 37 +++++++++++++++++
 .../links/EntityLinksSelectorPanel.html         | 42 +++++++++++++++-----
 .../links/LinksSelectorPanelAbstract.css        | 37 -----------------
 5 files changed, 138 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/3b80b5e3/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.css
index 084d9ca..8c3902e 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.css
@@ -16,6 +16,45 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
+.linksSelectorPanel .viewLinks {
+    float:right;
+    display:block;
+}
+
+.linksSelectorPanel ul.dropdown-menu {
+    min-width: 0;
+}
+
+.linksSelectorPanel ul.dropdown-menu li.viewItem {
+    min-width: 0;
+}
+
+.linksSelectorPanel ul.viewList li.viewItem:first-child span {
+    border-radius:4px 0 0 4px;
+    -moz-border-radius:4px 0 0 4px;
+    -webkit-border-radius:4px 0 0 4px;
+}
+
+.linksSelectorPanel ul.viewList li.viewItem:last-child span {
+    border-radius:0 4px 4px 0;
+    -moz-border-radius:0 4px 4px 0;
+    -webkit-border-radius:0 4px 4px 0;
+}
+
+
+.linksSelectorPanel .link-selector-panel-invisible {
+    display:none;
+}
+
+.linksSelectorPanel .list-inline {
+    margin-left: 0;
+}
+
+.linksSelectorPanel .list-inline li {
+    padding-left: 0;
+}
+
+
 .collectionContentsLinksSelectorPanel select {
 	margin-bottom: 1em;
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/3b80b5e3/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
index 22a440b..d35d523 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
@@ -7,9 +7,9 @@
   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
@@ -17,12 +17,31 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<html xmlns="http://www.w3.org/1999/xhtml"  
-      xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"  
-      xml:lang="en"  
-      lang="en">
-    <body>
-        <wicket:extend>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns:wicket="http://wicket.apache.org">
+<body>
+<wicket:panel>
+    <div class="linksSelectorPanel">
+        <div class="btn-group viewLinks" wicket:id="views">
+            <button type="button" class="btn btn-xs btn-info">
+                <span wicket:id="viewButtonIcon" class="ViewLinkItem"></span>
+                <span wicket:id="viewButtonTitle" class="ViewLinkItemTitle"></span>
+            </button>
+            <button type="button" class="btn btn-xs btn-info dropdown-toggle" data-toggle="dropdown">
+                <span class="caret"></span>
+            </button>
+            <ul wicket:id="viewList" class="dropdown-menu dropdown-menu-right" role="menu">
+                <li wicket:id="viewItem" class="viewItem">
+                    <a href="#" wicket:id="viewLink">
+                        <span wicket:id="viewItemIcon" class="ViewLinkItem"></span> <span wicket:id="viewItemTitle" class="ViewLinkItemTitle">[link title]</span>
+                    </a>
+                </li>
+            </ul>
+        </div>
+
+        <span wicket:id="additionalLinks"></span>
+
+        <div class="views">
             <div wicket:id="collectionContents-0" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
             <div wicket:id="collectionContents-1" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
             <div wicket:id="collectionContents-2" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
@@ -33,7 +52,8 @@
             <div wicket:id="collectionContents-7" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
             <div wicket:id="collectionContents-8" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
             <div wicket:id="collectionContents-9" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
-        </wicket:extend>
-    </body>
+        </div>
+    </div>
+</wicket:panel>
+</body>
 </html>
-

http://git-wip-us.apache.org/repos/asf/isis/blob/3b80b5e3/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.css
index eaeea17..6f7be55 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.css
@@ -16,3 +16,40 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
+.linksSelectorPanel .viewLinks {
+    float:right;
+    display:block;
+}
+
+.linksSelectorPanel ul.dropdown-menu {
+    min-width: 0;
+}
+
+.linksSelectorPanel ul.dropdown-menu li.viewItem {
+    min-width: 0;
+}
+
+.linksSelectorPanel ul.viewList li.viewItem:first-child span {
+    border-radius:4px 0 0 4px;
+    -moz-border-radius:4px 0 0 4px;
+    -webkit-border-radius:4px 0 0 4px;
+}
+
+.linksSelectorPanel ul.viewList li.viewItem:last-child span {
+    border-radius:0 4px 4px 0;
+    -moz-border-radius:0 4px 4px 0;
+    -webkit-border-radius:0 4px 4px 0;
+}
+
+
+.linksSelectorPanel .link-selector-panel-invisible {
+    display:none;
+}
+
+.linksSelectorPanel .list-inline {
+    margin-left: 0;
+}
+
+.linksSelectorPanel .list-inline li {
+    padding-left: 0;
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/3b80b5e3/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.html
index a1c9e5d..988f0a3 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanel.html
@@ -7,9 +7,9 @@
   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
@@ -17,12 +17,31 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<html xmlns="http://www.w3.org/1999/xhtml"  
-      xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"  
-      xml:lang="en"  
-      lang="en">
-    <body>
-        <wicket:extend>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns:wicket="http://wicket.apache.org">
+<body>
+<wicket:panel>
+    <div class="linksSelectorPanel">
+        <div class="btn-group viewLinks" wicket:id="views">
+            <button type="button" class="btn btn-xs btn-info">
+                <span wicket:id="viewButtonIcon" class="ViewLinkItem"></span>
+                <span wicket:id="viewButtonTitle" class="ViewLinkItemTitle"></span>
+            </button>
+            <button type="button" class="btn btn-xs btn-info dropdown-toggle" data-toggle="dropdown">
+                <span class="caret"></span>
+            </button>
+            <ul wicket:id="viewList" class="dropdown-menu dropdown-menu-right" role="menu">
+                <li wicket:id="viewItem" class="viewItem">
+                    <a href="#" wicket:id="viewLink">
+                        <span wicket:id="viewItemIcon" class="ViewLinkItem"></span> <span wicket:id="viewItemTitle" class="ViewLinkItemTitle">[link title]</span>
+                    </a>
+                </li>
+            </ul>
+        </div>
+
+        <span wicket:id="additionalLinks"></span>
+
+        <div class="views">
             <div wicket:id="entity-0" class="entityLinksSelectorPanel entityComponentType"></div>
             <div wicket:id="entity-1" class="entityLinksSelectorPanel entityComponentType"></div>
             <div wicket:id="entity-2" class="entityLinksSelectorPanel entityComponentType"></div>
@@ -33,7 +52,8 @@
             <div wicket:id="entity-7" class="entityLinksSelectorPanel entityComponentType"></div>
             <div wicket:id="entity-8" class="entityLinksSelectorPanel entityComponentType"></div>
             <div wicket:id="entity-9" class="entityLinksSelectorPanel entityComponentType"></div>
-        </wicket:extend>
-    </body>
+        </div>
+    </div>
+</wicket:panel>
+</body>
 </html>
-

http://git-wip-us.apache.org/repos/asf/isis/blob/3b80b5e3/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.css
index 335e510..9f1612a 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/selector/links/LinksSelectorPanelAbstract.css
@@ -17,40 +17,3 @@
  *  under the License.
  */
 
-.linksSelectorPanel .viewLinks {
-    float:right;
-    display:block;
-}
-
-.linksSelectorPanel ul.dropdown-menu {
-    min-width: 0;
-}
-
-.linksSelectorPanel ul.dropdown-menu li.viewItem {
-    min-width: 0;
-}
-
-.linksSelectorPanel ul.viewList li.viewItem:first-child span {
-    border-radius:4px 0 0 4px;
-    -moz-border-radius:4px 0 0 4px;
-    -webkit-border-radius:4px 0 0 4px;
-}
-
-.linksSelectorPanel ul.viewList li.viewItem:last-child span {
-    border-radius:0 4px 4px 0;
-    -moz-border-radius:0 4px 4px 0;
-    -webkit-border-radius:0 4px 4px 0;
-}
-
-
-.linksSelectorPanel .link-selector-panel-invisible {
-    display:none;
-}
-
-.linksSelectorPanel .list-inline {
-    margin-left: 0;
-}
-
-.linksSelectorPanel .list-inline li {
-    padding-left: 0;
-}


[31/44] isis git commit: ISIS-942: Allow auditing in transactions of entities being created/deleted.

Posted by da...@apache.org.
ISIS-942: Allow auditing in transactions of entities being created/deleted.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/3b397385
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/3b397385
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/3b397385

Branch: refs/heads/master
Commit: 3b397385b9315231f403f294b3a1aba73bf4ce42
Parents: b1a0f1d
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Fri Nov 7 17:13:51 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 10:21:48 2014 +0000

----------------------------------------------------------------------
 .../system/transaction/IsisTransaction.java     | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/3b397385/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
index b2536ba..c5171e9 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
@@ -106,6 +106,19 @@ public class IsisTransaction implements TransactionScopedComponent {
         }
     };
 
+    private static class Placeholder {
+        private static Placeholder NEW = new Placeholder("[NEW]");
+        private static Placeholder DELETED = new Placeholder("[DELETED]");
+        private final String str;
+        public Placeholder(String str) {
+            this.str = str;
+        }
+        @Override
+        public String toString() {
+            return str;
+        }
+    }
+
     public static enum State {
         /**
          * Started, still in progress.
@@ -1195,6 +1208,9 @@ public class IsisTransaction implements TransactionScopedComponent {
         }
 
         public boolean differ() {
+            if(getPre() == Placeholder.NEW || getPost() == Placeholder.DELETED) {
+                return true;
+            }
             return !Objects.equal(getPre(), getPost());
         }
     }
@@ -1226,7 +1242,7 @@ public class IsisTransaction implements TransactionScopedComponent {
             if(property.isNotPersisted()) {
                 continue;
             }
-            PreAndPostValues papv = PreAndPostValues.pre("[NEW]");
+            PreAndPostValues papv = PreAndPostValues.pre(Placeholder.NEW);
             changedObjectProperties.put(aap, papv);
         }
     }
@@ -1309,7 +1325,7 @@ public class IsisTransaction implements TransactionScopedComponent {
             if(adapter.isDestroyed()) {
                 // don't touch the object!!!
                 // JDO, for example, will complain otherwise...
-                papv.setPost("[DELETED]");
+                papv.setPost(Placeholder.DELETED);
             } else {
                 papv.setPost(aap.getPropertyValue());
             }


[43/44] isis git commit: ISIS-944: use StringBuilder instead of StringBuffer; improve javadoc.

Posted by da...@apache.org.
ISIS-944: use StringBuilder instead of StringBuffer; improve javadoc.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/62d77af9
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/62d77af9
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/62d77af9

Branch: refs/heads/master
Commit: 62d77af98dd28f12fc0ea2d075d6d6c18005af06
Parents: 545b161
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Nov 10 22:33:53 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 22:33:53 2014 +0000

----------------------------------------------------------------------
 .../apache/isis/applib/util/TitleBuffer.java    | 156 ++++++++++++++-----
 1 file changed, 116 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/62d77af9/core/applib/src/main/java/org/apache/isis/applib/util/TitleBuffer.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/util/TitleBuffer.java b/core/applib/src/main/java/org/apache/isis/applib/util/TitleBuffer.java
index 74e2a59..eaa7bfe 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/util/TitleBuffer.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/util/TitleBuffer.java
@@ -36,10 +36,15 @@ public class TitleBuffer {
     public static final Object[] NO_ARGUMENTS = new Object[0];
 
     /**
-     * Determines if the specified object's title (from its
-     * <code>toString</code> method) is empty. Will return true if either: the
-     * specified reference is null; the object's <code>toString</code> method
-     * returns null; or if the <code>toString</code> returns an empty string.
+     * Determines if the specified object's title is empty (or null).
+     *
+     * <p>
+     *     Note: this method only obtains the title using either <tt>title()</tt> or <tt>toString()</tt>; it doesn't
+     *     honour other mechanisms for specifying the title, such as {@link org.apache.isis.applib.annotation.Title}
+     *     annotation.  If that functionality is required, first call
+     *     {@link org.apache.isis.applib.DomainObjectContainer#titleOf(Object)} on the object and pass in the resultant
+     *     string.
+     * </p>
      */
     public static boolean isEmpty(final Object object) {
         final String title = titleFor(object);
@@ -53,16 +58,18 @@ public class TitleBuffer {
     private static String titleFor(final Object object) {
         if (object == null) {
             return null;
-        } else {
-            Method method;
-            try {
-                method = object.getClass().getMethod("title", NO_PARAMETER_TYPES);
-                return (String) method.invoke(object, NO_ARGUMENTS);
-            } catch (final SecurityException | IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
-                throw new TitleBufferException(e);
-            } catch (final NoSuchMethodException e) {
-                return object.toString();
-            }
+        }
+        if(object instanceof String) {
+            return object.toString();
+        }
+
+        try {
+            Method method = object.getClass().getMethod("title", NO_PARAMETER_TYPES);
+            return (String) method.invoke(object, NO_ARGUMENTS);
+        } catch (final SecurityException | IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
+            throw new TitleBufferException(e);
+        } catch (final NoSuchMethodException e) {
+            return object.toString();
         }
     }
 
@@ -74,18 +81,25 @@ public class TitleBuffer {
         return text == null || text.equals("");
     }
 
-    // TODO mgrigorov: is synchronization needed here ? If NO then use StringBuilder
-    private final StringBuffer title;
+    private final StringBuilder title;
 
     /**
-     * Creates a new, empty, title object.
+     * Creates a new, empty, {@link org.apache.isis.applib.util.TitleBuffer}.
      */
     public TitleBuffer() {
-        title = new StringBuffer();
+        title = new StringBuilder();
     }
 
     /**
-     * Creates a new title object, containing the title of the specified object.
+     * Creates a new {@link org.apache.isis.applib.util.TitleBuffer}, containing the title of the specified object.
+     * 
+     * <p>
+     *     Note: this method only obtains the title using either <tt>title()</tt> or <tt>toString()</tt>; it doesn't
+     *     honour other mechanisms for specifying the title, such as {@link org.apache.isis.applib.annotation.Title}
+     *     annotation.  If that functionality is required, first call
+     *     {@link org.apache.isis.applib.DomainObjectContainer#titleOf(Object)} on the object and pass in the resultant
+     *     string.
+     * </p>
      */
     public TitleBuffer(final Object object) {
         this();
@@ -94,6 +108,14 @@ public class TitleBuffer {
 
     /**
      * Creates a new title object, containing the title of the specified object.
+     *
+     * <p>
+     *     Note: this method only obtains the title using either <tt>title()</tt> or <tt>toString()</tt>; it doesn't
+     *     honour other mechanisms for specifying the title, such as {@link org.apache.isis.applib.annotation.Title}
+     *     annotation.  If that functionality is required, first call
+     *     {@link org.apache.isis.applib.DomainObjectContainer#titleOf(Object)} on the object and pass in the resultant
+     *     string.
+     * </p>
      */
     public TitleBuffer(final Object object, final String defaultTitle) {
         this();
@@ -122,7 +144,15 @@ public class TitleBuffer {
     }
 
     /**
-     * Append the title of the specified object.
+     * Append the title of the specified object to this {@link org.apache.isis.applib.util.TitleBuffer}.
+     *
+     * <p>
+     *     Note: this method only obtains the title using either <tt>title()</tt> or <tt>toString()</tt>; it doesn't
+     *     honour other mechanisms for specifying the title, such as {@link org.apache.isis.applib.annotation.Title}
+     *     annotation.  If that functionality is required, first call
+     *     {@link org.apache.isis.applib.DomainObjectContainer#titleOf(Object)} on the object and pass in the resultant
+     *     string.
+     * </p>
      */
     public TitleBuffer append(final Object object) {
         String title = titleFor(object);
@@ -136,7 +166,15 @@ public class TitleBuffer {
      * Appends the title of the specified object, or the specified text if the
      * objects title is null or empty. Prepends a space if there is already some
      * text in this title object.
-     * 
+     *
+     * <p>
+     *     Note: this method only obtains the title using either <tt>title()</tt> or <tt>toString()</tt>; it doesn't
+     *     honour other mechanisms for specifying the title, such as {@link org.apache.isis.applib.annotation.Title}
+     *     annotation.  If that functionality is required, first call
+     *     {@link org.apache.isis.applib.DomainObjectContainer#titleOf(Object)} on the object and pass in the resultant
+     *     string.
+     * </p>
+     *
      * @param object
      *            the object whose title is to be appended to this title.
      * @param defaultValue
@@ -168,10 +206,17 @@ public class TitleBuffer {
     }
 
     /**
-     * Appends the joining string and the title of the specified object (from
-     * its <code>toString</code> method). If the object is empty then nothing
+     * Appends the joining string and the title of the specified object. If the object is empty then nothing
      * will be appended.
-     * 
+     *
+     * <p>
+     *     Note: this method only obtains the title using either <tt>title()</tt> or <tt>toString()</tt>; it doesn't
+     *     honour other mechanisms for specifying the title, such as {@link org.apache.isis.applib.annotation.Title}
+     *     annotation.  If that functionality is required, first call
+     *     {@link org.apache.isis.applib.DomainObjectContainer#titleOf(Object)} on the object and pass in the resultant
+     *     string.
+     * </p>
+     *
      * @see #isEmpty(Object)
      */
     public TitleBuffer append(final String joiner, final Object object) {
@@ -185,13 +230,20 @@ public class TitleBuffer {
 
     /**
      * Append the <code>joiner</code> text, a space, and the title of the
-     * specified ObjectAdapter (<code>object</code>) (got by calling the objects
-     * title() method) to the text of this TitleString object. If the title of
+     * specified object to the text of this {@link org.apache.isis.applib.util.TitleBuffer}. If the title of
      * the specified object is null then use the <code>defaultValue</code> text.
      * If both the objects title and the default value are null or equate to a
      * zero-length string then no text will be appended ; not even the joiner
      * text.
-     * 
+     *
+     * <p>
+     *     Note: this method only obtains the title using either <tt>title()</tt> or <tt>toString()</tt>; it doesn't
+     *     honour other mechanisms for specifying the title, such as {@link org.apache.isis.applib.annotation.Title}
+     *     annotation.  If that functionality is required, first call
+     *     {@link org.apache.isis.applib.DomainObjectContainer#titleOf(Object)} on the object and pass in the resultant
+     *     string.
+     * </p>
+     *
      * @param joiner
      *            text to append before the title
      * @param object
@@ -213,7 +265,7 @@ public class TitleBuffer {
 
     /**
      * Appends the joiner text, a space, and the text to the text of this
-     * TitleString object. If no text yet exists in the object then the joiner
+     * {@link org.apache.isis.applib.util.TitleBuffer}. If no text yet exists in the object then the joiner
      * text and space are omitted.
      * 
      * @return a reference to the called object (itself).
@@ -266,14 +318,22 @@ public class TitleBuffer {
     }
 
     /**
-     * Concatenate the the title value (the result of calling an objects label()
-     * method), or the specified default value if the title is equal to null or
-     * is empty, to this TitleString object.
-     * 
+     * Concatenate the title of the object value or the specified default value if the title is equal to null or
+     * is empty, to this {@link org.apache.isis.applib.util.TitleBuffer}.
+     *
+     * <p>
+     *     Note: this method only obtains the title using either <tt>title()</tt> or <tt>toString()</tt>; it doesn't
+     *     honour other mechanisms for specifying the title, such as {@link org.apache.isis.applib.annotation.Title}
+     *     annotation.  If that functionality is required, first call
+     *     {@link org.apache.isis.applib.DomainObjectContainer#titleOf(Object)} on the object and pass in the resultant
+     *     string.
+     * </p>
+     *
      * @param object
-     *            the ObjectAdapter to get a title from
+     *            the object to get a title from
      * @param defaultValue
-     *            the default text to use when the ObjectAdapter is null
+     *            the default text to use when the object is null/empty
+     *
      * @return a reference to the called object (itself).
      */
     public final TitleBuffer concat(final Object object, final String defaultValue) {
@@ -289,7 +349,7 @@ public class TitleBuffer {
 
     /**
      * Concatenate the specified text on to the end of the text of this
-     * TitleString.
+     * {@link org.apache.isis.applib.util.TitleBuffer}.
      * 
      * @param text
      *            text to append
@@ -301,7 +361,7 @@ public class TitleBuffer {
     }
 
     /**
-     * Concatenate the joiner text and the text to the text of this TitleString
+     * Concatenate the joiner text and the text to the text of this {@link org.apache.isis.applib.util.TitleBuffer}
      * object. If no text yet exists in the object then the joiner text is
      * omitted.
      * 
@@ -317,9 +377,17 @@ public class TitleBuffer {
 
     /**
      * Concatenate the joiner text and the title of the object to the text of
-     * this TitleString object. If no object yet exists in the object then the
+     * this {@link org.apache.isis.applib.util.TitleBuffer}. If no object yet exists in the object then the
      * joiner text is omitted.
-     * 
+     *
+     * <p>
+     *     Note: this method only obtains the title using either <tt>title()</tt> or <tt>toString()</tt>; it doesn't
+     *     honour other mechanisms for specifying the title, such as {@link org.apache.isis.applib.annotation.Title}
+     *     annotation.  If that functionality is required, first call
+     *     {@link org.apache.isis.applib.DomainObjectContainer#titleOf(Object)} on the object and pass in the resultant
+     *     string.
+     * </p>
+     *
      * @return a reference to the called object (itself).
      */
     public final TitleBuffer concat(final String joiner, final Object object) {
@@ -333,9 +401,17 @@ public class TitleBuffer {
 
     /**
      * Concatenate the joiner text and the title of the object to the text of
-     * this TitleString object. If no object yet exists in the object then
+     * this {@link org.apache.isis.applib.util.TitleBuffer} object. If no object yet exists in the object then
      * defaultValue is used instead.
-     * 
+     *
+     * <p>
+     *     Note: this method only obtains the title using either <tt>title()</tt> or <tt>toString()</tt>; it doesn't
+     *     honour other mechanisms for specifying the title, such as {@link org.apache.isis.applib.annotation.Title}
+     *     annotation.  If that functionality is required, first call
+     *     {@link org.apache.isis.applib.DomainObjectContainer#titleOf(Object)} on the object and pass in the resultant
+     *     string.
+     * </p>
+
      * @return a reference to the called object (itself).
      */
     public final TitleBuffer concat(final String joiner, final Object object, final String defaultValue) {


[11/44] isis git commit: ISIS-537: update to ToDoItem's layout to demonstrate labelAt facet.

Posted by da...@apache.org.
ISIS-537: update to ToDoItem's layout to demonstrate labelAt facet.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/ee4fe8b8
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/ee4fe8b8
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/ee4fe8b8

Branch: refs/heads/master
Commit: ee4fe8b8ffb87aa59d365f89c7a5bd7edb498254
Parents: 6f2296c
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Nov 6 16:22:19 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Nov 6 16:22:19 2014 +0000

----------------------------------------------------------------------
 .../todoapp/dom/src/main/java/dom/todo/ToDoItem.layout.json  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/ee4fe8b8/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.layout.json
----------------------------------------------------------------------
diff --git a/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.layout.json b/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.layout.json
index 36491de..540b13f 100644
--- a/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.layout.json
+++ b/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.layout.json
@@ -22,11 +22,15 @@
             "General": {
                 "members": {
                     "description": {
-                        "typicalLength": { "value": 50 }
+                        "typicalLength": { "value": 50 },
+                        "labelAt": { "value": "TOP" }
                     },
                     "category": {
+                        "named": { "value": "Category/subcategory" },
+                        "labelAt": { "value": "TOP" }
                     },
                     "subcategory": {
+                        "labelAt": { "value": "NONE" },
                         "actions": {
                             "updateCategory": {
                                 "named": {
@@ -119,7 +123,7 @@
                         "hidden": {
                             "where": "ALL_TABLES"
                         },
-                        "labelAt": { "value": "LEFT" }
+                        "labelAt": { "value": "TOP" }
                     },
                     "attachment": {
                         "hidden": {


[40/44] isis git commit: ISIS-537: changing StandaloneCollectionPanel to use AdditionaLinksPanel (rather than CssMenuPanel); fixing layout for bulk actions and view selector in standalone; ensuring that bootstrap CSS applied to correct element in Additio

Posted by da...@apache.org.
ISIS-537: changing StandaloneCollectionPanel to use AdditionaLinksPanel (rather than CssMenuPanel); fixing layout for bulk actions and view selector in standalone; ensuring that bootstrap CSS applied to correct element in AdditionalLinksPanel.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/9726a179
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/9726a179
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/9726a179

Branch: refs/heads/master
Commit: 9726a179954b595c1cd693124077604e3d92a533
Parents: e20203e
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Nov 10 21:20:35 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 21:20:35 2014 +0000

----------------------------------------------------------------------
 .../additionallinks/AdditionalLinksPanel.css    |  7 +++
 .../additionallinks/AdditionalLinksPanel.java   |  2 +-
 .../collection/bulk/BulkActionsLinkFactory.java |  2 +-
 .../StandaloneCollectionPanel.css               |  4 +-
 .../StandaloneCollectionPanel.html              |  6 +--
 .../StandaloneCollectionPanel.java              | 52 +++++++++++---------
 .../components/widgets/cssmenu/CssMenuPanel.css |  2 +-
 .../wicket/ui/pages/bootstrap-overrides.css     |  5 +-
 .../src/main/java/dom/todo/ToDoItem.layout.json |  2 +-
 9 files changed, 49 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/9726a179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/AdditionalLinksPanel.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/AdditionalLinksPanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/AdditionalLinksPanel.css
index eece3f9..fd9ad27 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/AdditionalLinksPanel.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/AdditionalLinksPanel.css
@@ -21,3 +21,10 @@ span .fa {
     padding-right: 2px;
 }
 
+
+.additionalLinkList {
+    float:left;
+    margin:0;
+    padding:0;
+    list-style:none;
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/9726a179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/AdditionalLinksPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/AdditionalLinksPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/AdditionalLinksPanel.java
index 50b9a1b..ec40f09 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/AdditionalLinksPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/AdditionalLinksPanel.java
@@ -98,7 +98,7 @@ public class AdditionalLinksPanel extends PanelAbstract<ListOfLinksModel> {
                 link.add(new CssClassAppender(linkAndLabel.getActionIdentifier()));
                 String cssClass = linkAndLabel.getCssClass();
                 if(cssClass != null) {
-                    item.add(new CssClassAppender(cssClass));
+                    link.add(new CssClassAppender(cssClass));
                 }
                 viewTitleLabel.add(new CssClassAppender(StringExtensions.asLowerDashed(linkAndLabel.getLabel())));
                 link.addOrReplace(viewTitleLabel);

http://git-wip-us.apache.org/repos/asf/isis/blob/9726a179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/bulk/BulkActionsLinkFactory.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/bulk/BulkActionsLinkFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/bulk/BulkActionsLinkFactory.java
index 46f8642..e0534b4 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/bulk/BulkActionsLinkFactory.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/bulk/BulkActionsLinkFactory.java
@@ -70,7 +70,7 @@ public final class BulkActionsLinkFactory implements ActionLinkFactory {
 
     @Override
     public LinkAndLabel newLink(
-            final ObjectAdapterMemento serviceAdapterMemento,
+            final ObjectAdapterMemento objectAdapterMemento,
             final ObjectAction objectAction,
             final String linkId,
             final ActionPromptProvider actionPromptProvider) {

http://git-wip-us.apache.org/repos/asf/isis/blob/9726a179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.css
index eea4518..08ebcec 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.css
@@ -17,7 +17,7 @@
  *  under the License.
  */
 
-
+/*
 .standaloneCollectionPanel {
 }
 
@@ -40,3 +40,5 @@ div.standaloneCollectionPanel .iconAndTitle {
 	clear:both;
 }
 
+*/
+

http://git-wip-us.apache.org/repos/asf/isis/blob/9726a179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
index 194d8fa..f5f7f94 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
@@ -28,19 +28,17 @@
             <div wicket:id="actionPromptModalWindow"></div>
             <div class="standaloneCollectionPanel actionComponentType myBlockContainer panel panel-default">
                 <div class="iconAndTitle panel-heading actionPanelHeaderNew">
-                     <div wicket:id="actionName" class="actionName panel-title">[action name]</div>
+                    <span wicket:id="actionName" class="actionName panel-title">[action name]</span>
 
                     <div class="pull-right">
 
                         <div class="btn-group">
-                            <div class="entityActions" wicket:id="entityActions"></div>
+                            <div wicket:id="additionalLinks"></div>
                         </div>
                         <div class="btn-group">
                             <span wicket:id="selectorDropdown"/>
                         </div>
-
                     </div>
-
                 </div>
 
                 <div wicket:id="collectionContents" class="panel-body"></div>

http://git-wip-us.apache.org/repos/asf/isis/blob/9726a179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
index 0473974..c1206ff 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
@@ -20,6 +20,8 @@
 package org.apache.isis.viewer.wicket.ui.components.standalonecollection;
 
 import java.util.List;
+import com.google.common.base.Function;
+import com.google.common.collect.Lists;
 import org.apache.wicket.Component;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.markup.html.basic.Label;
@@ -27,6 +29,7 @@ import org.apache.wicket.model.Model;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
 import org.apache.isis.viewer.wicket.model.common.OnSelectionHandler;
+import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
 import org.apache.isis.viewer.wicket.model.models.ActionModel;
 import org.apache.isis.viewer.wicket.model.models.ActionPromptProvider;
 import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
@@ -34,17 +37,16 @@ import org.apache.isis.viewer.wicket.ui.ComponentFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentType;
 import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistry;
 import org.apache.isis.viewer.wicket.ui.components.actionprompt.ActionPromptModalWindow;
+import org.apache.isis.viewer.wicket.ui.components.additionallinks.AdditionalLinksPanel;
+import org.apache.isis.viewer.wicket.ui.components.collection.bulk.BulkActionsHelper;
+import org.apache.isis.viewer.wicket.ui.components.collection.bulk.BulkActionsLinkFactory;
+import org.apache.isis.viewer.wicket.ui.components.collection.bulk.BulkActionsProvider;
 import org.apache.isis.viewer.wicket.ui.components.collection.count.CollectionCountProvider;
 import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorHelper;
 import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorPanel;
 import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorProvider;
-import org.apache.isis.viewer.wicket.ui.components.collection.bulk.BulkActionsHelper;
-import org.apache.isis.viewer.wicket.ui.components.collection.bulk.BulkActionsLinkFactory;
-import org.apache.isis.viewer.wicket.ui.components.collection.bulk.BulkActionsProvider;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ObjectAdapterToggleboxColumn;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.multiple.CollectionContentsMultipleViewsPanelFactory;
-import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.CssMenuBuilder;
-import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.CssMenuPanel;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
 
 public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionModel>
@@ -55,24 +57,20 @@ public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionMod
     private static final String ID_ACTION_NAME = "actionName";
 
     private static final String ID_ACTION_PROMPT_MODAL_WINDOW = "actionPromptModalWindow";
-    private static final String ID_ENTITY_ACTIONS = "entityActions";
+    private static final String ID_ADDITIONAL_LINKS = "additionalLinks";
+    private static final String ID_ADDITIONAL_LINK = "additionalLink";
 
     private static final String ID_SELECTOR_DROPDOWN = "selectorDropdown";
-    private CollectionSelectorPanel selectorDropdownPanel;
 
+    private final ActionPromptModalWindow actionPromptModalWindow;
+    private final CollectionSelectorPanel selectorDropdownPanel;
     private final BulkActionsHelper bulkActionsHelper;
 
-    public StandaloneCollectionPanel(final String id, final EntityCollectionModel entityCollectionModel) {
-        super(id, entityCollectionModel);
-        buildGui(entityCollectionModel);
-
-        bulkActionsHelper = new BulkActionsHelper(entityCollectionModel);
-    }
-
     /**
      * note that the bulk actions components are added in {@link #configureBulkActions(org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ObjectAdapterToggleboxColumn)}.
      */
-    private void buildGui(final EntityCollectionModel entityCollectionModel) {
+    public StandaloneCollectionPanel(final String id, final EntityCollectionModel entityCollectionModel) {
+        super(id, entityCollectionModel);
 
         ActionModel actionModel = entityCollectionModel.getActionModelHint();
         ObjectAction action = actionModel.getActionMemento().getAction();
@@ -89,9 +87,9 @@ public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionMod
 
         if (componentFactories.size() <= 1) {
             permanentlyHide(ID_SELECTOR_DROPDOWN);
+            this.selectorDropdownPanel = null;
         } else {
-            CollectionSelectorPanel selectorDropdownPanel;
-            selectorDropdownPanel = new CollectionSelectorPanel(ID_SELECTOR_DROPDOWN, entityCollectionModel, new CollectionContentsMultipleViewsPanelFactory());
+            CollectionSelectorPanel selectorDropdownPanel = new CollectionSelectorPanel(ID_SELECTOR_DROPDOWN, entityCollectionModel, new CollectionContentsMultipleViewsPanelFactory());
 
             final Model<ComponentFactory> componentFactoryModel = new Model<>();
 
@@ -108,11 +106,12 @@ public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionMod
 
         final ComponentFactoryRegistry componentFactoryRegistry = getComponentFactoryRegistry();
         componentFactoryRegistry.addOrReplaceComponent(this, ComponentType.COLLECTION_CONTENTS, entityCollectionModel);
+
+        bulkActionsHelper = new BulkActionsHelper(entityCollectionModel);
     }
 
     //region > ActionPromptModalWindowProvider
 
-    private ActionPromptModalWindow actionPromptModalWindow;
     public ActionPromptModalWindow getActionPrompt() {
         return ActionPromptModalWindow.getActionPromptModalWindowIfEnabled(actionPromptModalWindow);
     }
@@ -158,15 +157,24 @@ public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionMod
 
         final List<ObjectAction> bulkActions = bulkActionsHelper.getBulkActions();
 
-        final CssMenuBuilder cssMenuBuilder =
-                new CssMenuBuilder(null, bulkActions, linkFactory, this, null);
-        final CssMenuPanel cssMenuPanel = cssMenuBuilder.buildPanel(ID_ENTITY_ACTIONS, "Actions");
+        List<LinkAndLabel> links = Lists.transform(bulkActions, new Function<ObjectAction, LinkAndLabel>(){
+            @Override
+            public LinkAndLabel apply(ObjectAction objectAction) {
+                return linkFactory.newLink(null, objectAction, ID_ADDITIONAL_LINK, StandaloneCollectionPanel.this);
+            }
+        });
+
+        AdditionalLinksPanel additionalLinks = new AdditionalLinksPanel(ID_ADDITIONAL_LINKS, links);
+        addOrReplace(additionalLinks);
 
-        addOrReplace(cssMenuPanel);
 
     }
+
     //endregion
 
+
+
+
     //region > CollectionSelectorProvider
 
     @Override

http://git-wip-us.apache.org/repos/asf/isis/blob/9726a179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/CssMenuPanel.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/CssMenuPanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/CssMenuPanel.css
index e4228f5..c858633 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/CssMenuPanel.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/CssMenuPanel.css
@@ -230,5 +230,5 @@
 .additionalLinkList li {
 	float:left;
 	margin-right:10px;
-	margin-bottom: 2px;
+/*	margin-bottom: 2px;*/
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/9726a179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
index cb7ed79..5a65da7 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
@@ -159,6 +159,7 @@ div.label-left .choicesPlaceholder {
     resize: none;
 }
 
-.entityCollectionsPanel .panel-heading {
+.entityCollectionsPanel .panel-heading,
+.standaloneCollectionPanel .panel-heading {
     padding-bottom: 15px;
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/9726a179/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.layout.json
----------------------------------------------------------------------
diff --git a/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.layout.json b/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.layout.json
index 540b13f..69944d2 100644
--- a/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.layout.json
+++ b/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.layout.json
@@ -152,7 +152,7 @@
                         "cssClassFa": { "value": "fa fa-plus-square" }
                     },
                     "remove": {
-                        "cssClass": { "value": "x-caution" },
+                        "cssClass": { "value": "x-caution btn-danger" },
                         "cssClassFa": { "value": "fa fa-minus-square" }
                     }
                 },


[05/44] isis git commit: ISIS-939: simplified MessageBroker

Posted by da...@apache.org.
ISIS-939: simplified MessageBroker

- removed the defunct MessageBroker interface (in runtime)
- renamed MessageBrokerDefault to MessageBroker (unextract interface), now in metamodel
- removed #setApplicationError, since no longer used.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/e48ab59c
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/e48ab59c
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/e48ab59c

Branch: refs/heads/master
Commit: e48ab59c110d923be288687a9e461bc3410736aa
Parents: 30eb514
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Nov 3 20:01:43 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Nov 6 16:18:58 2014 +0000

----------------------------------------------------------------------
 .../scimpi/dispatcher/action/ActionAction.java  |   3 +-
 .../scimpi/dispatcher/edit/EditAction.java      |   3 +-
 .../dispatcher/view/display/AddMessage.java     |   2 +-
 .../dispatcher/view/display/AddWarning.java     |   2 +-
 .../dispatcher/view/display/Messages.java       |   3 +-
 .../dispatcher/view/display/Warnings.java       |   3 +-
 .../commons/authentication/MessageBroker.java   | 109 +++++++++--
 .../internal/RuntimeContextFromSession.java     |   2 +-
 .../runtime/system/context/IsisContext.java     |   6 +-
 .../system/transaction/IsisTransaction.java     |  10 +-
 .../transaction/IsisTransactionManager.java     |  15 +-
 .../system/transaction/MessageBroker.java       |  28 ---
 .../transaction/MessageBrokerDefault.java       | 179 -------------------
 ...reTransactionManager_EndTransactionTest.java |  11 +-
 ...TransactionManager_StartTransactionTest.java |  10 +-
 .../system/transaction/IsisTransactionTest.java |   1 +
 16 files changed, 126 insertions(+), 261 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/e48ab59c/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java
index c598ba3..44a9756 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/action/ActionAction.java
@@ -21,11 +21,11 @@ package org.apache.isis.viewer.scimpi.dispatcher.action;
 
 import java.io.IOException;
 import java.util.List;
-
 import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.applib.profiles.Localization;
 import org.apache.isis.core.commons.authentication.AnonymousSession;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.authentication.MessageBroker;
 import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
@@ -39,7 +39,6 @@ import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
 import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.transaction.MessageBroker;
 import org.apache.isis.viewer.scimpi.dispatcher.Action;
 import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;

http://git-wip-us.apache.org/repos/asf/isis/blob/e48ab59c/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java
index 3784472..852ccea 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/edit/EditAction.java
@@ -21,11 +21,11 @@ package org.apache.isis.viewer.scimpi.dispatcher.edit;
 
 import java.io.IOException;
 import java.util.List;
-
 import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.applib.profiles.Localization;
 import org.apache.isis.core.commons.authentication.AnonymousSession;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.authentication.MessageBroker;
 import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.version.Version;
@@ -38,7 +38,6 @@ import org.apache.isis.core.metamodel.spec.feature.Contributed;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.transaction.MessageBroker;
 import org.apache.isis.viewer.scimpi.dispatcher.Action;
 import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
 import org.apache.isis.viewer.scimpi.dispatcher.NotLoggedInException;

http://git-wip-us.apache.org/repos/asf/isis/blob/e48ab59c/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddMessage.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddMessage.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddMessage.java
index acb53eb..7076f70 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddMessage.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddMessage.java
@@ -19,8 +19,8 @@
 
 package org.apache.isis.viewer.scimpi.dispatcher.view.display;
 
+import org.apache.isis.core.commons.authentication.MessageBroker;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.transaction.MessageBroker;
 import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 

http://git-wip-us.apache.org/repos/asf/isis/blob/e48ab59c/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddWarning.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddWarning.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddWarning.java
index 59d3dcc..ac0d240 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddWarning.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AddWarning.java
@@ -19,8 +19,8 @@
 
 package org.apache.isis.viewer.scimpi.dispatcher.view.display;
 
+import org.apache.isis.core.commons.authentication.MessageBroker;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.transaction.MessageBroker;
 import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 

http://git-wip-us.apache.org/repos/asf/isis/blob/e48ab59c/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Messages.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Messages.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Messages.java
index a6c8213..8ec1420 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Messages.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Messages.java
@@ -20,9 +20,8 @@
 package org.apache.isis.viewer.scimpi.dispatcher.view.display;
 
 import java.util.List;
-
+import org.apache.isis.core.commons.authentication.MessageBroker;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.transaction.MessageBroker;
 import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 

http://git-wip-us.apache.org/repos/asf/isis/blob/e48ab59c/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Warnings.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Warnings.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Warnings.java
index ca0becb..52be7d6 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Warnings.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/Warnings.java
@@ -20,9 +20,8 @@
 package org.apache.isis.viewer.scimpi.dispatcher.view.display;
 
 import java.util.List;
-
+import org.apache.isis.core.commons.authentication.MessageBroker;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.transaction.MessageBroker;
 import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 

http://git-wip-us.apache.org/repos/asf/isis/blob/e48ab59c/core/metamodel/src/main/java/org/apache/isis/core/commons/authentication/MessageBroker.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/commons/authentication/MessageBroker.java b/core/metamodel/src/main/java/org/apache/isis/core/commons/authentication/MessageBroker.java
index 2dc1d5b..12d5068 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/commons/authentication/MessageBroker.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/commons/authentication/MessageBroker.java
@@ -20,26 +20,107 @@
 package org.apache.isis.core.commons.authentication;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
+import com.google.common.collect.Lists;
+import org.apache.isis.core.commons.debug.DebugBuilder;
+import org.apache.isis.core.commons.debug.DebuggableWithTitle;
 
-/**
- * Moving from runtime, so that can preserve messages between interactions that
- * correspond to the same session.
- */
-public interface MessageBroker extends Serializable {
+public class MessageBroker implements Serializable, DebuggableWithTitle {
+
+    private static final long serialVersionUID = 1L;
+    
+    private final List<String> messages = Lists.newArrayList();
+    private final List<String> warnings = Lists.newArrayList();
+
+    //region > acquire (factory method)
+
+    public static MessageBroker acquire(final AuthenticationSession authenticationSession) {
+        MessageBroker messageBroker;
+        synchronized (authenticationSession) {
+            messageBroker = authenticationSession.getMessageBroker();
+            if(messageBroker == null) {
+                messageBroker = new MessageBroker();
+                authenticationSession.setMessageBroker(messageBroker);
+            }
+        }
+        return messageBroker;
+    }
+
+    private MessageBroker() {
+    }
+    //endregion
+
+    //region > reset
+
+    public void reset() {
+        warnings.clear();
+        messages.clear();
+    }
+
+    //endregion
+
+    //region > messages
+
+    public List<String> getMessages() {
+        return copyAndClear(messages);
+    }
+
+    public void addMessage(final String message) {
+        messages.add(message);
+    }
+
+    //endregion
+
+    //region > warnings
+
+    public List<String> getWarnings() {
+        return copyAndClear(warnings);
+    }
+
+    public void addWarning(final String message) {
+        warnings.add(message);
+    }
+
+    //endregion
+
+    //region > debugging
+
+    @Override
+    public void debugData(final DebugBuilder debug) {
+        debugArray(debug, "Messages", messages);
+        debugArray(debug, "Warnings", messages);
+    }
+
+    private void debugArray(final DebugBuilder debug, final String title, final List<String> vector) {
+        debug.appendln(title);
+        debug.indent();
+        if (vector.size() == 0) {
+            debug.appendln("none");
+        } else {
+            for (final String text : vector) {
+                debug.appendln(text);
+            }
+        }
+        debug.unindent();
+    }
 
-    void addMessage(String message);
-    List<String> getMessages();
-    String getMessagesCombined();
+    @Override
+    public String debugTitle() {
+        return "Simple Message Broker";
+    }
 
-    void addWarning(String message);
-    List<String> getWarnings();
-    String getWarningsCombined();
+    //endregion
 
+    //region > helpers
 
-    void setApplicationError(String message);
-    String getApplicationError();
+    private List<String> copyAndClear(final List<String> messages) {
+        final List<String> copy = Collections.unmodifiableList(new ArrayList<>(messages));
+        messages.clear();
+        return copy;
+    }
+    //endregion
 
-    void ensureEmpty();
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/e48ab59c/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java
index 782e18b..bc0d459 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java
@@ -27,6 +27,7 @@ import org.apache.isis.applib.services.bookmark.Bookmark;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider;
 import org.apache.isis.core.commons.authentication.AuthenticationSessionProviderAbstract;
+import org.apache.isis.core.commons.authentication.MessageBroker;
 import org.apache.isis.core.metamodel.adapter.*;
 import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
 import org.apache.isis.core.metamodel.adapter.mgr.AdapterManagerAware;
@@ -50,7 +51,6 @@ import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.core.runtime.system.session.IsisSession;
 import org.apache.isis.core.runtime.system.transaction.IsisTransaction;
 import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
-import org.apache.isis.core.runtime.system.transaction.MessageBroker;
 
 /**
  * Provides services to the metamodel based on the currently running

http://git-wip-us.apache.org/repos/asf/isis/blob/e48ab59c/core/runtime/src/main/java/org/apache/isis/core/runtime/system/context/IsisContext.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/context/IsisContext.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/context/IsisContext.java
index f145f89..6c5652f 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/context/IsisContext.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/context/IsisContext.java
@@ -24,6 +24,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.isis.applib.profiles.Localization;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.authentication.MessageBroker;
 import org.apache.isis.core.commons.components.TransactionScopedComponent;
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.commons.config.IsisConfigurationException;
@@ -41,7 +42,6 @@ import org.apache.isis.core.runtime.system.session.IsisSession;
 import org.apache.isis.core.runtime.system.session.IsisSessionFactory;
 import org.apache.isis.core.runtime.system.transaction.IsisTransaction;
 import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
-import org.apache.isis.core.runtime.system.transaction.MessageBroker;
 
 /**
  * Provides singleton <i>access to</i> the current (session scoped)
@@ -460,11 +460,11 @@ public abstract class IsisContext implements DebuggableWithTitle {
     }
 
     /**
-     * Convenience method, returning the {@link MessageBroker} of the
+     * Convenience method, returning the {@link org.apache.isis.core.commons.authentication.MessageBroker} of the
      * {@link #getCurrentTransaction() current transaction}.
      */
     public static MessageBroker getMessageBroker() {
-        return (MessageBroker) getCurrentTransaction().getMessageBroker();
+        return getCurrentTransaction().getMessageBroker();
     }
 
     // ///////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/isis/blob/e48ab59c/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
index 259269c..b2536ba 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
@@ -48,6 +48,7 @@ import org.apache.isis.applib.services.command.spi.CommandService;
 import org.apache.isis.applib.services.eventbus.ActionInteractionEvent;
 import org.apache.isis.applib.services.publish.*;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.authentication.MessageBroker;
 import org.apache.isis.core.commons.components.TransactionScopedComponent;
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.commons.ensure.Ensure;
@@ -203,7 +204,7 @@ public class IsisTransaction implements TransactionScopedComponent {
     private final TransactionalResource objectStore;
     private final List<PersistenceCommand> commands = Lists.newArrayList();
     private final IsisTransactionManager transactionManager;
-    private final org.apache.isis.core.commons.authentication.MessageBroker messageBroker;
+    private final MessageBroker messageBroker;
 
     private final ServicesInjector servicesInjector;
 
@@ -238,7 +239,7 @@ public class IsisTransaction implements TransactionScopedComponent {
 
     public IsisTransaction(
             final IsisTransactionManager transactionManager,
-            final org.apache.isis.core.commons.authentication.MessageBroker messageBroker,
+            final MessageBroker messageBroker,
             final TransactionalResource objectStore,
             final ServicesInjector servicesInjector) {
         
@@ -1031,16 +1032,15 @@ public class IsisTransaction implements TransactionScopedComponent {
     }
 
     /**
-     * The {@link MessageBroker} for this transaction.
+     * The {@link org.apache.isis.core.commons.authentication.MessageBroker} for this transaction.
      * 
      * <p>
      * Injected in constructor
      *
      * @deprecated - obtain the {@link org.apache.isis.core.commons.authentication.MessageBroker} instead from the {@link AuthenticationSession}.
      */
-    @Deprecated
     public MessageBroker getMessageBroker() {
-        return (MessageBroker) messageBroker;
+        return messageBroker;
     }
 
     public static class AdapterAndProperty {

http://git-wip-us.apache.org/repos/asf/isis/blob/e48ab59c/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
index 8c0e523..2d89384 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
@@ -30,6 +30,7 @@ import org.apache.isis.applib.services.command.CommandContext;
 import org.apache.isis.applib.services.command.CommandDefault;
 import org.apache.isis.applib.services.command.spi.CommandService;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.authentication.MessageBroker;
 import org.apache.isis.core.commons.components.SessionScopedComponent;
 import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.commons.exceptions.IsisException;
@@ -119,10 +120,10 @@ public class IsisTransactionManager implements SessionScopedComponent {
     
 
     /**
-     * Convenience method returning the {@link MessageBroker} of the
+     * Convenience method returning the {@link org.apache.isis.core.commons.authentication.MessageBroker} of the
      * {@link #getTransaction() current transaction}.
      */
-    protected org.apache.isis.core.commons.authentication.MessageBroker getMessageBroker() {
+    protected MessageBroker getMessageBroker() {
         return getTransaction().getMessageBroker();
     }
 
@@ -219,20 +220,20 @@ public class IsisTransactionManager implements SessionScopedComponent {
      * {@link #getTransaction()}.
      */
     protected final IsisTransaction createTransaction() {
-        org.apache.isis.core.commons.authentication.MessageBroker messageBroker = createMessageBroker();
+        MessageBroker messageBroker = createMessageBroker();
         return this.transaction = createTransaction(messageBroker, transactionalResource);
     }
 
 
     /**
-     * The provided {@link MessageBroker} is
+     * The provided {@link org.apache.isis.core.commons.authentication.MessageBroker} is
      * obtained from the {@link #createMessageBroker()} hook method.
      * @param transactionalResource
      *
      * @see #createMessageBroker()
      */
     private IsisTransaction createTransaction(
-            final org.apache.isis.core.commons.authentication.MessageBroker messageBroker,
+            final MessageBroker messageBroker,
             final TransactionalResource transactionalResource) {
         ensureThatArg(messageBroker, is(not(nullValue())));
 
@@ -533,8 +534,8 @@ public class IsisTransactionManager implements SessionScopedComponent {
      * 
      * <p> Called when a new {@link IsisTransaction} is created.
      */
-    protected org.apache.isis.core.commons.authentication.MessageBroker createMessageBroker() {
-        return MessageBrokerDefault.acquire(getAuthenticationSession());
+    protected MessageBroker createMessageBroker() {
+        return MessageBroker.acquire(getAuthenticationSession());
     }
 
     // ////////////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/isis/blob/e48ab59c/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/MessageBroker.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/MessageBroker.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/MessageBroker.java
deleted file mode 100644
index 282b8f3..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/MessageBroker.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.system.transaction;
-
-/**
- * @deprecated - replace with {@link org.apache.isis.core.commons.authentication.MessageBroker} in the core.
- */
-@Deprecated
-public interface MessageBroker extends org.apache.isis.core.commons.authentication.MessageBroker {
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/e48ab59c/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/MessageBrokerDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/MessageBrokerDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/MessageBrokerDefault.java
deleted file mode 100644
index b5fbd9a..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/MessageBrokerDefault.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.system.transaction;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.debug.DebuggableWithTitle;
-import org.apache.isis.core.commons.exceptions.IsisException;
-import org.apache.isis.core.commons.lang.ArrayExtensions;
-
-public class MessageBrokerDefault implements MessageBroker, DebuggableWithTitle {
-
-    private static final long serialVersionUID = 1L;
-    
-    private final List<String> messages = Lists.newArrayList();
-    private final List<String> warnings = Lists.newArrayList();
-    private String applicationError;
-
-    public static org.apache.isis.core.commons.authentication.MessageBroker acquire(final AuthenticationSession authenticationSession) {
-        org.apache.isis.core.commons.authentication.MessageBroker messageBroker;
-        synchronized (authenticationSession) {
-            messageBroker = authenticationSession.getMessageBroker();
-            if(messageBroker == null) {
-                messageBroker = new MessageBrokerDefault();
-                authenticationSession.setMessageBroker(messageBroker);
-            }
-        }
-        return messageBroker;
-    }
-
-    /**
-     * @deprecated - use {@link #acquire()}
-     */
-    @Deprecated
-    public MessageBrokerDefault() {
-    }
-
-    // //////////////////////////////////////////////////
-    // Reset / ensureEmpty
-    // //////////////////////////////////////////////////
-
-    public void reset() {
-        warnings.clear();
-        messages.clear();
-    }
-
-    @Override
-    public void ensureEmpty() {
-        if (warnings.size() > 0) {
-            throw new IsisException("Message broker still has warnings");
-        }
-        if (messages.size() > 0) {
-            throw new IsisException("Message broker still has messages");
-        }
-    }
-
-    // //////////////////////////////////////////////////
-    // Messages
-    // //////////////////////////////////////////////////
-
-    @Override
-    public List<String> getMessages() {
-        return copyAndClear(messages);
-    }
-
-    @Override
-    public void addMessage(final String message) {
-        messages.add(message);
-    }
-
-    @Override
-    public String getMessagesCombined() {
-        final List<String> x = messages;
-        final String string = ArrayExtensions.asSemicolonDelimitedStr(x);
-        return string;
-    }
-
-    // //////////////////////////////////////////////////
-    // Warnings
-    // //////////////////////////////////////////////////
-
-    @Override
-    public List<String> getWarnings() {
-        return copyAndClear(warnings);
-    }
-
-    @Override
-    public void addWarning(final String message) {
-        warnings.add(message);
-    }
-
-    @Override
-    public String getWarningsCombined() {
-        final List<String> x = warnings;
-        final String string = ArrayExtensions.asSemicolonDelimitedStr(x);
-        return string;
-    }
-
-
-    // //////////////////////////////////////////////////
-    // Application error
-    // //////////////////////////////////////////////////
-
-    @Override
-    public void setApplicationError(String error) {
-        this.applicationError = error;
-        
-    }
-
-    @Override
-    public String getApplicationError() {
-        String error = applicationError;
-        setApplicationError(null);
-        return error;
-    }
-
-    // //////////////////////////////////////////////////
-    // Debugging
-    // //////////////////////////////////////////////////
-
-    @Override
-    public void debugData(final DebugBuilder debug) {
-        debugArray(debug, "Messages", messages);
-        debugArray(debug, "Warnings", messages);
-    }
-
-    private void debugArray(final DebugBuilder debug, final String title, final List<String> vector) {
-        debug.appendln(title);
-        debug.indent();
-        if (vector.size() == 0) {
-            debug.appendln("none");
-        } else {
-            for (final String text : vector) {
-                debug.appendln(text);
-            }
-        }
-        debug.unindent();
-    }
-
-    @Override
-    public String debugTitle() {
-        return "Simple Message Broker";
-    }
-
-    // //////////////////////////////////////////////////
-    // Helpers
-    // //////////////////////////////////////////////////
-
-    private List<String> copyAndClear(final List<String> messages) {
-        final List<String> copy = Collections.unmodifiableList(new ArrayList<String>(messages));
-        messages.clear();
-        return copy;
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/e48ab59c/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/ObjectStoreTransactionManager_EndTransactionTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/ObjectStoreTransactionManager_EndTransactionTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/ObjectStoreTransactionManager_EndTransactionTest.java
index baa6080..f9cc749 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/ObjectStoreTransactionManager_EndTransactionTest.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/ObjectStoreTransactionManager_EndTransactionTest.java
@@ -19,13 +19,7 @@
 
 package org.apache.isis.core.runtime.persistence.objectstore.transaction;
 
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
 import java.util.Collections;
-import java.util.UUID;
-
 import org.hamcrest.Description;
 import org.hamcrest.Matcher;
 import org.hamcrest.TypeSafeMatcher;
@@ -35,7 +29,6 @@ import org.jmock.auto.Mock;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
-
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.authentication.MessageBroker;
 import org.apache.isis.core.metamodel.services.ServicesInjectorDefault;
@@ -44,6 +37,10 @@ import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
 import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
 import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
 
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
 public class ObjectStoreTransactionManager_EndTransactionTest {
 
     @Rule

http://git-wip-us.apache.org/repos/asf/isis/blob/e48ab59c/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/ObjectStoreTransactionManager_StartTransactionTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/ObjectStoreTransactionManager_StartTransactionTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/ObjectStoreTransactionManager_StartTransactionTest.java
index 091c643..14f67e9 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/ObjectStoreTransactionManager_StartTransactionTest.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/ObjectStoreTransactionManager_StartTransactionTest.java
@@ -19,18 +19,11 @@
 
 package org.apache.isis.core.runtime.persistence.objectstore.transaction;
 
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.CoreMatchers.sameInstance;
-import static org.junit.Assert.assertThat;
-
 import org.jmock.Expectations;
 import org.jmock.auto.Mock;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
-
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.authentication.MessageBroker;
 import org.apache.isis.core.metamodel.services.ServicesInjectorDefault;
@@ -40,6 +33,9 @@ import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
 import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
 import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
 
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.assertThat;
+
 public class ObjectStoreTransactionManager_StartTransactionTest {
 
     @Rule

http://git-wip-us.apache.org/repos/asf/isis/blob/e48ab59c/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java
index 9f4c2c8..ed7c66a 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java
@@ -34,6 +34,7 @@ import org.apache.isis.applib.services.command.spi.CommandService;
 import org.apache.isis.applib.services.publish.EventSerializer;
 import org.apache.isis.applib.services.publish.PublishingService;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.authentication.MessageBroker;
 import org.apache.isis.core.commons.matchers.IsisMatchers;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;


[44/44] isis git commit: ISIS-537: fixes for standalone collections; minor layout improvements

Posted by da...@apache.org.
ISIS-537: fixes for standalone collections; minor layout improvements

- NPE when switch back to standalone collection (table view) after alternate view (excel)
- after switch view of one collection, the "other" collections were no longer showing the correct view (lost their state)
- remove bottom border for tables
- render bulk actions to left, not right.
- change powered by to use TM rather than (R).
- remove debug message left over


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/8b7267e6
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/8b7267e6
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/8b7267e6

Branch: refs/heads/master
Commit: 8b7267e60e4f84ce627220c4c0e88dbf25c5bcfd
Parents: 62d77af
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Tue Nov 11 08:11:44 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Tue Nov 11 08:11:44 2014 +0000

----------------------------------------------------------------------
 .../CollectionContentsAsAjaxTablePanel.css      | 13 ++++++
 .../CollectionContentsAsAjaxTablePanel.java     |  6 ---
 .../CollectionContentsMultipleViewsPanel.java   | 43 +++++++++++---------
 .../components/scalars/ScalarPanelAbstract.java | 11 ++---
 .../StandaloneCollectionPanel.html              |  8 ++--
 .../StandaloneCollectionPanel.java              |  6 ++-
 .../viewer/wicket/ui/pages/PageAbstract.html    |  2 +-
 .../wicket/ui/pages/bootstrap-overrides.css     | 11 ++++-
 8 files changed, 59 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/8b7267e6/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.css
index 6f04938..66587b7 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.css
@@ -139,3 +139,16 @@
 .collectionContentsAsAjaxTablePanel .table-responsive {
 	overflow-x: auto;
 }
+
+.collectionContentsAsAjaxTablePanel table tbody tr:last-child td {
+    border-bottom: none;
+}
+
+.collectionContentsAsAjaxTablePanel table tfoot tr:first-child td {
+    border-top: none;
+    border-bottom: none;
+}
+
+.collectionContentsAsAjaxTablePanel .table {
+    margin-bottom: 0px;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/8b7267e6/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
index 6158ba3..44669cd 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
@@ -45,7 +45,6 @@ import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
 import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings;
 import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
 import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
-import org.apache.isis.viewer.wicket.ui.components.collection.bulk.BulkActionsHelper;
 import org.apache.isis.viewer.wicket.ui.components.collection.bulk.BulkActionsProvider;
 import org.apache.isis.viewer.wicket.ui.components.collection.count.CollectionCountProvider;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ColumnAbstract;
@@ -64,17 +63,12 @@ public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityColl
     private static final long serialVersionUID = 1L;
 
     private static final String ID_TABLE = "table";
-    private static final String ID_ACTION_PROMPT_MODAL_WINDOW = "actionPromptModalWindow";
-    private static final String ID_ENTITY_ACTIONS = "entityActions";
 
     private IsisAjaxFallbackDataTable<ObjectAdapter,String> dataTable;
 
-    private final BulkActionsHelper bulkActionsHelper;
-
 
     public CollectionContentsAsAjaxTablePanel(final String id, final EntityCollectionModel model) {
         super(id, model);
-        bulkActionsHelper = new BulkActionsHelper(model);
     }
     
     @Override

http://git-wip-us.apache.org/repos/asf/isis/blob/8b7267e6/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java
index 0a7019e..9e60554 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java
@@ -33,8 +33,8 @@ import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
 import org.apache.isis.viewer.wicket.ui.ComponentFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentType;
 import org.apache.isis.viewer.wicket.ui.components.collection.count.CollectionCountProvider;
-import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorPanel;
 import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorHelper;
+import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorPanel;
 import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorProvider;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
 import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
@@ -163,31 +163,34 @@ public class CollectionContentsMultipleViewsPanel
                 if(view >= 0 && view < componentFactories.size()) {
                     underlyingViewNum = view;
                 }
-            } catch(NumberFormatException ex) {
-                // ignore
-            }
-        }
 
-        final EntityCollectionModel dummyModel = getModel().asDummy();
-        for(int i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
-            final Component component = underlyingViews[i];
-            if(component == null) {
-                continue;
-            }
-            final boolean isSelected = i == underlyingViewNum;
-            applyCssVisibility(component, isSelected);
-            component.setDefaultModel(isSelected? getModel(): dummyModel);
-        }
 
-        this.selectedComponentFactory = ignoreFactory;
-        this.selectedComponent = underlyingViews[underlyingViewNum];
+                final EntityCollectionModel dummyModel = getModel().asDummy();
+                for(int i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
+                    final Component component = underlyingViews[i];
+                    if(component == null) {
+                        continue;
+                    }
+                    final boolean isSelected = i == underlyingViewNum;
+                    applyCssVisibility(component, isSelected);
+                    component.setDefaultModel(isSelected? getModel(): dummyModel);
+                }
+
+                this.selectedComponentFactory = ignoreFactory;
+                this.selectedComponent = underlyingViews[underlyingViewNum];
 
 
-        final AjaxRequestTarget target = uiHintEvent.getTarget();
-        if(target != null) {
-            target.add(this, selectorDropdownPanel);
+                final AjaxRequestTarget target = uiHintEvent.getTarget();
+                if(target != null) {
+                    target.add(this, selectorDropdownPanel);
+                }
+
+            } catch(NumberFormatException ex) {
+                // ignore
+            }
         }
 
+
     }
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/8b7267e6/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.java
index b67814a..6f6e6fe 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.java
@@ -22,10 +22,7 @@ package org.apache.isis.viewer.wicket.ui.components.scalars;
 import de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationPanel;
 
 import java.util.List;
-
 import com.google.common.collect.Lists;
-
-import org.apache.wicket.AttributeModifier;
 import org.apache.wicket.Component;
 import org.apache.wicket.MarkupContainer;
 import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -38,7 +35,6 @@ import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.form.LabeledWebMarkupContainer;
 import org.apache.wicket.markup.html.panel.Fragment;
 import org.apache.wicket.model.Model;
-
 import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
@@ -47,8 +43,10 @@ import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
 import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
-import org.apache.isis.viewer.wicket.model.models.*;
+import org.apache.isis.viewer.wicket.model.models.ActionPromptProvider;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
 import org.apache.isis.viewer.wicket.model.models.EntityModel.RenderingHint;
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
 import org.apache.isis.viewer.wicket.ui.components.additionallinks.AdditionalLinksPanel;
 import org.apache.isis.viewer.wicket.ui.components.additionallinks.EntityActionUtil;
 import org.apache.isis.viewer.wicket.ui.components.scalars.TextFieldValueModel.ScalarModelProvider;
@@ -348,9 +346,6 @@ public abstract class ScalarPanelAbstract extends PanelAbstract<ScalarModel> imp
 
         final LabelAtFacet facet = getModel().getFacet(LabelAtFacet.class);
 
-        // TODO mgrigorov: Remove this. It is for debugging
-        scalarName.add(new AttributeModifier("title", "labelAt=" + (facet != null? facet.value(): "(null)")));
-
         if (facet != null) {
             switch (facet.value()) {
                 case LEFT:

http://git-wip-us.apache.org/repos/asf/isis/blob/8b7267e6/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
index f5f7f94..a86f6cc 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
@@ -30,11 +30,11 @@
                 <div class="iconAndTitle panel-heading actionPanelHeaderNew">
                     <span wicket:id="actionName" class="actionName panel-title">[action name]</span>
 
-                    <div class="pull-right">
+                    <div class="btn-group">
+                        <div wicket:id="additionalLinks"></div>
+                    </div>
 
-                        <div class="btn-group">
-                            <div wicket:id="additionalLinks"></div>
-                        </div>
+                    <div class="pull-right">
                         <div class="btn-group">
                             <span wicket:id="selectorDropdown"/>
                         </div>

http://git-wip-us.apache.org/repos/asf/isis/blob/8b7267e6/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
index c1206ff..c1b333d 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
@@ -65,6 +65,7 @@ public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionMod
     private final ActionPromptModalWindow actionPromptModalWindow;
     private final CollectionSelectorPanel selectorDropdownPanel;
     private final BulkActionsHelper bulkActionsHelper;
+    private AdditionalLinksPanel additionalLinks;
 
     /**
      * note that the bulk actions components are added in {@link #configureBulkActions(org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ObjectAdapterToggleboxColumn)}.
@@ -152,6 +153,9 @@ public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionMod
     @Override
     public void configureBulkActions(final ObjectAdapterToggleboxColumn toggleboxColumn) {
 
+        if(additionalLinks != null) {
+            return;
+        }
         final BulkActionsLinkFactory linkFactory =
                 new BulkActionsLinkFactory(getModel(), toggleboxColumn);
 
@@ -164,7 +168,7 @@ public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionMod
             }
         });
 
-        AdditionalLinksPanel additionalLinks = new AdditionalLinksPanel(ID_ADDITIONAL_LINKS, links);
+        additionalLinks = new AdditionalLinksPanel(ID_ADDITIONAL_LINKS, links);
         addOrReplace(additionalLinks);
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/8b7267e6/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.html
index b6a0c3b..90c2175 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.html
@@ -94,7 +94,7 @@
                             </ul>
                             <ul class="nav navbar-nav navbar-right">
                                 <p class="navbar-text powered-by">Powered by:</p>
-                                <li><a href="http://isis.apache.org" target="_blank">Apache Isis &#174;</a></li>
+                                <li><a href="http://isis.apache.org" target="_blank">Apache Isis &#8482;</a></li>
                                 <li><a wicket:id="aboutLink" class="navbar-right">About</a></li>
                                 <li wicket:id="themePicker"></li>
                             </ul>

http://git-wip-us.apache.org/repos/asf/isis/blob/8b7267e6/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
index 5a65da7..51c53d3 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
@@ -89,7 +89,7 @@ div.label-left.form-group {
 div.label-left label.control-label {
     width: 30%;
     float: left;
-    padding-top: 7px;
+    padding-top: 2px;
     padding-left: 10px;
     text-align: start;
 }
@@ -163,3 +163,12 @@ div.label-left .choicesPlaceholder {
 .standaloneCollectionPanel .panel-heading {
     padding-bottom: 15px;
 }
+
+.standaloneCollectionPanel .additionalLinkList {
+    margin-left: 50px;
+}
+
+.referencePanel .entityLinkSelect2Panel .entityImage {
+    width: 20px;
+    height: 20px;
+}


[41/44] isis git commit: ISIS-537: updating simpleapp and todoapp datePickerPatterns to moment.js (from jQueryUI.js)

Posted by da...@apache.org.
ISIS-537: updating simpleapp and todoapp datePickerPatterns to moment.js (from jQueryUI.js)


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/da6d6cc2
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/da6d6cc2
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/da6d6cc2

Branch: refs/heads/master
Commit: da6d6cc2887119428ea0f7c23ef9c7310a4eaec6
Parents: 9726a17
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Nov 10 22:13:23 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 22:13:23 2014 +0000

----------------------------------------------------------------------
 .../webapp/src/main/webapp/WEB-INF/viewer_wicket.properties        | 2 +-
 .../webapp/src/main/webapp/WEB-INF/viewer_wicket.properties        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/da6d6cc2/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties
index 06d675e..79ddf66 100644
--- a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties
+++ b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties
@@ -38,7 +38,7 @@ isis.viewer.wicket.maxTitleLengthInParentedTables=0
 
 #isis.viewer.wicket.datePattern=dd/MM/yy
 #isis.viewer.wicket.dateTimePattern=dd/MM/yy HH:mm
-#isis.viewer.wicket.datePickerPattern=dd/mm/y
+#isis.viewer.wicket.datePickerPattern=DD/MM/YY
 
 
 #

http://git-wip-us.apache.org/repos/asf/isis/blob/da6d6cc2/example/application/todoapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties
----------------------------------------------------------------------
diff --git a/example/application/todoapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties b/example/application/todoapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties
index fcdf306..ea62094 100644
--- a/example/application/todoapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties
+++ b/example/application/todoapp/webapp/src/main/webapp/WEB-INF/viewer_wicket.properties
@@ -38,7 +38,7 @@ isis.viewer.wicket.maxTitleLengthInParentedTables=0
 
 #isis.viewer.wicket.datePattern=dd/MM/yy
 #isis.viewer.wicket.dateTimePattern=dd/MM/yy HH:mm
-#isis.viewer.wicket.datePickerPattern=dd/mm/y
+#isis.viewer.wicket.datePickerPattern=DD/MM/YY
 
 
 


[06/44] isis git commit: ISIS-939: deleted AdapterLifecycleTransitioner interface (performed no function).

Posted by da...@apache.org.
ISIS-939: deleted AdapterLifecycleTransitioner interface (performed no function).

Also: deleted unused/undocumented IsisServices service.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/bea5a027
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/bea5a027
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/bea5a027

Branch: refs/heads/master
Commit: bea5a027db888c5578e7debea601c773094f6fe2
Parents: e48ab59
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Nov 3 20:16:07 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Nov 6 16:18:59 2014 +0000

----------------------------------------------------------------------
 .../core/metamodel/adapter/ObjectAdapter.java   |  1 -
 .../adaptermanager/AdapterManagerDefault.java   |  3 --
 .../runtime/services/isis/IsisServices.java     | 39 --------------
 .../AdapterLifecycleTransitioner.java           | 56 --------------------
 .../system/persistence/PersistenceSession.java  |  4 +-
 5 files changed, 1 insertion(+), 102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/bea5a027/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ObjectAdapter.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ObjectAdapter.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ObjectAdapter.java
index 4b7b16f..6dc619a 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ObjectAdapter.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ObjectAdapter.java
@@ -98,7 +98,6 @@ public interface ObjectAdapter extends Instance, org.apache.isis.applib.annotati
      * only <tt>PojoAdapterX</tt> provides support for this; the regular
      * <tt>PojoAdapter</tt> does not currently.
      * 
-     * @param adapter
      * @return
      */
     Instance getInstance(Specification specification);

http://git-wip-us.apache.org/repos/asf/isis/blob/bea5a027/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
index 8de9088..6f180d7 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
@@ -55,7 +55,6 @@ import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
 import org.apache.isis.core.runtime.persistence.PojoRecreationException;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.AdapterLifecycleTransitioner;
 import org.apache.isis.core.runtime.system.persistence.OidGenerator;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.core.runtime.system.persistence.RecreatedPojoRemapper;
@@ -79,7 +78,6 @@ import static org.hamcrest.CoreMatchers.*;
  */
 public class AdapterManagerDefault implements AdapterManager, Iterable<ObjectAdapter>,
         RecreatedPojoRemapper,
-        AdapterLifecycleTransitioner,
         SessionScopedComponent,
         DebuggableWithTitle,
         Resettable {
@@ -464,7 +462,6 @@ public class AdapterManagerDefault implements AdapterManager, Iterable<ObjectAda
      * 
      * @param hintRootOid - allow a different persistent root oid to be provided.
      */
-    @Override
     public void remapAsPersistent(final ObjectAdapter adapter, RootOid hintRootOid) {
         
         final ObjectAdapter rootAdapter = adapter.getAggregateRoot();  // REVIEW: think this is redundant; would seem this method is only ever called for roots anyway.

http://git-wip-us.apache.org/repos/asf/isis/blob/bea5a027/core/runtime/src/main/java/org/apache/isis/core/runtime/services/isis/IsisServices.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/isis/IsisServices.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/isis/IsisServices.java
deleted file mode 100644
index 07cbab8..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/isis/IsisServices.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.isis.core.runtime.services.isis;
-
-import org.apache.isis.applib.AbstractService;
-import org.apache.isis.applib.annotation.ActionSemantics;
-import org.apache.isis.applib.annotation.ActionSemantics.Of;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-
-/**
- * A domain service providing access into the Isis runtime itself.
- * 
- * <p>
- * Intended only for use while prototyping.
- */
-public class IsisServices extends AbstractService {
-
-    @ActionSemantics(Of.IDEMPOTENT)
-    public void resetMetaModel() {
-        IsisContext.getSpecificationLoader().shutdown();
-        IsisContext.getSpecificationLoader().init();
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/bea5a027/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/AdapterLifecycleTransitioner.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/AdapterLifecycleTransitioner.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/AdapterLifecycleTransitioner.java
deleted file mode 100644
index d76bfd5..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/AdapterLifecycleTransitioner.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.system.persistence;
-
-import org.apache.isis.applib.annotation.Aggregated;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.adapter.oid.RootOid;
-import org.apache.isis.core.runtime.persistence.objectstore.algorithm.PersistAlgorithm;
-
-public interface AdapterLifecycleTransitioner {
-
-    /**
-     * Remaps the {@link ObjectAdapter adapter} and any associated 
-     * (collection) adapters (ie, those that wrap the List/Set instances).
-     * 
-     * <p>
-     * Note that it isn't necessary to remap any aggregated adapters (as per
-     * {@link Aggregated} annotation; the {@link PersistAlgorithm} calls this
-     * method and takes responsibility for locating the graph of transient
-     * objects that needs to be remapped.
-     * 
-     * <p>
-     * As a consequence of this call, the adapter's {@link Oid} will be
-     * {@link ObjectAdapter#replaceOid(Oid) replaced} (Oids are now immutable).
-     * The same is true of the associated collection adapters.
-     * 
-     * @param hintRootOid - primarily for testing purposes, to set the adapter with a specific rootOid.  Is passed through to the {@link OidGenerator}.
-     */
-    void remapAsPersistent(ObjectAdapter adapter, RootOid hintRootOid);
-
-    /**
-     * Removes the specified {@link ObjectAdapter adapter} from the identity
-     * maps.
-     */
-    void removeAdapter(ObjectAdapter adapter);
-
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/bea5a027/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
index 59887c0..af1619f 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
@@ -71,7 +71,7 @@ import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
 import static org.apache.isis.core.commons.ensure.Ensure.ensureThatState;
 import static org.hamcrest.CoreMatchers.*;
 
-public class PersistenceSession implements Persistor, EnlistedObjectDirtying, ToPersistObjectSet, RecreatedPojoRemapper, AdapterLifecycleTransitioner, SessionScopedComponent, DebuggableWithTitle {
+public class PersistenceSession implements Persistor, EnlistedObjectDirtying, ToPersistObjectSet, RecreatedPojoRemapper, SessionScopedComponent, DebuggableWithTitle {
 
     private static final Logger LOG = LoggerFactory.getLogger(PersistenceSession.class);
 
@@ -918,12 +918,10 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
     // AdapterLifecycleTransitioner
     // ///////////////////////////////////////////////////////////////////////////
 
-    @Override
     public void remapAsPersistent(ObjectAdapter adapter, RootOid hintRootOid) {
         adapterManager.remapAsPersistent(adapter, hintRootOid);
     }
 
-    @Override
     public void removeAdapter(ObjectAdapter adapter) {
         adapterManager.removeAdapter(adapter);
     }


[15/44] isis git commit: ISIS-537 Use NotificationPanel instead of FeedbackPanel

Posted by da...@apache.org.
ISIS-537 Use NotificationPanel instead of FeedbackPanel

https://trello.com/c/OB0ja10z/111-replace-all-usages-of-feedbackpanel-in-the-addons-with-notificationpanel-for-consistency-with-isis


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/8c0a5acd
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/8c0a5acd
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/8c0a5acd

Branch: refs/heads/master
Commit: 8c0a5acda672b9f617a2542266c443f18704adb3
Parents: 8a2c825
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Fri Nov 7 13:29:14 2014 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Fri Nov 7 13:29:14 2014 +0200

----------------------------------------------------------------------
 .../ui/components/entity/properties/EntityPropertiesForm.java   | 3 +--
 .../ui/components/widgets/formcomponent/FormFeedbackPanel.java  | 5 ++---
 2 files changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/8c0a5acd/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/properties/EntityPropertiesForm.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/properties/EntityPropertiesForm.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/properties/EntityPropertiesForm.java
index 6dc5cd6..7fa2f99 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/properties/EntityPropertiesForm.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/properties/EntityPropertiesForm.java
@@ -36,7 +36,6 @@ import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.form.Button;
 import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.markup.html.form.FormComponent;
-import org.apache.wicket.markup.html.panel.FeedbackPanel;
 import org.apache.wicket.markup.repeater.RepeatingView;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.ResourceModel;
@@ -107,7 +106,7 @@ public class EntityPropertiesForm extends FormAbstract<ObjectAdapter> {
     private Button okButton;
     private Button cancelButton;
 
-    private FeedbackPanel feedback;
+    private NotificationPanel feedback;
     
     private boolean renderedFirstField;
 

http://git-wip-us.apache.org/repos/asf/isis/blob/8c0a5acd/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormFeedbackPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormFeedbackPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormFeedbackPanel.java
index d673f24..d3ff54a 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormFeedbackPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormFeedbackPanel.java
@@ -24,12 +24,11 @@ import de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationPanel
 import org.apache.wicket.feedback.FeedbackMessage;
 import org.apache.wicket.feedback.IFeedbackMessageFilter;
 import org.apache.wicket.markup.html.form.FormComponent;
-import org.apache.wicket.markup.html.panel.FeedbackPanel;
 
 /**
- * {@link FeedbackPanel} designed for forms; filters out any
+ * {@link NotificationPanel} designed for forms; filters out any
  * {@link FeedbackMessage}s from {@link FormComponent}s (the idea being that
- * they will have their own {@link FeedbackPanel}s.
+ * they will have their own {@link NotificationPanel}s.
  */
 public class FormFeedbackPanel extends NotificationPanel {
     private static final long serialVersionUID = 1L;


[07/44] isis git commit: ISIS-939: simplifying PersistenceSession

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
index af1619f..8d4c1cb 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
@@ -18,7 +18,6 @@
  */
 package org.apache.isis.core.runtime.system.persistence;
 
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import com.google.common.collect.Lists;
@@ -26,8 +25,6 @@ import com.google.common.collect.Maps;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.isis.applib.query.Query;
-import org.apache.isis.applib.query.QueryDefault;
-import org.apache.isis.applib.query.QueryFindAllInstances;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.components.ApplicationScopedComponent;
 import org.apache.isis.core.commons.components.SessionScopedComponent;
@@ -48,10 +45,7 @@ import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacet;
 import org.apache.isis.core.metamodel.services.ServiceUtil;
 import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
 import org.apache.isis.core.metamodel.services.container.query.QueryCardinality;
-import org.apache.isis.core.metamodel.services.container.query.QueryFindByPattern;
-import org.apache.isis.core.metamodel.services.container.query.QueryFindByTitle;
 import org.apache.isis.core.metamodel.spec.*;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.runtime.persistence.FixturesInstalledFlag;
 import org.apache.isis.core.runtime.persistence.NotPersistableException;
 import org.apache.isis.core.runtime.persistence.adapter.PojoAdapterFactory;
@@ -59,19 +53,19 @@ import org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDef
 import org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorUnified;
 import org.apache.isis.core.runtime.persistence.objectstore.algorithm.PersistAlgorithm;
 import org.apache.isis.core.runtime.persistence.objectstore.algorithm.PersistAlgorithmUnified;
-import org.apache.isis.core.runtime.persistence.objectstore.algorithm.ToPersistObjectSet;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.CreateObjectCommand;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.DestroyObjectCommand;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.SaveObjectCommand;
-import org.apache.isis.core.runtime.persistence.query.*;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.transaction.*;
+import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
+import org.apache.isis.core.runtime.system.transaction.TransactionalClosureAbstract;
+import org.apache.isis.core.runtime.system.transaction.TransactionalClosureWithReturnAbstract;
 
 import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
 import static org.apache.isis.core.commons.ensure.Ensure.ensureThatState;
 import static org.hamcrest.CoreMatchers.*;
 
-public class PersistenceSession implements Persistor, EnlistedObjectDirtying, ToPersistObjectSet, RecreatedPojoRemapper, SessionScopedComponent, DebuggableWithTitle {
+public class PersistenceSession implements SessionScopedComponent, DebuggableWithTitle {
 
     private static final Logger LOG = LoggerFactory.getLogger(PersistenceSession.class);
 
@@ -87,13 +81,14 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
     private final ObjectStore objectStore;
     private final Map<ObjectSpecId, RootOid> servicesByObjectType = Maps.newHashMap();
 
-    private boolean dirtiableSupport;
+    private final PersistenceQueryFactory persistenceQueryFactory;
 
-    /**
-     * Injected using setter-based injection.
-     */
     private IsisTransactionManager transactionManager;
 
+    private boolean dirtiableSupport = true;
+
+
+
     private static enum State {
         NOT_INITIALIZED, OPEN, CLOSED
     }
@@ -124,6 +119,10 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
         this.oidGenerator = new OidGenerator(new IdentifierGeneratorUnified(configuration));
         this.adapterManager = new AdapterManagerDefault(new PojoRecreatorUnified(configuration));
         this.persistAlgorithm = new PersistAlgorithmUnified(configuration);
+        this.objectStore = objectStore;
+
+        this.persistenceQueryFactory = new PersistenceQueryFactory(getSpecificationLoader(), adapterManager);
+        this.transactionManager = new IsisTransactionManager(this, objectStore, servicesInjector);
 
         setState(State.NOT_INITIALIZED);
 
@@ -131,7 +130,6 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
             LOG.debug("creating " + this);
         }
 
-        this.objectStore = objectStore;
     }
 
     // ///////////////////////////////////////////////////////////////////////////
@@ -208,7 +206,7 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
             ObjectAdapter serviceAdapter = 
                     existingOid == null
                             ? getAdapterManager().adapterFor(service) 
-                            : mapRecreatedPojo(existingOid, service);
+                            : getAdapterManager().mapRecreatedPojo(existingOid, service);
             if (serviceAdapter.getOid().isTransient()) {
                 adapterManager.remapAsPersistent(serviceAdapter, null);
             }
@@ -287,7 +285,27 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
     // Factory
     // ///////////////////////////////////////////////////////////////////////////
 
-    @Override
+    /**
+     * Create a root or standalone {@link ObjectAdapter adapter}.
+     *
+     * <p>
+     * Creates a new instance of the specified type and returns it in an adapter
+     * whose resolved state set to {@link ResolveState#TRANSIENT} (except if the
+     * type is marked as {@link ObjectSpecification#isValueOrIsParented()
+     * aggregated} in which case it will be set to {@link ResolveState#VALUE}).
+     *
+     * <p>
+     * The returned object will be initialised (had the relevant callback
+     * lifecycle methods invoked).
+     *
+     * <p>
+     * While creating the object it will be initialised with default values and
+     * its created lifecycle method (its logical constructor) will be invoked.
+     *
+     * <p>
+     * This method is ultimately delegated to by the
+     * {@link org.apache.isis.applib.DomainObjectContainer}.
+     */
     public ObjectAdapter createTransientInstance(final ObjectSpecification objectSpec) {
         if (LOG.isDebugEnabled()) {
             LOG.debug("creating transient instance of " + objectSpec);
@@ -308,7 +326,20 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
         return objectSpec.initialize(adapter);
     }
 
-    @Override
+    /**
+     * Creates a new instance of the specified type and returns an adapter with
+     * an aggregated OID that show that this new object belongs to the specified
+     * parent. The new object's resolved state is set to
+     * {@link ResolveState#RESOLVED} as it state is part of it parent.
+     *
+     * <p>
+     * While creating the object it will be initialised with default values and
+     * its created lifecycle method (its logical constructor) will be invoked.
+     *
+     * <p>
+     * This method is ultimately delegated to by the
+     * {@link org.apache.isis.applib.DomainObjectContainer}.
+     */
     public ObjectAdapter createAggregatedInstance(final ObjectSpecification objectSpec, final ObjectAdapter parentAdapter) {
         if (LOG.isDebugEnabled()) {
             LOG.debug("creating aggregated instance of " + objectSpec);
@@ -328,7 +359,16 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
     // findInstances, getInstances
     // ///////////////////////////////////////////////////////////////////////////
 
-    @Override
+    /**
+     * Finds and returns instances that match the specified query.
+     *
+     * <p>
+     * The {@link QueryCardinality} determines whether all instances or just the
+     * first matching instance is returned.
+     *
+     * @throws org.apache.isis.core.runtime.persistence.UnsupportedFindException
+     *             if the criteria is not support by this persistor
+     */
     public <T> ObjectAdapter findInstances(final Query<T> query, final QueryCardinality cardinality) {
         final PersistenceQuery persistenceQuery = createPersistenceQueryFor(query, cardinality);
         if (persistenceQuery == null) {
@@ -337,7 +377,19 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
         return findInstances(persistenceQuery);
     }
 
-    @Override
+    /**
+     * Finds and returns instances that match the specified
+     * {@link PersistenceQuery}.
+     *
+     * <p>
+     * Compared to {@link #findInstances(Query, QueryCardinality)}, not that
+     * there is no {@link QueryCardinality} parameter. That's because
+     * {@link PersistenceQuery} intrinsically carry the knowledge as to how many
+     * rows they return.
+     *
+     * @throws org.apache.isis.core.runtime.persistence.UnsupportedFindException
+     *             if the criteria is not support by this persistor
+     */
     public ObjectAdapter findInstances(final PersistenceQuery persistenceQuery) {
         final List<ObjectAdapter> instances = getInstances(persistenceQuery);
         final ObjectSpecification specification = persistenceQuery.getSpecification();
@@ -350,53 +402,9 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
      * {@link PersistenceQuery NOF-internal representation}.
      */
     protected final PersistenceQuery createPersistenceQueryFor(final Query<?> query, final QueryCardinality cardinality) {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("createPersistenceQueryFor: " + query.getDescription());
-        }
-        final ObjectSpecification noSpec = specFor(query);
-        if (query instanceof QueryFindAllInstances) {
-            final QueryFindAllInstances<?> queryFindAllInstances = (QueryFindAllInstances<?>) query;
-            return new PersistenceQueryFindAllInstances(noSpec, queryFindAllInstances.getStart(), queryFindAllInstances.getCount());
-        }
-        if (query instanceof QueryFindByTitle) {
-            final QueryFindByTitle<?> queryByTitle = (QueryFindByTitle<?>) query;
-            final String title = queryByTitle.getTitle();
-            return new PersistenceQueryFindByTitle(noSpec, title, queryByTitle.getStart(), queryByTitle.getCount());
-        }
-        if (query instanceof QueryFindByPattern) {
-            final QueryFindByPattern<?> queryByPattern = (QueryFindByPattern<?>) query;
-            final Object pattern = queryByPattern.getPattern();
-            final ObjectAdapter patternAdapter = getAdapterManager().adapterFor(pattern);
-            return new PersistenceQueryFindByPattern(noSpec, patternAdapter, queryByPattern.getStart(), queryByPattern.getCount());
-        }
-        if (query instanceof QueryDefault) {
-            final QueryDefault<?> queryDefault = (QueryDefault<?>) query;
-            final String queryName = queryDefault.getQueryName();
-            final Map<String, ObjectAdapter> argumentsAdaptersByParameterName = wrap(queryDefault.getArgumentsByParameterName());
-            return new PersistenceQueryFindUsingApplibQueryDefault(noSpec, queryName, argumentsAdaptersByParameterName, cardinality, queryDefault.getStart(), queryDefault.getCount());
-        }
-        // fallback; generic serializable applib query.
-        return new PersistenceQueryFindUsingApplibQuerySerializable(noSpec, query, cardinality);
+        return persistenceQueryFactory.createPersistenceQueryFor(query, cardinality);
     }
 
-    private ObjectSpecification specFor(final Query<?> query) {
-        return getSpecificationLoader().loadSpecification(query.getResultType());
-    }
-
-    /**
-     * Converts a map of pojos keyed by string to a map of adapters keyed by the
-     * same strings.
-     */
-    private Map<String, ObjectAdapter> wrap(final Map<String, Object> argumentsByParameterName) {
-        final Map<String, ObjectAdapter> argumentsAdaptersByParameterName = new HashMap<String, ObjectAdapter>();
-        for (final Map.Entry<String, Object> entry : argumentsByParameterName.entrySet()) {
-            final String parameterName = entry.getKey();
-            final Object argument = argumentsByParameterName.get(parameterName);
-            final ObjectAdapter argumentAdapter = argument != null ? getAdapterManager().adapterFor(argument) : null;
-            argumentsAdaptersByParameterName.put(parameterName, argumentAdapter);
-        }
-        return argumentsAdaptersByParameterName;
-    }
 
     protected List<ObjectAdapter> getInstances(final PersistenceQuery persistenceQuery) {
         if (LOG.isDebugEnabled()) {
@@ -423,19 +431,10 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
     // Manual dirtying support
     // ///////////////////////////////////////////////////////////////////////////
 
-    /**
-     * @see #setDirtiableSupport(boolean)
-     */
     public boolean isCheckObjectsForDirtyFlag() {
         return dirtiableSupport;
     }
 
-    /**
-     * Whether to notice {@link Dirtiable manually-dirtied} objects.
-     */
-    public void setDirtiableSupport(final boolean checkObjectsForDirtyFlag) {
-        this.dirtiableSupport = checkObjectsForDirtyFlag;
-    }
 
     /**
      * Mark as {@link #objectChanged(ObjectAdapter) changed } all
@@ -451,7 +450,6 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
      * <p>
      * Called by the {@link IsisTransactionManager}.
      */
-    @Override
     public void objectChangedAllDirty() {
         if (!dirtiableSupport) {
             return;
@@ -471,7 +469,10 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
         }
     }
 
-    @Override
+    /**
+     * Set as {@link Dirtiable#clearDirty(ObjectAdapter) clean} any
+     * {@link Dirtiable} objects.
+     */
     public synchronized void clearAllDirty() {
         if (!isCheckObjectsForDirtyFlag()) {
             return;
@@ -510,18 +511,6 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
         objectStore.registerService(rootOid);
     }
 
-    public ObjectAdapter getService(final String id) {
-        for (final Object service : servicesInjector.getRegisteredServices()) {
-            // TODO this (ServiceUtil) uses reflection to access the service
-            // object; it should use the
-            // reflector, ie call allServices first and use the returned array
-            if (id.equals(ServiceUtil.id(service))) {
-                return getService(service);
-            }
-        }
-        return null;
-    }
-
     // REVIEW why does this get called multiple times when starting up
     public List<ObjectAdapter> getServices() {
         final List<Object> services = servicesInjector.getRegisteredServices();
@@ -535,19 +524,12 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
     private ObjectAdapter getService(final Object servicePojo) {
         final ObjectSpecification serviceSpecification = getSpecificationLoader().loadSpecification(servicePojo.getClass());
         final RootOid oid = getOidForService(serviceSpecification);
-        final ObjectAdapter serviceAdapter = mapRecreatedPojo(oid, servicePojo);
+        final ObjectAdapter serviceAdapter = getAdapterManager().mapRecreatedPojo(oid, servicePojo);
 
         serviceAdapter.markAsResolvedIfPossible();
         return serviceAdapter;
     }
 
-    /**
-     * Has any services.
-     */
-    public boolean hasServices() {
-        return servicesInjector.getRegisteredServices().size() > 0;
-    }
-
     private RootOid getOidForServiceFromPersistenceLayer(ObjectSpecification serviceSpecification) {
         final ObjectSpecId objectSpecId = serviceSpecification.getSpecId();
         RootOid oid = servicesByObjectType.get(objectSpecId);
@@ -587,15 +569,10 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
      */
     public boolean isFixturesInstalled() {
         final PersistenceSessionFactory persistenceSessionFactory = getPersistenceSessionFactory();
-        if (persistenceSessionFactory instanceof FixturesInstalledFlag) {
-            final FixturesInstalledFlag fixturesInstalledFlag = (FixturesInstalledFlag) persistenceSessionFactory;
-            if (fixturesInstalledFlag.isFixturesInstalled() == null) {
-                fixturesInstalledFlag.setFixturesInstalled(objectStore.isFixturesInstalled());
-            }
-            return fixturesInstalledFlag.isFixturesInstalled();
-        } else {
-            return objectStore.isFixturesInstalled();
+        if (persistenceSessionFactory.isFixturesInstalled() == null) {
+            persistenceSessionFactory.setFixturesInstalled(objectStore.isFixturesInstalled());
         }
+        return persistenceSessionFactory.isFixturesInstalled();
     }
 
     @Override
@@ -608,7 +585,10 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
     // loadObject, reload
     // ///////////////////////////////////////////////////////////////////////////
 
-    @Override
+    /**
+     * Loads the object identified by the specified {@link TypedOid} from the
+     * persisted set of objects.
+     */
     public ObjectAdapter loadObject(final TypedOid oid) {
         
         // REVIEW: 
@@ -642,7 +622,11 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
     // resolveImmediately, resolveField
     // ///////////////////////////////////////////////////////////////////////////
 
-    @Override
+    /**
+     * Re-initialises the fields of an object. If the object is unresolved then
+     * the object's missing data should be retrieved from the persistence
+     * mechanism and be used to set up the value objects and associations.
+     */
     public void resolveImmediately(final ObjectAdapter adapter) {
         // synchronize on the current session because getting race
         // conditions, I think between different UI threads when running
@@ -695,49 +679,28 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
         });
     }
 
-    @Override
-    public void resolveField(final ObjectAdapter objectAdapter, final ObjectAssociation field) {
-        if (field.isNotPersisted()) {
-            return;
-        }
-        if (field.isOneToManyAssociation()) {
-            return;
-        }
-        if (field.getSpecification().isParented()) {
-            return;
-        }
-        if (field.getSpecification().isValue()) {
-            return;
-        }
-        final ObjectAdapter referenceAdapter = field.get(objectAdapter);
-        if (referenceAdapter == null || referenceAdapter.isResolved()) {
-            return;
-        }
-        if (!referenceAdapter.representsPersistent()) {
-            return;
-        }
-        if (LOG.isInfoEnabled()) {
-            // don't log object - it's toString() may use the unresolved field
-            // or unresolved collection
-            LOG.info("resolve field " + objectAdapter.getSpecification().getShortIdentifier() + "." + field.getId() + ": " + referenceAdapter.getSpecification().getShortIdentifier() + " " + referenceAdapter.getResolveState().code() + " " + referenceAdapter.getOid());
-        }
-        resolveFieldFromPersistenceLayer(objectAdapter, field);
-    }
-
-    private void resolveFieldFromPersistenceLayer(final ObjectAdapter objectAdapter, final ObjectAssociation field) {
-        getTransactionManager().executeWithinTransaction(new TransactionalClosureAbstract() {
-            @Override
-            public void execute() {
-                objectStore.resolveField(objectAdapter, field);
-            }
-        });
-    }
-
     // ////////////////////////////////////////////////////////////////
     // makePersistent
     // ////////////////////////////////////////////////////////////////
 
-    @Override
+    /**
+     * Makes an {@link ObjectAdapter} persistent. The specified object should be
+     * stored away via this object store's persistence mechanism, and have an
+     * new and unique OID assigned to it. The object, should also be added to
+     * the {@link org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault} as the object is implicitly 'in use'.
+     *
+     * <p>
+     * If the object has any associations then each of these, where they aren't
+     * already persistent, should also be made persistent by recursively calling
+     * this method.
+     *
+     * <p>
+     * If the object to be persisted is a collection, then each element of that
+     * collection, that is not already persistent, should be made persistent by
+     * recursively calling this method.
+     *
+     * @see #remapAsPersistent(ObjectAdapter)
+     */
     public void makePersistent(final ObjectAdapter adapter) {
         if (adapter.representsPersistent()) {
             throw new NotPersistableException("Object already persistent: " + adapter);
@@ -784,7 +747,10 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
     // objectChanged
     // ///////////////////////////////////////////////////////////////////////////
 
-    @Override
+    /**
+     * Mark the {@link ObjectAdapter} as changed, and therefore requiring
+     * flushing to the persistence mechanism.
+     */
     public void objectChanged(final ObjectAdapter adapter) {
 
         if (adapter.isTransient() || (adapter.isParented() && adapter.getAggregateRoot().isTransient())) {
@@ -842,7 +808,10 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
     // destroyObject
     // ///////////////////////////////////////////////////////////////////////////
 
-    @Override
+    /**
+     * Removes the specified object from the system. The specified object's data
+     * should be removed from the persistence mechanism.
+     */
     public void destroyObject(final ObjectAdapter adapter) {
         ObjectSpecification spec = adapter.getSpecification();
         if (spec.isParented()) {
@@ -879,52 +848,6 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
         });
     }
 
-    // ///////////////////////////////////////////////////////////////////////////
-    // hasInstances
-    // ///////////////////////////////////////////////////////////////////////////
-
-    @Override
-    public boolean hasInstances(final ObjectSpecification specification) {
-        if (LOG.isInfoEnabled()) {
-            LOG.info("hasInstances of " + specification.getShortIdentifier());
-        }
-        return hasInstancesFromPersistenceLayer(specification);
-    }
-
-    private boolean hasInstancesFromPersistenceLayer(final ObjectSpecification specification) {
-        return getTransactionManager().executeWithinTransaction(new TransactionalClosureWithReturnAbstract<Boolean>() {
-            @Override
-            public Boolean execute() {
-                return objectStore.hasInstances(specification);
-            }
-        });
-    }
-
-    // ///////////////////////////////////////////////////////////////////////////
-    // RecreatedPojoRemapper
-    // ///////////////////////////////////////////////////////////////////////////
-
-    @Override
-    public ObjectAdapter mapRecreatedPojo(Oid oid, Object recreatedPojo) {
-        return adapterManager.mapRecreatedPojo(oid, recreatedPojo);
-    }
-
-    @Override
-    public void remapRecreatedPojo(ObjectAdapter adapter, Object recreatedPojo) {
-        adapterManager.remapRecreatedPojo(adapter, recreatedPojo);
-    }
-
-    // ///////////////////////////////////////////////////////////////////////////
-    // AdapterLifecycleTransitioner
-    // ///////////////////////////////////////////////////////////////////////////
-
-    public void remapAsPersistent(ObjectAdapter adapter, RootOid hintRootOid) {
-        adapterManager.remapAsPersistent(adapter, hintRootOid);
-    }
-
-    public void removeAdapter(ObjectAdapter adapter) {
-        adapterManager.removeAdapter(adapter);
-    }
 
     // ///////////////////////////////////////////////////////////////////////////
     // ToPersistObjectSet
@@ -950,7 +873,6 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
      * 
      * @see #remapAsPersistent(ObjectAdapter)
      */
-    @Override
     public void remapAsPersistent(final ObjectAdapter adapter) {
         final Oid transientOid = adapter.getOid();
         adapterManager.remapAsPersistent(adapter, null);
@@ -958,7 +880,10 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
         persistentByTransient.put(transientOid, persistentOid);
     }
 
-    @Override
+    /**
+     * To support ISIS-234; keep track, for the duration of the transaction only,
+     * of the old transient {@link Oid}s and their corresponding persistent {@link Oid}s.
+     */
     public Oid remappedFrom(Oid transientOid) {
         return persistentByTransient.get(transientOid);
     }
@@ -969,7 +894,6 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
      * {@link CreateObjectCommand}, and adds to the
      * {@link IsisTransactionManager}.
      */
-    @Override
     public void addCreateObjectCommand(final ObjectAdapter object) {
         getTransactionManager().addCommand(objectStore.createCreateObjectCommand(object));
     }
@@ -1086,11 +1010,16 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
 
     /**
      * The configured {@link AdapterManager}.
-     * 
+     *
+     * Access to looking up (and possibly lazily loading) adapters.
+     *
+     * <p>
+     * However, manipulating of adapters is not part of this interface.
+     *
      * <p>
      * Injected in constructor.
      */
-    public final AdapterManager getAdapterManager() {
+    public final AdapterManagerDefault getAdapterManager() {
         return adapterManager;
     }
 
@@ -1116,28 +1045,17 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
     // ///////////////////////////////////////////////////////////////////////////
 
     /**
-     * Inject the {@link IsisTransactionManager}.
-     * 
-     * <p>
-     * This must be injected using setter-based injection rather than through
-     * the constructor because there is a bidirectional relationship between the
-     * this class and the {@link IsisTransactionManager}.
-     * 
-     * @see #getTransactionManager()
-     */
-    public void setTransactionManager(final IsisTransactionManager transactionManager) {
-        this.transactionManager = transactionManager;
-    }
-
-    /**
      * The configured {@link IsisTransactionManager}.
-     * 
-     * @see #setTransactionManager(IsisTransactionManager)
      */
     public IsisTransactionManager getTransactionManager() {
         return transactionManager;
     }
 
+    // for testing only
+    void setTransactionManager(IsisTransactionManager transactionManager) {
+        this.transactionManager = transactionManager;
+    }
+
     // ///////////////////////////////////////////////////////////////////////////
     // Dependencies (from context)
     // ///////////////////////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
index cb3b320..2b203a2 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
@@ -39,7 +39,6 @@ import org.apache.isis.core.runtime.persistence.ObjectStoreFactory;
 import org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
 
 import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
 import static org.apache.isis.core.commons.ensure.Ensure.ensureThatState;
@@ -96,12 +95,8 @@ public class PersistenceSessionFactory implements MetaModelRefiner, ApplicationS
 
         ensureThatArg(objectStore, is(not(nullValue())));
 
-        final PersistenceSession persistenceSession =new PersistenceSession(this, servicesInjector, objectStore, getConfiguration());
+        final PersistenceSession persistenceSession = new PersistenceSession(this, servicesInjector, objectStore, getConfiguration());
 
-        final IsisTransactionManager transactionManager = new IsisTransactionManager(persistenceSession, objectStore, servicesInjector);
-
-        persistenceSession.setDirtiableSupport(true);
-        persistenceSession.setTransactionManager(transactionManager);
 
         return persistenceSession;
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/Persistor.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/Persistor.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/Persistor.java
deleted file mode 100644
index 11b4091..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/Persistor.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.isis.core.runtime.system.persistence;
-
-import org.apache.isis.applib.DomainObjectContainer;
-import org.apache.isis.applib.query.Query;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ResolveState;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
-import org.apache.isis.core.metamodel.services.container.query.QueryCardinality;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
-import org.apache.isis.core.runtime.persistence.UnsupportedFindException;
-import org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession;
-
-/**
- * Represents the client-side API of the <tt>PersistenceSession</tt>.
- */
-public interface Persistor {
-
-    
-    /////////////////////////////////////////////////////////////////
-    // AdapterManager
-    /////////////////////////////////////////////////////////////////
-
-    /**
-     * Access to looking up (and possibly lazily loading) adapters.
-     * 
-     * <p>
-     * However, manipulating of adapters is not part of this interface.
-     * @return
-     */
-    public abstract AdapterManager getAdapterManager();
-
-    
-    /////////////////////////////////////////////////////////////////
-    // find, load, resolve
-    /////////////////////////////////////////////////////////////////
-    
-
-    /**
-     * Finds and returns instances that match the specified query.
-     * 
-     * <p>
-     * The {@link QueryCardinality} determines whether all instances or just the
-     * first matching instance is returned.
-     * 
-     * @throws UnsupportedFindException
-     *             if the criteria is not support by this persistor
-     */
-    public abstract <T> ObjectAdapter findInstances(Query<T> query, QueryCardinality cardinality);
-
-    /**
-     * Whether there are any instances of the specified
-     * {@link ObjectSpecification type}.
-     *
-     * <p>
-     * Checks whether there are any instances of the specified type. The object
-     * store should look for instances of the type represented by <variable>type
-     * </variable> and return <code>true</code> if there are, or
-     * <code>false</code> if there are not.
-     * 
-     * <p>
-     * Used (ostensibly) by client-side code.
-     */
-    public abstract boolean hasInstances(ObjectSpecification specification);
-
-    /**
-     * Finds and returns instances that match the specified
-     * {@link PersistenceQuery}.
-     * 
-     * <p>
-     * Compared to {@link #findInstances(Query, QueryCardinality)}, not that
-     * there is no {@link QueryCardinality} parameter. That's because
-     * {@link PersistenceQuery} intrinsically carry the knowledge as to how many
-     * rows they return.
-     * 
-     * @throws UnsupportedFindException
-     *             if the criteria is not support by this persistor
-     */
-    public abstract ObjectAdapter findInstances(PersistenceQuery persistenceQuery);
-
-    /**
-     * Loads the object identified by the specified {@link TypedOid} from the
-     * persisted set of objects.
-     */
-    public abstract ObjectAdapter loadObject(TypedOid oid);
-    
-
-    /**
-     * Re-initialises the fields of an object. If the object is unresolved then
-     * the object's missing data should be retrieved from the persistence
-     * mechanism and be used to set up the value objects and associations.
-     */
-    public abstract void resolveImmediately(ObjectAdapter adapter);
-
-    /**
-     * Hint that specified field within the specified object is likely to be
-     * needed soon. This allows the object's data to be loaded, ready for use.
-     * 
-     * <p>
-     * This method need not do anything, but offers the object store the
-     * opportunity to load in objects before their use. Contrast this with
-     * resolveImmediately, which requires an object to be loaded before
-     * continuing.
-     * 
-     * @see #resolveImmediately(ObjectAdapter)
-     */
-    public abstract void resolveField(ObjectAdapter objectAdapter, ObjectAssociation field);
-
-
-    
-    /////////////////////////////////////////////////////////////////
-    // create, persist
-    /////////////////////////////////////////////////////////////////
-
-    /**
-     * Create a root or standalone {@link ObjectAdapter adapter}.
-     * 
-     * <p>
-     * Creates a new instance of the specified type and returns it in an adapter
-     * whose resolved state set to {@link ResolveState#TRANSIENT} (except if the
-     * type is marked as {@link ObjectSpecification#isValueOrIsParented()
-     * aggregated} in which case it will be set to {@link ResolveState#VALUE}).
-     * 
-     * <p>
-     * The returned object will be initialised (had the relevant callback
-     * lifecycle methods invoked).
-     * 
-     * <p>
-     * <b><i> REVIEW: not sure about {@link ResolveState#VALUE} - see comments
-     * in {@link #adapterFor(Object, Oid, OneToManyAssociation)}.</i></b>
-     * <p>
-     * TODO: this is the same as
-     * {@link RuntimeContextFromSession#createTransientInstance(ObjectSpecification)};
-     * could it be unified?
-     * 
-     * <p>
-     * While creating the object it will be initialised with default values and
-     * its created lifecycle method (its logical constructor) will be invoked.
-     * Contrast this with
-     * {@link #recreateTransientInstance(Oid, ObjectSpecification)}.
-     * 
-     * <p>
-     * This method is ultimately delegated to by the
-     * {@link DomainObjectContainer}.
-     */
-    public abstract ObjectAdapter createTransientInstance(ObjectSpecification objectSpec);
-
-    /**
-     * Creates a new instance of the specified type and returns an adapter with
-     * an aggregated OID that show that this new object belongs to the specified
-     * parent. The new object's resolved state is set to
-     * {@link ResolveState#RESOLVED} as it state is part of it parent.
-     * 
-     * <p>
-     * While creating the object it will be initialised with default values and
-     * its created lifecycle method (its logical constructor) will be invoked.
-     * Contrast this with
-     * {@link #recreateTransientInstance(Oid, ObjectSpecification)}.
-     * 
-     * <p>
-     * This method is ultimately delegated to by the
-     * {@link DomainObjectContainer}.
-     */
-    public abstract ObjectAdapter createAggregatedInstance(ObjectSpecification objectSpec, ObjectAdapter parentAdapter);
-
-    /**
-     * Makes an {@link ObjectAdapter} persistent. The specified object should be
-     * stored away via this object store's persistence mechanism, and have an
-     * new and unique OID assigned to it. The object, should also be added to
-     * the {@link org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault} as the object is implicitly 'in use'.
-     * 
-     * <p>
-     * If the object has any associations then each of these, where they aren't
-     * already persistent, should also be made persistent by recursively calling
-     * this method.
-     * 
-     * <p>
-     * If the object to be persisted is a collection, then each element of that
-     * collection, that is not already persistent, should be made persistent by
-     * recursively calling this method.
-     * 
-     * @see #remapAsPersistent(ObjectAdapter)
-     */
-    public abstract void makePersistent(ObjectAdapter adapter);
-
-
-    /////////////////////////////////////////////////////////////////
-    // change
-    /////////////////////////////////////////////////////////////////
-
-    /**
-     * Mark the {@link ObjectAdapter} as changed, and therefore requiring
-     * flushing to the persistence mechanism.
-     */
-    public abstract void objectChanged(ObjectAdapter adapter);
-
-    
-    /////////////////////////////////////////////////////////////////
-    // destroy
-    /////////////////////////////////////////////////////////////////
-
-    /**
-     * Removes the specified object from the system. The specified object's data
-     * should be removed from the persistence mechanism.
-     */
-    public abstract void destroyObject(ObjectAdapter adapter);
-
-
-    
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/RecreatedPojoRemapper.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/RecreatedPojoRemapper.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/RecreatedPojoRemapper.java
deleted file mode 100644
index ea89e21..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/RecreatedPojoRemapper.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.system.persistence;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.ResolveState;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-
-public interface RecreatedPojoRemapper {
-
-    /**
-     * Either returns an existing {@link ObjectAdapter adapter} (as per
-     * {@link #getAdapterFor(Object)} or {@link #getAdapterFor(Oid)}), otherwise
-     * re-creates an adapter with the specified (persistent) {@link Oid}.
-     * 
-     * <p>
-     * Typically called when the {@link Oid} is already known, that is, when
-     * resolving an already-persisted object. Is also available for
-     * <tt>Memento</tt> support however, so {@link Oid} could also represent a
-     * {@link Oid#isTransient() transient} object.
-     * 
-     * <p>
-     * If the {@link ObjectAdapter adapter} is recreated, its
-     * {@link ResolveState} will be set to either
-     * {@link ResolveState#TRANSIENT} or {@link ResolveState#GHOST} based on
-     * whether the {@link Oid} is {@link Oid#isTransient() transient} or not.
-     * 
-     * @param oid
-     * @param recreatedPojo - already known to the object store impl, or a service
-     */
-    ObjectAdapter mapRecreatedPojo(Oid oid, Object recreatedPojo);
-    
-    void remapRecreatedPojo(ObjectAdapter adapter, Object recreatedPojo);
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/EnlistedObjectDirtying.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/EnlistedObjectDirtying.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/EnlistedObjectDirtying.java
deleted file mode 100644
index 6efde67..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/EnlistedObjectDirtying.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.system.transaction;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.Dirtiable;
-
-/**
- * As called by the {@link IsisTransactionManager}.
- * 
- * <p>
- * Dirtiable support.
- */
-public interface EnlistedObjectDirtying {
-
-    /**
-     * Mark as {@link #objectChanged(ObjectAdapter) changed } all
-     * {@link Dirtiable} objects that have been
-     * {@link Dirtiable#markDirty(ObjectAdapter) manually marked} as dirty.
-     * 
-     * <p>
-     * Called by the {@link IsisTransactionManager}.
-     */
-    void objectChangedAllDirty();
-
-    /**
-     * Set as {@link Dirtiable#clearDirty(ObjectAdapter) clean} any
-     * {@link Dirtiable} objects.
-     */
-    void clearAllDirty();
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusObjectStore.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusObjectStore.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusObjectStore.java
index 0098d29..aa0d2c7 100644
--- a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusObjectStore.java
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusObjectStore.java
@@ -44,7 +44,6 @@ import org.apache.isis.core.metamodel.adapter.oid.*;
 import org.apache.isis.core.metamodel.spec.ObjectSpecId;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
 import org.apache.isis.core.runtime.persistence.PojoRefreshException;
 import org.apache.isis.core.runtime.persistence.UnsupportedFindException;
@@ -375,7 +374,7 @@ public class DataNucleusObjectStore implements ObjectStore {
         }
 
         final Object pojo = loadPojo(oid);
-        return getPersistenceSession().mapRecreatedPojo(oid, pojo);
+        return getPersistenceSession().getAdapterManager().mapRecreatedPojo(oid, pojo);
     }
 
     
@@ -497,32 +496,7 @@ public class DataNucleusObjectStore implements ObjectStore {
         frameworkSynchronizer.postLoadProcessingFor((PersistenceCapable) domainObject, CalledFrom.OS_RESOLVE);
     }
 
-    /**
-     * Walking the graph.
-     */
-    public void resolveField(final ObjectAdapter object, final ObjectAssociation association) {
-        ensureOpened();
-        ensureInTransaction();
-
-        final ObjectAdapter referencedCollectionAdapter = association.get(object);
-
-        // this code originally brought in from the JPA impl, but seems reasonable.
-        if (association.isOneToManyAssociation()) {
-            ensureThatState(referencedCollectionAdapter, is(notNullValue()));
 
-            final Object referencedCollection = referencedCollectionAdapter.getObject();
-            ensureThatState(referencedCollection, is(notNullValue()));
-
-            // if a proxy collection, then force it to initialize.  just 'touching' the object is sufficient.
-            // REVIEW: I wonder if this is actually needed; does JDO use proxy collections?
-            referencedCollection.hashCode();
-        }
-
-        // the JPA impl used to also call its lifecycle listener on the referenced collection object, eg List,
-        // itself.  I don't think this makes sense to do for JDO (the collection is not a PersistenceCapable).
-    }
-
-    
     // ///////////////////////////////////////////////////////////////////////
     // getInstances, hasInstances
     // ///////////////////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/FrameworkSynchronizer.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/FrameworkSynchronizer.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/FrameworkSynchronizer.java
index 94e9c34..66b7f1c 100644
--- a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/FrameworkSynchronizer.java
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/FrameworkSynchronizer.java
@@ -37,6 +37,7 @@ import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
 import org.apache.isis.core.metamodel.adapter.version.Version;
 import org.apache.isis.core.metamodel.facets.object.callbacks.*;
 import org.apache.isis.core.runtime.persistence.PersistorUtil;
+import org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.persistence.OidGenerator;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
@@ -89,7 +90,7 @@ public class FrameworkSynchronizer {
                     final Version originalVersion = adapter.getVersion();
 
                     // sync the pojo held by the adapter with that just loaded
-                    getPersistenceSession().remapRecreatedPojo(adapter, pojo);
+                    getPersistenceSession().getAdapterManager() .remapRecreatedPojo(adapter, pojo);
                     
                     // since there was already an adapter, do concurrency check
                     // (but don't set abort cause if checking is suppressed through thread-local)
@@ -119,9 +120,9 @@ public class FrameworkSynchronizer {
                     // ie from ObjectStore#resolveImmediately()
                     adapter = getAdapterManager().getAdapterFor(originalOid);
                     if(adapter != null) {
-                        getPersistenceSession().remapRecreatedPojo(adapter, pojo);
+                        getPersistenceSession().getAdapterManager() .remapRecreatedPojo(adapter, pojo);
                     } else {
-                        adapter = getPersistenceSession().mapRecreatedPojo(originalOid, pojo);
+                        adapter = getPersistenceSession().getAdapterManager().mapRecreatedPojo(originalOid, pojo);
                         CallbackFacet.Util.callCallback(adapter, LoadedCallbackFacet.class);
                     }
                 }
@@ -201,7 +202,7 @@ public class FrameworkSynchronizer {
                     // persisting
                     final RootOid persistentOid = getOidGenerator().createPersistentOrViewModelOid(pojo, isisOid);
 
-                    getPersistenceSession().remapAsPersistent(adapter, persistentOid);
+                    getPersistenceSession().getAdapterManager().remapAsPersistent(adapter, persistentOid);
 
                     CallbackFacet.Util.callCallback(adapter, PersistedCallbackFacet.class);
 
@@ -272,7 +273,7 @@ public class FrameworkSynchronizer {
                     return null;
                 }
                 final RootOid oid = getPersistenceSession().getOidGenerator().createPersistentOrViewModelOid(pojo, null);
-                final ObjectAdapter adapter = getPersistenceSession().mapRecreatedPojo(oid, pojo);
+                final ObjectAdapter adapter = getPersistenceSession().getAdapterManager().mapRecreatedPojo(oid, pojo);
                 return adapter;
             }
         }, calledFrom);
@@ -431,7 +432,7 @@ public class FrameworkSynchronizer {
     // Dependencies (from context)
     // /////////////////////////////////////////////////////////
 
-    protected AdapterManager getAdapterManager() {
+    protected AdapterManagerDefault getAdapterManager() {
         return getPersistenceSession().getAdapterManager();
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java
index 119ea19..d6d3eeb 100644
--- a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/persistence/queries/PersistenceQueryProcessorAbstract.java
@@ -19,22 +19,19 @@
 package org.apache.isis.objectstore.jdo.datanucleus.persistence.queries;
 
 import java.util.List;
-
 import javax.jdo.PersistenceManager;
 import javax.jdo.PersistenceManagerFactory;
 import javax.jdo.listener.InstanceLifecycleEvent;
 import javax.jdo.metadata.TypeMetadata;
 import javax.jdo.spi.PersistenceCapable;
-
 import com.google.common.collect.Lists;
-
 import org.apache.isis.core.commons.ensure.Assert;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.persistence.PersistenceQuery;
-import org.apache.isis.core.runtime.system.persistence.Persistor;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusObjectStore;
 import org.apache.isis.objectstore.jdo.datanucleus.persistence.FrameworkSynchronizer;
 import org.apache.isis.objectstore.jdo.datanucleus.persistence.FrameworkSynchronizer.CalledFrom;
@@ -98,7 +95,7 @@ public abstract class PersistenceQueryProcessorAbstract<T extends PersistenceQue
     // Dependencies (from context)
     // /////////////////////////////////////////////////////////////
 
-    protected Persistor getPersistenceSession() {
+    protected PersistenceSession getPersistenceSession() {
         return IsisContext.getPersistenceSession();
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmContractTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmContractTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmContractTest.java
index aad312f..7a3086b 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmContractTest.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmContractTest.java
@@ -34,6 +34,7 @@ import org.apache.isis.core.runtime.persistence.adapter.PojoAdapter;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.PojoAdapterBuilder;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.PojoAdapterBuilder.Persistence;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.PojoAdapterBuilder.Type;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
 import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
 
@@ -43,7 +44,7 @@ public abstract class PersistAlgorithmContractTest {
     public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
 
     @Mock
-    private ToPersistObjectSet mockAdder;
+    private PersistenceSession mockAdder;
 
     @Mock
     private ObjectSpecification objectSpec;

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionTest.java
index f9645c8..3cf5d3a 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionTest.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionTest.java
@@ -167,7 +167,8 @@ public class PersistenceSessionTest {
         }});
 
         
-        transactionManager = new IsisTransactionManager(persistenceSession, mockObjectStore, servicesInjector) {
+        transactionManager = persistenceSession.getTransactionManager();
+        new IsisTransactionManager(persistenceSession, mockObjectStore, servicesInjector) {
             @Override
             public AuthenticationSession getAuthenticationSession() {
                 return mockAuthenticationSession;

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/IsisSystemWithFixtures.java
----------------------------------------------------------------------
diff --git a/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/IsisSystemWithFixtures.java b/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/IsisSystemWithFixtures.java
index 131c418..cd449c8 100644
--- a/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/IsisSystemWithFixtures.java
+++ b/tck/tck-integtests/src/test/java/org/apache/isis/core/integtestsupport/IsisSystemWithFixtures.java
@@ -46,7 +46,6 @@ import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.persistence.ObjectStore;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.core.runtime.system.persistence.Persistor;
 import org.apache.isis.core.runtime.system.transaction.IsisTransaction;
 import org.apache.isis.core.runtime.system.transaction.IsisTransaction.State;
 import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
@@ -514,7 +513,7 @@ public class IsisSystemWithFixtures implements org.junit.rules.TestRule {
 
     public ObjectAdapter reload(RootOid oid) {
         ensureSessionInProgress();
-        final Persistor persistenceSession = getPersistenceSession();
+        final PersistenceSession persistenceSession = getPersistenceSession();
         return persistenceSession.loadObject(oid);
     }
 
@@ -527,7 +526,7 @@ public class IsisSystemWithFixtures implements org.junit.rules.TestRule {
         ensureSessionInProgress();
         ensureObjectIsNotPersistent(pojo);
         final ObjectAdapter adapter = adapterFor(pojo);
-        getPersistenceSession().remapAsPersistent(adapter, persistentOid);
+        getPersistenceSession().getAdapterManager().remapAsPersistent(adapter, persistentOid);
         return adapter;
     }
 
@@ -658,7 +657,7 @@ public class IsisSystemWithFixtures implements org.junit.rules.TestRule {
         return getPersistenceSession().getTransactionManager();
     }
     
-    public Persistor getPersistor() {
+    public PersistenceSession getPersistor() {
     	return getPersistenceSession();
     }
     


[26/44] isis git commit: ISIS-537: refactoring out SelectorHelper

Posted by da...@apache.org.
ISIS-537: refactoring out SelectorHelper


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/457b3653
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/457b3653
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/457b3653

Branch: refs/heads/master
Commit: 457b365355836c4ad47ff343e992c104b8984e83
Parents: 70af3c3
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sun Nov 9 15:31:24 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 10:21:42 2014 +0000

----------------------------------------------------------------------
 .../viewer/wicket/model/models/EntityModel.java |  5 +-
 .../CollectionContentsSelectorHelper.java       | 96 ++++++++++++++++++++
 ...ectionContentsSelectorDropdownPanelTest.java | 67 ++++++++++++++
 ...ollectionContentsLinksSelectorPanelTest.java | 69 --------------
 .../java/dom/todo/ToDoItemContributions.java    |  3 +-
 5 files changed, 165 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/457b3653/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
index 3955c31..6c66859 100644
--- a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
+++ b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
@@ -132,13 +132,11 @@ public class EntityModel extends BookmarkableModel<ObjectAdapter> implements UiH
     private final Map<PropertyMemento, ScalarModel> propertyScalarModels = Maps.newHashMap();
     private MemberGroupLayoutHint memberGroupLayoutHint;
 
-
     /**
      * Toggled by 'entityDetailsButton'.
      */
     private boolean entityDetailsVisible;
 
-
     /**
      * {@link ConcurrencyException}, if any, that might have occurred previously
      */
@@ -479,8 +477,7 @@ public class EntityModel extends BookmarkableModel<ObjectAdapter> implements UiH
             return null;
         }
         String hintKey = hintKey(component, key);
-        String value = hints.get(hintKey);
-        return value;
+        return hints.get(hintKey);
     }
     
     @Override

http://git-wip-us.apache.org/repos/asf/isis/blob/457b3653/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorHelper.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorHelper.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorHelper.java
new file mode 100644
index 0000000..6b796b5
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorHelper.java
@@ -0,0 +1,96 @@
+/*
+ *  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.collectioncontents.selector.dropdown;
+
+import java.util.ArrayList;
+import java.util.List;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
+import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistry;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.selector.links.CollectionContentsLinksSelectorPanelFactory;
+
+public class CollectionContentsSelectorHelper {
+
+    private static final long serialVersionUID = 1L;
+
+    private final ComponentType componentType;
+    private final ComponentFactoryRegistry componentFactoryRegistry;
+    private final EntityCollectionModel model;
+    private final ComponentFactory ignoreFactory;
+
+
+    public CollectionContentsSelectorHelper(
+            final ComponentType componentType,
+            final ComponentFactoryRegistry componentFactoryRegistry,
+            final EntityCollectionModel model,
+            final ComponentFactory ignoreFactory) {
+        this.componentType = componentType;
+        this.componentFactoryRegistry = componentFactoryRegistry;
+        this.model = model;
+        this.ignoreFactory = ignoreFactory;
+    }
+
+
+    public List<ComponentFactory> findOtherComponentFactories() {
+        final List<ComponentFactory> componentFactories = componentFactoryRegistry.findComponentFactories(componentType, model);
+        ArrayList<ComponentFactory> otherFactories = Lists.newArrayList(Collections2.filter(componentFactories, new Predicate<ComponentFactory>() {
+            @Override
+            public boolean apply(final ComponentFactory input) {
+                return input != ignoreFactory && input.getClass() != CollectionContentsLinksSelectorPanelFactory.class;
+            }
+        }));
+        return ordered(otherFactories);
+    }
+
+    private static List<ComponentFactory> ordered(List<ComponentFactory> componentFactories) {
+        return orderAjaxTableToEnd(componentFactories);
+    }
+
+
+
+    static List<ComponentFactory> orderAjaxTableToEnd(List<ComponentFactory> componentFactories) {
+        int ajaxTableIdx = findAjaxTable(componentFactories);
+        if(ajaxTableIdx>=0) {
+            List<ComponentFactory> orderedFactories = Lists.newArrayList(componentFactories);
+            ComponentFactory ajaxTableFactory = orderedFactories.remove(ajaxTableIdx);
+            orderedFactories.add(ajaxTableFactory);
+            return orderedFactories;
+        } else {
+            return componentFactories;
+        }
+    }
+
+    public static int findAjaxTable(List<ComponentFactory> componentFactories) {
+        for(int i=0; i<componentFactories.size(); i++) {
+            if(componentFactories.get(i) instanceof CollectionContentsAsAjaxTablePanelFactory) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/457b3653/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanelTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanelTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanelTest.java
new file mode 100644
index 0000000..d116be4
--- /dev/null
+++ b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/dropdown/CollectionContentsSelectorDropdownPanelTest.java
@@ -0,0 +1,67 @@
+/*
+ *  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.collectioncontents.selector.dropdown;
+
+import java.util.Arrays;
+import java.util.List;
+import org.jmock.auto.Mock;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class CollectionContentsSelectorDropdownPanelTest {
+
+    @Rule
+    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+
+    @Mock
+    private ComponentFactory one;
+    
+    @Mock
+    private ComponentFactory two;
+
+    private ComponentFactory ajaxTableComponentFactory;
+    
+    @Before
+    public void setUp() throws Exception {
+        ajaxTableComponentFactory = new CollectionContentsAsAjaxTablePanelFactory();
+    }
+    
+    @Test
+    public void testOrderAjaxTableToEnd() {
+        
+        List<ComponentFactory> componentFactories = 
+                Arrays.<ComponentFactory>asList(
+                        one,
+                        ajaxTableComponentFactory, 
+                        two);
+        List<ComponentFactory> orderAjaxTableToEnd = CollectionContentsSelectorDropdownPanel.orderAjaxTableToEnd(componentFactories);
+        assertThat(orderAjaxTableToEnd.get(0), is(one));
+        assertThat(orderAjaxTableToEnd.get(1), is(two));
+        assertThat(orderAjaxTableToEnd.get(2), is(ajaxTableComponentFactory));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/457b3653/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanelTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanelTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanelTest.java
deleted file mode 100644
index 60e6351..0000000
--- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanelTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *  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.collectioncontents.selector.links;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.jmock.auto.Mock;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-import org.apache.isis.viewer.wicket.ui.ComponentFactory;
-import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
-
-public class CollectionContentsLinksSelectorPanelTest {
-
-    @Rule
-    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
-    @Mock
-    private ComponentFactory one;
-    
-    @Mock
-    private ComponentFactory two;
-
-    private ComponentFactory ajaxTableComponentFactory;
-    
-    @Before
-    public void setUp() throws Exception {
-        ajaxTableComponentFactory = new CollectionContentsAsAjaxTablePanelFactory();
-    }
-    
-    @Test
-    public void testOrderAjaxTableToEnd() {
-        
-        List<ComponentFactory> componentFactories = 
-                Arrays.<ComponentFactory>asList(
-                        one,
-                        ajaxTableComponentFactory, 
-                        two);
-        List<ComponentFactory> orderAjaxTableToEnd = CollectionContentsLinksSelectorPanel.orderAjaxTableToEnd(componentFactories);
-        assertThat(orderAjaxTableToEnd.get(0), is(one));
-        assertThat(orderAjaxTableToEnd.get(1), is(two));
-        assertThat(orderAjaxTableToEnd.get(2), is(ajaxTableComponentFactory));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/457b3653/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItemContributions.java
----------------------------------------------------------------------
diff --git a/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItemContributions.java b/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItemContributions.java
index 1b758f8..71d9142 100644
--- a/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItemContributions.java
+++ b/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItemContributions.java
@@ -159,10 +159,9 @@ public class ToDoItemContributions extends AbstractFactoryAndRepository {
     @NotInServiceMenu
     @ActionSemantics(Of.SAFE)
     @NotContributed(As.ACTION)
-    @Programmatic
     public List<ToDoItem> similarTo(final ToDoItem toDoItem) {
         final List<ToDoItem> similarToDoItems = allMatches(
-                new QueryDefault<ToDoItem>(ToDoItem.class, 
+                new QueryDefault<ToDoItem>(ToDoItem.class,
                         "findByOwnedByAndCategory", 
                         "ownedBy", currentUserName(), 
                         "category", toDoItem.getCategory()));


[36/44] isis git commit: ISIS-537: continuing to pull out BulkActionsHelper (move bulk actions to panel header for standalone collection panel)

Posted by da...@apache.org.
ISIS-537: continuing to pull out BulkActionsHelper (move bulk actions to panel header for standalone collection panel)


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/9bad9179
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/9bad9179
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/9bad9179

Branch: refs/heads/master
Commit: 9bad91796ccba1ebca747a387b48fee8213c78a1
Parents: 276472f
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Nov 10 19:56:22 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 19:56:22 2014 +0000

----------------------------------------------------------------------
 .../selector/CollectionSelectorHelper.java      |  26 +--
 .../selector/CollectionSelectorPanel.java       |   4 +-
 .../ajaxtable/BulkActionsHelper.java            |   5 +-
 .../ajaxtable/BulkActionsLinkFactory.java       |  18 +-
 .../ajaxtable/BulkActionsProvider.java          |   6 +-
 .../CollectionContentsAsAjaxTablePanel.html     |   8 +-
 .../CollectionContentsAsAjaxTablePanel.java     | 223 ++++++++-----------
 .../columns/ObjectAdapterToggleboxColumn.java   |  20 +-
 .../CollectionContentsMultipleViewsPanel.java   |   6 +-
 .../collections/EntityCollectionsPanel.java     |   4 +-
 .../StandaloneCollectionPanel.html              |   5 +-
 .../StandaloneCollectionPanel.java              | 143 +++++++++++-
 12 files changed, 286 insertions(+), 182 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/9bad9179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorHelper.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorHelper.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorHelper.java
index dfcdbf5..eed5607 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorHelper.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorHelper.java
@@ -19,6 +19,7 @@
 
 package org.apache.isis.viewer.wicket.ui.components.collection.selector;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 import com.google.common.base.Predicate;
@@ -38,30 +39,29 @@ import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.multiple.CollectionContentsMultipleViewsPanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory;
 
-public class CollectionSelectorHelper {
+public class CollectionSelectorHelper implements Serializable {
+
+    private static final long serialVersionUID = 1L;
 
     static final String UIHINT_EVENT_VIEW_KEY = "view";
 
-    private final ComponentType componentType;
-    private final ComponentFactoryRegistry componentFactoryRegistry;
+    private static final ComponentFactory ignoreFactory = new CollectionContentsMultipleViewsPanelFactory();
+    private static final ComponentType componentType = ComponentType.COLLECTION_CONTENTS; // this.ignoreFactory.getComponentType();;
+
     private final EntityCollectionModel model;
-    private final ComponentFactory ignoreFactory;
     private final List<ComponentFactory> componentFactories;
 
-
     public CollectionSelectorHelper(
             final EntityCollectionModel model,
-            final ComponentFactoryRegistry componentFactoryRegistry,
-            final ComponentFactory ignoreFactory) {
-        this.componentFactoryRegistry = componentFactoryRegistry;
+            final ComponentFactoryRegistry componentFactoryRegistry) {
         this.model = model;
-        this.ignoreFactory = ignoreFactory;
-        this.componentType = ignoreFactory.getComponentType();
-
-        componentFactories = findOtherComponentFactories();
+        this.componentFactories = findOtherComponentFactories(componentFactoryRegistry);
     }
 
-    public List<ComponentFactory> findOtherComponentFactories() {
+    public List<ComponentFactory> findOtherComponentFactories(ComponentFactoryRegistry componentFactoryRegistry) {
+        if(componentFactories != null) {
+            return componentFactories;
+        }
         final List<ComponentFactory> componentFactories = componentFactoryRegistry.findComponentFactories(componentType, model);
         ArrayList<ComponentFactory> otherFactories = Lists.newArrayList(Collections2.filter(componentFactories, new Predicate<ComponentFactory>() {
             @Override

http://git-wip-us.apache.org/repos/asf/isis/blob/9bad9179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorPanel.java
index cb8d0f2..8cdc710 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorPanel.java
@@ -74,7 +74,7 @@ public class CollectionSelectorPanel
     public CollectionSelectorPanel(final String id, final EntityCollectionModel model, final ComponentFactory ignoreFactory) {
         super(id, model);
         this.componentType = ignoreFactory.getComponentType();
-        selectorHelper = new CollectionSelectorHelper(model, getComponentFactoryRegistry(), ignoreFactory);
+        selectorHelper = new CollectionSelectorHelper(model, getComponentFactoryRegistry());
     }
 
     /**
@@ -88,7 +88,7 @@ public class CollectionSelectorPanel
 
 
     private void addDropdown() {
-        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
+        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories(getComponentFactoryRegistry());
         final int selected = selectorHelper.honourViewHintElseDefault(this);
 
         // selector

http://git-wip-us.apache.org/repos/asf/isis/blob/9bad9179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsHelper.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsHelper.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsHelper.java
index e7b1b66..0c2822f 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsHelper.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsHelper.java
@@ -18,6 +18,7 @@
  */
 package org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable;
 
+import java.io.Serializable;
 import java.util.Collections;
 import java.util.List;
 import com.google.common.base.Predicate;
@@ -31,10 +32,12 @@ import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
 
-public class BulkActionsHelper {
+public class BulkActionsHelper implements Serializable {
 
     private final EntityCollectionModel model;
 
+    private static final long serialVersionUID = 1L;
+
     public BulkActionsHelper(final EntityCollectionModel model) {
         this.model = model;
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/9bad9179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsLinkFactory.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsLinkFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsLinkFactory.java
index 826aebf..efc68c1 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsLinkFactory.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsLinkFactory.java
@@ -23,7 +23,6 @@ import com.google.common.base.Predicate;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 import org.apache.wicket.Session;
-import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
 import org.apache.wicket.markup.html.link.AbstractLink;
 import org.apache.wicket.markup.html.link.Link;
 import org.apache.isis.applib.RecoverableException;
@@ -54,26 +53,21 @@ import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.ActionLinkFac
 import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.CssMenuItem;
 import org.apache.isis.viewer.wicket.ui.errors.JGrowlBehaviour;
 
-final class BulkActionsLinkFactory implements ActionLinkFactory {
+public final class BulkActionsLinkFactory implements ActionLinkFactory {
     
     private static final long serialVersionUID = 1L;
     private final EntityCollectionModel model;
     
-    @SuppressWarnings("unused")
-    private final DataTable<ObjectAdapter,String> dataTable;
-    private ObjectAdapterToggleboxColumn toggleboxColumn;
+    private final ObjectAdapterToggleboxColumn toggleboxColumn;
 
-    BulkActionsLinkFactory(
-            final EntityCollectionModel model, 
-            final DataTable<ObjectAdapter,String> dataTable) {
+    public BulkActionsLinkFactory(
+            final EntityCollectionModel model,
+            final ObjectAdapterToggleboxColumn toggleboxColumn) {
         this.model = model;
-        this.dataTable = dataTable;
-    }
-
-    public void setToggleboxColumn(ObjectAdapterToggleboxColumn toggleboxColumn) {
         this.toggleboxColumn = toggleboxColumn;
     }
 
+
     @Override
     public LinkAndLabel newLink(
             final ObjectAdapterMemento serviceAdapterMemento,

http://git-wip-us.apache.org/repos/asf/isis/blob/9bad9179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsProvider.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsProvider.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsProvider.java
index 697f556..2ab87a3 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsProvider.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsProvider.java
@@ -18,11 +18,11 @@
  */
 package org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable;
 
-import org.apache.isis.viewer.wicket.model.models.ActionPromptProvider;
-import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.ActionLinkFactory;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ObjectAdapterToggleboxColumn;
 
 public interface BulkActionsProvider {
 
-    public void configureBulkActionsProvider(ActionLinkFactory linkFactory, ActionPromptProvider actionPromptProvider);
+    void configureBulkActionsProvider(ObjectAdapterToggleboxColumn toggleboxColumn);
 
+    ObjectAdapterToggleboxColumn createToggleboxColumn();
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/9bad9179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.html
index 31c0121..694f262 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.html
@@ -21,12 +21,16 @@
     <body>
         <wicket:panel>
             <div class="collectionContentsAsAjaxTablePanel collectionContentsComponentType">
-                <div class="entityActions" wicket:id="entityActions"></div>
+                <!--
+                <div class="entityActions" xxxwicket:id="entityActions"></div>
+                -->
                 <div class="clearfix"></div>
                 <div class="table-responsive">
                     <table class="contents table table-striped table-condensed table-hover table-bordered" cellspacing="0" wicket:id="table">[table]</table>
                 </div>
-                <div wicket:id="actionPromptModalWindow"></div>
+                <!--
+                <div xxxwicket:id="actionPromptModalWindow"></div>
+                -->
             </div>
         </wicket:panel>
     </body>

http://git-wip-us.apache.org/repos/asf/isis/blob/9bad9179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
index 74ec5d9..b53427b 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
@@ -20,7 +20,6 @@
 package org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable;
 
 import java.util.List;
-import com.google.common.base.Predicate;
 import com.google.common.collect.Lists;
 import com.google.inject.Inject;
 import org.apache.wicket.Component;
@@ -40,25 +39,17 @@ import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
 import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.viewer.wicket.model.common.SelectionHandler;
 import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
 import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings;
-import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
 import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
-import org.apache.isis.viewer.wicket.model.models.ActionPrompt;
-import org.apache.isis.viewer.wicket.model.models.ActionPromptProvider;
 import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
-import org.apache.isis.viewer.wicket.ui.components.actionprompt.ActionPromptModalWindow;
 import org.apache.isis.viewer.wicket.ui.components.collection.count.CollectionCountProvider;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ColumnAbstract;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ObjectAdapterPropertyColumn;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ObjectAdapterTitleColumn;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ObjectAdapterToggleboxColumn;
-import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.ActionLinkFactory;
-import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.CssMenuBuilder;
-import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.CssMenuPanel;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
 import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
 
@@ -66,19 +57,16 @@ import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
  * {@link PanelAbstract Panel} that represents a {@link EntityCollectionModel
  * collection of entity}s rendered using {@link AjaxFallbackDefaultDataTable}.
  */
-public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityCollectionModel> implements CollectionCountProvider, ActionPromptProvider, BulkActionsProvider, UiHintPathSignificant {
+public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityCollectionModel> implements CollectionCountProvider /*, ActionPromptProvider, BulkActionsProvider */, UiHintPathSignificant {
 
     private static final long serialVersionUID = 1L;
 
     private static final String ID_TABLE = "table";
     private static final String ID_ACTION_PROMPT_MODAL_WINDOW = "actionPromptModalWindow";
-
     private static final String ID_ENTITY_ACTIONS = "entityActions";
 
-    @SuppressWarnings("deprecation")
-    private static final Predicate<ObjectAction> BULK = Filters.asPredicate(ObjectAction.Filters.bulk());
-    
     private IsisAjaxFallbackDataTable<ObjectAdapter,String> dataTable;
+
     private final BulkActionsHelper bulkActionsHelper;
 
 
@@ -94,14 +82,51 @@ public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityColl
     }
 
     private void buildGui() {
-        final EntityCollectionModel model = getModel();
 
         final List<IColumn<ObjectAdapter,String>> columns = Lists.newArrayList();
 
-        List<ObjectAction> bulkActions = bulkActionsHelper.getBulkActions();
+        // bulkactions
+        final BulkActionsProvider bulkActionsProvider = getBulkActionsProvider();
+
+        ObjectAdapterToggleboxColumn toggleboxColumn = null;
+        if(bulkActionsProvider != null) {
+
+//            List<ObjectAction> bulkActions = bulkActionsProvider.getBulkActions();
+//            if(!bulkActions.isEmpty()) {
+
+            toggleboxColumn = bulkActionsProvider.createToggleboxColumn();
+            if(toggleboxColumn != null) {
+                columns.add(toggleboxColumn);
+            }
+            bulkActionsProvider.configureBulkActionsProvider(toggleboxColumn);
+
+//            }
+
+        }
+
+//        } else {
+//        if(bulkActions.isEmpty() || getModel().isParented()) {
+//            //permanentlyHide(ID_ENTITY_ACTIONS);
+//            getBulkActionsProvider().configureBulkActionsProvider(null, null);
+//        } else {
+
+//            actionLinkFactoryDelegating = new ActionLinkFactoryDelegating();
+//            actionPromptProviderDelegating = new ActionPromptProviderDelegating();
+
+            //getBulkActionsProvider().configureBulkActionsProvider(linkFactory, this);
+//            getBulkActionsProvider().configureBulkActionsProvider(linkFactory, null);
+
+//            final CssMenuBuilder cssMenuBuilder = new CssMenuBuilder(null, bulkActions, actionLinkFactoryDelegating, actionPromptProviderDelegating, null);
+//            final CssMenuPanel cssMenuPanel = cssMenuBuilder.buildPanel(ID_ENTITY_ACTIONS, "Actions");
+//
+//            this.addOrReplace(cssMenuPanel);
 
-        final ObjectAdapterToggleboxColumn toggleboxColumn = addToggleboxColumnIfRequired(columns, bulkActions);
+  //      }
 
+        //List<ObjectAction> bulkActions = bulkActionsHelper.getBulkActions();
+
+
+        final EntityCollectionModel model = getModel();
         addTitleColumn(columns, model.getParentObjectAdapterMemento(), getSettings().getMaxTitleLengthInStandaloneTables(), getSettings().getMaxTitleLengthInStandaloneTables());
         addPropertyColumnsIfRequired(columns);
 
@@ -110,71 +135,55 @@ public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityColl
         addOrReplace(dataTable);
         dataTable.honourHints();
 
-        addActionPromptModalWindow();
-
-        // bulkactions
-        if(bulkActions.isEmpty() || getModel().isParented()) {
-            permanentlyHide(ID_ENTITY_ACTIONS);
-        } else {
-            BulkActionsLinkFactory linkFactory = new BulkActionsLinkFactory(getModel(), dataTable);
-            linkFactory.setToggleboxColumn(toggleboxColumn);
+        if(toggleboxColumn != null) {
+            final SelectionHandler handler = new SelectionHandler() {
 
-            actionLinkFactoryDelegating = new ActionLinkFactoryDelegating();
-            actionPromptProviderDelegating = new ActionPromptProviderDelegating();
+                private static final long serialVersionUID = 1L;
 
-            getBulkActionsProvider().configureBulkActionsProvider(linkFactory, this);
+                @Override
+                public void onSelected(
+                        final Component context,
+                        final ObjectAdapter selectedAdapter,
+                        final AjaxRequestTarget ajaxRequestTarget) {
+                    model.toggleSelectionOn(selectedAdapter);
+                }
 
-            final CssMenuBuilder cssMenuBuilder = new CssMenuBuilder(null, bulkActions, actionLinkFactoryDelegating, actionPromptProviderDelegating, null);
-            final CssMenuPanel cssMenuPanel = cssMenuBuilder.buildPanel(ID_ENTITY_ACTIONS, "Actions");
+                @Override
+                public void onConcurrencyException(
+                        final Component context,
+                        final ObjectAdapter selectedAdapter,
+                        final ConcurrencyException ex,
+                        final AjaxRequestTarget ajaxRequestTarget) {
 
-            this.addOrReplace(cssMenuPanel);
+                    // this causes the row to be repainted
+                    // but it isn't possible (yet) to raise any warning
+                    // because that only gets flushed on page refresh.
+                    //
 
+                    // perhaps something to tackle in a separate ticket....
+                    ajaxRequestTarget.add(dataTable);
+                }
+            };
+            toggleboxColumn.setHandler(handler);
         }
-    }
 
-    private BulkActionsProvider getBulkActionsProvider() {
-        return this;
-    }
-
-    private ObjectAdapterToggleboxColumn addToggleboxColumnIfRequired(
-            final List<IColumn<ObjectAdapter,String>> columns,
-            final List<ObjectAction> bulkActions) {
-        final EntityCollectionModel entityCollectionModel = getModel();
-        if(bulkActions.isEmpty() || entityCollectionModel.isParented()) {
-            return null;
-        }
-        
-        ObjectAdapterToggleboxColumn toggleboxColumn = new ObjectAdapterToggleboxColumn(new SelectionHandler() {
-            
-            private static final long serialVersionUID = 1L;
+        //addActionPromptModalWindow();
 
-            @Override
-            public void onSelected(
-                    final Component context, final ObjectAdapter selectedAdapter,
-                    AjaxRequestTarget ajaxRequestTarget) {
-                entityCollectionModel.toggleSelectionOn(selectedAdapter);
-            }
+    }
 
-            @Override
-            public void onConcurrencyException(
-                    final Component context, ObjectAdapter selectedAdapter, 
-                    ConcurrencyException ex,
-                    AjaxRequestTarget ajaxRequestTarget) {
-                
-                // this causes the row to be repainted
-                // but it isn't possible (yet) to raise any warning
-                // because that only gets flushed on page refresh.
-                //
-                
-                // perhaps something to tackle in a separate ticket....
-                ajaxRequestTarget.add(dataTable);
+    private BulkActionsProvider getBulkActionsProvider() {
+        Component component = this;
+        while(component != null) {
+            if(component instanceof BulkActionsProvider) {
+                return (BulkActionsProvider) component;
             }
-        });
-        columns.add(toggleboxColumn);
-        return toggleboxColumn;
+            component = component.getParent();
+        }
+        return null;
     }
 
 
+
     private void addTitleColumn(final List<IColumn<ObjectAdapter,String>> columns, ObjectAdapterMemento parentAdapterMementoIfAny, int maxTitleParented, int maxTitleStandalone) {
         int maxTitleLength = getModel().isParented()? maxTitleParented: maxTitleStandalone;
         columns.add(new ObjectAdapterTitleColumn(parentAdapterMementoIfAny, maxTitleLength));
@@ -249,19 +258,19 @@ public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityColl
     //endregion
 
 
-    //region > ActionPromptModalWindowProvider
-    
-    private ActionPromptModalWindow actionPromptModalWindow;
-    public ActionPromptModalWindow getActionPrompt() {
-        return ActionPromptModalWindow.getActionPromptModalWindowIfEnabled(actionPromptModalWindow);
-    }
-    
-    private void addActionPromptModalWindow() {
-        this.actionPromptModalWindow = ActionPromptModalWindow.newModalWindow(ID_ACTION_PROMPT_MODAL_WINDOW); 
-        addOrReplace(actionPromptModalWindow);
-    }
-
-    //endregion
+//    //region > ActionPromptModalWindowProvider
+//
+//    private ActionPromptModalWindow actionPromptModalWindow;
+//    public ActionPromptModalWindow getActionPrompt() {
+//        return ActionPromptModalWindow.getActionPromptModalWindowIfEnabled(actionPromptModalWindow);
+//    }
+//
+//    private void addActionPromptModalWindow() {
+//        this.actionPromptModalWindow = ActionPromptModalWindow.newModalWindow(ID_ACTION_PROMPT_MODAL_WINDOW);
+//        addOrReplace(actionPromptModalWindow);
+//    }
+//
+//    //endregion
 
     // //////////////////////////////////////
     
@@ -287,56 +296,6 @@ public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityColl
     // //////////////////////////////////////
 
 
-    private ActionPromptProviderDelegating actionPromptProviderDelegating;
-    private ActionLinkFactoryDelegating actionLinkFactoryDelegating;
-
-    @Override
-    public void configureBulkActionsProvider(
-            final ActionLinkFactory linkFactory,
-            final ActionPromptProvider actionPromptProvider) {
-        actionLinkFactoryDelegating.setDelegate(linkFactory);
-        actionPromptProviderDelegating.setDelegate(actionPromptProvider);
-    }
-
-    public static class ActionLinkFactoryDelegating implements ActionLinkFactory {
-
-        private ActionLinkFactory delegate;
-
-        public ActionLinkFactory getDelegate() {
-            return delegate;
-        }
-
-        public void setDelegate(ActionLinkFactory delegate) {
-            this.delegate = delegate;
-        }
-
-        @Override
-        public LinkAndLabel newLink(
-                final ObjectAdapterMemento adapter,
-                final ObjectAction noAction,
-                final String linkId,
-                final ActionPromptProvider actionPromptProvider) {
-            return delegate.newLink(adapter, noAction, linkId, actionPromptProvider);
-        }
-    }
-
-    public static class ActionPromptProviderDelegating implements ActionPromptProvider {
-
-        private ActionPromptProvider delegate;
-
-        public ActionPromptProvider getDelegate() {
-            return delegate;
-        }
-
-        public void setDelegate(ActionPromptProvider delegate) {
-            this.delegate = delegate;
-        }
-
-        @Override
-        public ActionPrompt getActionPrompt() {
-            return delegate.getActionPrompt();
-        }
-    }
 
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/9bad9179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/columns/ObjectAdapterToggleboxColumn.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/columns/ObjectAdapterToggleboxColumn.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/columns/ObjectAdapterToggleboxColumn.java
index 954a25a..31bb8ce 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/columns/ObjectAdapterToggleboxColumn.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/columns/ObjectAdapterToggleboxColumn.java
@@ -39,13 +39,21 @@ public final class ObjectAdapterToggleboxColumn extends ColumnAbstract<ObjectAda
 
     private static final long serialVersionUID = 1L;
 
-    private final SelectionHandler handler;
+    private SelectionHandler handler;
 
+    public ObjectAdapterToggleboxColumn() {
+        this(null);
+    }
+    
     public ObjectAdapterToggleboxColumn(final SelectionHandler handler) {
         super("");
         this.handler = handler;
     }
-    
+
+    public void setHandler(SelectionHandler handler) {
+        this.handler = handler;
+    }
+
     @Override
     public Component getHeader(String componentId) {
         
@@ -82,12 +90,16 @@ public final class ObjectAdapterToggleboxColumn extends ColumnAbstract<ObjectAda
                 ObjectAdapter selectedAdapter = null;
                 try {
                     selectedAdapter = entityModel.load(ConcurrencyChecking.CHECK);
-                    handler.onSelected(this, selectedAdapter, target);
+                    if(handler != null) {
+                        handler.onSelected(this, selectedAdapter, target);
+                    }
                 } catch(ConcurrencyException ex) {
 
                     // should work second time, because the previous attempt will have updated the OAM's OIDs version.
                     selectedAdapter = entityModel.load(ConcurrencyChecking.CHECK);
-                    handler.onConcurrencyException(this, selectedAdapter, ex, target);
+                    if(handler != null) {
+                        handler.onConcurrencyException(this, selectedAdapter, ex, target);
+                    }
                     
                     entityModel.setException(ex);
                 }

http://git-wip-us.apache.org/repos/asf/isis/blob/9bad9179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java
index 49db84a..e4a37b3 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java
@@ -75,7 +75,7 @@ public class CollectionContentsMultipleViewsPanel
         this.ignoreFactory = ignoreFactory;
         this.underlyingIdPrefix = ComponentType.COLLECTION_CONTENTS.toString();
         this.componentType = ignoreFactory.getComponentType();
-        selectorHelper = new CollectionSelectorHelper(model, getComponentFactoryRegistry(), ignoreFactory);
+        selectorHelper = new CollectionSelectorHelper(model, getComponentFactoryRegistry());
 
     }
 
@@ -92,7 +92,7 @@ public class CollectionContentsMultipleViewsPanel
         final EntityCollectionModel model = getModel();
 
         final int selected = selectorHelper.honourViewHintElseDefault(getSelectorDropdownPanel());
-        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
+        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories(getComponentFactoryRegistry());
 
         // create all, hide the one not selected
         underlyingViews = new Component[MAX_NUM_UNDERLYING_VIEWS];
@@ -140,7 +140,7 @@ public class CollectionContentsMultipleViewsPanel
         int underlyingViewNum = 0;
         String viewStr = uiHintContainer.getHint(this.getSelectorDropdownPanel(), UIHINT_VIEW);
 
-        List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
+        List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories(getComponentFactoryRegistry());
 
         if(viewStr != null) {
             try {

http://git-wip-us.apache.org/repos/asf/isis/blob/9bad9179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
index 876177d..beee965 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
@@ -128,9 +128,9 @@ public class EntityCollectionsPanel extends PanelAbstract<EntityModel> {
         AdditionalLinksPanel additionalLinks = new AdditionalLinksPanel(ID_ADDITIONAL_LINKS, links);
         fieldset.addOrReplace(additionalLinks);
 
-        final CollectionSelectorHelper selectorHelper = new CollectionSelectorHelper(entityCollectionModel, getComponentFactoryRegistry(), new CollectionContentsMultipleViewsPanelFactory());
+        final CollectionSelectorHelper selectorHelper = new CollectionSelectorHelper(entityCollectionModel, getComponentFactoryRegistry());
 
-        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
+        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories(getComponentFactoryRegistry());
 
         if (componentFactories.size() <= 1) {
             permanentlyHide(ID_SELECTOR_DROPDOWN);

http://git-wip-us.apache.org/repos/asf/isis/blob/9bad9179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
index d09c0bd..194d8fa 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.html
@@ -25,17 +25,16 @@
     <body>
         <wicket:panel>
 
+            <div wicket:id="actionPromptModalWindow"></div>
             <div class="standaloneCollectionPanel actionComponentType myBlockContainer panel panel-default">
                 <div class="iconAndTitle panel-heading actionPanelHeaderNew">
                      <div wicket:id="actionName" class="actionName panel-title">[action name]</div>
 
                     <div class="pull-right">
 
-                        <!--
                         <div class="btn-group">
-                            <div xxxwicket:id="additionalLinks"></div>
+                            <div class="entityActions" wicket:id="entityActions"></div>
                         </div>
-                        -->
                         <div class="btn-group">
                             <span wicket:id="selectorDropdown"/>
                         </div>

http://git-wip-us.apache.org/repos/asf/isis/blob/9bad9179/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
index 7ac4640..a4e76ce 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/standalonecollection/StandaloneCollectionPanel.java
@@ -22,33 +22,48 @@ package org.apache.isis.viewer.wicket.ui.components.standalonecollection;
 import java.util.List;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.model.Model;
-
 import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
 import org.apache.isis.viewer.wicket.model.models.ActionModel;
+import org.apache.isis.viewer.wicket.model.models.ActionPromptProvider;
 import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
 import org.apache.isis.viewer.wicket.ui.ComponentFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentType;
 import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistry;
+import org.apache.isis.viewer.wicket.ui.components.actionprompt.ActionPromptModalWindow;
 import org.apache.isis.viewer.wicket.ui.components.collection.count.CollectionCountProvider;
 import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorHelper;
 import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorPanel;
 import org.apache.isis.viewer.wicket.ui.components.collection.selector.CollectionSelectorProvider;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.BulkActionsHelper;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.BulkActionsLinkFactory;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.BulkActionsProvider;
+import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.columns.ObjectAdapterToggleboxColumn;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.multiple.CollectionContentsMultipleViewsPanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.ActionLinkFactory;
+import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.CssMenuBuilder;
+import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.CssMenuPanel;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
 
 public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionModel>
-        implements CollectionCountProvider, CollectionSelectorProvider {
+        implements CollectionCountProvider, CollectionSelectorProvider, BulkActionsProvider, ActionPromptProvider {
 
     private static final long serialVersionUID = 1L;
 
     private static final String ID_ACTION_NAME = "actionName";
-    private static final String ID_ADDITIONAL_LINKS = "additionalLinks";
+
+    private static final String ID_ACTION_PROMPT_MODAL_WINDOW = "actionPromptModalWindow";
+    private static final String ID_ENTITY_ACTIONS = "entityActions";
+
     private static final String ID_SELECTOR_DROPDOWN = "selectorDropdown";
     private CollectionSelectorPanel selectorDropdownPanel;
 
+    private final BulkActionsHelper bulkActionsHelper;
+
     public StandaloneCollectionPanel(final String id, final EntityCollectionModel entityCollectionModel) {
         super(id, entityCollectionModel);
         buildGui(entityCollectionModel);
+
+        bulkActionsHelper = new BulkActionsHelper(entityCollectionModel);
     }
 
     private void buildGui(final EntityCollectionModel entityCollectionModel) {
@@ -57,9 +72,24 @@ public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionMod
         ObjectAction action = actionModel.getActionMemento().getAction();
         addOrReplace(new Label(StandaloneCollectionPanel.ID_ACTION_NAME, Model.of(action.getName())));
 
-        final CollectionSelectorHelper selectorHelper = new CollectionSelectorHelper(entityCollectionModel, getComponentFactoryRegistry(), new CollectionContentsMultipleViewsPanelFactory());
+        final CollectionSelectorHelper selectorHelper = new CollectionSelectorHelper(entityCollectionModel, getComponentFactoryRegistry());
+
+        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories(getComponentFactoryRegistry());
+
+
+
+        addActionPromptModalWindow();
+
+        // bulkactions ... in configureBulkActionsProvider
+
+//        List<ObjectAction> bulkActions = bulkActionsHelper.getBulkActions();
+//
+//        if(bulkActions.isEmpty() || getModel().isParented()) {
+//            permanentlyHide(ID_ENTITY_ACTIONS);
+//        } else {
+//
+//        }
 
-        final List<ComponentFactory> componentFactories = selectorHelper.findOtherComponentFactories();
 
         if (componentFactories.size() <= 1) {
             permanentlyHide(ID_SELECTOR_DROPDOWN);
@@ -94,4 +124,107 @@ public class StandaloneCollectionPanel extends PanelAbstract<EntityCollectionMod
     public CollectionSelectorPanel getSelectorDropdownPanel() {
         return selectorDropdownPanel;
     }
+
+
+
+    //region > ActionPromptModalWindowProvider
+
+    private ActionPromptModalWindow actionPromptModalWindow;
+    public ActionPromptModalWindow getActionPrompt() {
+        return ActionPromptModalWindow.getActionPromptModalWindowIfEnabled(actionPromptModalWindow);
+    }
+
+    private void addActionPromptModalWindow() {
+        this.actionPromptModalWindow = ActionPromptModalWindow.newModalWindow(ID_ACTION_PROMPT_MODAL_WINDOW);
+        addOrReplace(actionPromptModalWindow);
+    }
+
+    //endregion
+
+
+
+
+    @Override
+    public void configureBulkActionsProvider(ObjectAdapterToggleboxColumn toggleboxColumn) {
+        BulkActionsLinkFactory linkFactory = new BulkActionsLinkFactory(getModel(), toggleboxColumn);
+        configureBulkActionsProvider(linkFactory, this);
+    }
+
+    private void configureBulkActionsProvider(
+            final ActionLinkFactory linkFactory,
+            final ActionPromptProvider actionPromptProvider) {
+
+        if(linkFactory != null) {
+            final List<ObjectAction> bulkActions = bulkActionsHelper.getBulkActions();
+
+            final CssMenuBuilder cssMenuBuilder = new CssMenuBuilder(null, bulkActions, linkFactory, actionPromptProvider != null? actionPromptProvider: this, null);
+            final CssMenuPanel cssMenuPanel = cssMenuBuilder.buildPanel(ID_ENTITY_ACTIONS, "Actions");
+
+            addOrReplace(cssMenuPanel);
+
+        } else {
+            permanentlyHide(ID_ENTITY_ACTIONS);
+
+        }
+    }
+
+
+    private List<ObjectAction> getBulkActions() {
+        return bulkActionsHelper.getBulkActions();
+    }
+
+//    public static class ActionLinkFactoryDelegating implements ActionLinkFactory {
+//
+//        private ActionLinkFactory delegate;
+//
+//        public ActionLinkFactory getDelegate() {
+//            return delegate;
+//        }
+//
+//        public void setDelegate(ActionLinkFactory delegate) {
+//            this.delegate = delegate;
+//        }
+//
+//        @Override
+//        public LinkAndLabel newLink(
+//                final ObjectAdapterMemento adapter,
+//                final ObjectAction noAction,
+//                final String linkId,
+//                final ActionPromptProvider actionPromptProvider) {
+//            return delegate.newLink(adapter, noAction, linkId, actionPromptProvider);
+//        }
+//    }
+//
+//    public static class ActionPromptProviderDelegating implements ActionPromptProvider {
+//
+//        private ActionPromptProvider delegate;
+//
+//        public ActionPromptProvider getDelegate() {
+//            return delegate;
+//        }
+//
+//        public void setDelegate(ActionPromptProvider delegate) {
+//            this.delegate = delegate;
+//        }
+//
+//        @Override
+//        public ActionPrompt getActionPrompt() {
+//            return delegate.getActionPrompt();
+//        }
+//    }
+
+
+    @Override
+    public ObjectAdapterToggleboxColumn createToggleboxColumn() {
+
+        final List<ObjectAction> bulkActions = getBulkActions();
+
+        final EntityCollectionModel entityCollectionModel = getModel();
+        if(bulkActions.isEmpty() || entityCollectionModel.isParented()) {
+            return null;
+        }
+
+        return new ObjectAdapterToggleboxColumn();
+    }
+
 }


[23/44] isis git commit: ISIS-537: updating comments only.

Posted by da...@apache.org.
ISIS-537: updating comments only.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/bb087872
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/bb087872
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/bb087872

Branch: refs/heads/master
Commit: bb0878725fb92199caada73e12511480ede613ba
Parents: 4912641
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sun Nov 9 12:20:40 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 10:21:39 2014 +0000

----------------------------------------------------------------------
 .../selector/links/EntityLinksSelectorPanelFactory.java   |  5 -----
 .../isis/viewer/wicket/ui/panels/PanelAbstract.java       | 10 +++++-----
 2 files changed, 5 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/bb087872/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanelFactory.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanelFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanelFactory.java
index 32a4c23..30b2ce3 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanelFactory.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanelFactory.java
@@ -29,12 +29,7 @@ import org.apache.isis.viewer.wicket.ui.components.entity.EntityComponentFactory
 
 /**
  * {@link ComponentFactory} for {@link EntityLinksSelectorPanel}.
- * 
- * <p>
- * Either this selector, or {@link EntityDropDownSelectorPanelFactory} should be registered;
- * but not both.
  */
-// TODO mgrigorov: EntityDropDownSelectorPanelFactory doesn't seem to exist anymore. Update the javadoc
 public class EntityLinksSelectorPanelFactory extends EntityComponentFactoryAbstract {
 
     private static final long serialVersionUID = 1L;

http://git-wip-us.apache.org/repos/asf/isis/blob/bb087872/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java
index daa7029..f873e00 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java
@@ -109,22 +109,22 @@ public abstract class PanelAbstract<T extends IModel<?>> extends Panel implement
 
     /**
      * Renders the corresponding CSS for this panel.
-     * 
+     *
      * <p>
-     * For most subclasses of {@link PanelAbstract} - specifically those that have their own {@link ComponentFactory}, 
+     * For most subclasses of {@link PanelAbstract} - specifically those that have their own {@link ComponentFactory},
      * it is additionally the responsibility (via {@link ComponentFactory#getCssResourceReference()}) of the factory
      * to declare the {@link CssResourceReference}(s) to be included.  These are then all bundled up into
      * a single unit, as part of the application bootstrapping (<tt>IsisWicketApplication#init</tt>).
-     * 
+     *
      * <p>
      * This is done because some browsers (we're looking at you, IE!) have a limit of only 31 CSS files.
-     * 
+     *
      * <p>
      * For subclasses that do not have a {@link ComponentFactory}, their CSS will simply be referenced standalone.
      */
     @Override
     public void renderHead(final IHeaderResponse response) {
-        // TODO: mgrigorov remove this stuff once happy no longer needed at all.
+        // TODO: mgrigorov remove this stuff once happy no longer needed at all, plus any CSS of panels that used to rely on this.
 //        PanelUtil.renderHead(response, this.getClass());
     }
 


[24/44] isis git commit: ISIS-537: collection actions now rendered in the panel header.

Posted by da...@apache.org.
ISIS-537: collection actions now rendered in the panel header.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/5918dd61
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/5918dd61
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/5918dd61

Branch: refs/heads/master
Commit: 5918dd61c41c4a80aea25746d68206108c2e8e0f
Parents: bb08787
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sun Nov 9 13:39:41 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 10:21:40 2014 +0000

----------------------------------------------------------------------
 .../additionallinks/EntityActionUtil.java       | 25 +++++++---
 .../components/collection/CollectionPanel.java  |  3 +-
 .../CollectionContentsLinksSelectorPanel.html   |  2 -
 .../CollectionContentsLinksSelectorPanel.java   | 50 +-------------------
 .../collections/EntityCollectionsPanel.html     | 31 ++++++++++++
 .../collections/EntityCollectionsPanel.java     | 14 ++++--
 .../wicket/ui/pages/bootstrap-overrides.css     |  4 ++
 7 files changed, 66 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/5918dd61/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/EntityActionUtil.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/EntityActionUtil.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/EntityActionUtil.java
index e6d86cb..5382a4f 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/EntityActionUtil.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/additionallinks/EntityActionUtil.java
@@ -59,7 +59,17 @@ public final class EntityActionUtil {
             final ObjectAssociation association,
             final ActionPromptProvider actionPromptProvider,
             final DeploymentType deploymentType) {
-        
+
+        return entityActionsForAssociation(
+                entityModel, association, actionPromptProvider, deploymentType, ID_ADDITIONAL_LINK);
+    }
+
+    public static List<LinkAndLabel> entityActionsForAssociation(
+            final EntityModel entityModel,
+            final ObjectAssociation association,
+            final ActionPromptProvider actionPromptProvider,
+            final DeploymentType deploymentType,
+            final String linkId) {
         final List<ObjectAction> associatedActions = Lists.newArrayList();
 
         addActions(ActionType.USER, entityModel, association, associatedActions);
@@ -67,7 +77,7 @@ public final class EntityActionUtil {
             addActions(ActionType.EXPLORATION, entityModel, association, associatedActions);
             addActions(ActionType.PROTOTYPE, entityModel, association, associatedActions);
         }
-        
+
         Collections.sort(associatedActions, new Comparator<ObjectAction>() {
 
             @Override
@@ -75,16 +85,17 @@ public final class EntityActionUtil {
                 final MemberOrderFacet m1 = o1.getFacet(MemberOrderFacet.class);
                 final MemberOrderFacet m2 = o2.getFacet(MemberOrderFacet.class);
                 return memberOrderFacetComparator.compare(m1, m2);
-            }});
-        
+            }
+        });
+
         final ActionLinkFactory linkFactory = new EntityActionLinkFactory(entityModel);
-    
+
         final ObjectAdapterMemento adapterMemento = entityModel.getObjectAdapterMemento();
         return Lists.transform(associatedActions, new Function<ObjectAction, LinkAndLabel>(){
-    
+
             @Override
             public LinkAndLabel apply(ObjectAction objectAction) {
-                return linkFactory.newLink(adapterMemento, objectAction, ID_ADDITIONAL_LINK, actionPromptProvider);
+                return linkFactory.newLink(adapterMemento, objectAction, linkId, actionPromptProvider);
             }});
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/5918dd61/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/CollectionPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/CollectionPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/CollectionPanel.java
index 0f26d28..ec68145 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/CollectionPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/CollectionPanel.java
@@ -50,7 +50,6 @@ public class CollectionPanel extends PanelAbstract<EntityCollectionModel> implem
 
     private static final long serialVersionUID = 1L;
 
-    private static final String ID_COLLECTION = "collection";
     private static final String ID_FEEDBACK = "feedback";
     private static final String ID_ACTION_PROMPT_MODAL_WINDOW = "actionPromptModalWindow";
 
@@ -77,7 +76,7 @@ public class CollectionPanel extends PanelAbstract<EntityCollectionModel> implem
 
         addActionPromptModalWindow();
         
-        List<LinkAndLabel> entityActions = EntityActionUtil.entityActionsForAssociation(entityModel, otma, this, getDeploymentType());
+        List<LinkAndLabel> entityActions = EntityActionUtil.entityActionsForAssociation(entityModel, otma, this, getDeploymentType(), "additionalLink");
         collectionModel.addEntityActions(entityActions);
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/5918dd61/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
index d35d523..1fbf7df 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.html
@@ -39,8 +39,6 @@
             </ul>
         </div>
 
-        <span wicket:id="additionalLinks"></span>
-
         <div class="views">
             <div wicket:id="collectionContents-0" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>
             <div wicket:id="collectionContents-1" class="collectionContentsLinksSelectorPanel collectionContentsComponentType"></div>

http://git-wip-us.apache.org/repos/asf/isis/blob/5918dd61/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
index c68bf71..d0d987b 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/selector/links/CollectionContentsLinksSelectorPanel.java
@@ -28,7 +28,6 @@ import com.google.common.collect.Collections2;
 import com.google.common.collect.Lists;
 import org.apache.wicket.AttributeModifier;
 import org.apache.wicket.Component;
-import org.apache.wicket.MarkupContainer;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.markup.html.AjaxLink;
 import org.apache.wicket.event.Broadcast;
@@ -48,20 +47,16 @@ import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
 import org.apache.isis.viewer.wicket.model.hints.IsisUiHintEvent;
 import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
 import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
-import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
-import org.apache.isis.viewer.wicket.model.links.LinksProvider;
 import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
 import org.apache.isis.viewer.wicket.ui.CollectionContentsAsFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentType;
-import org.apache.isis.viewer.wicket.ui.components.additionallinks.AdditionalLinksPanel;
 import org.apache.isis.viewer.wicket.ui.components.collection.CollectionCountProvider;
 import org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable.CollectionContentsAsAjaxTablePanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.collectioncontents.unresolved.CollectionContentsAsUnresolvedPanelFactory;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
 import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
-import org.apache.isis.viewer.wicket.ui.util.Components;
 import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
 import org.apache.isis.viewer.wicket.ui.util.CssClassRemover;
 
@@ -78,8 +73,6 @@ public class CollectionContentsLinksSelectorPanel
     private static final String INVISIBLE_CLASS = "link-selector-panel-invisible";
     private static final int MAX_NUM_UNDERLYING_VIEWS = 10;
 
-    private static final String ID_ADDITIONAL_LINKS = "additionalLinks";
-
     private static final String ID_VIEWS = "views";
     private static final String ID_VIEW_LIST = "viewList";
     private static final String ID_VIEW_LINK = "viewLink";
@@ -114,34 +107,10 @@ public class CollectionContentsLinksSelectorPanel
     public void onInitialize() {
         super.onInitialize();
         ComponentFactory componentFactory = getComponentFactoryRegistry().findComponentFactoryElseFailFast(getComponentType(), getModel());
-        addAdditionalLinks(getModel());
         addUnderlyingViews(underlyingIdPrefix, getModel(), componentFactory);
-        applyCssVisibility(additionalLinks, selectedComponent instanceof CollectionCountProvider);
     }
 
 
-    protected void addAdditionalLinks(final EntityCollectionModel model) {
-        if(!(model instanceof LinksProvider)) {
-            permanentlyHide(ID_ADDITIONAL_LINKS);
-            return;
-        }
-        LinksProvider linksProvider = (LinksProvider) model;
-        List<LinkAndLabel> links = linksProvider.getLinks();
-
-        addAdditionalLinks(this, links);
-    }
-
-    protected void addAdditionalLinks(MarkupContainer markupContainer, List<LinkAndLabel> links) {
-        if(links == null || links.isEmpty()) {
-            Components.permanentlyHide(markupContainer, ID_ADDITIONAL_LINKS);
-            return;
-        }
-        links = Lists.newArrayList(links); // copy, to serialize any lazy evaluation
-
-        additionalLinks = new AdditionalLinksPanel(ID_ADDITIONAL_LINKS, links);
-        markupContainer.addOrReplace(additionalLinks);
-    }
-
     private void addUnderlyingViews(final String underlyingIdPrefix, final EntityCollectionModel model, final ComponentFactory factory) {
         final List<ComponentFactory> componentFactories = findOtherComponentFactories(model, factory);
 
@@ -152,7 +121,7 @@ public class CollectionContentsLinksSelectorPanel
         // create all, hide the one not selected
         final Component[] underlyingViews = new Component[MAX_NUM_UNDERLYING_VIEWS];
         int i = 0;
-        final EntityCollectionModel emptyModel = dummyOf(model);
+        final EntityCollectionModel emptyModel = model.asDummy();
         for (ComponentFactory componentFactory : componentFactories) {
             final String underlyingId = underlyingIdPrefix + "-" + i;
 
@@ -209,7 +178,7 @@ public class CollectionContentsLinksSelectorPanel
                             CollectionContentsLinksSelectorPanel linksSelectorPanel = CollectionContentsLinksSelectorPanel.this;
                             linksSelectorPanel.setViewHintAndBroadcast(underlyingViewNum, target);
 
-                            final EntityCollectionModel dummyModel = dummyOf(model);
+                            final EntityCollectionModel dummyModel = model.asDummy();
                             for(int i=0; i<MAX_NUM_UNDERLYING_VIEWS; i++) {
                                 final Component component = underlyingViews[i];
                                 if(component == null) {
@@ -424,21 +393,6 @@ public class CollectionContentsLinksSelectorPanel
     }
 
 
-
-
-
-
-
-    /**
-     * Ask for a dummy (empty) {@link Model} to pass into those components that are rendered but will be
-     * made invisible using CSS styling.
-     */
-    protected EntityCollectionModel dummyOf(EntityCollectionModel model) {
-        return model.asDummy();
-    }
-
-    
-
     static List<ComponentFactory> orderAjaxTableToEnd(List<ComponentFactory> componentFactories) {
         int ajaxTableIdx = findAjaxTable(componentFactories);
         if(ajaxTableIdx>=0) {

http://git-wip-us.apache.org/repos/asf/isis/blob/5918dd61/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
index 90fdc22..216d9c9 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
@@ -23,9 +23,40 @@
             <div class="entityCollectionsPanel entityCollectionsComponentType">
                 <div wicket:id="collections" class="myBlockContainer">
                     <div wicket:id="collectionGroup" class="panel panel-default">
+
                         <div class="panel-heading">
                             <span wicket:id="collectionName" class="panel-title">[collection name]</span>
+                            <div class="pull-right">
+
+                                <!--
+                                <div class="btn-group">
+                                    <a href="#" class="btn btn-default btn-sm">## Lock</a>
+                                    <a href="#" class="btn btn-default btn-sm">## Delete</a>
+                                    <a href="#" class="btn btn-default btn-sm">## Move</a>
+                                </div>
+                                -->
+
+                                <div class="btn-group">
+                                    <div wicket:id="additionalLinks"></div>
+                                </div>
+
+                                <!--
+                                <div class="btn-group">
+                                    <ul xxwicket:id="viewList" class="dropdown-menu dropdown-menu-right" role="menu">
+                                        <li xxwicket:id="viewItem" class="viewItem">
+                                            <a href="#" xxwicket:id="viewLink">
+                                                <span xxwicket:id="viewItemIcon" class="ViewLinkItem"></span> <span xxwicket:id="viewItemTitle" class="ViewLinkItemTitle">[link title]</span>
+                                            </a>
+                                        </li>
+                                    </ul>
+                                </div>
+                                -->
+
+                            </div>
                         </div>
+
+
+
                         <div wicket:id="collection" class="collection panel-body">
                             [collection]
                         </div>

http://git-wip-us.apache.org/repos/asf/isis/blob/5918dd61/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
index f18ba4a..55ad54b 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
@@ -20,11 +20,9 @@
 package org.apache.isis.viewer.wicket.ui.components.entity.collections;
 
 import java.util.List;
-
 import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.repeater.RepeatingView;
-
 import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.applib.filter.Filter;
 import org.apache.isis.applib.filter.Filters;
@@ -34,7 +32,10 @@ import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.Contributed;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
+import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
 import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.components.additionallinks.AdditionalLinksPanel;
 import org.apache.isis.viewer.wicket.ui.components.collection.CollectionPanel;
 import org.apache.isis.viewer.wicket.ui.components.widgets.containers.UiHintPathSignificantWebMarkupContainer;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
@@ -54,6 +55,8 @@ public class EntityCollectionsPanel extends PanelAbstract<EntityModel> {
     private static final String ID_COLLECTIONS = "collections";
     private static final String ID_COLLECTION = "collection";
 
+    private static final String ID_ADDITIONAL_LINKS = "additionalLinks";
+
     private Label labelComponent;
 
 
@@ -109,12 +112,15 @@ public class EntityCollectionsPanel extends PanelAbstract<EntityModel> {
         final OneToManyAssociation otma = (OneToManyAssociation) association;
 
         final CollectionPanel collectionPanel = new CollectionPanel(ID_COLLECTION, entityModel, otma);
+        fieldset.addOrReplace(collectionPanel);
 
         labelComponent = collectionPanel.createLabel(ID_COLLECTION_NAME, association.getName());
-
         fieldset.add(labelComponent);
 
-        fieldset.addOrReplace(collectionPanel);
+        final EntityCollectionModel entityCollectionModel = collectionPanel.getModel();
+        List<LinkAndLabel> links = entityCollectionModel.getLinks();
+        AdditionalLinksPanel additionalLinks = new AdditionalLinksPanel(ID_ADDITIONAL_LINKS, links);
+        fieldset.addOrReplace(additionalLinks);
     }
 
     private List<ObjectAssociation> visibleCollections(final ObjectAdapter adapter, final ObjectSpecification noSpec) {

http://git-wip-us.apache.org/repos/asf/isis/blob/5918dd61/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
index 9c287ff..cb7ed79 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
@@ -158,3 +158,7 @@ div.label-left .choicesPlaceholder {
 .modal-body textarea {
     resize: none;
 }
+
+.entityCollectionsPanel .panel-heading {
+    padding-bottom: 15px;
+}
\ No newline at end of file


[03/44] isis git commit: ISIS-939: more simplified of persistence sessions and object stores.

Posted by da...@apache.org.
ISIS-939: more simplified of persistence sessions and object stores.

- deleted ObjectStoreSpi, just use ObjectStore (impl) directly;
- deleted AdapterManagerAbstract, not used
- deleted AdapterMapDelegator, not used
- for in-memory objectstore, renamed ObjectStorePersistedObjectsDefault (impl) to ObjectStorePersistedObjects (unextracted interface)
- renamed PersistenceSessionFactoryDelegate to ObjectStoreFactory
- renamed PersistenceSessionFactoryDelegating to PersistenceSessionFactory (unextracted interface)
- removed AdapterManagerSpi interface, just use AdapterManagerDefault directly instead.
- deleted AdpaterUtils, not used


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/fab4f479
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/fab4f479
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/fab4f479

Branch: refs/heads/master
Commit: fab4f4797ee276f32896bc711bb1ca70a033501f
Parents: 46dc3a4
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Nov 3 19:27:18 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Nov 6 16:18:55 2014 +0000

----------------------------------------------------------------------
 .../integtestsupport/IsisSystemDefault.java     |   2 +-
 .../integtestsupport/IsisSystemForTest.java     |   4 +-
 .../adapter/mgr/AdapterManagerAbstract.java     |  31 ---
 .../adapter/mgr/AdapterMapDelegator.java        |  50 ----
 .../noruntime/RuntimeContextNoRuntime.java      |  12 +-
 .../core/objectstore/InMemoryObjectStore.java   |  22 +-
 .../InMemoryPersistenceMechanismInstaller.java  |   6 +-
 .../InMemoryPersistenceSessionFactory.java      |  13 +-
 .../AbstractInMemoryPersistenceCommand.java     |   1 -
 .../commands/InMemoryCreateObjectCommand.java   |   1 -
 .../commands/InMemoryDestroyObjectCommand.java  |   1 -
 .../commands/InMemorySaveObjectCommand.java     |   1 -
 .../internal/ObjectStoreInstances.java          |   7 +-
 .../internal/ObjectStorePersistedObjects.java   |  62 ++++-
 .../ObjectStorePersistedObjectsDefault.java     | 102 --------
 .../PersistenceMechanismInstaller.java          |   6 +-
 .../PersistenceMechanismInstallerAbstract.java  |   5 +-
 .../persistence/FixturesInstalledFlag.java      |   3 +-
 .../runtime/persistence/ObjectStoreFactory.java |  35 +++
 .../persistence/PersistenceConstants.java       |   2 -
 .../PersistenceSessionFactoryDelegate.java      |  36 ---
 .../PersistenceSessionFactoryDelegating.java    | 237 -------------------
 .../adaptermanager/AdapterManagerDefault.java   |  62 +++--
 .../adaptermanager/AdapterUtils.java            |  58 -----
 .../persistence/objectstore/ObjectStoreSpi.java |  27 ---
 .../transaction/TransactionalResource.java      |  18 +-
 .../system/IsisSystemFixturesHookAbstract.java  |   2 +-
 .../core/runtime/system/SystemConstants.java    |   3 +-
 .../system/persistence/AdapterManagerSpi.java   |  51 ----
 .../runtime/system/persistence/ObjectStore.java |   7 +-
 .../system/persistence/PersistenceSession.java  |  13 +-
 .../persistence/PersistenceSessionFactory.java  | 199 ++++++++++++++--
 .../runtime/system/persistence/Persistor.java   |   2 +-
 .../system/session/IsisSessionFactory.java      |   6 +-
 .../session/IsisSessionFactoryDefault.java      |   3 +-
 .../IsisSystemAbstract.java                     |   4 +-
 .../IsisSystemUsingInstallers.java              |   2 +-
 .../jdo/datanucleus/DataNucleusObjectStore.java |   8 +-
 ...ataNucleusPersistenceMechanismInstaller.java |   4 +-
 ...bjectStoreInstances_findInstancesAndAdd.java |  16 +-
 ...tStorePersistedObjectsDefault_instances.java |   5 +-
 ...jectsDefault_savesOidGeneratorAsMemento.java |   4 +-
 ...ctStorePersistedObjectsDefault_services.java |   4 +-
 .../core/runtime/context/IsisContextTest.java   |  10 +-
 .../persistence/PersistenceSessionTest.java     |   5 +-
 ...onFactoryAbstractTest_init_and_shutdown.java |   2 +-
 .../system/transaction/IsisTransactionTest.java |  18 +-
 .../IsisSystemWithFixtures.java                 |   4 +-
 .../tck/ObjectStoreContractTest_persist.java    |   6 +-
 .../InMemoryObjectStoreTest_openAndClose.java   |   7 +-
 50 files changed, 407 insertions(+), 782 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemDefault.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemDefault.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemDefault.java
index 8f8a05c..65d0ac9 100644
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemDefault.java
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemDefault.java
@@ -42,10 +42,10 @@ import org.apache.isis.core.runtime.authorization.standard.AuthorizationManagerS
 import org.apache.isis.core.runtime.fixtures.FixturesInstaller;
 import org.apache.isis.core.runtime.fixtures.FixturesInstallerFromConfiguration;
 import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.core.runtime.services.ServicesInstallerFromConfiguration;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.IsisSystemException;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.core.runtime.systemusinginstallers.IsisSystemAbstract;
 import org.apache.isis.core.runtime.transaction.facetdecorator.standard.StandardTransactionFacetDecorator;
 import org.apache.isis.core.security.authentication.AuthenticatorBypass;

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java
index b4976ff..66ac70c 100644
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java
@@ -47,10 +47,10 @@ import org.apache.isis.core.runtime.authentication.AuthenticationRequest;
 import org.apache.isis.core.runtime.fixtures.FixturesInstallerDelegate;
 import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
 import org.apache.isis.core.runtime.logging.IsisLoggingConfigurer;
-import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
 import org.apache.isis.core.runtime.services.ServicesInstallerFromAnnotation;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.ObjectStore;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.core.runtime.system.persistence.Persistor;
 import org.apache.isis.core.runtime.system.transaction.IsisTransaction;
@@ -565,7 +565,7 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
     }
 
     @SuppressWarnings("unchecked")
-    public <T extends ObjectStoreSpi> T getObjectStore(Class<T> cls) {
+    public <T extends ObjectStore> T getObjectStore(Class<T> cls) {
         final PersistenceSession persistenceSession = getPersistenceSession();
         return (T) persistenceSession.getObjectStore();
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManagerAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManagerAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManagerAbstract.java
deleted file mode 100644
index a3ee9ad..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManagerAbstract.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.isis.core.metamodel.adapter.mgr;
-
-import org.apache.isis.core.commons.components.Injectable;
-
-public abstract class AdapterManagerAbstract implements AdapterManager, Injectable {
-
-    @Override
-    public void injectInto(final Object candidate) {
-        if (AdapterManagerAware.class.isAssignableFrom(candidate.getClass())) {
-            final AdapterManagerAware cast = AdapterManagerAware.class.cast(candidate);
-            cast.setAdapterManager(this);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterMapDelegator.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterMapDelegator.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterMapDelegator.java
deleted file mode 100644
index 51ab391..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterMapDelegator.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.isis.core.metamodel.adapter.mgr;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
-
-/**
- * Just delegates to an underlying {@link AdapterManager}.
- * 
- * <p>
- * Provided to allow subclasses to override specific methods if required.
- */
-public abstract class AdapterMapDelegator extends AdapterManagerAbstract {
-
-    private final AdapterManager underlying;
-
-    public AdapterMapDelegator(final AdapterManager underlying) {
-        this.underlying = underlying;
-    }
-
-    @Override
-    public ObjectAdapter getAdapterFor(final Object pojo) {
-        return underlying.getAdapterFor(pojo);
-    }
-
-    @Override
-    public ObjectAdapter adapterFor(final Object domainObject) {
-        return underlying.adapterFor(domainObject);
-    }
-
-    @Override
-    public ObjectAdapter adapterFor(final Object pojo, final ObjectAdapter ownerAdapter, final OneToManyAssociation collection) {
-        return underlying.adapterFor(pojo, ownerAdapter, collection);
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/noruntime/RuntimeContextNoRuntime.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/noruntime/RuntimeContextNoRuntime.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/noruntime/RuntimeContextNoRuntime.java
index 33c0419..8e19839 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/noruntime/RuntimeContextNoRuntime.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/noruntime/RuntimeContextNoRuntime.java
@@ -29,7 +29,7 @@ import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider
 import org.apache.isis.core.commons.authentication.AuthenticationSessionProviderAbstract;
 import org.apache.isis.core.metamodel.adapter.*;
 import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManagerAbstract;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManagerAware;
 import org.apache.isis.core.metamodel.adapter.oid.Oid;
 import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
 import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
@@ -96,7 +96,15 @@ public class RuntimeContextNoRuntime extends RuntimeContextAbstract {
                 throw new UnsupportedOperationException("Not supported by this implementation of RuntimeContext");
             }
         };
-        adapterManager = new AdapterManagerAbstract() {
+        adapterManager = new AdapterManager() {
+
+            @Override
+            public void injectInto(final Object candidate) {
+                if (AdapterManagerAware.class.isAssignableFrom(candidate.getClass())) {
+                    final AdapterManagerAware cast = AdapterManagerAware.class.cast(candidate);
+                    cast.setAdapterManager(this);
+                }
+            }
 
             @Override
             public ObjectAdapter getAdapterFor(final Object pojo) {

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryObjectStore.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryObjectStore.java b/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryObjectStore.java
index 5ae36cf..58a426c 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryObjectStore.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryObjectStore.java
@@ -23,14 +23,9 @@ import java.text.MessageFormat;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Vector;
-
 import com.google.common.collect.Lists;
-
-import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.commons.debug.DebugUtils;
 import org.apache.isis.core.commons.exceptions.IsisException;
@@ -52,21 +47,21 @@ import org.apache.isis.core.objectstore.commands.InMemoryDestroyObjectCommand;
 import org.apache.isis.core.objectstore.commands.InMemorySaveObjectCommand;
 import org.apache.isis.core.objectstore.internal.ObjectStoreInstances;
 import org.apache.isis.core.objectstore.internal.ObjectStorePersistedObjects;
-import org.apache.isis.core.objectstore.internal.ObjectStorePersistedObjectsDefault;
+import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
 import org.apache.isis.core.runtime.persistence.ObjectPersistenceException;
 import org.apache.isis.core.runtime.persistence.UnsupportedFindException;
-import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.CreateObjectCommand;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.DestroyObjectCommand;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.PersistenceCommand;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.SaveObjectCommand;
 import org.apache.isis.core.runtime.persistence.query.PersistenceQueryBuiltIn;
 import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.ObjectStore;
 import org.apache.isis.core.runtime.system.persistence.PersistenceQuery;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 
-public class InMemoryObjectStore implements ObjectStoreSpi {
+public class InMemoryObjectStore implements ObjectStore {
 
     private final static Logger LOG = LoggerFactory.getLogger(InMemoryObjectStore.class);
 
@@ -99,7 +94,7 @@ public class InMemoryObjectStore implements ObjectStoreSpi {
             if (inMemoryPersistenceSessionFactory != null) {
                 persistedObjects = inMemoryPersistenceSessionFactory.createPersistedObjects();
             } else {
-                persistedObjects = new ObjectStorePersistedObjectsDefault();
+                persistedObjects = new ObjectStorePersistedObjects();
             }
         } else {
             recreateAdapters();
@@ -465,8 +460,7 @@ public class InMemoryObjectStore implements ObjectStoreSpi {
     /**
      * Must use {@link IsisContext context}, because although this object is
      * recreated with each {@link PersistenceSession session}, the persisted
-     * objects that get
-     * {@link #attachPersistedObjects(ObjectStorePersistedObjects) attached} to
+     * objects that get attached to
      * it span multiple sessions.
      * 
      * <p>
@@ -481,9 +475,7 @@ public class InMemoryObjectStore implements ObjectStoreSpi {
     /**
      * Must use {@link IsisContext context}, because although this object is
      * recreated with each {@link PersistenceSession session}, the persisted
-     * objects that get
-     * {@link #attachPersistedObjects(ObjectStorePersistedObjects) attached} to
-     * it span multiple sessions.
+     * objects that get attached to it span multiple sessions.
      * 
      * <p>
      * The alternative design would be to laboriously inject the session into
@@ -500,7 +492,7 @@ public class InMemoryObjectStore implements ObjectStoreSpi {
 
 
     /**
-     * Downcasts the {@link PersistenceSessionFactory} to
+     * Downcasts the {@link org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory} to
      * {@link InMemoryPersistenceSessionFactory}.
      */
     protected InMemoryPersistenceSessionFactory getInMemoryPersistenceSessionFactory() {

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryPersistenceMechanismInstaller.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryPersistenceMechanismInstaller.java b/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryPersistenceMechanismInstaller.java
index 293d557..cc48c06 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryPersistenceMechanismInstaller.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryPersistenceMechanismInstaller.java
@@ -21,8 +21,8 @@ package org.apache.isis.core.objectstore;
 
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstallerAbstract;
-import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
 import org.apache.isis.core.runtime.system.DeploymentType;
+import org.apache.isis.core.runtime.system.persistence.ObjectStore;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 
 /**
@@ -50,10 +50,10 @@ public class InMemoryPersistenceMechanismInstaller extends PersistenceMechanismI
     // ///////////////////////////////////////////////////////////////
 
     /**
-     * Hook method to return {@link ObjectStoreSpi}.
+     * Hook method to return {@link ObjectStore}.
      */
     @Override
-    public ObjectStoreSpi createObjectStore(
+    public ObjectStore createObjectStore(
             final IsisConfiguration configuration) {
         return new InMemoryObjectStore();
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryPersistenceSessionFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryPersistenceSessionFactory.java b/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryPersistenceSessionFactory.java
index 3dc4ed1..455ca6a 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryPersistenceSessionFactory.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryPersistenceSessionFactory.java
@@ -22,21 +22,20 @@ package org.apache.isis.core.objectstore;
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.objectstore.internal.ObjectStoreInstances;
 import org.apache.isis.core.objectstore.internal.ObjectStorePersistedObjects;
-import org.apache.isis.core.objectstore.internal.ObjectStorePersistedObjectsDefault;
-import org.apache.isis.core.runtime.persistence.PersistenceSessionFactoryDelegate;
-import org.apache.isis.core.runtime.persistence.PersistenceSessionFactoryDelegating;
+import org.apache.isis.core.runtime.persistence.ObjectStoreFactory;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.persistence.IdentifierGenerator;
 import org.apache.isis.core.runtime.system.persistence.IdentifierGeneratorDefault;
 import org.apache.isis.core.runtime.system.persistence.OidGenerator;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 
-public class InMemoryPersistenceSessionFactory extends PersistenceSessionFactoryDelegating {
+public class InMemoryPersistenceSessionFactory extends PersistenceSessionFactory {
 
     private ObjectStorePersistedObjects persistedObjects;
 
-    public InMemoryPersistenceSessionFactory(final DeploymentType deploymentType, final IsisConfiguration configuration, final PersistenceSessionFactoryDelegate persistenceSessionFactoryDelegate) {
-        super(deploymentType, configuration, persistenceSessionFactoryDelegate);
+    public InMemoryPersistenceSessionFactory(final DeploymentType deploymentType, final IsisConfiguration configuration, final ObjectStoreFactory objectStoreFactory) {
+        super(deploymentType, configuration, objectStoreFactory);
     }
 
     ObjectStorePersistedObjects getPersistedObjects() {
@@ -63,7 +62,7 @@ public class InMemoryPersistenceSessionFactory extends PersistenceSessionFactory
      * {@link InMemoryObjectStore#open() open}ed.
      */
     public ObjectStorePersistedObjects createPersistedObjects() {
-        return new ObjectStorePersistedObjectsDefault();
+        return new ObjectStorePersistedObjects();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/AbstractInMemoryPersistenceCommand.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/AbstractInMemoryPersistenceCommand.java b/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/AbstractInMemoryPersistenceCommand.java
index 6937cf6..9c5602c 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/AbstractInMemoryPersistenceCommand.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/AbstractInMemoryPersistenceCommand.java
@@ -21,7 +21,6 @@ package org.apache.isis.core.objectstore.commands;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.ObjectSpecId;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/InMemoryCreateObjectCommand.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/InMemoryCreateObjectCommand.java b/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/InMemoryCreateObjectCommand.java
index efab9de..af2d363 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/InMemoryCreateObjectCommand.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/InMemoryCreateObjectCommand.java
@@ -21,7 +21,6 @@ package org.apache.isis.core.objectstore.commands;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.objectstore.internal.ObjectStorePersistedObjects;
 import org.apache.isis.core.runtime.persistence.ObjectPersistenceException;

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/InMemoryDestroyObjectCommand.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/InMemoryDestroyObjectCommand.java b/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/InMemoryDestroyObjectCommand.java
index 18d6b0c..16093ab 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/InMemoryDestroyObjectCommand.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/InMemoryDestroyObjectCommand.java
@@ -21,7 +21,6 @@ package org.apache.isis.core.objectstore.commands;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.objectstore.internal.ObjectStorePersistedObjects;
 import org.apache.isis.core.runtime.persistence.ObjectPersistenceException;

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/InMemorySaveObjectCommand.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/InMemorySaveObjectCommand.java b/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/InMemorySaveObjectCommand.java
index 789b86f..4b48f61 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/InMemorySaveObjectCommand.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/objectstore/commands/InMemorySaveObjectCommand.java
@@ -21,7 +21,6 @@ package org.apache.isis.core.objectstore.commands;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.objectstore.internal.ObjectStorePersistedObjects;
 import org.apache.isis.core.runtime.persistence.ObjectPersistenceException;

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/objectstore/internal/ObjectStoreInstances.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/objectstore/internal/ObjectStoreInstances.java b/core/runtime/src/main/java/org/apache/isis/core/objectstore/internal/ObjectStoreInstances.java
index 3a6ea23..028dffb 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/objectstore/internal/ObjectStoreInstances.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/objectstore/internal/ObjectStoreInstances.java
@@ -40,7 +40,6 @@ import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.objectstore.InMemoryObjectStore;
 import org.apache.isis.core.runtime.persistence.query.PersistenceQueryBuiltIn;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.AdapterManagerSpi;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 
 /*
@@ -125,10 +124,8 @@ public class ObjectStoreInstances {
 
     /**
      * If the pojo exists in the object store, then looks up the
-     * {@link ObjectAdapter adapter} from the {@link AdapterManagerSpi}, and only
-     * if none found does it
-     * {@link PersistenceSessionHydrator#mapRecreatedPojo(Object, Object) recreate}
-     * a new {@link ObjectAdapter adapter}.
+     * {@link ObjectAdapter adapter} from the {@link org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault}, and only
+     * if none found does it recreates a new {@link ObjectAdapter adapter}.
      */
     public ObjectAdapter getObjectAndMapIfRequired(final Oid oid) {
         final Object pojo = getObjectInstances().get(oid);

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjects.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjects.java b/core/runtime/src/main/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjects.java
index 85dffcb..4e3cf35 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjects.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjects.java
@@ -19,6 +19,12 @@
 
 package org.apache.isis.core.objectstore.internal;
 
+import java.util.Map;
+import java.util.Set;
+
+import com.google.common.collect.Maps;
+
+import org.apache.isis.core.commons.exceptions.IsisException;
 import org.apache.isis.core.metamodel.adapter.oid.Oid;
 import org.apache.isis.core.metamodel.spec.ObjectSpecId;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
@@ -29,22 +35,60 @@ import org.apache.isis.core.runtime.system.persistence.IdentifierGeneratorDefaul
  * 
  * Attached and detached to each session.
  */
-public interface ObjectStorePersistedObjects {
+public class ObjectStorePersistedObjects {
+
+    private final Map<ObjectSpecId, ObjectStoreInstances> instancesBySpecMap = Maps.newHashMap();
+    private final Map<ObjectSpecId, Oid> serviceOidByIdMap = Maps.newHashMap();
+
+    private IdentifierGeneratorDefault.Memento oidGeneratorMemento;
+
 
-    public IdentifierGeneratorDefault.Memento getOidGeneratorMemento();
+    public IdentifierGeneratorDefault.Memento getOidGeneratorMemento() {
+        return oidGeneratorMemento;
+    }
 
-    public void saveOidGeneratorMemento(IdentifierGeneratorDefault.Memento memento);
+    public void saveOidGeneratorMemento(final IdentifierGeneratorDefault.Memento memento) {
+        this.oidGeneratorMemento = memento;
+    }
 
-    public void registerService(ObjectSpecId objectSpecId, Oid oid);
+    public Oid getService(final ObjectSpecId objectSpecId) {
+        return serviceOidByIdMap.get(objectSpecId);
+    }
 
-    public Oid getService(ObjectSpecId objectSpecId);
+    public void registerService(final ObjectSpecId objectSpecId, final Oid oid) {
+        final Oid oidLookedUpByName = serviceOidByIdMap.get(objectSpecId);
+        if (oidLookedUpByName != null) {
+            if (oidLookedUpByName.equals(oid)) {
+                throw new IsisException("Already another service registered as name: " + objectSpecId + " (existing Oid: " + oidLookedUpByName + ", " + "intended: " + oid + ")");
+            }
+        } else {
+            serviceOidByIdMap.put(objectSpecId, oid);
+        }
+    }
 
-    public Iterable<ObjectSpecId> specifications();
+    // TODO: this is where the clever logic needs to go to determine how to save
+    // into our custom Map.
+    // also think we shouldn't surface the entire Map, just the API we require
+    // (keySet, values etc).
+    public ObjectStoreInstances instancesFor(final ObjectSpecId specId) {
+        ObjectStoreInstances ins = instancesBySpecMap.get(specId);
+        if (ins == null) {
+            ins = new ObjectStoreInstances(specId);
+            instancesBySpecMap.put(specId, ins);
+        }
+        return ins;
+    }
 
-    public ObjectStoreInstances instancesFor(ObjectSpecId spec);
+    public Iterable<ObjectSpecId> specifications() {
+        return instancesBySpecMap.keySet();
+    }
 
-    public Iterable<ObjectStoreInstances> instances();
+    public void clear() {
+        instancesBySpecMap.clear();
+    }
 
-    public void clear();
+    public Iterable<ObjectStoreInstances> instances() {
+        return instancesBySpecMap.values();
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjectsDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjectsDefault.java b/core/runtime/src/main/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjectsDefault.java
deleted file mode 100644
index 33d06a0..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/objectstore/internal/ObjectStorePersistedObjectsDefault.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.objectstore.internal;
-
-import java.util.Map;
-import java.util.Set;
-
-import com.google.common.collect.Maps;
-
-import org.apache.isis.core.commons.exceptions.IsisException;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.spec.ObjectSpecId;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.runtime.system.persistence.IdentifierGeneratorDefault;
-
-/**
- * Represents the persisted objects.
- * 
- * Attached and detached to each session.
- */
-public class ObjectStorePersistedObjectsDefault implements ObjectStorePersistedObjects {
-
-    private final Map<ObjectSpecId, ObjectStoreInstances> instancesBySpecMap = Maps.newHashMap();
-    private final Map<ObjectSpecId, Oid> serviceOidByIdMap = Maps.newHashMap();
-
-    private IdentifierGeneratorDefault.Memento oidGeneratorMemento;
-
-
-    @Override
-    public IdentifierGeneratorDefault.Memento getOidGeneratorMemento() {
-        return oidGeneratorMemento;
-    }
-
-    @Override
-    public void saveOidGeneratorMemento(final IdentifierGeneratorDefault.Memento memento) {
-        this.oidGeneratorMemento = memento;
-    }
-
-    @Override
-    public Oid getService(final ObjectSpecId objectSpecId) {
-        return serviceOidByIdMap.get(objectSpecId);
-    }
-
-    @Override
-    public void registerService(final ObjectSpecId objectSpecId, final Oid oid) {
-        final Oid oidLookedUpByName = serviceOidByIdMap.get(objectSpecId);
-        if (oidLookedUpByName != null) {
-            if (oidLookedUpByName.equals(oid)) {
-                throw new IsisException("Already another service registered as name: " + objectSpecId + " (existing Oid: " + oidLookedUpByName + ", " + "intended: " + oid + ")");
-            }
-        } else {
-            serviceOidByIdMap.put(objectSpecId, oid);
-        }
-    }
-
-    // TODO: this is where the clever logic needs to go to determine how to save
-    // into our custom Map.
-    // also think we shouldn't surface the entire Map, just the API we require
-    // (keySet, values etc).
-    @Override
-    public ObjectStoreInstances instancesFor(final ObjectSpecId specId) {
-        ObjectStoreInstances ins = instancesBySpecMap.get(specId);
-        if (ins == null) {
-            ins = new ObjectStoreInstances(specId);
-            instancesBySpecMap.put(specId, ins);
-        }
-        return ins;
-    }
-
-    @Override
-    public Iterable<ObjectSpecId> specifications() {
-        return instancesBySpecMap.keySet();
-    }
-
-    @Override
-    public void clear() {
-        instancesBySpecMap.clear();
-    }
-
-    @Override
-    public Iterable<ObjectStoreInstances> instances() {
-        return instancesBySpecMap.values();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java
index 3376c02..f7594cc 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java
@@ -20,15 +20,15 @@
 package org.apache.isis.core.runtime.installerregistry.installerapi;
 
 import org.apache.isis.core.commons.components.Installer;
-import org.apache.isis.core.runtime.persistence.PersistenceSessionFactoryDelegate;
+import org.apache.isis.core.runtime.persistence.ObjectStoreFactory;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 
 /**
  * Installs a {@link PersistenceSession} during system start up.
  */
-public interface PersistenceMechanismInstaller extends Installer, PersistenceSessionFactoryDelegate {
+public interface PersistenceMechanismInstaller extends Installer, ObjectStoreFactory {
 
     static String TYPE = "persistor";
 

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstallerAbstract.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstallerAbstract.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstallerAbstract.java
index 75e6fc4..58e04ae 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstallerAbstract.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstallerAbstract.java
@@ -27,11 +27,10 @@ import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
 import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidator;
 import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
-import org.apache.isis.core.runtime.persistence.PersistenceSessionFactoryDelegating;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.persistence.ObjectFactory;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 
 /**
  * An abstract implementation of {@link PersistenceMechanismInstaller} that will
@@ -52,7 +51,7 @@ public abstract class PersistenceMechanismInstallerAbstract extends InstallerAbs
     
     @Override
     public PersistenceSessionFactory createPersistenceSessionFactory(final DeploymentType deploymentType) {
-        return new PersistenceSessionFactoryDelegating(deploymentType, getConfiguration(), this);
+        return new PersistenceSessionFactory(deploymentType, getConfiguration(), this);
     }
 
     //endregion

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/FixturesInstalledFlag.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/FixturesInstalledFlag.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/FixturesInstalledFlag.java
index 44ded4d..8eacc26 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/FixturesInstalledFlag.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/FixturesInstalledFlag.java
@@ -20,10 +20,9 @@
 package org.apache.isis.core.runtime.persistence;
 
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 
 /**
- * For {@link PersistenceSessionFactory} implementations that can cache the
+ * For {@link org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory} implementations that can cache the
  * {@link PersistenceSession#isFixturesInstalled()} so is only called once per
  * application scope.
  */

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectStoreFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectStoreFactory.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectStoreFactory.java
new file mode 100644
index 0000000..fb0fdec
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/ObjectStoreFactory.java
@@ -0,0 +1,35 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.runtime.persistence;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.config.IsisConfigurationBuilderAware;
+import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
+import org.apache.isis.core.runtime.system.persistence.ObjectStore;
+
+/**
+ * Creates an {@link org.apache.isis.core.runtime.system.persistence.ObjectStore} on behalf of a
+ * {@link org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory}.
+ */
+public interface ObjectStoreFactory extends IsisConfigurationBuilderAware, MetaModelRefiner {
+
+    ObjectStore createObjectStore(final IsisConfiguration configuration);
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceConstants.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceConstants.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceConstants.java
index cdeaaec..0d97653 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceConstants.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceConstants.java
@@ -19,8 +19,6 @@
 
 package org.apache.isis.core.runtime.persistence;
 
-import org.apache.isis.core.runtime.system.persistence.ObjectFactory;
-
 public final class PersistenceConstants {
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceSessionFactoryDelegate.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceSessionFactoryDelegate.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceSessionFactoryDelegate.java
deleted file mode 100644
index 59a6010..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceSessionFactoryDelegate.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.persistence;
-
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.commons.config.IsisConfigurationBuilderAware;
-import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
-import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
-
-/**
- * Creates an {@link org.apache.isis.core.runtime.system.persistence.ObjectStore} on behalf of a
- * {@link PersistenceSessionFactory}.
- */
-public interface PersistenceSessionFactoryDelegate extends IsisConfigurationBuilderAware, MetaModelRefiner {
-
-    ObjectStoreSpi createObjectStore(final IsisConfiguration configuration);
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceSessionFactoryDelegating.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceSessionFactoryDelegating.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceSessionFactoryDelegating.java
deleted file mode 100644
index 69153f2..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceSessionFactoryDelegating.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.persistence;
-
-import java.util.List;
-import java.util.Properties;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.isis.applib.clock.Clock;
-import org.apache.isis.applib.fixtures.FixtureClock;
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.services.ServicesInjectorDefault;
-import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
-import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
-import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
-import org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession;
-import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
-import org.apache.isis.core.runtime.system.DeploymentType;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
-import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
-
-import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
-import static org.apache.isis.core.commons.ensure.Ensure.ensureThatState;
-import static org.hamcrest.CoreMatchers.*;
-
-/**
- * Implementation that just delegates to a supplied
- * {@link PersistenceSessionFactoryDelegate}.
- */
-public class PersistenceSessionFactoryDelegating implements PersistenceSessionFactory, FixturesInstalledFlag {
-
-    private static final Logger LOG = LoggerFactory.getLogger(PersistenceSessionFactoryDelegating.class);
-
-    private final DeploymentType deploymentType;
-    private final IsisConfiguration configuration;
-    private final PersistenceSessionFactoryDelegate persistenceSessionFactoryDelegate;
-
-    /**
-     * @see #setServices(List)
-     */
-    private List<Object> serviceList;
-
-    private Boolean fixturesInstalled;
-
-    private final ServicesInjectorSpi servicesInjector = new ServicesInjectorDefault();
-    private RuntimeContext runtimeContext;
-
-    public PersistenceSessionFactoryDelegating(
-            final DeploymentType deploymentType, 
-            final IsisConfiguration isisConfiguration, 
-            final PersistenceSessionFactoryDelegate persistenceSessionFactoryDelegate) {
-        this.deploymentType = deploymentType;
-        this.configuration = isisConfiguration;
-        this.persistenceSessionFactoryDelegate = persistenceSessionFactoryDelegate;
-    }
-
-    @Override
-    public DeploymentType getDeploymentType() {
-        return deploymentType;
-    }
-
-    public PersistenceSessionFactoryDelegate getDelegate() {
-        return persistenceSessionFactoryDelegate;
-    }
-
-    @Override
-    public PersistenceSession createPersistenceSession() {
-
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("installing " + this.getClass().getName());
-        }
-
-        ServicesInjectorSpi servicesInjector = getServicesInjector();
-
-        final ObjectStoreSpi objectStore = persistenceSessionFactoryDelegate.createObjectStore(getConfiguration());
-
-        ensureThatArg(objectStore, is(not(nullValue())));
-
-        final PersistenceSession persistenceSession =new PersistenceSession(this, servicesInjector, objectStore, getConfiguration());
-
-        final IsisTransactionManager transactionManager = new IsisTransactionManager(persistenceSession, objectStore, servicesInjector);
-
-        persistenceSession.setDirtiableSupport(true);
-        persistenceSession.setTransactionManager(transactionManager);
-
-        return persistenceSession;
-    }
-
-    @Override
-    public final void init() {
-
-        // check prereq dependencies injected
-        ensureThatState(serviceList, is(notNullValue()));
-
-        // a bit of a workaround, but required if anything in the metamodel (for
-        // example, a
-        // ValueSemanticsProvider for a date value type) needs to use the Clock
-        // singleton
-        // we do this after loading the services to allow a service to prime a
-        // different clock
-        // implementation (eg to use an NTP time service).
-        if (!deploymentType.isProduction() && !Clock.isInitialized()) {
-            FixtureClock.initialize();
-        }
-
-        runtimeContext = createRuntimeContext(getConfiguration());
-        ensureThatState(runtimeContext, is(not(nullValue())));
-
-        // inject the specification loader etc.
-        runtimeContext.injectInto(servicesInjector);
-        
-        // wire up components
-
-        getSpecificationLoader().injectInto(runtimeContext);
-        for (Object service : serviceList) {
-            runtimeContext.injectInto(service);
-        }
-
-        servicesInjector.setServices(serviceList);
-        servicesInjector.init();
-    }
-
-    private RuntimeContext createRuntimeContext(final IsisConfiguration configuration) {
-        final RuntimeContextFromSession runtimeContext = new RuntimeContextFromSession();
-        final Properties properties = applicationPropertiesFrom(configuration);
-        runtimeContext.setProperties(properties);
-        return runtimeContext;
-    }
-
-    private static Properties applicationPropertiesFrom(final IsisConfiguration configuration) {
-        final Properties properties = new Properties();
-        final IsisConfiguration applicationConfiguration = configuration.getProperties("application");
-        for (final String key : applicationConfiguration) {
-            final String value = applicationConfiguration.getString(key);
-            final String newKey = key.substring("application.".length());
-            properties.setProperty(newKey, value);
-        }
-        return properties;
-    }
-
-
-
-    @Override
-    public final void shutdown() {
-        doShutdown();
-    }
-
-    /**
-     * Optional hook method for implementation-specific shutdown.
-     */
-    protected void doShutdown() {
-    }
-
-    
-    // //////////////////////////////////////////////////////
-    // Components (setup during init...)
-    // //////////////////////////////////////////////////////
-
-    public ServicesInjectorSpi getServicesInjector() {
-        return servicesInjector;
-    }
-
-    // //////////////////////////////////////////////////////
-    // MetaModelAdjuster impl
-    // //////////////////////////////////////////////////////
-
-    @Override
-    public void refineMetaModelValidator(MetaModelValidatorComposite metaModelValidator, IsisConfiguration configuration) {
-        persistenceSessionFactoryDelegate.refineMetaModelValidator(metaModelValidator, configuration);
-    }
-
-    @Override
-    public void refineProgrammingModel(ProgrammingModel baseProgrammingModel, IsisConfiguration configuration) {
-        persistenceSessionFactoryDelegate.refineProgrammingModel(baseProgrammingModel, configuration);
-    }
-
-    // //////////////////////////////////////////////////////
-    // FixturesInstalledFlag impl
-    // //////////////////////////////////////////////////////
-
-    @Override
-    public Boolean isFixturesInstalled() {
-        return fixturesInstalled;
-    }
-
-    @Override
-    public void setFixturesInstalled(final Boolean fixturesInstalled) {
-        this.fixturesInstalled = fixturesInstalled;
-    }
-
-    // //////////////////////////////////////////////////////
-    // Dependencies (injected from constructor)
-    // //////////////////////////////////////////////////////
-
-    public IsisConfiguration getConfiguration() {
-        return configuration;
-    }
-    
-    // //////////////////////////////////////////////////////
-    // Dependencies (injected via setters)
-    // //////////////////////////////////////////////////////
-
-    @Override
-    public void setServices(final List<Object> serviceList) {
-        this.serviceList = serviceList;
-    }
-
-    // //////////////////////////////////////////////////////
-    // Dependencies (from context)
-    // //////////////////////////////////////////////////////
-
-    protected SpecificationLoaderSpi getSpecificationLoader() {
-        return IsisContext.getSpecificationLoader();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
index 9d67051..8de9088 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
@@ -19,43 +19,33 @@
 
 package org.apache.isis.core.runtime.persistence.adaptermanager;
 
-import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.hamcrest.CoreMatchers.nullValue;
-
 import java.util.Iterator;
-
-import org.apache.isis.core.runtime.persistence.PojoRecreationException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.components.Resettable;
+import org.apache.isis.core.commons.components.SessionScopedComponent;
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.commons.debug.DebugBuilder;
+import org.apache.isis.core.commons.debug.DebuggableWithTitle;
 import org.apache.isis.core.commons.ensure.Assert;
 import org.apache.isis.core.commons.ensure.Ensure;
 import org.apache.isis.core.commons.ensure.IsisAssertException;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
 import org.apache.isis.core.metamodel.adapter.ResolveState;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
 import org.apache.isis.core.metamodel.adapter.mgr.AdapterManagerAware;
-import org.apache.isis.core.metamodel.adapter.oid.AggregatedOid;
-import org.apache.isis.core.metamodel.adapter.oid.CollectionOid;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
-import org.apache.isis.core.metamodel.adapter.oid.RootOid;
-import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
+import org.apache.isis.core.metamodel.adapter.oid.*;
 import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
 import org.apache.isis.core.metamodel.adapter.version.Version;
-import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.facets.actcoll.typeof.ElementSpecificationProviderFromTypeOfFacet;
+import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacet;
 import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
 import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacetUtils;
 import org.apache.isis.core.metamodel.facets.object.parented.ParentedFacet;
 import org.apache.isis.core.metamodel.facets.object.value.ValueFacet;
-import org.apache.isis.core.metamodel.facets.actcoll.typeof.ElementSpecificationProviderFromTypeOfFacet;
-import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacet;
+import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollectionAccessorFacet;
 import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
 import org.apache.isis.core.metamodel.spec.ObjectSpecId;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
@@ -63,12 +53,36 @@ import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
 import org.apache.isis.core.metamodel.spec.feature.Contributed;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.core.runtime.persistence.PojoRecreationException;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.AdapterManagerSpi;
+import org.apache.isis.core.runtime.system.persistence.AdapterLifecycleTransitioner;
 import org.apache.isis.core.runtime.system.persistence.OidGenerator;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
+import org.apache.isis.core.runtime.system.persistence.RecreatedPojoRemapper;
+
+import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
+import static org.hamcrest.CoreMatchers.*;
 
-public class AdapterManagerDefault implements AdapterManagerSpi {
+/**
+ * Responsible for managing the {@link ObjectAdapter adapter}s and {@link Oid
+ * identities} for each and every POJO that is being used by the framework.
+ *
+ * <p>
+ * It provides a consistent set of adapters in memory, providing an
+ * {@link ObjectAdapter adapter} for the POJOs that are in use ensuring that the
+ * same object is not loaded twice into memory.
+ *
+ * <p>
+ * Each POJO is given an {@link ObjectAdapter adapter} so that the framework can
+ * work with the POJOs even though it does not understand their types. Each POJO
+ * maps to an {@link ObjectAdapter adapter} and these are reused.
+ */
+public class AdapterManagerDefault implements AdapterManager, Iterable<ObjectAdapter>,
+        RecreatedPojoRemapper,
+        AdapterLifecycleTransitioner,
+        SessionScopedComponent,
+        DebuggableWithTitle,
+        Resettable {
 
     private static final Logger LOG = LoggerFactory.getLogger(AdapterManagerDefault.class);
 
@@ -87,7 +101,7 @@ public class AdapterManagerDefault implements AdapterManagerSpi {
      * to allow transient objects to be reattached; can instead provide a
      * {@link PojoRecreator} implementation that is injected into the Adapter Manager.
      * 
-     * @see http://www.datanucleus.org/servlet/forum/viewthread_thread,7238_lastpage,yes#35976
+     * @see <a href="http://www.datanucleus.org/servlet/forum/viewthread_thread,7238_lastpage,yes#35976">this thread</a>
      */
     public AdapterManagerDefault(PojoRecreator pojoRecreator) {
         this.pojoRecreator = pojoRecreator;
@@ -292,12 +306,12 @@ public class AdapterManagerDefault implements AdapterManagerSpi {
 
     @Override
     public ObjectAdapter adapterFor(final TypedOid typedOid) {
-        return adapterFor(typedOid, ConcurrencyChecking.NO_CHECK);
+        return adapterFor(typedOid, AdapterManager.ConcurrencyChecking.NO_CHECK);
     }
 
 
     @Override
-    public ObjectAdapter adapterFor(final TypedOid typedOid, final ConcurrencyChecking concurrencyChecking) {
+    public ObjectAdapter adapterFor(final TypedOid typedOid, final AdapterManager.ConcurrencyChecking concurrencyChecking) {
 
         // attempt to locate adapter for the Oid
         ObjectAdapter adapter = getAdapterFor(typedOid);
@@ -327,7 +341,7 @@ public class AdapterManagerDefault implements AdapterManagerSpi {
                        otherVersion != null && 
                        thisVersion.different(otherVersion)) {
                         
-                        if(isConcurrencyCheckingGloballyEnabled() && ConcurrencyChecking.isCurrentlyEnabled()) {
+                        if(isConcurrencyCheckingGloballyEnabled() && AdapterManager.ConcurrencyChecking.isCurrentlyEnabled()) {
                             LOG.info("concurrency conflict detected on " + recreatedOid + " (" + otherVersion + ")");
                             final String currentUser = getAuthenticationSession().getUserName();
                             throw new ConcurrencyException(currentUser, recreatedOid, thisVersion, otherVersion);

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterUtils.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterUtils.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterUtils.java
deleted file mode 100644
index b610802..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterUtils.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.persistence.adaptermanager;
-
-import org.apache.isis.core.commons.exceptions.UnknownTypeException;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacetUtils;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
-import org.apache.isis.core.runtime.system.persistence.AdapterManagerSpi;
-
-public final class AdapterUtils {
-    private AdapterUtils() {
-    }
-
-    public static ObjectAdapter createAdapter(final Class<?> type, final Object object, final AdapterManagerSpi adapterManager, final SpecificationLoaderSpi specificationLoader) {
-        final ObjectSpecification specification = specificationLoader.loadSpecification(type);
-        if (specification.isNotCollection()) {
-            return adapterManager.adapterFor(object);
-        } else {
-            throw new UnknownTypeException("not an object, is this a collection?");
-        }
-    }
-
-    public static Object[] getCollectionAsObjectArray(final Object option, final ObjectSpecification spec, final AdapterManagerSpi adapterManager) {
-        final ObjectAdapter collection = adapterManager.adapterFor(option);
-        final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(collection);
-        final Object[] optionArray = new Object[facet.size(collection)];
-        int j = 0;
-        for (final ObjectAdapter adapter : facet.iterable(collection)) {
-            optionArray[j++] = adapter.getObject();
-        }
-        return optionArray;
-    }
-
-    public static Object domainObject(final ObjectAdapter inObject) {
-        return inObject == null ? null : inObject.getObject();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/ObjectStoreSpi.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/ObjectStoreSpi.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/ObjectStoreSpi.java
deleted file mode 100644
index 82ce9f1..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/ObjectStoreSpi.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.persistence.objectstore;
-
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.TransactionalResource;
-import org.apache.isis.core.runtime.system.persistence.ObjectStore;
-
-public interface ObjectStoreSpi extends ObjectStore, TransactionalResource {
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/TransactionalResource.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/TransactionalResource.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/TransactionalResource.java
index 8e8ad1b..1e012d8 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/TransactionalResource.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/TransactionalResource.java
@@ -20,40 +20,38 @@
 package org.apache.isis.core.runtime.persistence.objectstore.transaction;
 
 import java.util.List;
-
-import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
 import org.apache.isis.core.runtime.system.transaction.IsisTransaction;
 import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
 
 /**
  * Interface for the {@link IsisTransactionManager} to interact with some
- * transactional resource (ie a {@link ObjectStoreSpi}).
+ * transactional resource (ie a {@link org.apache.isis.core.runtime.system.persistence.ObjectStore}).
  */
 public interface TransactionalResource {
 
     /**
-     * Used by the {@link ObjectStoreTransactionManager} to tell the underlying
-     * {@link ObjectStoreSpi} to start a transaction.
+     * Used by the {@link IsisTransactionManager} to tell the underlying
+     * {@link org.apache.isis.core.runtime.system.persistence.ObjectStore} to start a transaction.
      */
     void startTransaction();
 
     /**
      * Used by the current {@link IsisTransaction} to flush changes to
-     * the {@link ObjectStoreSpi} (either via a
+     * the {@link org.apache.isis.core.runtime.system.persistence.ObjectStore} (either via a
      * {@link IsisTransactionManager#flushTransaction()} or a
      * {@link IsisTransactionManager#endTransaction()}).
      */
     void execute(List<PersistenceCommand> unmodifiableList);
 
     /**
-     * Used by the {@link ObjectStoreTransactionManager} to tell the underlying
-     * {@link ObjectStoreSpi} to commit a transaction.
+     * Used by the {@link IsisTransactionManager} to tell the underlying
+     * {@link org.apache.isis.core.runtime.system.persistence.ObjectStore} to commit a transaction.
      */
     void endTransaction();
 
     /**
-     * Used by the {@link ObjectStoreTransactionManager} to tell the underlying
-     * {@link ObjectStoreSpi} to abort a transaction.
+     * Used by the {@link IsisTransactionManager} to tell the underlying
+     * {@link org.apache.isis.core.runtime.system.persistence.ObjectStore} to abort a transaction.
      */
     void abortTransaction();
 

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/system/IsisSystemFixturesHookAbstract.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/IsisSystemFixturesHookAbstract.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/IsisSystemFixturesHookAbstract.java
index 7f4aa22..7f4d207 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/IsisSystemFixturesHookAbstract.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/IsisSystemFixturesHookAbstract.java
@@ -37,11 +37,11 @@ import org.apache.isis.core.runtime.authentication.AuthenticationManager;
 import org.apache.isis.core.runtime.authentication.exploration.ExplorationSession;
 import org.apache.isis.core.runtime.authorization.AuthorizationManager;
 import org.apache.isis.core.runtime.installerregistry.InstallerLookup;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.internal.InitialisationSession;
 import org.apache.isis.core.runtime.system.internal.IsisLocaleInitializer;
 import org.apache.isis.core.runtime.system.internal.IsisTimeZoneInitializer;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.core.runtime.system.session.IsisSession;
 import org.apache.isis.core.runtime.system.session.IsisSessionFactory;
 import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/system/SystemConstants.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/SystemConstants.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/SystemConstants.java
index 62a2bee..5d82d26 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/SystemConstants.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/SystemConstants.java
@@ -30,7 +30,6 @@ import org.apache.isis.core.runtime.authorization.AuthorizationManagerInstaller;
 import org.apache.isis.core.runtime.fixtures.FixturesInstaller;
 import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
 import org.apache.isis.core.runtime.services.ServicesInstaller;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 
 public final class SystemConstants {
 
@@ -57,7 +56,7 @@ public final class SystemConstants {
 
 
     /**
-     * Key used to lookup {@link PersistenceSessionFactory persistor} in
+     * Key used to lookup {@link org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory persistor} in
      * {@link IsisConfiguration}, and root for any
      * {@link PersistenceMechanismInstaller persistor}-specific configuration
      * keys.

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/AdapterManagerSpi.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/AdapterManagerSpi.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/AdapterManagerSpi.java
deleted file mode 100644
index 9d11937..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/AdapterManagerSpi.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.system.persistence;
-
-import org.apache.isis.core.commons.components.Resettable;
-import org.apache.isis.core.commons.components.SessionScopedComponent;
-import org.apache.isis.core.commons.debug.DebuggableWithTitle;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-
-/**
- * Responsible for managing the {@link ObjectAdapter adapter}s and {@link Oid
- * identities} for each and every POJO that is being used by the framework.
- * 
- * <p>
- * It provides a consistent set of adapters in memory, providing an
- * {@link ObjectAdapter adapter} for the POJOs that are in use ensuring that the
- * same object is not loaded twice into memory.
- * 
- * <p>
- * Each POJO is given an {@link ObjectAdapter adapter} so that the framework can
- * work with the POJOs even though it does not understand their types. Each POJO
- * maps to an {@link ObjectAdapter adapter} and these are reused.
- */
-public interface AdapterManagerSpi extends AdapterManager, Iterable<ObjectAdapter>,
-    RecreatedPojoRemapper,
-    AdapterLifecycleTransitioner,
-    SessionScopedComponent,
-    DebuggableWithTitle,  
-    Resettable {
-
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java
index 539b393..a5b8005 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java
@@ -29,12 +29,9 @@ import org.apache.isis.core.metamodel.adapter.oid.RootOid;
 import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.CreateObjectCommand;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.DestroyObjectCommand;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.PersistenceCommand;
-import org.apache.isis.core.runtime.persistence.objectstore.transaction.SaveObjectCommand;
+import org.apache.isis.core.runtime.persistence.objectstore.transaction.*;
 
-public interface ObjectStore extends DebuggableWithTitle, SessionScopedComponent {
+public interface ObjectStore extends TransactionalResource, DebuggableWithTitle, SessionScopedComponent {
 
     /**
      * The name of this component.

http://git-wip-us.apache.org/repos/asf/isis/blob/fab4f479/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
index cdd3a10..294ef30 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
@@ -57,7 +57,6 @@ import org.apache.isis.core.runtime.persistence.NotPersistableException;
 import org.apache.isis.core.runtime.persistence.adapter.PojoAdapterFactory;
 import org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault;
 import org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorUnified;
-import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
 import org.apache.isis.core.runtime.persistence.objectstore.algorithm.PersistAlgorithm;
 import org.apache.isis.core.runtime.persistence.objectstore.algorithm.PersistAlgorithmUnified;
 import org.apache.isis.core.runtime.persistence.objectstore.algorithm.ToPersistObjectSet;
@@ -82,7 +81,7 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
     private final ObjectAdapterFactory objectAdapterFactory;
     private final ServicesInjectorSpi servicesInjector;
     private final OidGenerator oidGenerator;
-    private final AdapterManagerSpi adapterManager;
+    private final AdapterManagerDefault adapterManager;
 
     private final PersistAlgorithm persistAlgorithm ;
     private final ObjectStore objectStore;
@@ -574,10 +573,10 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
      * initialise the persistor.
      * 
      * <p>
-     * Returns the cached value of {@link ObjectStoreSpi#isFixturesInstalled()
+     * Returns the cached value of {@link ObjectStore#isFixturesInstalled()
      * whether fixtures are installed} from the
      * {@link PersistenceSessionFactory} (provided it implements
-     * {@link FixturesInstalledFlag}), otherwise queries {@link ObjectStoreSpi}
+     * {@link FixturesInstalledFlag}), otherwise queries {@link ObjectStore}
      * directly.
      * <p>
      * This caching is important because if we've determined, for a given run,
@@ -979,8 +978,8 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
     }
 
     /**
-     * Uses the {@link ObjectStoreSpi} to
-     * {@link ObjectStoreSpi#createCreateObjectCommand(ObjectAdapter) create} a
+     * Uses the {@link ObjectStore} to
+     * {@link ObjectStore#createCreateObjectCommand(ObjectAdapter) create} a
      * {@link CreateObjectCommand}, and adds to the
      * {@link IsisTransactionManager}.
      */
@@ -1104,7 +1103,7 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
     }
 
     /**
-     * The configured {@link AdapterManagerSpi}.
+     * The configured {@link AdapterManager}.
      * 
      * <p>
      * Injected in constructor.


[13/44] isis git commit: ISIS-537 Add 20px under the entity (EntityPropertiesPanel) to make a clear distinction with the row for entityCollectionsOverflow

Posted by da...@apache.org.
ISIS-537 Add 20px under the entity (EntityPropertiesPanel) to make a clear distinction with the row for entityCollectionsOverflow

https://trello.com/c/3LYn12tx/115-a-bit-more-space-underneath-the-ok-edit-cancel-buttons


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/d905d387
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/d905d387
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/d905d387

Branch: refs/heads/master
Commit: d905d387a07eba8e1af3462b944fb3203a76a0d2
Parents: bbdf17b
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Fri Nov 7 13:13:06 2014 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Fri Nov 7 13:13:06 2014 +0200

----------------------------------------------------------------------
 .../ui/components/entity/properties/EntityPropertiesPanel.html     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/d905d387/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/properties/EntityPropertiesPanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/properties/EntityPropertiesPanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/properties/EntityPropertiesPanel.html
index 18dfd1d..e5ff967 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/properties/EntityPropertiesPanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/properties/EntityPropertiesPanel.html
@@ -22,7 +22,7 @@
         <wicket:panel>
             <div class="entityPropertiesPanel entityPropertiesComponentType">
                 <form wicket:id="entityProperties" class="inputForm" role="form">
-                    <div class="row">
+                    <div class="row" style="padding-bottom: 20px">
                         <div wicket:id="leftColumn">
                             <div class="inputFormTable properties">
                                 <fieldset wicket:id="memberGroup" class="memberGroup myBlockContainer">


[10/44] isis git commit: ISIS-941: don't try to flush property changes from form for disabled properties.

Posted by da...@apache.org.
ISIS-941: don't try to flush property changes from form for disabled properties.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/6f2296ce
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/6f2296ce
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/6f2296ce

Branch: refs/heads/master
Commit: 6f2296ce0d399435acb792df72c759825bfd245e
Parents: 0ecd015
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Tue Nov 4 23:53:53 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Nov 6 16:19:04 2014 +0000

----------------------------------------------------------------------
 .../isis/viewer/wicket/model/models/EntityModel.java | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/6f2296ce/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
index a2ec3df..3955c31 100644
--- a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
+++ b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
@@ -36,6 +36,7 @@ import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
 import org.apache.isis.core.metamodel.adapter.oid.RootOid;
 import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
 import org.apache.isis.core.metamodel.consent.Consent;
+import org.apache.isis.core.metamodel.facets.members.disabled.DisabledFacet;
 import org.apache.isis.core.metamodel.facets.object.bookmarkpolicy.BookmarkPolicyFacet;
 import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacet;
 import org.apache.isis.core.metamodel.spec.ObjectSpecId;
@@ -580,6 +581,20 @@ public class EntityModel extends BookmarkableModel<ObjectAdapter> implements UiH
             // for example, see ExampleTaggableEntity (in isisaddons-module-tags).
             //
 
+            //
+            // on the other hand, we mustn't attempt to apply changes for disabled properties...
+            // even if the property is persisted (it might be written to by an action), it is never updated by
+            // an edit.
+            //
+            // Fundamentally, then, any non-disabled property (whether persisted or not) should be updated in the
+            // Isis runtime.
+            //
+
+            if(property.containsDoOpFacet(DisabledFacet.class)) {
+                // skip, as per comments above
+                continue;
+            }
+
             final ObjectAdapter associate = scalarModel.getObject();
             property.set(adapter, associate);
         }


[35/44] isis git commit: ISIS-537: factoring out BulkActionsProvider interface.

Posted by da...@apache.org.
ISIS-537: factoring out BulkActionsProvider interface.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/276472f9
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/276472f9
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/276472f9

Branch: refs/heads/master
Commit: 276472f96301ab5c971879bd18c91ad1320a086e
Parents: 5022f85
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Nov 10 18:40:52 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 18:40:52 2014 +0000

----------------------------------------------------------------------
 .../ajaxtable/BulkActionsLinkFactory.java       |   8 +-
 .../ajaxtable/BulkActionsProvider.java          |  28 +++
 .../CollectionContentsAsAjaxTablePanel.java     | 186 ++++++++++---------
 .../widgets/cssmenu/CssMenuBuilder.java         |   5 +-
 4 files changed, 138 insertions(+), 89 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/276472f9/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsLinkFactory.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsLinkFactory.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsLinkFactory.java
index 4d7a9a8..826aebf 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsLinkFactory.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsLinkFactory.java
@@ -61,14 +61,16 @@ final class BulkActionsLinkFactory implements ActionLinkFactory {
     
     @SuppressWarnings("unused")
     private final DataTable<ObjectAdapter,String> dataTable;
-    private final ObjectAdapterToggleboxColumn toggleboxColumn;
+    private ObjectAdapterToggleboxColumn toggleboxColumn;
 
     BulkActionsLinkFactory(
             final EntityCollectionModel model, 
-            final DataTable<ObjectAdapter,String> dataTable, 
-            final ObjectAdapterToggleboxColumn toggleboxColumn) {
+            final DataTable<ObjectAdapter,String> dataTable) {
         this.model = model;
         this.dataTable = dataTable;
+    }
+
+    public void setToggleboxColumn(ObjectAdapterToggleboxColumn toggleboxColumn) {
         this.toggleboxColumn = toggleboxColumn;
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/276472f9/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsProvider.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsProvider.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsProvider.java
new file mode 100644
index 0000000..697f556
--- /dev/null
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/BulkActionsProvider.java
@@ -0,0 +1,28 @@
+/*
+ *  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.collectioncontents.ajaxtable;
+
+import org.apache.isis.viewer.wicket.model.models.ActionPromptProvider;
+import org.apache.isis.viewer.wicket.ui.components.widgets.cssmenu.ActionLinkFactory;
+
+public interface BulkActionsProvider {
+
+    public void configureBulkActionsProvider(ActionLinkFactory linkFactory, ActionPromptProvider actionPromptProvider);
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/276472f9/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
index aca3535..74ec5d9 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.java
@@ -19,10 +19,8 @@
 
 package org.apache.isis.viewer.wicket.ui.components.collectioncontents.ajaxtable;
 
-import java.util.Collections;
 import java.util.List;
 import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
 import com.google.inject.Inject;
 import org.apache.wicket.Component;
@@ -40,16 +38,16 @@ import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking;
 import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
 import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet;
-import org.apache.isis.core.metamodel.spec.ActionType;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.Contributed;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.viewer.wicket.model.common.SelectionHandler;
 import org.apache.isis.viewer.wicket.model.hints.UiHintPathSignificant;
 import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings;
+import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
 import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
+import org.apache.isis.viewer.wicket.model.models.ActionPrompt;
 import org.apache.isis.viewer.wicket.model.models.ActionPromptProvider;
 import org.apache.isis.viewer.wicket.model.models.EntityCollectionModel;
 import org.apache.isis.viewer.wicket.ui.components.actionprompt.ActionPromptModalWindow;
@@ -68,7 +66,7 @@ import org.apache.isis.viewer.wicket.ui.panels.PanelUtil;
  * {@link PanelAbstract Panel} that represents a {@link EntityCollectionModel
  * collection of entity}s rendered using {@link AjaxFallbackDefaultDataTable}.
  */
-public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityCollectionModel> implements CollectionCountProvider, ActionPromptProvider, UiHintPathSignificant {
+public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityCollectionModel> implements CollectionCountProvider, ActionPromptProvider, BulkActionsProvider, UiHintPathSignificant {
 
     private static final long serialVersionUID = 1L;
 
@@ -81,9 +79,12 @@ public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityColl
     private static final Predicate<ObjectAction> BULK = Filters.asPredicate(ObjectAction.Filters.bulk());
     
     private IsisAjaxFallbackDataTable<ObjectAdapter,String> dataTable;
+    private final BulkActionsHelper bulkActionsHelper;
+
 
     public CollectionContentsAsAjaxTablePanel(final String id, final EntityCollectionModel model) {
         super(id, model);
+        bulkActionsHelper = new BulkActionsHelper(model);
     }
     
     @Override
@@ -97,23 +98,47 @@ public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityColl
 
         final List<IColumn<ObjectAdapter,String>> columns = Lists.newArrayList();
 
-        List<ObjectAction> bulkActions = determineBulkActions();
+        List<ObjectAction> bulkActions = bulkActionsHelper.getBulkActions();
+
+        final ObjectAdapterToggleboxColumn toggleboxColumn = addToggleboxColumnIfRequired(columns, bulkActions);
 
-        ObjectAdapterToggleboxColumn toggleboxColumn = addToggleboxColumnIfRequired(columns, bulkActions);
         addTitleColumn(columns, model.getParentObjectAdapterMemento(), getSettings().getMaxTitleLengthInStandaloneTables(), getSettings().getMaxTitleLengthInStandaloneTables());
         addPropertyColumnsIfRequired(columns);
 
         final SortableDataProvider<ObjectAdapter,String> dataProvider = new CollectionContentsSortableDataProvider(model);
         dataTable = new IsisAjaxFallbackDataTable<>(ID_TABLE, columns, dataProvider, model.getPageSize());
-        
-        addActionPromptModalWindow();
-        buildEntityActionsGui(bulkActions, this, toggleboxColumn);
-
         addOrReplace(dataTable);
         dataTable.honourHints();
+
+        addActionPromptModalWindow();
+
+        // bulkactions
+        if(bulkActions.isEmpty() || getModel().isParented()) {
+            permanentlyHide(ID_ENTITY_ACTIONS);
+        } else {
+            BulkActionsLinkFactory linkFactory = new BulkActionsLinkFactory(getModel(), dataTable);
+            linkFactory.setToggleboxColumn(toggleboxColumn);
+
+            actionLinkFactoryDelegating = new ActionLinkFactoryDelegating();
+            actionPromptProviderDelegating = new ActionPromptProviderDelegating();
+
+            getBulkActionsProvider().configureBulkActionsProvider(linkFactory, this);
+
+            final CssMenuBuilder cssMenuBuilder = new CssMenuBuilder(null, bulkActions, actionLinkFactoryDelegating, actionPromptProviderDelegating, null);
+            final CssMenuPanel cssMenuPanel = cssMenuBuilder.buildPanel(ID_ENTITY_ACTIONS, "Actions");
+
+            this.addOrReplace(cssMenuPanel);
+
+        }
     }
 
-    private ObjectAdapterToggleboxColumn addToggleboxColumnIfRequired(final List<IColumn<ObjectAdapter,String>> columns, List<ObjectAction> bulkActions) {
+    private BulkActionsProvider getBulkActionsProvider() {
+        return this;
+    }
+
+    private ObjectAdapterToggleboxColumn addToggleboxColumnIfRequired(
+            final List<IColumn<ObjectAdapter,String>> columns,
+            final List<ObjectAction> bulkActions) {
         final EntityCollectionModel entityCollectionModel = getModel();
         if(bulkActions.isEmpty() || entityCollectionModel.isParented()) {
             return null;
@@ -149,58 +174,6 @@ public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityColl
         return toggleboxColumn;
     }
 
-    private void buildEntityActionsGui(
-            final List<ObjectAction> bulkActions,
-            final ActionPromptProvider actionPromptProvider,
-            final ObjectAdapterToggleboxColumn toggleboxColumn) {
-        final EntityCollectionModel model = getModel();
-
-        if(bulkActions.isEmpty() || model.isParented()) {
-            permanentlyHide(ID_ENTITY_ACTIONS);
-            return;
-        }
-
-        if(!bulkActions.isEmpty()) {
-            final ActionLinkFactory linkFactory = new BulkActionsLinkFactory(model, dataTable, toggleboxColumn);
-
-            final CssMenuBuilder cssMenuBuilder = new CssMenuBuilder(null, bulkActions, linkFactory, actionPromptProvider, null);
-            // TODO: i18n
-            final CssMenuPanel cssMenuPanel = cssMenuBuilder.buildPanel(ID_ENTITY_ACTIONS, "Actions");
-
-            this.addOrReplace(cssMenuPanel);
-        } else {
-            permanentlyHide(ID_ENTITY_ACTIONS);
-        }
-    }
-
-    private List<ObjectAction> determineBulkActions() {
-        final EntityCollectionModel model = getModel();
-        
-        if(model.isParented()) {
-            return Collections.emptyList();
-        }
-        
-        final ObjectSpecification typeSpec = model.getTypeOfSpecification();
-        
-        List<ObjectAction> objectActions = typeSpec.getObjectActions(ActionType.USER, Contributed.INCLUDED, Filters.<ObjectAction>any());
-        
-        if ( isExploring() || isPrototyping()) {
-            List<ObjectAction> explorationActions = typeSpec.getObjectActions(ActionType.EXPLORATION, Contributed.INCLUDED, Filters.<ObjectAction>any());
-            List<ObjectAction> prototypeActions = typeSpec.getObjectActions(ActionType.PROTOTYPE, Contributed.INCLUDED, Filters.<ObjectAction>any());
-            objectActions.addAll(explorationActions);
-            objectActions.addAll(prototypeActions);
-        }
-        if (isDebugMode()) {
-            List<ObjectAction> debugActions = typeSpec.getObjectActions(ActionType.DEBUG, Contributed.INCLUDED, Filters.<ObjectAction>any());
-            objectActions.addAll(debugActions);
-        }
-
-        List<ObjectAction> flattenedActions = objectActions;
-        
-        return Lists.newArrayList(Iterables.filter(flattenedActions, BULK));
-    }
-
-    
 
     private void addTitleColumn(final List<IColumn<ObjectAdapter,String>> columns, ObjectAdapterMemento parentAdapterMementoIfAny, int maxTitleParented, int maxTitleStandalone) {
         int maxTitleLength = getModel().isParented()? maxTitleParented: maxTitleStandalone;
@@ -270,10 +243,13 @@ public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityColl
         return model.getCount();
     }
 
-    
-    // ///////////////////////////////////////////////////////////////////
-    // ActionPromptModalWindowProvider
-    // ///////////////////////////////////////////////////////////////////
+
+    //region > BulkActionsProvider
+
+    //endregion
+
+
+    //region > ActionPromptModalWindowProvider
     
     private ActionPromptModalWindow actionPromptModalWindow;
     public ActionPromptModalWindow getActionPrompt() {
@@ -285,26 +261,10 @@ public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityColl
         addOrReplace(actionPromptModalWindow);
     }
 
+    //endregion
 
     // //////////////////////////////////////
     
-    public boolean isExploring() {
-        return IsisContext.getDeploymentType().isExploring();
-    }
-    public boolean isPrototyping() {
-        return IsisContext.getDeploymentType().isPrototyping();
-    }
-
-    /**
-     * Protected so can be overridden in testing if required.
-     */
-    protected boolean isDebugMode() {
-        // TODO: need to figure out how to switch into debug mode;
-        // probably call a Debug toggle page, and stuff into
-        // Session.getMetaData()
-        return true;
-    }
-
     @Override
     public void renderHead(IHeaderResponse response) {
         super.renderHead(response);
@@ -323,4 +283,60 @@ public class CollectionContentsAsAjaxTablePanel extends PanelAbstract<EntityColl
     protected MessageBroker getMessageBroker() {
         return getAuthenticationSession().getMessageBroker();
     }
+
+    // //////////////////////////////////////
+
+
+    private ActionPromptProviderDelegating actionPromptProviderDelegating;
+    private ActionLinkFactoryDelegating actionLinkFactoryDelegating;
+
+    @Override
+    public void configureBulkActionsProvider(
+            final ActionLinkFactory linkFactory,
+            final ActionPromptProvider actionPromptProvider) {
+        actionLinkFactoryDelegating.setDelegate(linkFactory);
+        actionPromptProviderDelegating.setDelegate(actionPromptProvider);
+    }
+
+    public static class ActionLinkFactoryDelegating implements ActionLinkFactory {
+
+        private ActionLinkFactory delegate;
+
+        public ActionLinkFactory getDelegate() {
+            return delegate;
+        }
+
+        public void setDelegate(ActionLinkFactory delegate) {
+            this.delegate = delegate;
+        }
+
+        @Override
+        public LinkAndLabel newLink(
+                final ObjectAdapterMemento adapter,
+                final ObjectAction noAction,
+                final String linkId,
+                final ActionPromptProvider actionPromptProvider) {
+            return delegate.newLink(adapter, noAction, linkId, actionPromptProvider);
+        }
+    }
+
+    public static class ActionPromptProviderDelegating implements ActionPromptProvider {
+
+        private ActionPromptProvider delegate;
+
+        public ActionPromptProvider getDelegate() {
+            return delegate;
+        }
+
+        public void setDelegate(ActionPromptProvider delegate) {
+            this.delegate = delegate;
+        }
+
+        @Override
+        public ActionPrompt getActionPrompt() {
+            return delegate.getActionPrompt();
+        }
+    }
+
+
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/276472f9/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/CssMenuBuilder.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/CssMenuBuilder.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/CssMenuBuilder.java
index c9f54e9..6b9189f 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/CssMenuBuilder.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/CssMenuBuilder.java
@@ -55,7 +55,10 @@ public class CssMenuBuilder {
         private final ActionPromptProvider actionPromptProvider;
         private final Predicate<ObjectAction> objectActionPredicate;
 
-        public CssMenuContext(ActionLinkFactory cssMenuLinkFactory, ActionPromptProvider actionPromptProvider, Predicate<ObjectAction> objectActionPredicate) {
+        public CssMenuContext(
+                final ActionLinkFactory cssMenuLinkFactory,
+                final ActionPromptProvider actionPromptProvider,
+                final Predicate<ObjectAction> objectActionPredicate) {
             this.cssMenuLinkFactory = cssMenuLinkFactory;
             this.actionPromptProvider = actionPromptProvider;
             this.objectActionPredicate = objectActionPredicate != null? objectActionPredicate: Predicates.<ObjectAction>alwaysTrue();


[08/44] isis git commit: ISIS-939: simplifying PersistenceSession

Posted by da...@apache.org.
ISIS-939: simplifying PersistenceSession

- removing PersistenceSession#resolveField (introduce ResolveFieldUtil for scimpi to call), also from the *ObjectStore impls
- remove Persistor interface, instead PersistenceSession everywhere
- remove ToPersistObjectSet interface, instead PersistenceSession everywhere
- remove RecreatedPojoRemapper interface, instead PersistenceSession everywhere
- remove EnlistedObjectDirtying interface, instead PersistenceSession everywhere
- remove ObjectAdapterMemento#getTitleHint() and #captureTitleHintIfPossible()
- re-introduce MessageBroker's #getApplicationError and #setApplicationError
- remove ObjectAdapter#isTitleAvailable() and from PojoAdapter
- removed commented out lines in ResolveState
- simplify PersistenceSession (remove #mapRecreatedPojo, #remapRecreatedPojo)
- introduce PersistenceQueryFactory from PersistenceSession
- PersistenceSession creates IsisTransactionManager in its constructor


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/5f8fca9b
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/5f8fca9b
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/5f8fca9b

Branch: refs/heads/master
Commit: 5f8fca9b9c13c0f2f81caccdbb247154e7b25cc7
Parents: bea5a02
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Nov 3 22:55:07 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Nov 6 16:19:00 2014 +0000

----------------------------------------------------------------------
 .../dispatcher/AbstractObjectProcessor.java     |   3 +-
 .../scimpi/dispatcher/ResolveFieldUtil.java     |  71 ++++
 .../dispatcher/context/RequestContext.java      |  13 +-
 .../dispatcher/view/collection/Collection.java  |   5 +-
 .../view/display/AbstractTableView.java         |  10 +-
 .../dispatcher/view/display/LongFormView.java   |   5 +-
 .../scimpi/dispatcher/view/edit/EditObject.java |   3 +-
 .../view/simple/AbstractConditionalBlock.java   |  10 +-
 .../dispatcher/view/simple/AbstractLink.java    |   3 +-
 .../dispatcher/view/simple/RemoveElement.java   |   7 +-
 .../model/isis/PersistenceSessionProvider.java  |   5 +-
 .../model/mementos/ObjectAdapterMemento.java    |  21 --
 .../viewer/wicket/model/models/EntityModel.java |  10 -
 .../wicket/model/models/ModelAbstract.java      |   4 +-
 .../FormComponentPanelAbstract.java             |  24 +-
 .../viewer/wicket/ui/panels/FormAbstract.java   |   8 +-
 .../viewer/wicket/ui/panels/PanelAbstract.java  |  21 +-
 .../integtestsupport/IsisSystemForTest.java     |   7 +-
 .../commons/authentication/MessageBroker.java   |  11 +
 .../core/metamodel/adapter/ObjectAdapter.java   |   2 -
 .../core/metamodel/adapter/ResolveState.java    |  59 +---
 .../metamodel/adapter/mgr/AdapterManager.java   |   8 +-
 .../core/objectstore/InMemoryObjectStore.java   |  11 +-
 .../internal/ObjectStoreInstances.java          |   2 +-
 .../ObjectFixtureFilePersistor.java             |  17 +-
 .../fixtures/FixturesInstallerDelegate.java     |   5 +-
 .../isis/core/runtime/memento/Memento.java      |   2 +-
 .../persistence/adapter/PojoAdapter.java        |   7 -
 .../adaptermanager/AdapterManagerDefault.java   |  24 +-
 .../objectstore/algorithm/PersistAlgorithm.java |   3 +-
 .../algorithm/PersistAlgorithmDefault.java      |   5 +-
 .../PersistAlgorithmForDataNucleus.java         |   5 +-
 .../algorithm/PersistAlgorithmUnified.java      |   5 +-
 .../algorithm/ToPersistObjectSet.java           |  45 ---
 ...shingServiceWithDefaultPayloadFactories.java |   2 +-
 .../runtime/system/persistence/ObjectStore.java |  12 +-
 .../persistence/PersistenceQueryFactory.java    | 103 ++++++
 .../system/persistence/PersistenceSession.java  | 346 +++++++------------
 .../persistence/PersistenceSessionFactory.java  |   7 +-
 .../runtime/system/persistence/Persistor.java   | 231 -------------
 .../persistence/RecreatedPojoRemapper.java      |  52 ---
 .../transaction/EnlistedObjectDirtying.java     |  49 ---
 .../jdo/datanucleus/DataNucleusObjectStore.java |  28 +-
 .../persistence/FrameworkSynchronizer.java      |  13 +-
 .../PersistenceQueryProcessorAbstract.java      |   7 +-
 .../algorithm/PersistAlgorithmContractTest.java |   3 +-
 .../persistence/PersistenceSessionTest.java     |   3 +-
 .../IsisSystemWithFixtures.java                 |   7 +-
 48 files changed, 427 insertions(+), 877 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractObjectProcessor.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractObjectProcessor.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractObjectProcessor.java
index d163bc1..97dd1ed 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractObjectProcessor.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/AbstractObjectProcessor.java
@@ -21,7 +21,6 @@ package org.apache.isis.viewer.scimpi.dispatcher;
 
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 
 public abstract class AbstractObjectProcessor extends AbstractElementProcessor {
@@ -38,7 +37,7 @@ public abstract class AbstractObjectProcessor extends AbstractElementProcessor {
             if (error != null) {
                 throw new ScimpiException("Field " + objectField.getId() + " " + error);
             }
-            IsisContext.getPersistenceSession().resolveField(object, objectField);
+            ResolveFieldUtil.resolveField(object, objectField);
             object = objectField.get(object);
         }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ResolveFieldUtil.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ResolveFieldUtil.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ResolveFieldUtil.java
new file mode 100644
index 0000000..a0ae5cf
--- /dev/null
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/ResolveFieldUtil.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.scimpi.dispatcher;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+
+import static org.apache.isis.core.commons.ensure.Ensure.ensureThatState;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+
+public final class ResolveFieldUtil {
+
+    private ResolveFieldUtil(){}
+
+    /**
+     * Walking the graph.
+     *
+     * <p>
+     *     This combines the implementations of both the DN Objectstore
+     *     and also the in-memory objectstore.
+     * </p>
+     */
+    public static void resolveField(final ObjectAdapter object, final ObjectAssociation association) {
+
+
+        // DN impl.
+        {
+            final ObjectAdapter referencedCollectionAdapter = association.get(object);
+
+            // this code originally brought in from the JPA impl, but seems reasonable.
+            if (association.isOneToManyAssociation()) {
+                ensureThatState(referencedCollectionAdapter, is(notNullValue()));
+
+                final Object referencedCollection = referencedCollectionAdapter.getObject();
+                ensureThatState(referencedCollection, is(notNullValue()));
+
+                // if a proxy collection, then force it to initialize.  just 'touching' the object is sufficient.
+                // REVIEW: I wonder if this is actually needed; does JDO use proxy collections?
+                referencedCollection.hashCode();
+            }
+
+            // the JPA impl used to also call its lifecycle listener on the referenced collection object, eg List,
+            // itself.  I don't think this makes sense to do for JDO (the collection is not a PersistenceCapable).
+        }
+
+        // In-memory objectstore impl
+        {
+            final ObjectAdapter referenceAdapter = association.get(object);
+            referenceAdapter.markAsResolvedIfPossible();
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
index fc36d15..183a0b2 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/context/RequestContext.java
@@ -23,19 +23,12 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintWriter;
 import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.Map.Entry;
-import java.util.TreeSet;
-
 import com.google.common.collect.Maps;
-
 import org.apache.commons.lang.StringEscapeUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.commons.factory.InstanceUtil;
@@ -50,7 +43,7 @@ import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.Contributed;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.Persistor;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
 import org.apache.isis.viewer.scimpi.dispatcher.ErrorCollator;
 import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
@@ -853,7 +846,7 @@ public abstract class RequestContext {
     }
 
 
-    protected Persistor getPersistenceSession() {
+    protected PersistenceSession getPersistenceSession() {
         return IsisContext.getPersistenceSession();
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/collection/Collection.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/collection/Collection.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/collection/Collection.java
index 5a561b6..1002c9f 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/collection/Collection.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/collection/Collection.java
@@ -20,12 +20,11 @@
 package org.apache.isis.viewer.scimpi.dispatcher.view.collection;
 
 import java.util.Iterator;
-
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
 import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
@@ -48,7 +47,7 @@ public class Collection extends AbstractElementProcessor {
             if (!objectField.isOneToManyAssociation()) {
                 throw new ScimpiException("Field " + objectField.getId() + " is not a collection");
             }
-            IsisContext.getPersistenceSession().resolveField(object, objectField);
+            ResolveFieldUtil.resolveField(object, objectField);
             collection = objectField.get(object);
         } else {
             final String id = request.getOptionalProperty(COLLECTION);

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractTableView.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractTableView.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractTableView.java
index 26df958..286d84d 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractTableView.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/AbstractTableView.java
@@ -21,17 +21,17 @@ package org.apache.isis.viewer.scimpi.dispatcher.view.display;
 
 import java.util.Iterator;
 import java.util.List;
-
 import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
 import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacet;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.Contributed;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.Persistor;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
 import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
@@ -68,7 +68,7 @@ public abstract class AbstractTableView extends AbstractElementProcessor {
                 throw new ScimpiException("Field " + objectField.getId() + " is not a collection");
             }
             isFieldEditable = objectField.isUsable(IsisContext.getAuthenticationSession(), object, where).isAllowed();
-            getPersistenceSession().resolveField(object, objectField);
+            ResolveFieldUtil.resolveField(object, objectField);
             collection = objectField.get(object);
             final TypeOfFacet facet = objectField.getFacet(TypeOfFacet.class);
             elementSpec = facet.valueSpec();
@@ -94,7 +94,7 @@ public abstract class AbstractTableView extends AbstractElementProcessor {
 
     }
 
-    protected Persistor getPersistenceSession() {
+    protected PersistenceSession getPersistenceSession() {
         return IsisContext.getPersistenceSession();
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/LongFormView.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/LongFormView.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/LongFormView.java
index 5630bcb..1efad45 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/LongFormView.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/display/LongFormView.java
@@ -20,12 +20,11 @@
 package org.apache.isis.viewer.scimpi.dispatcher.view.display;
 
 import java.util.List;
-
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.Contributed;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 import org.apache.isis.viewer.scimpi.dispatcher.view.display.TableView.SimpleTableBuilder;
 import org.apache.isis.viewer.scimpi.dispatcher.view.field.LinkedObject;
@@ -43,7 +42,7 @@ public class LongFormView extends AbstractFormView {
                 rowClasses = rowClassesList.split("[,|/]");
             }
             int noColumns;
-            IsisContext.getPersistenceSession().resolveField(object, field);
+            ResolveFieldUtil.resolveField(object, field);
             final ObjectAdapter collection = field.get(object);
             final ObjectSpecification elementSpec = collection.getElementSpecification();
             final List<ObjectAssociation> fields = elementSpec.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.VISIBLE_AT_LEAST_SOMETIMES);

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
index 4117ee7..deafb1a 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/edit/EditObject.java
@@ -34,6 +34,7 @@ import org.apache.isis.core.metamodel.facets.object.choices.enums.EnumFacet;
 import org.apache.isis.core.metamodel.facets.value.booleans.BooleanValueFacet;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
 import org.apache.isis.viewer.scimpi.dispatcher.edit.EditAction;
@@ -215,7 +216,7 @@ public class EditObject extends AbstractElementProcessor {
             final String fieldName = inputField.getName();
             final ObjectAssociation field = object.getSpecification().getAssociation(fieldName);
             if (field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) {
-                IsisContext.getPersistenceSession().resolveField(object, field);
+                ResolveFieldUtil.resolveField(object, field);
                 final ObjectAdapter fieldValue = field.get(object);
                 if (inputField.isEditable()) {
                     final String value = getValue(context, fieldValue);

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractConditionalBlock.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractConditionalBlock.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractConditionalBlock.java
index a17fcdb..dc5b39a 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractConditionalBlock.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractConditionalBlock.java
@@ -22,14 +22,13 @@ package org.apache.isis.viewer.scimpi.dispatcher.view.simple;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
 import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.applib.filter.Filters;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.consent.Consent;
-import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
 import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacet;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
 import org.apache.isis.core.metamodel.spec.ActionType;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.Contributed;
@@ -37,6 +36,7 @@ import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
+import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
 import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
 import org.apache.isis.viewer.scimpi.dispatcher.processor.Request;
 import org.apache.isis.viewer.scimpi.dispatcher.util.MethodsUtils;
@@ -494,7 +494,8 @@ class TestFieldSet extends Test {
     boolean test(final Request request, final String attributeName, final String targetId) {
         final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
         final ObjectAssociation objectField = findProperty(attributeName, object);
-        IsisContext.getPersistenceSession().resolveField(object, objectField);
+
+        ResolveFieldUtil.resolveField(object, objectField);
         final ObjectAdapter fld = objectField.get(object);
         if (fld != null) {
             final Object fieldValue = fld.getObject();
@@ -523,7 +524,7 @@ class TestFieldValue extends Test {
         
         final ObjectAdapter object = MethodsUtils.findObject(request.getContext(), targetId);
         final ObjectAssociation objectField = findProperty(fieldName, object);
-        IsisContext.getPersistenceSession().resolveField(object, objectField);
+        ResolveFieldUtil.resolveField(object, objectField);
         final ObjectAdapter fld = objectField.get(object);
         
         // TODO test for reference or value
@@ -561,3 +562,4 @@ class TestSet extends Test {
         return valuePresent;
     }
 }
+

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractLink.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractLink.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractLink.java
index 743be2d..b6798be 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractLink.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/AbstractLink.java
@@ -25,6 +25,7 @@ import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
 import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
+import org.apache.isis.viewer.scimpi.dispatcher.ResolveFieldUtil;
 import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
@@ -63,7 +64,7 @@ public abstract class AbstractLink extends AbstractElementProcessor {
             if (field.isVisible(IsisContext.getAuthenticationSession(), adapter, where).isVetoed()) {
                 throw new ForbiddenException(field, ForbiddenException.VISIBLE);
             }
-            IsisContext.getPersistenceSession().resolveField(adapter, field);
+            ResolveFieldUtil.resolveField(adapter, field);
             adapter = field.get(adapter);
             if (adapter != null) {
                 objectId = context.mapObject(adapter, Scope.INTERACTION);

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java
----------------------------------------------------------------------
diff --git a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java
index 56ed442..3321b87 100644
--- a/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java
+++ b/component/viewer/scimpi/dispatcher/src/main/java/org/apache/isis/viewer/scimpi/dispatcher/view/simple/RemoveElement.java
@@ -30,10 +30,7 @@ import org.apache.isis.core.metamodel.spec.feature.Contributed;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.scimpi.dispatcher.AbstractElementProcessor;
-import org.apache.isis.viewer.scimpi.dispatcher.Dispatcher;
-import org.apache.isis.viewer.scimpi.dispatcher.ForbiddenException;
-import org.apache.isis.viewer.scimpi.dispatcher.ScimpiException;
+import org.apache.isis.viewer.scimpi.dispatcher.*;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext;
 import org.apache.isis.viewer.scimpi.dispatcher.context.RequestContext.Scope;
 import org.apache.isis.viewer.scimpi.dispatcher.edit.RemoveAction;
@@ -90,7 +87,7 @@ public class RemoveElement extends AbstractElementProcessor {
         if (field.isVisible(IsisContext.getAuthenticationSession(), adapter, where).isVetoed()) {
             throw new ForbiddenException(field, ForbiddenException.VISIBLE);
         }
-        IsisContext.getPersistenceSession().resolveField(adapter, field);
+        ResolveFieldUtil.resolveField(adapter, field);
 
         Consent usable = field.isUsable(IsisContext.getAuthenticationSession(), adapter, where);
         if (usable.isAllowed()) {

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/isis/PersistenceSessionProvider.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/isis/PersistenceSessionProvider.java b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/isis/PersistenceSessionProvider.java
index 2c210a3..3c6d78f 100644
--- a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/isis/PersistenceSessionProvider.java
+++ b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/isis/PersistenceSessionProvider.java
@@ -19,9 +19,10 @@
 
 package org.apache.isis.viewer.wicket.model.isis;
 
-import org.apache.isis.core.runtime.system.persistence.Persistor;
+
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 
 public interface PersistenceSessionProvider {
 
-    Persistor getPersistenceSession();
+    PersistenceSession getPersistenceSession();
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/mementos/ObjectAdapterMemento.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/mementos/ObjectAdapterMemento.java b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/mementos/ObjectAdapterMemento.java
index 72658fd..107bde0 100644
--- a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/mementos/ObjectAdapterMemento.java
+++ b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/mementos/ObjectAdapterMemento.java
@@ -236,7 +236,6 @@ public class ObjectAdapterMemento implements Serializable {
         final ObjectSpecification specification = adapter.getSpecification();
         objectSpecId = specification.getSpecId();
         init(adapter);
-        captureTitleHintIfPossible();
     }
 
     private void init(final ObjectAdapter adapter) {
@@ -267,26 +266,6 @@ public class ObjectAdapterMemento implements Serializable {
     }
     
 
-    
-    public void captureTitleHintIfPossible() {
-        if (this.titleHint != null) {
-            return;
-        } 
-        
-        // REVIEW: this check is because Wicket 6.0.0 seems to call onEndRequest prior to onDetach
-        // so by the time we get here, there is no session to use...
-        if(IsisContext.inSession()) {
-            ObjectAdapter objectAdapter = this.getObjectAdapter(ConcurrencyChecking.NO_CHECK);
-            if (objectAdapter.isTitleAvailable()) {
-                this.titleHint = objectAdapter.titleString();
-            }
-        }
-    }
-
-    public String getTitleHint() {
-        return titleHint;
-    }
-
     /**
      * Lazily looks up {@link ObjectAdapter} if required.
      * 

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
index 2faca9b..a2ec3df 100644
--- a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
+++ b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
@@ -357,16 +357,6 @@ public class EntityModel extends BookmarkableModel<ObjectAdapter> implements UiH
         adapterMemento = ObjectAdapterMemento.createOrNull(adapter);
     }
 
-    @Override
-    public void detach() {
-        if (isAttached()) {
-            if (adapterMemento != null) {
-                adapterMemento.captureTitleHintIfPossible();
-            }
-        }
-        super.detach();
-    }
-
 
     // //////////////////////////////////////////////////////////
     // PropertyModels

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ModelAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ModelAbstract.java b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ModelAbstract.java
index 24361af..4556cd2 100644
--- a/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ModelAbstract.java
+++ b/component/viewer/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/models/ModelAbstract.java
@@ -25,7 +25,7 @@ import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.Persistor;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 
 /**
  * Adapter for {@link LoadableDetachableModel}s, providing access to some of the
@@ -50,7 +50,7 @@ public abstract class ModelAbstract<T> extends LoadableDetachableModel<T> {
         return IsisContext.getAuthenticationSession();
     }
 
-    protected Persistor getPersistenceSession() {
+    protected PersistenceSession getPersistenceSession() {
         return IsisContext.getPersistenceSession();
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormComponentPanelAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormComponentPanelAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormComponentPanelAbstract.java
index 785f473..59f152e 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormComponentPanelAbstract.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/formcomponent/FormComponentPanelAbstract.java
@@ -20,20 +20,18 @@
 package org.apache.isis.viewer.wicket.ui.components.widgets.formcomponent;
 
 import java.util.List;
-
 import org.apache.wicket.Component;
 import org.apache.wicket.MarkupContainer;
 import org.apache.wicket.Session;
 import org.apache.wicket.markup.html.form.FormComponent;
 import org.apache.wicket.markup.html.form.FormComponentPanel;
 import org.apache.wicket.model.IModel;
-
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider;
 import org.apache.isis.core.commons.authentication.AuthenticationSessionProviderAware;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.Persistor;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
 import org.apache.isis.viewer.wicket.model.isis.PersistenceSessionProvider;
 import org.apache.isis.viewer.wicket.ui.ComponentType;
@@ -52,18 +50,6 @@ public abstract class FormComponentPanelAbstract<T> extends FormComponentPanel<T
 
     private ComponentType componentType;
 
-    public FormComponentPanelAbstract(final ComponentType componentType) {
-        this(componentType, null);
-    }
-
-    public FormComponentPanelAbstract(final String id) {
-        this(id, null);
-    }
-
-    public FormComponentPanelAbstract(final ComponentType componentType, final IModel<T> model) {
-        this(componentType.getWicketId(), model);
-    }
-
     public FormComponentPanelAbstract(final String id, final IModel<T> model) {
         super(id, model);
         this.componentType = ComponentType.lookup(id);
@@ -156,19 +142,15 @@ public abstract class FormComponentPanelAbstract<T> extends FormComponentPanel<T
     // ///////////////////////////////////////////////////////////////////
 
     @Override
-    public Persistor getPersistenceSession() {
+    public PersistenceSession getPersistenceSession() {
         return IsisContext.getPersistenceSession();
     }
 
     protected List<ObjectAdapter> getServices() {
-        return IsisContext.getPersistenceSession().getServices();
+        return getPersistenceSession().getServices();
     }
 
-    protected List<ObjectAdapter> getServiceAdapters() {
-        return IsisContext.getPersistenceSession().getServices();
-    }
 
-    
     // /////////////////////////////////////////////////
     // *Provider impl.
     // /////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/FormAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/FormAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/FormAbstract.java
index 048e25f..c98db31 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/FormAbstract.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/FormAbstract.java
@@ -33,7 +33,7 @@ import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.Persistor;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.viewer.wicket.model.isis.PersistenceSessionProvider;
 import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistry;
 import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistryAccessor;
@@ -134,12 +134,8 @@ public abstract class FormAbstract<T> extends Form<T> implements IHeaderContribu
     // Dependencies (from IsisContext)
     // ///////////////////////////////////////////////////////////////////
 
-    public IsisContext getIsisContext() {
-        return IsisContext.getInstance();
-    }
-
     @Override
-    public Persistor getPersistenceSession() {
+    public PersistenceSession getPersistenceSession() {
         return IsisContext.getPersistenceSession();
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java
index 4667b12..690a0ff 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/panels/PanelAbstract.java
@@ -19,10 +19,6 @@
 
 package org.apache.isis.viewer.wicket.ui.panels;
 
-import java.util.List;
-
-import com.google.inject.Inject;
-
 import org.apache.wicket.Component;
 import org.apache.wicket.Session;
 import org.apache.wicket.markup.head.IHeaderResponse;
@@ -30,14 +26,12 @@ import org.apache.wicket.markup.html.IHeaderContributor;
 import org.apache.wicket.markup.html.panel.Panel;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.request.resource.CssResourceReference;
-
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider;
 import org.apache.isis.core.commons.authentication.AuthenticationSessionProviderAware;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
 import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.Persistor;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
 import org.apache.isis.viewer.wicket.model.isis.PersistenceSessionProvider;
 import org.apache.isis.viewer.wicket.ui.ComponentFactory;
@@ -160,25 +154,18 @@ public abstract class PanelAbstract<T extends IModel<?>> extends Panel implement
     }
 
     // ///////////////////////////////////////////////////////////////////
-    // Dependencies (from IsisContext
+    // Dependencies (from IsisContext)
     // ///////////////////////////////////////////////////////////////////
 
-    public IsisContext getIsisContext() {
-        return IsisContext.getInstance();
-    }
-
     @Override
-    public Persistor getPersistenceSession() {
+    public PersistenceSession getPersistenceSession() {
         return IsisContext.getPersistenceSession();
     }
 
     public AdapterManager getAdapterManager() {
-        return IsisContext.getPersistenceSession().getAdapterManager();
+        return getPersistenceSession().getAdapterManager();
     }
 
-    protected List<ObjectAdapter> getServiceAdapters() {
-        return IsisContext.getPersistenceSession().getServices();
-    }
 
     // /////////////////////////////////////////////////
     // Dependency Injection

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java
index 66ac70c..03fce17 100644
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java
@@ -52,7 +52,6 @@ import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.persistence.ObjectStore;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.core.runtime.system.persistence.Persistor;
 import org.apache.isis.core.runtime.system.transaction.IsisTransaction;
 import org.apache.isis.core.runtime.system.transaction.IsisTransaction.State;
 import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
@@ -547,7 +546,7 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
 
     public ObjectAdapter reload(RootOid oid) {
         ensureSessionInProgress();
-        final Persistor persistenceSession = getPersistenceSession();
+        final PersistenceSession persistenceSession = getPersistenceSession();
         return persistenceSession.loadObject(oid);
     }
 
@@ -560,7 +559,7 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
         ensureSessionInProgress();
         ensureObjectIsNotPersistent(pojo);
         final ObjectAdapter adapter = adapterFor(pojo);
-        getPersistenceSession().remapAsPersistent(adapter, persistentOid);
+        getPersistenceSession().getAdapterManager().remapAsPersistent(adapter, persistentOid);
         return adapter;
     }
 
@@ -803,7 +802,7 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
         return getPersistenceSession().getTransactionManager();
     }
     
-    public Persistor getPersistor() {
+    public PersistenceSession getPersistor() {
     	return getPersistenceSession();
     }
     

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/metamodel/src/main/java/org/apache/isis/core/commons/authentication/MessageBroker.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/commons/authentication/MessageBroker.java b/core/metamodel/src/main/java/org/apache/isis/core/commons/authentication/MessageBroker.java
index 12d5068..dc36cce 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/commons/authentication/MessageBroker.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/commons/authentication/MessageBroker.java
@@ -33,6 +33,7 @@ public class MessageBroker implements Serializable, DebuggableWithTitle {
     
     private final List<String> messages = Lists.newArrayList();
     private final List<String> warnings = Lists.newArrayList();
+    private String applicationError;
 
     //region > acquire (factory method)
 
@@ -57,6 +58,7 @@ public class MessageBroker implements Serializable, DebuggableWithTitle {
     public void reset() {
         warnings.clear();
         messages.clear();
+        applicationError = null;
     }
 
     //endregion
@@ -85,6 +87,14 @@ public class MessageBroker implements Serializable, DebuggableWithTitle {
 
     //endregion
 
+    public String getApplicationError() {
+        return applicationError;
+    }
+
+    public void setApplicationError(String applicationError) {
+        this.applicationError = applicationError;
+    }
+
     //region > debugging
 
     @Override
@@ -120,6 +130,7 @@ public class MessageBroker implements Serializable, DebuggableWithTitle {
         messages.clear();
         return copy;
     }
+
     //endregion
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ObjectAdapter.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ObjectAdapter.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ObjectAdapter.java
index 6dc619a..1954b3e 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ObjectAdapter.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ObjectAdapter.java
@@ -208,11 +208,9 @@ public interface ObjectAdapter extends Instance, org.apache.isis.applib.annotati
 
 
     boolean canTransitionToResolving();
-    boolean isTitleAvailable();
     void markAsResolvedIfPossible();
 
     
-    
     Version getVersion();
 
     void setVersion(Version version);

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ResolveState.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ResolveState.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ResolveState.java
index f5beaf9..fbf1fe6 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ResolveState.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ResolveState.java
@@ -19,6 +19,9 @@
 
 package org.apache.isis.core.metamodel.adapter;
 
+import java.util.*;
+import com.google.common.collect.Maps;
+
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RepresentsPersistent.DOES_NOT_REPRESENT_PERSISTENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RepresentsPersistent.REPRESENTS_PERSISTENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RespondsToChanges.DOES_NOT_RESPOND_TO_CHANGES;
@@ -26,14 +29,6 @@ import static org.apache.isis.core.metamodel.adapter.ResolveState.RespondsToChan
 import static org.apache.isis.core.metamodel.adapter.ResolveState.TransitionFrom.CANNOT_TRANSITION_FROM;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.TransitionFrom.CAN_TRANSITION_FROM;
 
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-
-import com.google.common.collect.Maps;
-
 public final class ResolveState {
     private static final Map<String, ResolveState> statesByName = Maps.newHashMap();
 
@@ -61,40 +56,6 @@ public final class ResolveState {
     public static final ResolveState DESTROYED = new ResolveState("Destroyed", "D~~", null,      CANNOT_TRANSITION_FROM, RESPONDS_TO_CHANGES,         DOES_NOT_REPRESENT_PERSISTENT);
     public static final ResolveState VALUE     = new ResolveState("Value",     "V~~", null,      CANNOT_TRANSITION_FROM, RESPONDS_TO_CHANGES,         DOES_NOT_REPRESENT_PERSISTENT);
 
-    // 20120709: used only in <tt>Memento</tt>, when recreating a transient object.
-    // however, analysis is that could equally set to TRANSIENT, rendering this state
-    // surplus to requirements.
-    // public static final ResolveState SERIALIZING_TRANSIENT = new ResolveState("Serializing Transient", "T~S", TRANSIENT, CANNOT_TRANSITION_FROM, DOES_NOT_RESPOND_TO_CHANGES, REPRESENTS_TRANSIENT,         DOES_NOT_REPRESENT_PERSISTENT);
-
-    // no longer seem to be used
-
-    // public static final ResolveState PART_RESOLVED = new
-    // ResolveState("Part Resolved", "Pr~~", null, RESOLVABLE_FROM,
-    // NOT_RESOLVABLE_INTO, RESPONDS_TO_CHANGES, DOES_NOT_REPRESENT_TRANSIENT,
-    // REPRESENTS_PERSISTENT, DOES_NOT_REPRESENT_RESOLVING, COULD_RESOLVE);
-    // public static final ResolveState RESOLVING_PART = new
-    // ResolveState("Resolving Part", "P~r~", PART_RESOLVED,
-    // NOT_RESOLVABLE_FROM, RESOLVABLE_INTO, DOES_NOT_RESPOND_TO_CHANGES,
-    // DOES_NOT_REPRESENT_TRANSIENT, REPRESENTS_PERSISTENT,
-    // REPRESENTS_RESOLVING, COULD_RESOLVE);
-
-    // no longer appear to be needed following the removal of remoting support.
-
-    // public static final ResolveState SERIALIZING_GHOST = new
-    // ResolveState("Serializing Ghost", "PG~S", GHOST, NOT_RESOLVABLE_FROM,
-    // NOT_RESOLVABLE_INTO, DOES_NOT_RESPOND_TO_CHANGES,
-    // DOES_NOT_REPRESENT_TRANSIENT, REPRESENTS_PERSISTENT,
-    // DOES_NOT_REPRESENT_RESOLVING, COULD_RESOLVE);
-    // public static final ResolveState SERIALIZING_PART_RESOLVED = new
-    // ResolveState("Serializing Part Resolved", "Pr~S", PART_RESOLVED,
-    // NOT_RESOLVABLE_FROM, NOT_RESOLVABLE_INTO, DOES_NOT_RESPOND_TO_CHANGES,
-    // DOES_NOT_REPRESENT_TRANSIENT, REPRESENTS_PERSISTENT,
-    // DOES_NOT_REPRESENT_RESOLVING,
-    // COULD_RESOLVE);
-
-    // 20120709: only used in <tt>DefaultPersistAlgorithm</tt>
-    // able to remove because, after refactoring simplifications, ended up as equivalent to UPDATING.
-    // public static final ResolveState SERIALIZING_RESOLVED  = new ResolveState("Serializing Resolved",   "PRS", RESOLVED,  CANNOT_TRANSITION_FROM, DOES_NOT_RESPOND_TO_CHANGES, DOES_NOT_REPRESENT_TRANSIENT, REPRESENTS_PERSISTENT);
 
 
     /**
@@ -104,28 +65,14 @@ public final class ResolveState {
     public static Map<ResolveState, ResolveState[]> changeToStatesByState = new HashMap<ResolveState, ResolveState[]>() {
         private static final long serialVersionUID = 1L;
         {
-            // previously also RESOLVING_PART and SERIALIZING_GHOST
             put(GHOST, new ResolveState[] { DESTROYED, RESOLVING, UPDATING });
             put(NEW, new ResolveState[] { TRANSIENT, GHOST, VALUE });
-            // previously also SERIALIZING_TRANSIENT
             put(TRANSIENT, new ResolveState[] { RESOLVED });
             put(RESOLVING, new ResolveState[] { RESOLVED });
-            // previously also SERIALIZING_RESOLVED
             put(RESOLVED, new ResolveState[] { GHOST, UPDATING, DESTROYED });
-            //put(SERIALIZING_RESOLVED, new ResolveState[] { RESOLVED });
-            //put(SERIALIZING_TRANSIENT, new ResolveState[] { TRANSIENT });
             put(UPDATING, new ResolveState[] { RESOLVED });
             put(DESTROYED, new ResolveState[] {});
             put(VALUE, new ResolveState[] {});
-
-            // put(PART_RESOLVED, new ResolveState[] { RESOLVING , UPDATING,
-            // DESTROYED , RESOLVING_PART, SERIALIZING_PART_RESOLVED });
-            // put(RESOLVING_PART, new ResolveState[] { PART_RESOLVED, RESOLVED
-            // });
-            // put(SERIALIZING_GHOST, new ResolveState[] { GHOST });
-            // put(SERIALIZING_PART_RESOLVED, new ResolveState[] { PART_RESOLVED
-            // });
-
         }
     };
 

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java
index 03423d1..8ebae19 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/mgr/AdapterManager.java
@@ -121,7 +121,7 @@ public interface AdapterManager extends Injectable {
                 ConcurrencyChecking.concurrencyChecking.set(prior);
             }
         }
-        
+
         /**
          * Allows a caller to temporarily disable concurrency checking for the current thread.
          */
@@ -140,7 +140,7 @@ public interface AdapterManager extends Injectable {
 
     /**
      * As per {@link #adapterFor(TypedOid, ConcurrencyChecking)}, with
-     * {@value org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking#NO_CHECK no checking}.
+     * {@link org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking#NO_CHECK no checking}.
      *
      * <p>
      * This method  will <i>always</i> return an object, possibly indicating it is persistent; so make sure that you
@@ -162,7 +162,7 @@ public interface AdapterManager extends Injectable {
      * {@link Oid#isTransient() transient} object.
      * 
      * <p>
-     * The pojo itself is recreated by delegating to a {@link PojoRecreator} implementation.
+     * The pojo itself is recreated by delegating to a {@link org.apache.isis.core.metamodel.adapter.mgr.AdapterManager}.
      * The default impl just uses the {@link ObjectSpecification#createObject()};
      * however object stores (eg JDO/DataNucleus) can provide alternative implementations
      * in order to ensure that the created pojo is attached to a persistence context.
@@ -182,7 +182,7 @@ public interface AdapterManager extends Injectable {
      * will be {@link TypedOid#setVersion(org.apache.isis.core.metamodel.adapter.version.Version) set} to the current 
      * value.  This allows the client to retry if they wish.
      * 
-     * @throws {@link ObjectNotFoundException} if the object does not exist.
+     * @throws {@link org.apache.isis.core.runtime.persistence.ObjectNotFoundException} if the object does not exist.
      */
     ObjectAdapter adapterFor(TypedOid oid, ConcurrencyChecking concurrencyChecking);
 

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryObjectStore.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryObjectStore.java b/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryObjectStore.java
index 58a426c..53e3775 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryObjectStore.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/objectstore/InMemoryObjectStore.java
@@ -128,7 +128,7 @@ public class InMemoryObjectStore implements ObjectStore {
                 // this could happen if we rehydrate a persisted object that
                 // depends on another persisted object
                 // not yet rehydrated.
-                getPersistenceSession().removeAdapter(existingAdapterLookedUpByPojo);
+                getPersistenceSession().getAdapterManager().removeAdapter(existingAdapterLookedUpByPojo);
             }
 
             final ObjectAdapter existingAdapterLookedUpByOid = getAdapterManager().getAdapterFor(oid);
@@ -136,7 +136,7 @@ public class InMemoryObjectStore implements ObjectStore {
                 throw new IsisException("A mapping already exists for " + oid + ": " + existingAdapterLookedUpByOid);
             }
 
-            final ObjectAdapter recreatedAdapter = getPersistenceSession().mapRecreatedPojo(oid, pojo);
+            final ObjectAdapter recreatedAdapter = getPersistenceSession().getAdapterManager().mapRecreatedPojo(oid, pojo);
 
             final Version version = objectStoreInstances.getVersion(oid);
             recreatedAdapter.setVersion(version);
@@ -266,13 +266,6 @@ public class InMemoryObjectStore implements ObjectStore {
         adapter.markAsResolvedIfPossible();
     }
 
-    @Override
-    public void resolveField(final ObjectAdapter object, final ObjectAssociation field) throws ObjectPersistenceException {
-        final ObjectAdapter referenceAdapter = field.get(object);
-        referenceAdapter.markAsResolvedIfPossible();
-    }
-
-
 
     // ///////////////////////////////////////////////////////
     // getInstances, hasInstances

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/objectstore/internal/ObjectStoreInstances.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/objectstore/internal/ObjectStoreInstances.java b/core/runtime/src/main/java/org/apache/isis/core/objectstore/internal/ObjectStoreInstances.java
index 028dffb..b24f332 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/objectstore/internal/ObjectStoreInstances.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/objectstore/internal/ObjectStoreInstances.java
@@ -140,7 +140,7 @@ public class ObjectStoreInstances {
         if (adapterLookedUpByOid != null) {
             return adapterLookedUpByOid;
         }
-        return getPersistenceSession().mapRecreatedPojo(oid, pojo);
+        return getPersistenceSession().getAdapterManager().mapRecreatedPojo(oid, pojo);
     }
 
     // ///////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/runtime/fixturedomainservice/ObjectFixtureFilePersistor.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/fixturedomainservice/ObjectFixtureFilePersistor.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/fixturedomainservice/ObjectFixtureFilePersistor.java
index 934ecbe..90ac06e 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/fixturedomainservice/ObjectFixtureFilePersistor.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/fixturedomainservice/ObjectFixtureFilePersistor.java
@@ -19,20 +19,10 @@
 
 package org.apache.isis.core.runtime.fixturedomainservice;
 
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
+import java.io.*;
+import java.util.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
 import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
@@ -46,7 +36,6 @@ import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.core.runtime.system.persistence.Persistor;
 
 public class ObjectFixtureFilePersistor {
 
@@ -216,7 +205,7 @@ class LoadedObjects {
     }
 
     
-    protected Persistor getPersistenceSession() {
+    protected PersistenceSession getPersistenceSession() {
         return IsisContext.getPersistenceSession();
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/runtime/fixtures/FixturesInstallerDelegate.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/fixtures/FixturesInstallerDelegate.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/fixtures/FixturesInstallerDelegate.java
index 9dd3556..868c498 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/fixtures/FixturesInstallerDelegate.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/fixtures/FixturesInstallerDelegate.java
@@ -33,7 +33,6 @@ import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.core.runtime.system.persistence.Persistor;
 import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
 
 /**
@@ -147,7 +146,7 @@ public class FixturesInstallerDelegate {
     /**
      * Hook - default does nothing.
      */
-    protected void preInstallFixtures(final Persistor persistenceSession) {
+    protected void preInstallFixtures(final PersistenceSession persistenceSession) {
     }
 
     // ///////////////////////////////////////
@@ -238,7 +237,7 @@ public class FixturesInstallerDelegate {
     /**
      * Hook - default does nothing.
      */
-    protected void postInstallFixtures(final Persistor persistenceSession) {
+    protected void postInstallFixtures(final PersistenceSession persistenceSession) {
     }
 
     // /////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/runtime/memento/Memento.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/memento/Memento.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/memento/Memento.java
index dd384d5..b470119 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/memento/Memento.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/memento/Memento.java
@@ -197,7 +197,7 @@ public class Memento implements Serializable {
 		if (spec.isParentedOrFreeCollection()) {
         	
         	final Object recreatedPojo = spec.createObject();
-        	adapter = getPersistenceSession().mapRecreatedPojo(oid, recreatedPojo);
+        	adapter = getPersistenceSession().getAdapterManager() .mapRecreatedPojo(oid, recreatedPojo);
             populateCollection(adapter, (CollectionData) data);
             
         } else {

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapter.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapter.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapter.java
index 08b6af4..8df358b 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapter.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adapter/PojoAdapter.java
@@ -234,13 +234,6 @@ public class PojoAdapter extends InstanceAbstract implements ObjectAdapter {
         return aggregateResolveState().canTransitionToResolving();
     }
 
-
-    @Override
-    public boolean isTitleAvailable() {
-        final ResolveState resolveState = aggregateResolveState();
-        return resolveState.isValue() || resolveState.isResolved();
-    }
-
     /**
      * If {@link #isGhost()}, then will become resolved.
      */

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
index 6f180d7..c9f685c 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault.java
@@ -57,7 +57,6 @@ import org.apache.isis.core.runtime.persistence.PojoRecreationException;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.persistence.OidGenerator;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.core.runtime.system.persistence.RecreatedPojoRemapper;
 
 import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
 import static org.hamcrest.CoreMatchers.*;
@@ -77,7 +76,6 @@ import static org.hamcrest.CoreMatchers.*;
  * maps to an {@link ObjectAdapter adapter} and these are reused.
  */
 public class AdapterManagerDefault implements AdapterManager, Iterable<ObjectAdapter>,
-        RecreatedPojoRemapper,
         SessionScopedComponent,
         DebuggableWithTitle,
         Resettable {
@@ -366,7 +364,6 @@ public class AdapterManagerDefault implements AdapterManager, Iterable<ObjectAda
         return adapter;
     }
 
-    @Override
     public void remapRecreatedPojo(ObjectAdapter adapter, final Object pojo) {
         removeAdapter(adapter);
         adapter.replacePojo(pojo);
@@ -374,7 +371,26 @@ public class AdapterManagerDefault implements AdapterManager, Iterable<ObjectAda
     }
 
 
-    @Override
+    /**
+     * Either returns an existing {@link ObjectAdapter adapter} (as per
+     * {@link #getAdapterFor(Object)} or {@link #getAdapterFor(Oid)}), otherwise
+     * re-creates an adapter with the specified (persistent) {@link Oid}.
+     *
+     * <p>
+     * Typically called when the {@link Oid} is already known, that is, when
+     * resolving an already-persisted object. Is also available for
+     * <tt>Memento</tt> support however, so {@link Oid} could also represent a
+     * {@link Oid#isTransient() transient} object.
+     *
+     * <p>
+     * If the {@link ObjectAdapter adapter} is recreated, its
+     * {@link ResolveState} will be set to either
+     * {@link ResolveState#TRANSIENT} or {@link ResolveState#GHOST} based on
+     * whether the {@link Oid} is {@link Oid#isTransient() transient} or not.
+     *
+     * @param oid
+     * @param recreatedPojo - already known to the object store impl, or a service
+     */
     public ObjectAdapter mapRecreatedPojo(final Oid oid, final Object recreatedPojo) {
 
         // attempt to locate adapter for the pojo

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithm.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithm.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithm.java
index 53f2d58..c0a9de1 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithm.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithm.java
@@ -20,10 +20,11 @@
 package org.apache.isis.core.runtime.persistence.objectstore.algorithm;
 
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 
 public interface PersistAlgorithm {
     
-    public void makePersistent(final ObjectAdapter object, final ToPersistObjectSet adders);
+    public void makePersistent(final ObjectAdapter object, final PersistenceSession adders);
 
     public String name();
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmDefault.java
index 57afe05..fb2a81d 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmDefault.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmDefault.java
@@ -30,6 +30,7 @@ import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacetU
 import org.apache.isis.core.metamodel.spec.feature.Contributed;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.runtime.persistence.ObjectPersistenceException;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 
 class PersistAlgorithmDefault extends PersistAlgorithmAbstract {
     private static final Logger LOG = LoggerFactory.getLogger(PersistAlgorithmDefault.class);
@@ -40,7 +41,7 @@ class PersistAlgorithmDefault extends PersistAlgorithmAbstract {
     }
 
     @Override
-    public void makePersistent(final ObjectAdapter adapter, final ToPersistObjectSet toPersistObjectSet) {
+    public void makePersistent(final ObjectAdapter adapter, final PersistenceSession toPersistObjectSet) {
         if (adapter.getSpecification().isParentedOrFreeCollection()) {
             if(LOG.isDebugEnabled()) {
                 LOG.debug("persist " + adapter);
@@ -61,7 +62,7 @@ class PersistAlgorithmDefault extends PersistAlgorithmAbstract {
         }
     }
 
-    protected void persist(final ObjectAdapter adapter, final ToPersistObjectSet toPersistObjectSet) {
+    protected void persist(final ObjectAdapter adapter, final PersistenceSession toPersistObjectSet) {
         if (alreadyPersistedOrNotPersistableOrServiceOrStandalone(adapter)) {
             return;
         }

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmForDataNucleus.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmForDataNucleus.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmForDataNucleus.java
index 134654b..297f470 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmForDataNucleus.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmForDataNucleus.java
@@ -22,6 +22,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.isis.core.commons.util.ToString;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 
 
 /**
@@ -51,7 +52,7 @@ class PersistAlgorithmForDataNucleus extends PersistAlgorithmAbstract {
     // ////////////////////////////////////////////////////////////////
 
     public void makePersistent(final ObjectAdapter adapter,
-            final ToPersistObjectSet toPersistObjectSet) {
+            final PersistenceSession persistenceSession) {
         if (alreadyPersistedOrNotPersistable(adapter)) {
             return;
         }
@@ -68,7 +69,7 @@ class PersistAlgorithmForDataNucleus extends PersistAlgorithmAbstract {
         if (alreadyPersistedOrNotPersistable(adapter)) {
             return;
         }
-        toPersistObjectSet.addCreateObjectCommand(adapter);
+        persistenceSession.addCreateObjectCommand(adapter);
     }
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmUnified.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmUnified.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmUnified.java
index dca5413..5ebc0b0 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmUnified.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/PersistAlgorithmUnified.java
@@ -23,6 +23,7 @@ import org.slf4j.LoggerFactory;
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.runtime.PersistorImplementation;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 
 
 /**
@@ -48,8 +49,8 @@ public class PersistAlgorithmUnified extends PersistAlgorithmAbstract {
 
     public void makePersistent(
             final ObjectAdapter adapter,
-            final ToPersistObjectSet toPersistObjectSet) {
-        persistAlgorithm.makePersistent(adapter, toPersistObjectSet);
+            final PersistenceSession persistenceSession) {
+        persistAlgorithm.makePersistent(adapter, persistenceSession);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/ToPersistObjectSet.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/ToPersistObjectSet.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/ToPersistObjectSet.java
deleted file mode 100644
index 7170743..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/algorithm/ToPersistObjectSet.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.persistence.objectstore.algorithm;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-
-/**
- * Set of {@link ObjectAdapter}s that require persisting.
- * 
- * <p>
- * Is consumed by {@link PersistAlgorithm}, and is ultimately implemented by
- * {@link PersistenceSession}.
- */
-public interface ToPersistObjectSet {
-
-    void remapAsPersistent(final ObjectAdapter object);
-    
-    void addCreateObjectCommand(ObjectAdapter object);
-    
-    /**
-     * To support ISIS-234; keep track, for the duration of the transaction only, 
-     * of the old transient {@link Oid}s and their corresponding persistent {@link Oid}s.
-     */
-    Oid remappedFrom(Oid oid);
-    
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/PublishingServiceWithDefaultPayloadFactories.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/PublishingServiceWithDefaultPayloadFactories.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/PublishingServiceWithDefaultPayloadFactories.java
index f7c7466..caa5e28 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/PublishingServiceWithDefaultPayloadFactories.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/objectstore/transaction/PublishingServiceWithDefaultPayloadFactories.java
@@ -58,7 +58,7 @@ public class PublishingServiceWithDefaultPayloadFactories {
             // objectstores such as JDO prevent the underlying pojo from being touched once it has been deleted.
             // we therefore replace that pojo with an 'empty' one.
             Object replacementObject = adapter.getSpecification().createObject();
-            getPersistenceSession().remapRecreatedPojo(adapter, replacementObject);
+            getPersistenceSession().getAdapterManager().remapRecreatedPojo(adapter, replacementObject);
             return adapter;
         }
         protected PersistenceSession getPersistenceSession() {

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java
index a5b8005..ff28104 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/ObjectStore.java
@@ -28,7 +28,6 @@ import org.apache.isis.core.metamodel.adapter.oid.CollectionOid;
 import org.apache.isis.core.metamodel.adapter.oid.RootOid;
 import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.runtime.persistence.objectstore.transaction.*;
 
 public interface ObjectStore extends TransactionalResource, DebuggableWithTitle, SessionScopedComponent {
@@ -121,8 +120,7 @@ public interface ObjectStore extends TransactionalResource, DebuggableWithTitle,
 
     /**
      * Retrieves the object identified by the specified {@link TypedOid} from the object
-     * store, {@link RecreatedPojoRemapper#mapRecreatedPojo(org.apache.isis.core.metamodel.adapter.oid.Oid, Object) mapped} into
-     * the {@link AdapterManager}.
+     * store, {@link AdapterManager#mapRecreatedPojo(org.apache.isis.core.metamodel.adapter.oid.Oid, Object) mapped by the adapter manager}.
      * 
      * <p>The cache should be checked first and, if the object is cached,
      * the cached version should be returned. It is important that if this
@@ -163,7 +161,7 @@ public interface ObjectStore extends TransactionalResource, DebuggableWithTitle,
 
 
     // ///////////////////////////////////////////////////////
-    // resolveField, resolveImmediately
+    // resolveImmediately
     // ///////////////////////////////////////////////////////
 
     /**
@@ -173,12 +171,6 @@ public interface ObjectStore extends TransactionalResource, DebuggableWithTitle,
      */
     void resolveImmediately(ObjectAdapter object);
 
-    /**
-     * Called by the resolveEagerly method in ObjectAdapterManager.
-     * 
-     * @see PersistenceSession#resolveField(ObjectAdapter, ObjectAssociation)
-     */
-    void resolveField(ObjectAdapter object, ObjectAssociation field);
 
     // ///////////////////////////////////////////////////////
     // Services

http://git-wip-us.apache.org/repos/asf/isis/blob/5f8fca9b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceQueryFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceQueryFactory.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceQueryFactory.java
new file mode 100644
index 0000000..e93769b
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceQueryFactory.java
@@ -0,0 +1,103 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.core.runtime.system.persistence;
+
+import java.util.Map;
+import com.google.common.collect.Maps;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.isis.applib.query.Query;
+import org.apache.isis.applib.query.QueryDefault;
+import org.apache.isis.applib.query.QueryFindAllInstances;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.services.container.query.QueryCardinality;
+import org.apache.isis.core.metamodel.services.container.query.QueryFindByPattern;
+import org.apache.isis.core.metamodel.services.container.query.QueryFindByTitle;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+import org.apache.isis.core.runtime.persistence.query.*;
+
+public class PersistenceQueryFactory {
+
+    private static final Logger LOG = LoggerFactory.getLogger(PersistenceQueryFactory.class);
+
+    private final SpecificationLoader specificationLoader;
+    private final AdapterManager adapterManager;
+
+    PersistenceQueryFactory(final SpecificationLoader specificationLoader, final AdapterManager adapterManager) {
+        this.specificationLoader = specificationLoader;
+        this.adapterManager = adapterManager;
+    }
+
+    /**
+     * Converts the {@link org.apache.isis.applib.query.Query applib representation of a query} into the
+     * {@link PersistenceQuery NOF-internal representation}.
+     */
+    final PersistenceQuery createPersistenceQueryFor(final Query<?> query, final QueryCardinality cardinality) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("createPersistenceQueryFor: " + query.getDescription());
+        }
+        final ObjectSpecification noSpec = specFor(query);
+        if (query instanceof QueryFindAllInstances) {
+            final QueryFindAllInstances<?> queryFindAllInstances = (QueryFindAllInstances<?>) query;
+            return new PersistenceQueryFindAllInstances(noSpec, queryFindAllInstances.getStart(), queryFindAllInstances.getCount());
+        }
+        if (query instanceof QueryFindByTitle) {
+            final QueryFindByTitle<?> queryByTitle = (QueryFindByTitle<?>) query;
+            final String title = queryByTitle.getTitle();
+            return new PersistenceQueryFindByTitle(noSpec, title, queryByTitle.getStart(), queryByTitle.getCount());
+        }
+        if (query instanceof QueryFindByPattern) {
+            final QueryFindByPattern<?> queryByPattern = (QueryFindByPattern<?>) query;
+            final Object pattern = queryByPattern.getPattern();
+            final ObjectAdapter patternAdapter = adapterManager.adapterFor(pattern);
+            return new PersistenceQueryFindByPattern(noSpec, patternAdapter, queryByPattern.getStart(), queryByPattern.getCount());
+        }
+        if (query instanceof QueryDefault) {
+            final QueryDefault<?> queryDefault = (QueryDefault<?>) query;
+            final String queryName = queryDefault.getQueryName();
+            final Map<String, ObjectAdapter> argumentsAdaptersByParameterName = wrap(queryDefault.getArgumentsByParameterName());
+            return new PersistenceQueryFindUsingApplibQueryDefault(noSpec, queryName, argumentsAdaptersByParameterName, cardinality, queryDefault.getStart(), queryDefault.getCount());
+        }
+        // fallback; generic serializable applib query.
+        return new PersistenceQueryFindUsingApplibQuerySerializable(noSpec, query, cardinality);
+    }
+
+    /**
+     * Converts a map of pojos keyed by string to a map of adapters keyed by the
+     * same strings.
+     */
+    private Map<String, ObjectAdapter> wrap(final Map<String, Object> argumentsByParameterName) {
+        final Map<String, ObjectAdapter> argumentsAdaptersByParameterName = Maps.newHashMap();
+        for (final Map.Entry<String, Object> entry : argumentsByParameterName.entrySet()) {
+            final String parameterName = entry.getKey();
+            final Object argument = argumentsByParameterName.get(parameterName);
+            final ObjectAdapter argumentAdapter = argument != null ? adapterManager.adapterFor(argument) : null;
+            argumentsAdaptersByParameterName.put(parameterName, argumentAdapter);
+        }
+        return argumentsAdaptersByParameterName;
+    }
+
+    private ObjectSpecification specFor(final Query<?> query) {
+        return specificationLoader.loadSpecification(query.getResultType());
+    }
+
+
+}


[42/44] isis git commit: ISIS-944: Optimize TitleBuffer to not create the title twice per method - once for isEmpty(Object) and second time for the actual append/concat call

Posted by da...@apache.org.
ISIS-944: Optimize TitleBuffer to not create the title twice per method - once for isEmpty(Object) and second time for the actual append/concat call


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/545b161b
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/545b161b
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/545b161b

Branch: refs/heads/master
Commit: 545b161b0f3429976568b7c35dd81074dc562118
Parents: da6d6cc
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon Nov 10 23:14:03 2014 +0200
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Nov 10 22:21:30 2014 +0000

----------------------------------------------------------------------
 .../apache/isis/applib/util/TitleBuffer.java    | 61 +++++++++++---------
 1 file changed, 33 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/545b161b/core/applib/src/main/java/org/apache/isis/applib/util/TitleBuffer.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/util/TitleBuffer.java b/core/applib/src/main/java/org/apache/isis/applib/util/TitleBuffer.java
index e7fe610..74e2a59 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/util/TitleBuffer.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/util/TitleBuffer.java
@@ -32,6 +32,8 @@ import java.lang.reflect.Method;
  */
 public class TitleBuffer {
     private static final String SPACE = " ";
+    public static final Class[] NO_PARAMETER_TYPES = new Class[0];
+    public static final Object[] NO_ARGUMENTS = new Object[0];
 
     /**
      * Determines if the specified object's title (from its
@@ -41,7 +43,7 @@ public class TitleBuffer {
      */
     public static boolean isEmpty(final Object object) {
         final String title = titleFor(object);
-        return title == null || title.equals("");
+        return isEmpty(title);
     }
 
     /**
@@ -54,18 +56,12 @@ public class TitleBuffer {
         } else {
             Method method;
             try {
-                method = object.getClass().getMethod("title", new Class[0]);
-                return (String) method.invoke(object, new Object[0]);
-            } catch (final SecurityException e) {
+                method = object.getClass().getMethod("title", NO_PARAMETER_TYPES);
+                return (String) method.invoke(object, NO_ARGUMENTS);
+            } catch (final SecurityException | IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
                 throw new TitleBufferException(e);
             } catch (final NoSuchMethodException e) {
                 return object.toString();
-            } catch (final IllegalArgumentException e) {
-                throw new TitleBufferException(e);
-            } catch (final IllegalAccessException e) {
-                throw new TitleBufferException(e);
-            } catch (final InvocationTargetException e) {
-                throw new TitleBufferException(e);
             }
         }
     }
@@ -78,6 +74,7 @@ public class TitleBuffer {
         return text == null || text.equals("");
     }
 
+    // TODO mgrigorov: is synchronization needed here ? If NO then use StringBuilder
     private final StringBuffer title;
 
     /**
@@ -100,10 +97,11 @@ public class TitleBuffer {
      */
     public TitleBuffer(final Object object, final String defaultTitle) {
         this();
-        if (isEmpty(object)) {
+        String title = titleFor(object);
+        if (isEmpty(title)) {
             concat(defaultTitle);
         } else {
-            concat(object);
+            concat(title);
         }
     }
 
@@ -127,8 +125,9 @@ public class TitleBuffer {
      * Append the title of the specified object.
      */
     public TitleBuffer append(final Object object) {
-        if (!isEmpty(object)) {
-            appendWithSpace(object);
+        String title = titleFor(object);
+        if (!isEmpty(title)) {
+            appendWithSpace(title);
         }
         return this;
     }
@@ -146,8 +145,9 @@ public class TitleBuffer {
      * @return a reference to the called object (itself).
      */
     public TitleBuffer append(final Object object, final String defaultValue) {
-        if (!isEmpty(object)) {
-            appendWithSpace(object);
+        String title = titleFor(object);
+        if (!isEmpty(title)) {
+            appendWithSpace(title);
         } else {
             appendWithSpace(defaultValue);
         }
@@ -175,9 +175,10 @@ public class TitleBuffer {
      * @see #isEmpty(Object)
      */
     public TitleBuffer append(final String joiner, final Object object) {
-        if (!isEmpty(object)) {
+        String title = titleFor(object);
+        if (!isEmpty(title)) {
             appendJoiner(joiner);
-            appendWithSpace(object);
+            appendWithSpace(title);
         }
         return this;
     }
@@ -201,8 +202,9 @@ public class TitleBuffer {
      */
     public TitleBuffer append(final String joiner, final Object object, final String defaultTitle) {
         appendJoiner(joiner);
-        if (!isEmpty(object)) {
-            appendWithSpace(object);
+        String title = titleFor(object);
+        if (!isEmpty(title)) {
+            appendWithSpace(title);
         } else {
             appendWithSpace(defaultTitle);
         }
@@ -275,10 +277,11 @@ public class TitleBuffer {
      * @return a reference to the called object (itself).
      */
     public final TitleBuffer concat(final Object object, final String defaultValue) {
-        if (isEmpty(object)) {
-            title.append(defaultValue);
+        String title = titleFor(object);
+        if (isEmpty(title)) {
+            this.title.append(defaultValue);
         } else {
-            title.append(titleFor(object));
+            this.title.append(title);
         }
 
         return this;
@@ -320,9 +323,10 @@ public class TitleBuffer {
      * @return a reference to the called object (itself).
      */
     public final TitleBuffer concat(final String joiner, final Object object) {
-        if (!isEmpty(object)) {
+        String title = titleFor(object);
+        if (!isEmpty(title)) {
             appendJoiner(joiner);
-            concat(object, "");
+            concat(title, "");
         }
         return this;
     }
@@ -335,12 +339,13 @@ public class TitleBuffer {
      * @return a reference to the called object (itself).
      */
     public final TitleBuffer concat(final String joiner, final Object object, final String defaultValue) {
-        if (isEmpty(object)) {
+        String title = titleFor(object);
+        if (isEmpty(title)) {
             appendJoiner(joiner);
-            title.append(defaultValue);
+            this.title.append(defaultValue);
         } else {
             appendJoiner(joiner);
-            title.append(titleFor(object));
+            this.title.append(title);
         }
         return this;
     }


[17/44] isis git commit: ISIS-537 Use Bootstrap grid offset classes instead of empty columns. Suggested by Bootlint 0.8.0

Posted by da...@apache.org.
ISIS-537 Use Bootstrap grid offset classes instead of empty columns. Suggested by Bootlint 0.8.0


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/f4321aea
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/f4321aea
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/f4321aea

Branch: refs/heads/master
Commit: f4321aeaf5de39a016ae57432921651f91cf6e05
Parents: 3902705
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon Nov 10 10:26:30 2014 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon Nov 10 10:26:30 2014 +0200

----------------------------------------------------------------------
 .../org/apache/isis/viewer/wicket/ui/pages/about/AboutPage.html  | 4 +---
 .../viewer/wicket/ui/pages/actionprompt/ActionPromptPage.html    | 4 +---
 .../org/apache/isis/viewer/wicket/ui/pages/home/HomePage.html    | 4 +---
 3 files changed, 3 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/f4321aea/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/about/AboutPage.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/about/AboutPage.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/about/AboutPage.html
index 855ca14..eb3a892 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/about/AboutPage.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/about/AboutPage.html
@@ -33,11 +33,9 @@
                 <div>
                     <div wicket:id="bookmarks"></div>
                     <div class="row">
-                        <div class="col-xs-2"></div>
-                        <div class="col-xs-8">
+                        <div class="col-xs-offset-2 col-xs-8">
                             <div wicket:id="about"></div>
                         </div>
-                        <div class="col-xs-2"></div>
                     </div>
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/isis/blob/f4321aea/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/actionprompt/ActionPromptPage.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/actionprompt/ActionPromptPage.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/actionprompt/ActionPromptPage.html
index 7a9b7cf..4fd4f02 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/actionprompt/ActionPromptPage.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/actionprompt/ActionPromptPage.html
@@ -27,11 +27,9 @@
 			<div class="actionPromptPage">
 				<div wicket:id="bookmarks"></div>
 				<div class="row">
-					<div class="col-xs-2"></div>
-					<div class="col-xs-8">
+					<div class="col-xs-offset-2 col-xs-8">
 						<div wicket:id="actionPrompt"></div>
 					</div>
-					<div class="col-xs-2"></div>
 				</div>
 			</div>
 		</wicket:extend>

http://git-wip-us.apache.org/repos/asf/isis/blob/f4321aea/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/home/HomePage.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/home/HomePage.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/home/HomePage.html
index 8c79daa..a63f302 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/home/HomePage.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/home/HomePage.html
@@ -28,11 +28,9 @@
                 <div wicket:id="bookmarks"></div>
                 <div wicket:id="welcome"></div>
                 <div class="row">
-                    <div class="col-xs-2"></div>
-                    <div class="col-xs-8">
+                    <div class="col-xs-offset-2 col-xs-8">
                         <div wicket:id="actionPrompt"></div>
                     </div>
-                    <div class="col-xs-2"></div>
                 </div>
             </div>
         </wicket:extend>