ISIS-993: reorganizing components is all.

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

Branch: refs/heads/ISIS-993
Commit: 9a3c26e1d0dfc8968ca1575b8e2215d5adde5465
Parents: 55c4ac7
Author: Dan Haywood <d...@haywood-associates.co.uk>
Authored: Thu Jan 14 16:11:13 2016 +0000
Committer: Dan Haywood <d...@haywood-associates.co.uk>
Committed: Mon Jan 25 15:06:07 2016 +0000

----------------------------------------------------------------------
 .../ComponentFactoryRegistrarDefault.java       |   4 +-
 .../viewer/wicket/model/models/EntityModel.java |  16 +++
 .../components/entity/EntityPanelFactory.java   |  60 ++++++++
 .../tabbed/ColumnTabGroupListColumnPanel.html   |  34 +++++
 .../tabbed/ColumnTabGroupListColumnPanel.java   | 113 +++++++++++++++
 .../entity/tabgrouplist/TabGroupListPanel.html  |  28 ++++
 .../entity/tabgrouplist/TabGroupListPanel.java  | 143 ++++++++++++++++++
 .../entity/tabgroups/EntityTabGroupsPanel.html  |  34 -----
 .../entity/tabgroups/EntityTabGroupsPanel.java  | 112 ---------------
 .../tabgroups/EntityTabGroupsPanelFactory.java  |  60 --------
 .../entity/tabgroups/EntityTabPanel.html        |  31 ----
 .../entity/tabgroups/EntityTabPanel.java        |  23 ---
 .../entity/tabgroups/ListOfTabGroupsPanel.html  |  28 ----
 .../entity/tabgroups/ListOfTabGroupsPanel.java  | 144 -------------------
 .../ui/components/entity/tabpanel/TabPanel.html |  31 ++++
 .../ui/components/entity/tabpanel/TabPanel.java |  23 +++
 16 files changed, 450 insertions(+), 434 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/9a3c26e1/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java
----------------------------------------------------------------------
diff --git 
a/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java
 
b/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java
index 3cf6308..a7646d0 100644
--- 
a/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java
+++ 
b/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/components/ComponentFactoryRegistrarDefault.java
@@ -45,7 +45,7 @@ import 
org.apache.isis.viewer.wicket.ui.components.entity.icontitle.EntityIconAn
 import 
org.apache.isis.viewer.wicket.ui.components.entity.icontitle.EntityIconTitleAndCopyLinkPanelFactory;
 import 
org.apache.isis.viewer.wicket.ui.components.entity.properties.EntityPropertiesPanelFactory;
 import 
org.apache.isis.viewer.wicket.ui.components.entity.selector.links.EntityLinksSelectorPanelFactory;
-import 
org.apache.isis.viewer.wicket.ui.components.entity.tabgroups.EntityTabGroupsPanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.entity.EntityPanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.footer.FooterPanelFactory;
 import org.apache.isis.viewer.wicket.ui.components.header.HeaderPanelFactory;
 import 
org.apache.isis.viewer.wicket.ui.components.scalars.isisapplib.IsisBlobPanelFactory;
@@ -166,7 +166,7 @@ public class ComponentFactoryRegistrarDefault implements 
ComponentFactoryRegistr
     protected void addComponentFactoriesForEntity(final ComponentFactoryList 
componentFactories) {
 
         // top-level
-        componentFactories.add(new EntityTabGroupsPanelFactory());
+        componentFactories.add(new EntityPanelFactory());
 
         // lower-level
         componentFactories.add(new EntityIconAndTitlePanelFactory());

http://git-wip-us.apache.org/repos/asf/isis/blob/9a3c26e1/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
----------------------------------------------------------------------
diff --git 
a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
 
b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
index 0fb28ac..66d2636 100644
--- 
a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
+++ 
b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
@@ -660,6 +660,22 @@ public class EntityModel extends 
BookmarkableModel<ObjectAdapter> {
     }
 
 
+    private TabGroup tabGroupMetadata;
+
+    public TabGroup getTabGroupMetadata() {
+        return tabGroupMetadata;
+    }
+
+    /**
+     * Returns a new copy that SHARES the property scalar models (for edit 
form).
+     */
+    public EntityModel cloneWithTabGroupMetadata(final TabGroup 
tabGroupMetadata) {
+        final EntityModel entityModel = new EntityModel(this.adapterMemento, 
this.propertyScalarModels);
+        entityModel.tabGroupMetadata = tabGroupMetadata;
+        return entityModel;
+    }
+
+
     private Tab tabMetadata;
 
     public Tab getTabMetadata() {

http://git-wip-us.apache.org/repos/asf/isis/blob/9a3c26e1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/EntityPanelFactory.java
----------------------------------------------------------------------
diff --git 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/EntityPanelFactory.java
 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/EntityPanelFactory.java
new file mode 100644
index 0000000..bc5dcd0
--- /dev/null
+++ 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/EntityPanelFactory.java
@@ -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.
+ */
+
+package org.apache.isis.viewer.wicket.ui.components.entity;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+
+import org.apache.isis.applib.layout.v1_0.ObjectLayoutMetadata;
+import 
org.apache.isis.core.metamodel.facets.object.layoutmetadata.ObjectLayoutMetadataFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.ComponentFactory;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import 
org.apache.isis.viewer.wicket.ui.components.entity.combined.EntityCombinedPanel;
+import 
org.apache.isis.viewer.wicket.ui.components.entity.tabbed.ColumnTabGroupListColumnPanel;
+
+/**
+ * {@link ComponentFactory} for {@link ColumnTabGroupListColumnPanel}.
+ */
+public class EntityPanelFactory extends EntityComponentFactoryAbstract {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final String NAME = "tabbed";
+
+    public EntityPanelFactory() {
+        super(ComponentType.ENTITY, NAME, ColumnTabGroupListColumnPanel.class);
+    }
+
+    @Override
+    public Component createComponent(final String id, final IModel<?> model) {
+
+        final EntityModel entityModel = (EntityModel) model;
+
+        final ObjectSpecification specification = 
entityModel.getTypeOfSpecification();
+        final ObjectLayoutMetadataFacet facet = 
specification.getFacet(ObjectLayoutMetadataFacet.class);
+        final ObjectLayoutMetadata layoutMetadata = facet.getMetadata();
+        final boolean hasLayout = layoutMetadata != null;
+        return hasLayout
+                ? new ColumnTabGroupListColumnPanel(id, entityModel)
+                : new EntityCombinedPanel(id, entityModel);
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/9a3c26e1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/ColumnTabGroupListColumnPanel.html
----------------------------------------------------------------------
diff --git 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/ColumnTabGroupListColumnPanel.html
 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/ColumnTabGroupListColumnPanel.html
new file mode 100644
index 0000000..7b172aa
--- /dev/null
+++ 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/ColumnTabGroupListColumnPanel.html
@@ -0,0 +1,34 @@
+<?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.
+-->
+<html xmlns:wicket="http://wicket.apache.org";>
+<body>
+<wicket:panel>
+       <div class="entityTabbed">
+               <div wicket:id="entitySummary"></div>
+
+        <div class="row">
+            <div wicket:id="leftColumn" class = "leftColumn"/>
+            <div wicket:id="middleColumn" class="middleColumn"/>
+            <div wicket:id="rightColumn" class = "rightColumn"/>
+        </div>
+       </div>
+</wicket:panel>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/isis/blob/9a3c26e1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/ColumnTabGroupListColumnPanel.java
----------------------------------------------------------------------
diff --git 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/ColumnTabGroupListColumnPanel.java
 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/ColumnTabGroupListColumnPanel.java
new file mode 100644
index 0000000..108d784
--- /dev/null
+++ 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/ColumnTabGroupListColumnPanel.java
@@ -0,0 +1,113 @@
+/*
+ *  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.entity.tabbed;
+
+import java.util.List;
+
+import com.google.common.collect.FluentIterable;
+
+import org.apache.isis.applib.layout.v1_0.Column;
+import org.apache.isis.applib.layout.v1_0.ObjectLayoutMetadata;
+import org.apache.isis.applib.layout.v1_0.TabGroup;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
+import 
org.apache.isis.core.metamodel.facets.object.layoutmetadata.ObjectLayoutMetadataFacet;
+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.entity.properties.EntityColumn;
+import 
org.apache.isis.viewer.wicket.ui.components.entity.tabgrouplist.TabGroupListPanel;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
+
+/**
+ * {@link PanelAbstract Panel} to represent an entity on a single page made up
+ * of several &lt;div&gt; regions.
+ */
+public class ColumnTabGroupListColumnPanel extends PanelAbstract<EntityModel> {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final String ID_LEFT_COLUMN = "leftColumn";
+    private static final String ID_MIDDLE_COLUMN = "middleColumn";
+    private static final String ID_RIGHT_COLUMN = "rightColumn";
+
+    public ColumnTabGroupListColumnPanel(final String id, final EntityModel 
entityModel) {
+        super(id, entityModel);
+        buildGui();
+    }
+
+    private void buildGui() {
+        final EntityModel model = getModel();
+        final ObjectAdapter objectAdapter = model.getObject();
+        final CssClassFacet facet = 
objectAdapter.getSpecification().getFacet(CssClassFacet.class);
+        if(facet != null) {
+            final String cssClass = facet.cssClass(objectAdapter);
+            CssClassAppender.appendCssClassTo(this, cssClass);
+        }
+
+        // forces metadata to be derived && synced
+        final ObjectLayoutMetadataFacet objectLayoutMetadataFacet = 
model.getTypeOfSpecification().getFacet(ObjectLayoutMetadataFacet.class);
+        final ObjectLayoutMetadata objectLayoutMetadata = 
objectLayoutMetadataFacet.getMetadata();
+
+
+        addOrReplace(ComponentType.ENTITY_SUMMARY, model);
+
+        final int leftSpan = addColumnIfRequired(ID_LEFT_COLUMN, 
objectLayoutMetadata.getLeft(), Column.Hint.LEFT);
+
+        final TabGroupListPanel middleTabs = addTabGroups(ID_MIDDLE_COLUMN, 
objectLayoutMetadata.getTabGroups());
+
+        final int rightSpan = addColumnIfRequired(ID_RIGHT_COLUMN, 
objectLayoutMetadata.getRight(), Column.Hint.RIGHT);
+
+        final int columnSpans = leftSpan + rightSpan;
+        int tabGroupSpan = columnSpans < 12 ? 12 - (columnSpans) : 12;
+        CssClassAppender.appendCssClassTo(middleTabs, "col-xs-" + 
tabGroupSpan);
+
+    }
+
+    private TabGroupListPanel addTabGroups(
+            final String id, final List<TabGroup> tabGroupList) {
+        final EntityModel model = getModel();
+        final List<TabGroup> tabGroups = FluentIterable
+                .from(tabGroupList)
+                .filter(TabGroup.Predicates.notEmpty())
+                .toList();
+        final EntityModel entityModelWitHints = 
model.cloneWithTabGroupListMetadata(tabGroups);
+        final TabGroupListPanel middleComponent = new TabGroupListPanel(id, 
entityModelWitHints);
+        addOrReplace(middleComponent);
+        return middleComponent;
+    }
+
+    private int addColumnIfRequired(final String id, final Column col, final 
Column.Hint hint) {
+        if(col != null) {
+            final EntityModel entityModel =
+                    getModel().cloneWithColumnMetadata(col, hint);
+            final int span = entityModel.getColumnMetadata().getSpan();
+            if(span > 0) {
+                final EntityColumn entityColumn = new EntityColumn(id, 
entityModel, this);
+                addOrReplace(entityColumn);
+                CssClassAppender.appendCssClassTo(entityColumn, "col-xs-" + 
span);
+                return span;
+            }
+        }
+        permanentlyHide(id);
+        return 0;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/9a3c26e1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgrouplist/TabGroupListPanel.html
----------------------------------------------------------------------
diff --git 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgrouplist/TabGroupListPanel.html
 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgrouplist/TabGroupListPanel.html
new file mode 100644
index 0000000..6699518
--- /dev/null
+++ 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgrouplist/TabGroupListPanel.html
@@ -0,0 +1,28 @@
+<?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.
+-->
+<html xmlns:wicket="http://wicket.apache.org";>
+<body>
+<wicket:panel>
+    <div wicket:id="tabGroups">
+        <div wicket:id="tabGroup">[tabbed panel will be here]</div>
+    </div>
+</wicket:panel>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/isis/blob/9a3c26e1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgrouplist/TabGroupListPanel.java
----------------------------------------------------------------------
diff --git 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgrouplist/TabGroupListPanel.java
 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgrouplist/TabGroupListPanel.java
new file mode 100644
index 0000000..d14c73c
--- /dev/null
+++ 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgrouplist/TabGroupListPanel.java
@@ -0,0 +1,143 @@
+/*
+ *  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.entity.tabgrouplist;
+
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.Lists;
+
+import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
+import org.apache.wicket.extensions.markup.html.tabs.ITab;
+import org.apache.wicket.extensions.markup.html.tabs.TabbedPanel;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.Model;
+
+import org.apache.isis.applib.layout.v1_0.Tab;
+import org.apache.isis.applib.layout.v1_0.TabGroup;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.adapter.oid.RootOid;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.components.entity.tabpanel.TabPanel;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+import 
de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel;
+
+public class TabGroupListPanel extends PanelAbstract<EntityModel> {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final String ID_TAB_GROUPS = "tabGroups";
+    private static final String ID_TAB_GROUP = "tabGroup";
+
+    public TabGroupListPanel(final String id, final EntityModel entityModel) {
+        super(id, entityModel);
+        buildGui();
+    }
+
+    private void buildGui() {
+        final EntityModel model = getModel();
+
+        final List<TabGroup> tabGroups = model.getTabGroupListMetadata();
+
+        final AtomicInteger tabGroupRef = new AtomicInteger(0);
+        final ListView<TabGroup> tabGroupsList =
+                new ListView<TabGroup>(ID_TAB_GROUPS, tabGroups) {
+
+            @Override
+            protected void populateItem(final ListItem<TabGroup> item) {
+
+                final List<ITab> tabs = Lists.newArrayList();
+                final TabGroup tabGroup = item.getModelObject();
+                final List<Tab> tabList = FluentIterable
+                        .from(tabGroup.getTabs())
+                        .filter(Tab.Predicates.notEmpty())
+                        .toList();
+
+                for (final Tab tab : tabList) {
+                    tabs.add(new AbstractTab(Model.of(tab.getName())) {
+                        private static final long serialVersionUID = 1L;
+
+                        @Override
+                        public Panel getPanel(String panelId) {
+                            return new TabPanel(panelId, model, tab);
+                        }
+                    });
+                }
+                final AjaxBootstrapTabbedPanel ajaxBootstrapTabbedPanel = 
newTabbedPanel(tabs, tabGroupRef.get());
+
+                item.add(ajaxBootstrapTabbedPanel);
+
+                tabGroupRef.incrementAndGet();
+            }
+
+            private AjaxBootstrapTabbedPanel newTabbedPanel(final List<ITab> 
tabs, final int tabGroupNumber) {
+                final AjaxBootstrapTabbedPanel tabbedPanel = new 
AjaxBootstrapTabbedPanel(ID_TAB_GROUP, tabs) {
+                    @Override
+                    public TabbedPanel setSelectedTab(final int index) {
+                        saveSelectedTabInSession(tabGroupNumber, index);
+                        return super.setSelectedTab(index);
+                    }
+                };
+                setSelectedTabFromSessionIfAny(tabbedPanel, tabGroupNumber);
+                return tabbedPanel;
+
+            }
+
+            private void setSelectedTabFromSessionIfAny(
+                    final AjaxBootstrapTabbedPanel ajaxBootstrapTabbedPanel,
+                    final int tabGroupNumber) {
+                final String key = buildKey(tabGroupNumber);
+                final String value = (String) getSession().getAttribute(key);
+                if(value != null) {
+                    final int tabIndex = Integer.parseInt(value);
+                    final int numTabs = 
ajaxBootstrapTabbedPanel.getTabs().size();
+                    if(tabIndex < numTabs) {
+                        // to support dynamic reloading; the data in the 
session might not be compatible with current layout.
+                        ajaxBootstrapTabbedPanel.setSelectedTab(tabIndex);
+                    }
+                }
+            }
+
+            private void saveSelectedTabInSession(final int tabGroupNumber, 
final int tabIndex) {
+                final String key = buildKey(tabGroupNumber);
+                getSession().setAttribute(key, "" + tabIndex);
+            }
+
+            private String buildKey(final int tabGroupNumber) {
+                final ObjectAdapterMemento objectAdapterMemento = 
TabGroupListPanel.this.getModel().getObjectAdapterMemento();
+                final RootOid oid = (RootOid) 
objectAdapterMemento.getObjectAdapter(
+                        AdapterManager.ConcurrencyChecking.NO_CHECK).getOid();
+                final String key =
+                        IsisContext.getOidMarshaller().marshalNoVersion(oid) + 
"." + tabGroupNumber + ".selectedTab";
+                return key;
+            }
+
+        };
+
+        add(tabGroupsList);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/9a3c26e1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabGroupsPanel.html
----------------------------------------------------------------------
diff --git 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabGroupsPanel.html
 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabGroupsPanel.html
deleted file mode 100644
index 7b172aa..0000000
--- 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabGroupsPanel.html
+++ /dev/null
@@ -1,34 +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.
--->
-<html xmlns:wicket="http://wicket.apache.org";>
-<body>
-<wicket:panel>
-       <div class="entityTabbed">
-               <div wicket:id="entitySummary"></div>
-
-        <div class="row">
-            <div wicket:id="leftColumn" class = "leftColumn"/>
-            <div wicket:id="middleColumn" class="middleColumn"/>
-            <div wicket:id="rightColumn" class = "rightColumn"/>
-        </div>
-       </div>
-</wicket:panel>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/isis/blob/9a3c26e1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabGroupsPanel.java
----------------------------------------------------------------------
diff --git 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabGroupsPanel.java
 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabGroupsPanel.java
deleted file mode 100644
index ba3a2ac..0000000
--- 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabGroupsPanel.java
+++ /dev/null
@@ -1,112 +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.entity.tabgroups;
-
-import java.util.List;
-
-import com.google.common.collect.FluentIterable;
-
-import org.apache.isis.applib.layout.v1_0.Column;
-import org.apache.isis.applib.layout.v1_0.ObjectLayoutMetadata;
-import org.apache.isis.applib.layout.v1_0.TabGroup;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
-import 
org.apache.isis.core.metamodel.facets.object.layoutmetadata.ObjectLayoutMetadataFacet;
-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.entity.properties.EntityColumn;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
-
-/**
- * {@link PanelAbstract Panel} to represent an entity on a single page made up
- * of several &lt;div&gt; regions.
- */
-public class EntityTabGroupsPanel extends PanelAbstract<EntityModel> {
-
-    private static final long serialVersionUID = 1L;
-
-    private static final String ID_LEFT_COLUMN = "leftColumn";
-    private static final String ID_MIDDLE_COLUMN = "middleColumn";
-    private static final String ID_RIGHT_COLUMN = "rightColumn";
-
-    public EntityTabGroupsPanel(final String id, final EntityModel 
entityModel) {
-        super(id, entityModel);
-        buildGui();
-    }
-
-    private void buildGui() {
-        final EntityModel model = getModel();
-        final ObjectAdapter objectAdapter = model.getObject();
-        final CssClassFacet facet = 
objectAdapter.getSpecification().getFacet(CssClassFacet.class);
-        if(facet != null) {
-            final String cssClass = facet.cssClass(objectAdapter);
-            CssClassAppender.appendCssClassTo(this, cssClass);
-        }
-
-        // forces metadata to be derived && synced
-        final ObjectLayoutMetadataFacet objectLayoutMetadataFacet = 
model.getTypeOfSpecification().getFacet(ObjectLayoutMetadataFacet.class);
-        final ObjectLayoutMetadata objectLayoutMetadata = 
objectLayoutMetadataFacet.getMetadata();
-
-
-        addOrReplace(ComponentType.ENTITY_SUMMARY, model);
-
-        final int leftSpan = addColumnIfRequired(ID_LEFT_COLUMN, 
objectLayoutMetadata.getLeft(), Column.Hint.LEFT);
-
-        final ListOfTabGroupsPanel middleTabs = addTabGroups(ID_MIDDLE_COLUMN, 
objectLayoutMetadata.getTabGroups());
-
-        final int rightSpan = addColumnIfRequired(ID_RIGHT_COLUMN, 
objectLayoutMetadata.getRight(), Column.Hint.RIGHT);
-
-        final int columnSpans = leftSpan + rightSpan;
-        int tabGroupSpan = columnSpans < 12 ? 12 - (columnSpans) : 12;
-        CssClassAppender.appendCssClassTo(middleTabs, "col-xs-" + 
tabGroupSpan);
-
-    }
-
-    private ListOfTabGroupsPanel addTabGroups(
-            final String id, final List<TabGroup> tabGroupList) {
-        final EntityModel model = getModel();
-        final List<TabGroup> tabGroups = FluentIterable
-                .from(tabGroupList)
-                .filter(TabGroup.Predicates.notEmpty())
-                .toList();
-        final EntityModel entityModelWitHints = 
model.cloneWithTabGroupListMetadata(tabGroups);
-        final ListOfTabGroupsPanel middleComponent = new 
ListOfTabGroupsPanel(id, entityModelWitHints);
-        addOrReplace(middleComponent);
-        return middleComponent;
-    }
-
-    private int addColumnIfRequired(final String id, final Column col, final 
Column.Hint hint) {
-        if(col != null) {
-            final EntityModel entityModel =
-                    getModel().cloneWithColumnMetadata(col, hint);
-            final int span = entityModel.getColumnMetadata().getSpan();
-            if(span > 0) {
-                final EntityColumn entityColumn = new EntityColumn(id, 
entityModel, this);
-                addOrReplace(entityColumn);
-                CssClassAppender.appendCssClassTo(entityColumn, "col-xs-" + 
span);
-                return span;
-            }
-        }
-        permanentlyHide(id);
-        return 0;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/9a3c26e1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabGroupsPanelFactory.java
----------------------------------------------------------------------
diff --git 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabGroupsPanelFactory.java
 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabGroupsPanelFactory.java
deleted file mode 100644
index 722f98b..0000000
--- 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabGroupsPanelFactory.java
+++ /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.
- */
-
-package org.apache.isis.viewer.wicket.ui.components.entity.tabgroups;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.model.IModel;
-
-import org.apache.isis.applib.layout.v1_0.ObjectLayoutMetadata;
-import 
org.apache.isis.core.metamodel.facets.object.layoutmetadata.ObjectLayoutMetadataFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.viewer.wicket.model.models.EntityModel;
-import org.apache.isis.viewer.wicket.ui.ComponentFactory;
-import org.apache.isis.viewer.wicket.ui.ComponentType;
-import 
org.apache.isis.viewer.wicket.ui.components.entity.EntityComponentFactoryAbstract;
-import 
org.apache.isis.viewer.wicket.ui.components.entity.combined.EntityCombinedPanel;
-
-/**
- * {@link ComponentFactory} for {@link EntityTabGroupsPanel}.
- */
-public class EntityTabGroupsPanelFactory extends 
EntityComponentFactoryAbstract {
-
-    private static final long serialVersionUID = 1L;
-
-    private static final String NAME = "tabbed";
-
-    public EntityTabGroupsPanelFactory() {
-        super(ComponentType.ENTITY, NAME, EntityTabGroupsPanel.class);
-    }
-
-    @Override
-    public Component createComponent(final String id, final IModel<?> model) {
-
-        final EntityModel entityModel = (EntityModel) model;
-
-        final ObjectSpecification specification = 
entityModel.getTypeOfSpecification();
-        final ObjectLayoutMetadataFacet facet = 
specification.getFacet(ObjectLayoutMetadataFacet.class);
-        final ObjectLayoutMetadata layoutMetadata = facet.getMetadata();
-        final boolean hasLayout = layoutMetadata != null;
-        return hasLayout
-                ? new EntityTabGroupsPanel(id, entityModel)
-                : new EntityCombinedPanel(id, entityModel);
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/9a3c26e1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabPanel.html
----------------------------------------------------------------------
diff --git 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabPanel.html
 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabPanel.html
deleted file mode 100644
index 111fc68..0000000
--- 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabPanel.html
+++ /dev/null
@@ -1,31 +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.
--->
-<html xmlns:wicket="http://wicket.apache.org";>
-<body>
-<wicket:panel>
-       <div class="tabPanel">
-               <form class="inputForm" role="form">
-                       <div wicket:id="column">
-                       </div>
-               </form>
-       </div>
-</wicket:panel>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/isis/blob/9a3c26e1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabPanel.java
----------------------------------------------------------------------
diff --git 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabPanel.java
 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabPanel.java
deleted file mode 100644
index 1efc856..0000000
--- 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabPanel.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.apache.isis.viewer.wicket.ui.components.entity.tabgroups;
-
-import org.apache.isis.applib.layout.v1_0.Tab;
-import org.apache.isis.viewer.wicket.model.models.EntityModel;
-import org.apache.isis.viewer.wicket.ui.ComponentType;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-
-public class EntityTabPanel extends PanelAbstract {
-    private static final long serialVersionUID = 1L;
-
-    private static final String ID_COLUMN = "column";
-
-    public EntityTabPanel(String id, final EntityModel model, final Tab tab) {
-        super(id);
-
-        final EntityModel modelWithTabHints = model.cloneWithTabMetadata(tab);
-
-        getComponentFactoryRegistry()
-                .addOrReplaceComponent(this,
-                        ID_COLUMN, ComponentType.ENTITY_PROPERTIES, 
modelWithTabHints);
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/9a3c26e1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/ListOfTabGroupsPanel.html
----------------------------------------------------------------------
diff --git 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/ListOfTabGroupsPanel.html
 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/ListOfTabGroupsPanel.html
deleted file mode 100644
index 6699518..0000000
--- 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/ListOfTabGroupsPanel.html
+++ /dev/null
@@ -1,28 +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.
--->
-<html xmlns:wicket="http://wicket.apache.org";>
-<body>
-<wicket:panel>
-    <div wicket:id="tabGroups">
-        <div wicket:id="tabGroup">[tabbed panel will be here]</div>
-    </div>
-</wicket:panel>
-</body>
-</html>

http://git-wip-us.apache.org/repos/asf/isis/blob/9a3c26e1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/ListOfTabGroupsPanel.java
----------------------------------------------------------------------
diff --git 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/ListOfTabGroupsPanel.java
 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/ListOfTabGroupsPanel.java
deleted file mode 100644
index c8cc961..0000000
--- 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/ListOfTabGroupsPanel.java
+++ /dev/null
@@ -1,144 +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.entity.tabgroups;
-
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.Lists;
-
-import org.apache.wicket.MarkupContainer;
-import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
-import org.apache.wicket.extensions.markup.html.tabs.ITab;
-import org.apache.wicket.extensions.markup.html.tabs.TabbedPanel;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.Model;
-
-import org.apache.isis.applib.layout.v1_0.Tab;
-import org.apache.isis.applib.layout.v1_0.TabGroup;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.adapter.oid.RootOid;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
-import org.apache.isis.viewer.wicket.model.models.EntityModel;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-
-import 
de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel;
-
-public class ListOfTabGroupsPanel extends PanelAbstract<EntityModel> {
-
-    private static final long serialVersionUID = 1L;
-
-    private static final String ID_TAB_GROUPS = "tabGroups";
-    private static final String ID_TAB_GROUP = "tabGroup";
-
-    public ListOfTabGroupsPanel(final String id, final EntityModel 
entityModel) {
-        super(id, entityModel);
-        buildGui();
-    }
-
-    private void buildGui() {
-        final EntityModel model = getModel();
-
-        final List<TabGroup> tabGroups = model.getTabGroupListMetadata();
-
-        final AtomicInteger tabGroupRef = new AtomicInteger(0);
-        final ListView<TabGroup> tabGroupsList =
-                new ListView<TabGroup>(ID_TAB_GROUPS, tabGroups) {
-
-            @Override
-            protected void populateItem(final ListItem<TabGroup> item) {
-
-                final List<ITab> tabs = Lists.newArrayList();
-                final TabGroup tabGroup = item.getModelObject();
-                final List<Tab> tabList = FluentIterable
-                        .from(tabGroup.getTabs())
-                        .filter(Tab.Predicates.notEmpty())
-                        .toList();
-
-                for (final Tab tab : tabList) {
-                    tabs.add(new AbstractTab(Model.of(tab.getName())) {
-                        private static final long serialVersionUID = 1L;
-
-                        @Override
-                        public Panel getPanel(String panelId) {
-                            return new EntityTabPanel(panelId, model, tab);
-                        }
-                    });
-                }
-                final AjaxBootstrapTabbedPanel ajaxBootstrapTabbedPanel = 
newTabbedPanel(tabs, tabGroupRef.get());
-
-                item.add(ajaxBootstrapTabbedPanel);
-
-                tabGroupRef.incrementAndGet();
-            }
-
-            private AjaxBootstrapTabbedPanel newTabbedPanel(final List<ITab> 
tabs, final int tabGroupNumber) {
-                final AjaxBootstrapTabbedPanel tabbedPanel = new 
AjaxBootstrapTabbedPanel(ID_TAB_GROUP, tabs) {
-                    @Override
-                    public TabbedPanel setSelectedTab(final int index) {
-                        saveSelectedTabInSession(tabGroupNumber, index);
-                        return super.setSelectedTab(index);
-                    }
-                };
-                setSelectedTabFromSessionIfAny(tabbedPanel, tabGroupNumber);
-                return tabbedPanel;
-
-            }
-
-            private void setSelectedTabFromSessionIfAny(
-                    final AjaxBootstrapTabbedPanel ajaxBootstrapTabbedPanel,
-                    final int tabGroupNumber) {
-                final String key = buildKey(tabGroupNumber);
-                final String value = (String) getSession().getAttribute(key);
-                if(value != null) {
-                    final int tabIndex = Integer.parseInt(value);
-                    final int numTabs = 
ajaxBootstrapTabbedPanel.getTabs().size();
-                    if(tabIndex < numTabs) {
-                        // to support dynamic reloading; the data in the 
session might not be compatible with current layout.
-                        ajaxBootstrapTabbedPanel.setSelectedTab(tabIndex);
-                    }
-                }
-            }
-
-            private void saveSelectedTabInSession(final int tabGroupNumber, 
final int tabIndex) {
-                final String key = buildKey(tabGroupNumber);
-                getSession().setAttribute(key, "" + tabIndex);
-            }
-
-            private String buildKey(final int tabGroupNumber) {
-                final ObjectAdapterMemento objectAdapterMemento = 
ListOfTabGroupsPanel.this.getModel().getObjectAdapterMemento();
-                final RootOid oid = (RootOid) 
objectAdapterMemento.getObjectAdapter(
-                        AdapterManager.ConcurrencyChecking.NO_CHECK).getOid();
-                final String key =
-                        IsisContext.getOidMarshaller().marshalNoVersion(oid) + 
"." + tabGroupNumber + ".selectedTab";
-                return key;
-            }
-
-        };
-
-        add(tabGroupsList);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/9a3c26e1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabpanel/TabPanel.html
----------------------------------------------------------------------
diff --git 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabpanel/TabPanel.html
 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabpanel/TabPanel.html
new file mode 100644
index 0000000..111fc68
--- /dev/null
+++ 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabpanel/TabPanel.html
@@ -0,0 +1,31 @@
+<?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.
+-->
+<html xmlns:wicket="http://wicket.apache.org";>
+<body>
+<wicket:panel>
+       <div class="tabPanel">
+               <form class="inputForm" role="form">
+                       <div wicket:id="column">
+                       </div>
+               </form>
+       </div>
+</wicket:panel>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/isis/blob/9a3c26e1/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabpanel/TabPanel.java
----------------------------------------------------------------------
diff --git 
a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabpanel/TabPanel.java
 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabpanel/TabPanel.java
new file mode 100644
index 0000000..b6a5f70
--- /dev/null
+++ 
b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabpanel/TabPanel.java
@@ -0,0 +1,23 @@
+package org.apache.isis.viewer.wicket.ui.components.entity.tabpanel;
+
+import org.apache.isis.applib.layout.v1_0.Tab;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+public class TabPanel extends PanelAbstract {
+    private static final long serialVersionUID = 1L;
+
+    private static final String ID_COLUMN = "column";
+
+    public TabPanel(String id, final EntityModel model, final Tab tab) {
+        super(id);
+
+        final EntityModel modelWithTabHints = model.cloneWithTabMetadata(tab);
+
+        getComponentFactoryRegistry()
+                .addOrReplaceComponent(this,
+                        ID_COLUMN, ComponentType.ENTITY_PROPERTIES, 
modelWithTabHints);
+
+    }
+}

Reply via email to