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 2016/02/02 01:35:58 UTC
[01/15] isis git commit: ISIS-993: store hint on the column,
rather than pass around separately.
Repository: isis
Updated Branches:
refs/heads/ISIS-993 65f7d320f -> 63d03d29b
ISIS-993: store hint on the column, rather than pass around separately.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/fc59d351
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/fc59d351
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/fc59d351
Branch: refs/heads/ISIS-993
Commit: fc59d351325454489fe22382b8c41ac4ae30f1e5
Parents: 65f7d32
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sun Jan 31 11:40:43 2016 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Sun Jan 31 11:40:43 2016 +0000
----------------------------------------------------------------------
.../isis/applib/layout/fixedcols/FCColumn.java | 13 ++++++++
.../isis/applib/layout/fixedcols/FCPage.java | 2 ++
.../isis/applib/layout/fixedcols/FCTab.java | 3 ++
.../viewer/wicket/model/models/EntityModel.java | 32 ++++++++------------
.../components/entity/column/EntityColumn.java | 2 +-
.../propsandcolls/EntityPropsAndCollsForm.java | 2 +-
.../entity/tabbed/EntityTabbedPanel.java | 8 ++---
7 files changed, 37 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/fc59d351/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCColumn.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCColumn.java b/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCColumn.java
index 47d7812..a11b459 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCColumn.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCColumn.java
@@ -137,6 +137,19 @@ public class FCColumn implements Serializable, MemberRegionOwner, Owned<FCColumn
+ private Hint hint;
+
+ @XmlTransient
+ public Hint getHint() {
+ return hint;
+ }
+
+ public void setHint(final Hint hint) {
+ this.hint = hint;
+ }
+
+
+
public enum Hint {
LEFT,
MIDDLE,
http://git-wip-us.apache.org/repos/asf/isis/blob/fc59d351/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCPage.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCPage.java b/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCPage.java
index 1b50e8d..a86ea88 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCPage.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCPage.java
@@ -82,6 +82,7 @@ public class FCPage implements Page, Dto, ActionOwner, Serializable, FCColumnOwn
public void setLeft(final FCColumn left) {
this.left = left;
+ left.setHint(FCColumn.Hint.LEFT);
}
@@ -109,6 +110,7 @@ public class FCPage implements Page, Dto, ActionOwner, Serializable, FCColumnOwn
public void setRight(final FCColumn right) {
this.right = right;
+ right.setHint(FCColumn.Hint.RIGHT);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/fc59d351/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCTab.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCTab.java b/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCTab.java
index 9475929..026f09f 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCTab.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCTab.java
@@ -70,6 +70,7 @@ public class FCTab implements FCColumnOwner, Serializable, Owned<FCTabGroup> {
public void setLeft(final FCColumn left) {
this.left = left;
+ left.setHint(FCColumn.Hint.LEFT);
}
@@ -82,6 +83,7 @@ public class FCTab implements FCColumnOwner, Serializable, Owned<FCTabGroup> {
public void setMiddle(final FCColumn middle) {
this.middle = middle;
+ middle.setHint(FCColumn.Hint.MIDDLE);
}
@@ -94,6 +96,7 @@ public class FCTab implements FCColumnOwner, Serializable, Owned<FCTabGroup> {
public void setRight(final FCColumn right) {
this.right = right;
+ right.setHint(FCColumn.Hint.RIGHT);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/fc59d351/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 debcd80..b169164 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
@@ -696,36 +696,21 @@ public class EntityModel extends BookmarkableModel<ObjectAdapter> {
}
- private FCColumn FCColumn;
- private FCColumn.Hint columnHint;
+ private FCColumn fcColumn;
/**
* Returns a new copy that SHARES the property scalar models (for edit form).
*/
- public EntityModel cloneWithColumnMetadata(final FCColumn FCColumn, final FCColumn.Hint columnHint) {
+ public EntityModel cloneWithColumnMetadata(final FCColumn fcColumn) {
final EntityModel entityModel = new EntityModel(this.adapterMemento, this.propertyScalarModels);
- entityModel.FCColumn = FCColumn;
- entityModel.columnHint = columnHint;
+ entityModel.fcColumn = fcColumn;
return entityModel;
}
public FCColumn getFCColumn() {
- return FCColumn;
- }
- public FCColumn.Hint getColumnHint() {
- return columnHint;
- }
-
- @Override
- protected void doSetHint(final String scopeKey, final String attributeName, final String value) {
- ScopedSessionAttribute scopedSessionAttribute = scopedSessionAttributeByName.get(attributeName);
- if(scopedSessionAttribute == null) {
- scopedSessionAttribute = ScopedSessionAttribute.create(this, scopeKey, attributeName);
- }
- scopedSessionAttribute.set(value);
+ return fcColumn;
}
-
private FieldSet fieldSet;
public FieldSet getFieldSet() {
return fieldSet;
@@ -757,6 +742,15 @@ public class EntityModel extends BookmarkableModel<ObjectAdapter> {
return entityModel;
}
+ @Override
+ protected void doSetHint(final String scopeKey, final String attributeName, final String value) {
+ ScopedSessionAttribute scopedSessionAttribute = scopedSessionAttributeByName.get(attributeName);
+ if(scopedSessionAttribute == null) {
+ scopedSessionAttribute = ScopedSessionAttribute.create(this, scopeKey, attributeName);
+ }
+ scopedSessionAttribute.set(value);
+ }
+
// //////////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/isis/blob/fc59d351/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.java
index 66bc4c6..34eb66f 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.java
@@ -76,7 +76,7 @@ public class EntityColumn extends PanelAbstract<EntityModel> {
super(id, entityModel);
columnMetaDataIfAny = entityModel.getFCColumn();
- hint = entityModel.getColumnHint();
+ hint = entityModel.getFCColumn().getHint();
buildGui();
}
http://git-wip-us.apache.org/repos/asf/isis/blob/fc59d351/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.java
index 69eea60..9668c96 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.java
@@ -237,7 +237,7 @@ public class EntityPropsAndCollsForm extends FormAbstract<ObjectAdapter> impleme
final Hint hint) {
final FCColumn columnMetaDataIfAny = hint.from(FCTabMetaDataIfAny);
- final EntityModel entityModelWithHints = entityModel.cloneWithColumnMetadata(columnMetaDataIfAny, hint);
+ final EntityModel entityModelWithHints = entityModel.cloneWithColumnMetadata(columnMetaDataIfAny);
final EntityColumn columnMembers =
new EntityColumn(ID_ENTITY_COLUMN, entityModelWithHints);
http://git-wip-us.apache.org/repos/asf/isis/blob/fc59d351/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.java
index 56a346a..e9d6fda 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.java
@@ -69,11 +69,11 @@ public class EntityTabbedPanel extends PanelAbstract<EntityModel> {
addOrReplace(ComponentType.ENTITY_SUMMARY, model);
- final int leftSpan = addColumnIfRequired(ID_LEFT_COLUMN, page.getLeft(), FCColumn.Hint.LEFT);
+ final int leftSpan = addColumnIfRequired(ID_LEFT_COLUMN, page.getLeft());
final TabGroupListPanel middleTabs = addTabGroups(ID_MIDDLE_COLUMN, page.getTabGroups());
- final int rightSpan = addColumnIfRequired(ID_RIGHT_COLUMN, page.getRight(), FCColumn.Hint.RIGHT);
+ final int rightSpan = addColumnIfRequired(ID_RIGHT_COLUMN, page.getRight());
final int columnSpans = leftSpan + rightSpan;
int tabGroupSpan = columnSpans < 12 ? 12 - (columnSpans) : 12;
@@ -94,10 +94,10 @@ public class EntityTabbedPanel extends PanelAbstract<EntityModel> {
return middleComponent;
}
- private int addColumnIfRequired(final String id, final FCColumn col, final FCColumn.Hint hint) {
+ private int addColumnIfRequired(final String id, final FCColumn col) {
if(col != null) {
final EntityModel entityModel =
- getModel().cloneWithColumnMetadata(col, hint);
+ getModel().cloneWithColumnMetadata(col);
final int span = entityModel.getFCColumn().getSpan();
if(span > 0) {
final EntityColumn entityColumn = new EntityColumn(id, entityModel);
[13/15] isis git commit: ISIS-993: renamed Page to Grid,
PageFacet to GridFacet, PageService to GridService,
PageNormalizerService to GridNormalizerService, BS3PagePanel to BS3GridPanel,
FCPagePanel to FCGridPanel,
Posted by da...@apache.org.
ISIS-993: renamed Page to Grid, PageFacet to GridFacet, PageService to GridService, PageNormalizerService to GridNormalizerService, BS3PagePanel to BS3GridPanel, FCPagePanel to FCGridPanel,
Also regenerated bootstrap3.xsd for new id attrs and sorted out an issue with the unreferencedXxx attrs so that they can be optional.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/7fb63556
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/7fb63556
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/7fb63556
Branch: refs/heads/ISIS-993
Commit: 7fb6355663b4ccddba24e7ebe47774f56b62c148
Parents: 25a267a
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Feb 1 23:22:31 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Feb 1 23:22:31 2016 +0100
----------------------------------------------------------------------
.../applib/layout/bootstrap3/bootstrap3.xsd | 12 +-
.../applib/layout/fixedcols/fixedcols.xsd | 4 +-
.../isis/applib/layout/bootstrap3/BS3Col.java | 18 +-
.../isis/applib/layout/bootstrap3/BS3Grid.java | 345 ++++++++++++++++
.../isis/applib/layout/bootstrap3/BS3Page.java | 345 ----------------
.../isis/applib/layout/bootstrap3/BS3Row.java | 2 +-
.../apache/isis/applib/layout/common/Grid.java | 51 +++
.../apache/isis/applib/layout/common/Page.java | 57 ---
.../isis/applib/layout/fixedcols/FCColumn.java | 2 +-
.../isis/applib/layout/fixedcols/FCGrid.java | 305 ++++++++++++++
.../isis/applib/layout/fixedcols/FCPage.java | 305 --------------
.../applib/services/layout/GridService.java | 46 +++
.../layout/Object_downloadLayoutXml.java | 14 +-
.../services/layout/Object_viewLayout.java | 10 +-
.../applib/services/layout/PageService.java | 49 ---
.../metamodel/facets/object/grid/GridFacet.java | 33 ++
.../facets/object/grid/GridFacetDefault.java | 116 ++++++
.../facets/object/grid/GridFacetFactory.java | 63 +++
.../facets/object/layoutmetadata/PageFacet.java | 33 --
.../object/layoutmetadata/PageFacetDefault.java | 117 ------
.../object/layoutmetadata/PageFacetFactory.java | 63 ---
.../json/LayoutMetadataReaderFromJson.java | 10 +-
.../services/grid/GridServiceDefault.java | 189 +++++++++
.../grid/normalizer/GridNormalizer.java | 25 ++
.../grid/normalizer/GridNormalizerAbstract.java | 35 ++
.../grid/normalizer/GridNormalizerBS3.java | 39 ++
.../grid/normalizer/GridNormalizerFC.java | 399 +++++++++++++++++++
.../grid/normalizer/GridNormalizerService.java | 37 ++
.../GridNormalizerServiceDefault.java | 110 +++++
.../services/layout/PageServiceDefault.java | 189 ---------
.../layout/provider/PageNormalizer.java | 25 --
.../layout/provider/PageNormalizerAbstract.java | 35 --
.../layout/provider/PageNormalizerBS3.java | 39 --
.../layout/provider/PageNormalizerFC.java | 399 -------------------
.../layout/provider/PageNormalizerService.java | 37 --
.../provider/PageNormalizerServiceDefault.java | 110 -----
.../services/metamodel/MetadataMenu.java | 12 +-
.../dflt/ProgrammingModelFacetsJava5.java | 4 +-
.../object/layoutxml/GridFacetDefaultTest.java | 60 +++
.../object/layoutxml/PageFacetDefaultTest.java | 60 ---
.../layout/bootstrap3/BS3GridTest.java | 149 +++++++
.../layout/bootstrap3/BS3PageTest.java | 149 -------
.../metamodel/layout/fixedcols/FCGridTest.java | 120 ++++++
.../metamodel/layout/fixedcols/FCPageTest.java | 120 ------
.../links/EntityLinksSelectorPanelFactory.java | 28 +-
.../components/layout/EntityPanelFactory.java | 4 +-
.../ui/components/layout/bs3/BS3GridPanel.html | 28 ++
.../ui/components/layout/bs3/BS3GridPanel.java | 66 +++
.../ui/components/layout/bs3/BS3PagePanel.html | 28 --
.../ui/components/layout/bs3/BS3PagePanel.java | 66 ---
.../layout/fixedcols/FCGridPanel.html | 34 ++
.../layout/fixedcols/FCGridPanel.java | 114 ++++++
.../layout/fixedcols/FCPagePanel.html | 34 --
.../layout/fixedcols/FCPagePanel.java | 114 ------
.../propsandcolls/EntityPropsAndCollsPanel.java | 4 +-
.../EntityPropsAndCollsPanelFactory.java | 4 +-
.../wicket/ui/pages/entity/EntityPage.java | 12 +-
.../dom/simple/SimpleObject.layout-FC.xml | 4 +-
.../dom/simple/SimpleObject.layout.xml | 10 +-
59 files changed, 2441 insertions(+), 2451 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/adocs/documentation/src/main/asciidoc/schema/applib/layout/bootstrap3/bootstrap3.xsd
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/schema/applib/layout/bootstrap3/bootstrap3.xsd b/adocs/documentation/src/main/asciidoc/schema/applib/layout/bootstrap3/bootstrap3.xsd
index db16d1a..7259fcc 100644
--- a/adocs/documentation/src/main/asciidoc/schema/applib/layout/bootstrap3/bootstrap3.xsd
+++ b/adocs/documentation/src/main/asciidoc/schema/applib/layout/bootstrap3/bootstrap3.xsd
@@ -9,9 +9,9 @@
<xs:element name="col" type="tns:col"/>
- <xs:element name="page" type="tns:page"/>
+ <xs:element name="grid" type="tns:grid"/>
- <xs:complexType name="page">
+ <xs:complexType name="grid">
<xs:complexContent>
<xs:extension base="tns:bs3ElementAbstract">
<xs:sequence>
@@ -37,6 +37,7 @@
<xs:element ref="tns:clearFixHidden"/>
</xs:choice>
</xs:sequence>
+ <xs:attribute name="id" type="xs:string"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
@@ -52,10 +53,11 @@
<xs:element ref="ns1:fieldSet" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="ns1:collection" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
+ <xs:attribute name="id" type="xs:string"/>
<xs:attribute name="span" type="xs:int" use="required"/>
- <xs:attribute name="unreferencedActions" type="xs:boolean" use="optional"/>
- <xs:attribute name="unreferencedCollections" type="xs:boolean" use="optional"/>
- <xs:attribute name="unreferencedProperties" type="xs:boolean" use="optional"/>
+ <xs:attribute name="unreferencedActions" type="xs:boolean"/>
+ <xs:attribute name="unreferencedCollections" type="xs:boolean"/>
+ <xs:attribute name="unreferencedProperties" type="xs:boolean"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/adocs/documentation/src/main/asciidoc/schema/applib/layout/fixedcols/fixedcols.xsd
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/schema/applib/layout/fixedcols/fixedcols.xsd b/adocs/documentation/src/main/asciidoc/schema/applib/layout/fixedcols/fixedcols.xsd
index 5934983..7820a18 100644
--- a/adocs/documentation/src/main/asciidoc/schema/applib/layout/fixedcols/fixedcols.xsd
+++ b/adocs/documentation/src/main/asciidoc/schema/applib/layout/fixedcols/fixedcols.xsd
@@ -3,9 +3,9 @@
<xs:import namespace="http://isis.apache.org/schema/applib/layout/common" schemaLocation="../common"/>
- <xs:element name="page" type="tns:page"/>
+ <xs:element name="grid" type="tns:grid"/>
- <xs:complexType name="page">
+ <xs:complexType name="grid">
<xs:sequence>
<xs:element ref="ns1:action" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="left" type="tns:fcColumn" minOccurs="0"/>
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java
index 90ae5db..cef0f80 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java
@@ -95,7 +95,7 @@ public class BS3Col extends BS3RowContent implements ActionLayoutDataOwner, BS3T
}
- private boolean unreferencedActions;
+ private Boolean unreferencedActions;
/**
* Whether this column should be used to hold any unreferenced actions (contributed or "native").
@@ -105,16 +105,16 @@ public class BS3Col extends BS3RowContent implements ActionLayoutDataOwner, BS3T
* </p>
*/
@XmlAttribute(required = false)
- public boolean isUnreferencedActions() {
+ public Boolean isUnreferencedActions() {
return unreferencedActions;
}
- public void setUnreferencedActions(final boolean unreferencedActions) {
+ public void setUnreferencedActions(final Boolean unreferencedActions) {
this.unreferencedActions = unreferencedActions;
}
- private boolean unreferencedProperties;
+ private Boolean unreferencedProperties;
/**
* Whether the first fieldset in this column should be used to hold any unreferenced properties (contributed or "native").
*
@@ -123,16 +123,16 @@ public class BS3Col extends BS3RowContent implements ActionLayoutDataOwner, BS3T
* </p>
*/
@XmlAttribute(required = false)
- public boolean isUnreferencedProperties() {
+ public Boolean isUnreferencedProperties() {
return unreferencedProperties;
}
- public void setUnreferencedProperties(final boolean unreferencedProperties) {
+ public void setUnreferencedProperties(final Boolean unreferencedProperties) {
this.unreferencedProperties = unreferencedProperties;
}
- private boolean unreferencedCollections;
+ private Boolean unreferencedCollections;
/**
* Whether this column should be used to hold any unreferenced collections (contributed or "native").
*
@@ -141,11 +141,11 @@ public class BS3Col extends BS3RowContent implements ActionLayoutDataOwner, BS3T
* </p>
*/
@XmlAttribute(required = false)
- public boolean isUnreferencedCollections() {
+ public Boolean isUnreferencedCollections() {
return unreferencedCollections;
}
- public void setUnreferencedCollections(final boolean unreferencedCollections) {
+ public void setUnreferencedCollections(final Boolean unreferencedCollections) {
this.unreferencedCollections = unreferencedCollections;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Grid.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Grid.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Grid.java
new file mode 100644
index 0000000..e3904c4
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Grid.java
@@ -0,0 +1,345 @@
+/*
+ * 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.layout.bootstrap3;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.layout.common.ActionLayoutData;
+import org.apache.isis.applib.layout.common.ActionLayoutDataOwner;
+import org.apache.isis.applib.layout.common.CollectionLayoutData;
+import org.apache.isis.applib.layout.common.DomainObjectLayoutData;
+import org.apache.isis.applib.layout.common.FieldSet;
+import org.apache.isis.applib.layout.common.Grid;
+import org.apache.isis.applib.layout.common.PropertyLayoutData;
+import org.apache.isis.applib.services.dto.Dto;
+
+/**
+ * This is the top-level for rendering the domain object's properties, collections and actions. It simply consists
+ * of a number of rows.
+ *
+ * <p>
+ * The element is rendered as a <div class="...">
+ * </p>
+ */
+@XmlRootElement(
+ name = "grid"
+)
+@XmlType(
+ name = "grid"
+ , propOrder = {
+ "rows"
+ , "metadataErrors"
+ }
+)
+public class BS3Grid extends BS3ElementAbstract implements Grid, Dto, BS3RowOwner {
+
+ private static final long serialVersionUID = 1L;
+
+ private List<BS3Row> rows = new ArrayList<BS3Row>(){{
+ add(new BS3Row());
+ }};
+
+ // no wrapper
+ @XmlElement(name = "row", required = true)
+ public List<BS3Row> getRows() {
+ return rows;
+ }
+
+ public void setRows(final List<BS3Row> rows) {
+ this.rows = rows;
+ }
+
+
+
+ private boolean normalized;
+
+ @Programmatic
+ @XmlTransient
+ public boolean isNormalized() {
+ return normalized;
+ }
+
+ @Programmatic
+ public void setNormalized(final boolean normalized) {
+ this.normalized = normalized;
+ }
+
+ private List<String> metadataErrors = Lists.newArrayList();
+
+ /**
+ * For diagnostics; populated by the framework if and only if a metadata error.
+ *
+ * <p>
+ * For example, if there is not exactly one {@link BS3Col} with the
+ * {@link BS3Col#isUnreferencedActions()} attribute set, then this is an error. Ditto for
+ * {@link BS3Col#isUnreferencedCollections() collections}
+ * and {@link BS3Col#isUnreferencedProperties() properties}.
+ * </p>
+ */
+ @XmlElement(required = false)
+ public List<String> getMetadataErrors() {
+ return metadataErrors;
+ }
+
+ public void setMetadataErrors(final List<String> metadataErrors) {
+ this.metadataErrors = metadataErrors;
+ }
+
+ interface Visitor {
+ void visit(final BS3Grid bs3Page);
+ void visit(final BS3Row bs3Row);
+ void visit(final BS3Col bs3Col);
+ void visit(final BS3ClearFix bs3ClearFix);
+ void visit(final BS3TabGroup bs3TabGroup);
+ void visit(final BS3Tab bs3Tab);
+ void visit(final FieldSet fieldSet);
+ void visit(final DomainObjectLayoutData domainObjectLayout);
+ void visit(final PropertyLayoutData propertyLayoutData);
+ void visit(final CollectionLayoutData collectionLayoutData);
+ void visit(final ActionLayoutData actionLayoutData);
+ }
+
+ public static class VisitorAdapter implements Visitor {
+ @Override
+ public void visit(final BS3Grid bs3Page) { }
+ @Override
+ public void visit(final BS3Row bs3Row) { }
+ @Override
+ public void visit(final BS3Col bs3Col) { }
+ @Override
+ public void visit(final BS3ClearFix bs3ClearFix) { }
+ @Override
+ public void visit(final BS3TabGroup bs3TabGroup) { }
+ @Override
+ public void visit(final BS3Tab bs3Tab) { }
+ @Override
+ public void visit(final DomainObjectLayoutData domainObjectLayout) { }
+ @Override
+ public void visit(final FieldSet fieldSet) {}
+ @Override
+ public void visit(final PropertyLayoutData propertyLayoutData) {}
+ @Override
+ public void visit(final CollectionLayoutData collectionLayoutData) {}
+ @Override
+ public void visit(final ActionLayoutData actionLayoutData) { }
+ }
+
+ public void visit(final BS3Grid.Visitor visitor) {
+ visitor.visit(this);
+ traverseRows(this, visitor);
+ }
+
+ protected void traverseRows(final BS3RowOwner rowOwner, final Visitor visitor) {
+ for (BS3Row bs3Row : rowOwner.getRows()) {
+ bs3Row.setOwner(this);
+ visitor.visit(bs3Row);
+ final List<BS3RowContent> cols = bs3Row.getCols();
+ for (BS3RowContent rowContent : cols) {
+ rowContent.setOwner(bs3Row);
+ if(rowContent instanceof BS3Col) {
+ final BS3Col bs3Col = (BS3Col) rowContent;
+ visitor.visit(bs3Col);
+ traverseDomainObject(bs3Col, visitor);
+ traverseTabGroups(bs3Col, visitor);
+ traverseActions(bs3Col, visitor);
+ traverseFieldSets(bs3Col, visitor);
+ traverseCollections(bs3Col, visitor);
+ traverseRows(bs3Col, visitor);
+ } else if (rowContent instanceof BS3ClearFix) {
+ final BS3ClearFix bs3ClearFix = (BS3ClearFix) rowContent;
+ visitor.visit(bs3ClearFix);
+ } else {
+ throw new IllegalStateException(
+ "Unrecognized implementation of BS3RowContent, " + rowContent);
+ }
+ }
+ }
+ }
+
+ private void traverseDomainObject(final BS3Col bs3Col, final Visitor visitor) {
+ final DomainObjectLayoutData domainObject = bs3Col.getDomainObject();
+ if(domainObject == null) {
+ return;
+ }
+ domainObject.setOwner(bs3Col);
+ visitor.visit(domainObject);
+ }
+
+ private void traverseTabGroups(
+ final BS3TabGroupOwner bs3TabGroupOwner,
+ final Visitor visitor) {
+ final List<BS3TabGroup> tabGroups = bs3TabGroupOwner.getTabGroups();
+ for (BS3TabGroup bs3TabGroup : tabGroups) {
+ bs3TabGroup.setOwner(bs3TabGroupOwner);
+ visitor.visit(bs3TabGroup);
+ traverseTabs(bs3TabGroup, visitor);
+ }
+ }
+
+ private void traverseTabs(
+ final BS3TabOwner bs3TabOwner,
+ final Visitor visitor) {
+ final List<BS3Tab> tabs = bs3TabOwner.getTabs();
+ for (BS3Tab tab : tabs) {
+ tab.setOwner(bs3TabOwner);
+ visitor.visit(tab);
+ traverseRows(tab, visitor);
+ }
+ }
+
+ private void traverseActions(
+ final ActionLayoutDataOwner actionLayoutDataOwner,
+ final Visitor visitor) {
+ final List<ActionLayoutData> actionLayoutDatas = actionLayoutDataOwner.getActions();
+ if(actionLayoutDatas == null) {
+ return;
+ }
+ for (final ActionLayoutData actionLayoutData : actionLayoutDatas) {
+ actionLayoutData.setOwner(actionLayoutDataOwner);
+ visitor.visit(actionLayoutData);
+ }
+ }
+
+ private void traverseFieldSets(final BS3Col bs3Col, final Visitor visitor) {
+ final List<FieldSet> fieldSets = bs3Col.getFieldSets();
+ for (FieldSet fieldSet : fieldSets) {
+ fieldSet.setOwner(bs3Col);
+ visitor.visit(fieldSet);
+ traverseActions(fieldSet, visitor);
+ final List<PropertyLayoutData> properties = fieldSet.getProperties();
+ for (final PropertyLayoutData property : properties) {
+ property.setOwner(fieldSet);
+ visitor.visit(property);
+ traverseActions(property, visitor);
+ }
+ }
+ }
+
+ private void traverseCollections(final BS3Col bs3Col, final Visitor visitor) {
+ final List<CollectionLayoutData> collections = bs3Col.getCollections();
+ for (CollectionLayoutData collection : collections) {
+ collection.setOwner(bs3Col);
+ visitor.visit(collection);
+ traverseActions(collection, visitor);
+ }
+ }
+
+
+
+ @Programmatic
+ @XmlTransient
+ public LinkedHashMap<String, PropertyLayoutData> getAllPropertiesById() {
+ final LinkedHashMap<String, PropertyLayoutData> propertiesById = Maps.newLinkedHashMap();
+ visit(new BS3Grid.VisitorAdapter() {
+ public void visit(final PropertyLayoutData propertyLayoutData) {
+ propertiesById.put(propertyLayoutData.getId(), propertyLayoutData);
+ }
+ });
+ return propertiesById;
+ }
+
+
+ @Programmatic
+ @XmlTransient
+ public LinkedHashMap<String, CollectionLayoutData> getAllCollectionsById() {
+ final LinkedHashMap<String, CollectionLayoutData> collectionsById = Maps.newLinkedHashMap();
+
+ visit(new BS3Grid.VisitorAdapter() {
+ @Override
+ public void visit(final CollectionLayoutData collectionLayoutData) {
+ collectionsById.put(collectionLayoutData.getId(), collectionLayoutData);
+ }
+ });
+ return collectionsById;
+ }
+
+
+ @Programmatic
+ @XmlTransient
+ public LinkedHashMap<String, ActionLayoutData> getAllActionsById() {
+ final LinkedHashMap<String, ActionLayoutData> actionsById = Maps.newLinkedHashMap();
+
+ visit(new BS3Grid.VisitorAdapter() {
+ @Override
+ public void visit(final ActionLayoutData actionLayoutData) {
+ actionsById.put(actionLayoutData.getId(), actionLayoutData);
+ }
+ });
+ return actionsById;
+ }
+
+
+ @Programmatic
+ @XmlTransient
+ public LinkedHashMap<String, FieldSet> getAllFieldSetsByName() {
+ final LinkedHashMap<String, FieldSet> fieldSetsByName = Maps.newLinkedHashMap();
+
+ visit(new BS3Grid.VisitorAdapter() {
+ @Override
+ public void visit(final FieldSet fieldSet) {
+ fieldSetsByName.put(fieldSet.getName(), fieldSet);
+ }
+ });
+ return fieldSetsByName;
+ }
+
+
+ @Programmatic
+ @XmlTransient
+ public LinkedHashMap<String, BS3Tab> getAllTabsByName() {
+ final LinkedHashMap<String, BS3Tab> tabsByName = Maps.newLinkedHashMap();
+
+ visit(new BS3Grid.VisitorAdapter() {
+ @Override
+ public void visit(final BS3Tab bS3Tab) {
+ tabsByName.put(bS3Tab.getName(), bS3Tab);
+ }
+ });
+ return tabsByName;
+ }
+
+
+ // TODO: need to figure out where the checking that can't have multiple divs with the same CSS id should go...
+ @Programmatic
+ @XmlTransient
+ public LinkedHashMap<String, HasCssId> getAllCssId() {
+ final LinkedHashMap<String, HasCssId> divsByCssId = Maps.newLinkedHashMap();
+
+ visit(new BS3Grid.VisitorAdapter() {
+ @Override
+ public void visit(final BS3Row bs3Row) {
+ final String id = bs3Row.getId();
+ divsByCssId.put(id, bs3Row);
+ }
+ });
+ return divsByCssId;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Page.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Page.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Page.java
deleted file mode 100644
index 6dd559b..0000000
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Page.java
+++ /dev/null
@@ -1,345 +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.applib.layout.bootstrap3;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.XmlType;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.layout.common.ActionLayoutData;
-import org.apache.isis.applib.layout.common.ActionLayoutDataOwner;
-import org.apache.isis.applib.layout.common.CollectionLayoutData;
-import org.apache.isis.applib.layout.common.DomainObjectLayoutData;
-import org.apache.isis.applib.layout.common.FieldSet;
-import org.apache.isis.applib.layout.common.Page;
-import org.apache.isis.applib.layout.common.PropertyLayoutData;
-import org.apache.isis.applib.services.dto.Dto;
-
-/**
- * This is the top-level for rendering the domain object's properties, collections and actions. It simply consists
- * of a number of rows.
- *
- * <p>
- * The element is rendered as a <div class="...">
- * </p>
- */
-@XmlRootElement(
- name = "page"
-)
-@XmlType(
- name = "page"
- , propOrder = {
- "rows"
- , "metadataErrors"
- }
-)
-public class BS3Page extends BS3ElementAbstract implements Page, Dto, BS3RowOwner {
-
- private static final long serialVersionUID = 1L;
-
- private List<BS3Row> rows = new ArrayList<BS3Row>(){{
- add(new BS3Row());
- }};
-
- // no wrapper
- @XmlElement(name = "row", required = true)
- public List<BS3Row> getRows() {
- return rows;
- }
-
- public void setRows(final List<BS3Row> rows) {
- this.rows = rows;
- }
-
-
-
- private boolean normalized;
-
- @Programmatic
- @XmlTransient
- public boolean isNormalized() {
- return normalized;
- }
-
- @Programmatic
- public void setNormalized(final boolean normalized) {
- this.normalized = normalized;
- }
-
- private List<String> metadataErrors = Lists.newArrayList();
-
- /**
- * For diagnostics; populated by the framework if and only if a metadata error.
- *
- * <p>
- * For example, if there is not exactly one {@link BS3Col} with the
- * {@link BS3Col#isUnreferencedActions()} attribute set, then this is an error. Ditto for
- * {@link BS3Col#isUnreferencedCollections() collections}
- * and {@link BS3Col#isUnreferencedProperties() properties}.
- * </p>
- */
- @XmlElement(required = false)
- public List<String> getMetadataErrors() {
- return metadataErrors;
- }
-
- public void setMetadataErrors(final List<String> metadataErrors) {
- this.metadataErrors = metadataErrors;
- }
-
- interface Visitor {
- void visit(final BS3Page bs3Page);
- void visit(final BS3Row bs3Row);
- void visit(final BS3Col bs3Col);
- void visit(final BS3ClearFix bs3ClearFix);
- void visit(final BS3TabGroup bs3TabGroup);
- void visit(final BS3Tab bs3Tab);
- void visit(final FieldSet fieldSet);
- void visit(final DomainObjectLayoutData domainObjectLayout);
- void visit(final PropertyLayoutData propertyLayoutData);
- void visit(final CollectionLayoutData collectionLayoutData);
- void visit(final ActionLayoutData actionLayoutData);
- }
-
- public static class VisitorAdapter implements Visitor {
- @Override
- public void visit(final BS3Page bs3Page) { }
- @Override
- public void visit(final BS3Row bs3Row) { }
- @Override
- public void visit(final BS3Col bs3Col) { }
- @Override
- public void visit(final BS3ClearFix bs3ClearFix) { }
- @Override
- public void visit(final BS3TabGroup bs3TabGroup) { }
- @Override
- public void visit(final BS3Tab bs3Tab) { }
- @Override
- public void visit(final DomainObjectLayoutData domainObjectLayout) { }
- @Override
- public void visit(final FieldSet fieldSet) {}
- @Override
- public void visit(final PropertyLayoutData propertyLayoutData) {}
- @Override
- public void visit(final CollectionLayoutData collectionLayoutData) {}
- @Override
- public void visit(final ActionLayoutData actionLayoutData) { }
- }
-
- public void visit(final BS3Page.Visitor visitor) {
- visitor.visit(this);
- traverseRows(this, visitor);
- }
-
- protected void traverseRows(final BS3RowOwner rowOwner, final Visitor visitor) {
- for (BS3Row bs3Row : rowOwner.getRows()) {
- bs3Row.setOwner(this);
- visitor.visit(bs3Row);
- final List<BS3RowContent> cols = bs3Row.getCols();
- for (BS3RowContent rowContent : cols) {
- rowContent.setOwner(bs3Row);
- if(rowContent instanceof BS3Col) {
- final BS3Col bs3Col = (BS3Col) rowContent;
- visitor.visit(bs3Col);
- traverseDomainObject(bs3Col, visitor);
- traverseTabGroups(bs3Col, visitor);
- traverseActions(bs3Col, visitor);
- traverseFieldSets(bs3Col, visitor);
- traverseCollections(bs3Col, visitor);
- traverseRows(bs3Col, visitor);
- } else if (rowContent instanceof BS3ClearFix) {
- final BS3ClearFix bs3ClearFix = (BS3ClearFix) rowContent;
- visitor.visit(bs3ClearFix);
- } else {
- throw new IllegalStateException(
- "Unrecognized implementation of BS3RowContent, " + rowContent);
- }
- }
- }
- }
-
- private void traverseDomainObject(final BS3Col bs3Col, final Visitor visitor) {
- final DomainObjectLayoutData domainObject = bs3Col.getDomainObject();
- if(domainObject == null) {
- return;
- }
- domainObject.setOwner(bs3Col);
- visitor.visit(domainObject);
- }
-
- private void traverseTabGroups(
- final BS3TabGroupOwner bs3TabGroupOwner,
- final Visitor visitor) {
- final List<BS3TabGroup> tabGroups = bs3TabGroupOwner.getTabGroups();
- for (BS3TabGroup bs3TabGroup : tabGroups) {
- bs3TabGroup.setOwner(bs3TabGroupOwner);
- visitor.visit(bs3TabGroup);
- traverseTabs(bs3TabGroup, visitor);
- }
- }
-
- private void traverseTabs(
- final BS3TabOwner bs3TabOwner,
- final Visitor visitor) {
- final List<BS3Tab> tabs = bs3TabOwner.getTabs();
- for (BS3Tab tab : tabs) {
- tab.setOwner(bs3TabOwner);
- visitor.visit(tab);
- traverseRows(tab, visitor);
- }
- }
-
- private void traverseActions(
- final ActionLayoutDataOwner actionLayoutDataOwner,
- final Visitor visitor) {
- final List<ActionLayoutData> actionLayoutDatas = actionLayoutDataOwner.getActions();
- if(actionLayoutDatas == null) {
- return;
- }
- for (final ActionLayoutData actionLayoutData : actionLayoutDatas) {
- actionLayoutData.setOwner(actionLayoutDataOwner);
- visitor.visit(actionLayoutData);
- }
- }
-
- private void traverseFieldSets(final BS3Col bs3Col, final Visitor visitor) {
- final List<FieldSet> fieldSets = bs3Col.getFieldSets();
- for (FieldSet fieldSet : fieldSets) {
- fieldSet.setOwner(bs3Col);
- visitor.visit(fieldSet);
- traverseActions(fieldSet, visitor);
- final List<PropertyLayoutData> properties = fieldSet.getProperties();
- for (final PropertyLayoutData property : properties) {
- property.setOwner(fieldSet);
- visitor.visit(property);
- traverseActions(property, visitor);
- }
- }
- }
-
- private void traverseCollections(final BS3Col bs3Col, final Visitor visitor) {
- final List<CollectionLayoutData> collections = bs3Col.getCollections();
- for (CollectionLayoutData collection : collections) {
- collection.setOwner(bs3Col);
- visitor.visit(collection);
- traverseActions(collection, visitor);
- }
- }
-
-
-
- @Programmatic
- @XmlTransient
- public LinkedHashMap<String, PropertyLayoutData> getAllPropertiesById() {
- final LinkedHashMap<String, PropertyLayoutData> propertiesById = Maps.newLinkedHashMap();
- visit(new BS3Page.VisitorAdapter() {
- public void visit(final PropertyLayoutData propertyLayoutData) {
- propertiesById.put(propertyLayoutData.getId(), propertyLayoutData);
- }
- });
- return propertiesById;
- }
-
-
- @Programmatic
- @XmlTransient
- public LinkedHashMap<String, CollectionLayoutData> getAllCollectionsById() {
- final LinkedHashMap<String, CollectionLayoutData> collectionsById = Maps.newLinkedHashMap();
-
- visit(new BS3Page.VisitorAdapter() {
- @Override
- public void visit(final CollectionLayoutData collectionLayoutData) {
- collectionsById.put(collectionLayoutData.getId(), collectionLayoutData);
- }
- });
- return collectionsById;
- }
-
-
- @Programmatic
- @XmlTransient
- public LinkedHashMap<String, ActionLayoutData> getAllActionsById() {
- final LinkedHashMap<String, ActionLayoutData> actionsById = Maps.newLinkedHashMap();
-
- visit(new BS3Page.VisitorAdapter() {
- @Override
- public void visit(final ActionLayoutData actionLayoutData) {
- actionsById.put(actionLayoutData.getId(), actionLayoutData);
- }
- });
- return actionsById;
- }
-
-
- @Programmatic
- @XmlTransient
- public LinkedHashMap<String, FieldSet> getAllFieldSetsByName() {
- final LinkedHashMap<String, FieldSet> fieldSetsByName = Maps.newLinkedHashMap();
-
- visit(new BS3Page.VisitorAdapter() {
- @Override
- public void visit(final FieldSet fieldSet) {
- fieldSetsByName.put(fieldSet.getName(), fieldSet);
- }
- });
- return fieldSetsByName;
- }
-
-
- @Programmatic
- @XmlTransient
- public LinkedHashMap<String, BS3Tab> getAllTabsByName() {
- final LinkedHashMap<String, BS3Tab> tabsByName = Maps.newLinkedHashMap();
-
- visit(new BS3Page.VisitorAdapter() {
- @Override
- public void visit(final BS3Tab bS3Tab) {
- tabsByName.put(bS3Tab.getName(), bS3Tab);
- }
- });
- return tabsByName;
- }
-
-
- // TODO: need to figure out where the checking that can't have multiple divs with the same CSS id should go...
- @Programmatic
- @XmlTransient
- public LinkedHashMap<String, HasCssId> getAllCssId() {
- final LinkedHashMap<String, HasCssId> divsByCssId = Maps.newLinkedHashMap();
-
- visit(new BS3Page.VisitorAdapter() {
- @Override
- public void visit(final BS3Row bs3Row) {
- final String id = bs3Row.getId();
- divsByCssId.put(id, bs3Row);
- }
- });
- return divsByCssId;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Row.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Row.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Row.java
index dee70d4..ff75f46 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Row.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Row.java
@@ -28,7 +28,7 @@ import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
/**
- * Contains a row of content, either on the top-level {@link BS3Page page} or at any other lower-level element that can
+ * Contains a row of content, either on the top-level {@link BS3Grid page} or at any other lower-level element that can
* contain rows, eg {@link BS3Tab tabs}.
*
* <p>
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/applib/src/main/java/org/apache/isis/applib/layout/common/Grid.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/common/Grid.java b/core/applib/src/main/java/org/apache/isis/applib/layout/common/Grid.java
new file mode 100644
index 0000000..92e5a1d
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/common/Grid.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.applib.layout.common;
+
+import java.util.LinkedHashMap;
+
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.services.layout.GridService;
+
+/**
+ * All top-level page layout classes should implement this interface.
+ *
+ * <p>
+ * It is used by the {@link GridService} as a common based type for any layouts read in from XML.
+ * </p>
+ */
+public interface Grid {
+
+ boolean isNormalized();
+
+ void setNormalized(final boolean normalized);
+
+ @Programmatic
+ LinkedHashMap<String, PropertyLayoutData> getAllPropertiesById();
+
+ @Programmatic
+ LinkedHashMap<String, CollectionLayoutData> getAllCollectionsById();
+
+ @Programmatic
+ LinkedHashMap<String, ActionLayoutData> getAllActionsById();
+
+ @Programmatic
+ LinkedHashMap<String, FieldSet> getAllFieldSetsByName();
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/applib/src/main/java/org/apache/isis/applib/layout/common/Page.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/common/Page.java b/core/applib/src/main/java/org/apache/isis/applib/layout/common/Page.java
deleted file mode 100644
index 8ed1d88..0000000
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/common/Page.java
+++ /dev/null
@@ -1,57 +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.applib.layout.common;
-
-import java.util.LinkedHashMap;
-
-import javax.xml.bind.annotation.XmlTransient;
-
-import com.google.common.collect.Maps;
-
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.layout.fixedcols.FCPage;
-import org.apache.isis.applib.layout.fixedcols.FCTab;
-import org.apache.isis.applib.services.layout.PageService;
-
-/**
- * All top-level page layout classes should implement this interface.
- *
- * <p>
- * It is used by the {@link PageService} as a common based type for any layouts read in from XML.
- * </p>
- */
-public interface Page {
-
- boolean isNormalized();
-
- void setNormalized(final boolean normalized);
-
- @Programmatic
- LinkedHashMap<String, PropertyLayoutData> getAllPropertiesById();
-
- @Programmatic
- LinkedHashMap<String, CollectionLayoutData> getAllCollectionsById();
-
- @Programmatic
- LinkedHashMap<String, ActionLayoutData> getAllActionsById();
-
- @Programmatic
- LinkedHashMap<String, FieldSet> getAllFieldSetsByName();
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCColumn.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCColumn.java b/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCColumn.java
index 80e5207..25436ea 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCColumn.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCColumn.java
@@ -42,7 +42,7 @@ import org.apache.isis.applib.layout.common.Owned;
*
* <p>
* A column generally is used within a {@link FCTab}; there can be up to three such (left, middle and right). It is
- * also possible for their to be a column far-left on the top-level {@link FCPage page}, and another far-right.
+ * also possible for their to be a column far-left on the top-level {@link FCGrid page}, and another far-right.
* </p>
*
*/
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCGrid.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCGrid.java b/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCGrid.java
new file mode 100644
index 0000000..ed32e64
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCGrid.java
@@ -0,0 +1,305 @@
+/*
+ * 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.layout.fixedcols;
+
+import java.io.Serializable;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementRef;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+import com.google.common.collect.Maps;
+
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.layout.common.ActionLayoutData;
+import org.apache.isis.applib.layout.common.ActionLayoutDataOwner;
+import org.apache.isis.applib.layout.common.CollectionLayoutData;
+import org.apache.isis.applib.layout.common.FieldSet;
+import org.apache.isis.applib.layout.common.Grid;
+import org.apache.isis.applib.layout.common.PropertyLayoutData;
+import org.apache.isis.applib.services.dto.Dto;
+
+/**
+ * Top-level page, consisting of an optional {@link FCColumn column} on the far left and another (also optional) on the
+ * far right, with the middle consisting of a number of {@link FCTabGroup tabgroup}s, stacked vertically.
+ */
+@XmlRootElement(
+ name = "grid"
+)
+@XmlType(
+ name = "grid"
+ , propOrder = {
+ "actions"
+ , "left"
+ , "tabGroups"
+ , "right"
+ }
+)
+public class FCGrid implements Grid, Dto, ActionLayoutDataOwner, Serializable, FCColumnOwner, FCTabGroupOwner {
+
+ private static final long serialVersionUID = 1L;
+
+ private List<ActionLayoutData> actions;
+
+ // no wrapper
+ @XmlElementRef(type = ActionLayoutData.class, name="action", required = false)
+ public List<ActionLayoutData> getActions() {
+ return actions;
+ }
+
+ public void setActions(List<ActionLayoutData> actionLayoutDatas) {
+ this.actions = actionLayoutDatas;
+ }
+
+
+
+ private FCColumn left;
+
+ @XmlElement(required = false)
+ public FCColumn getLeft() {
+ return left;
+ }
+
+ public void setLeft(final FCColumn left) {
+ this.left = left;
+ left.setHint(FCColumn.Hint.LEFT);
+ }
+
+
+
+ private List<FCTabGroup> tabGroups;
+
+ // no wrapper
+ @XmlElement(name = "tabGroup", required = true)
+ public List<FCTabGroup> getTabGroups() {
+ return tabGroups;
+ }
+
+ public void setTabGroups(List<FCTabGroup> tabGroups) {
+ this.tabGroups = tabGroups;
+ }
+
+
+
+ private FCColumn right;
+
+ @XmlElement(required = false)
+ public FCColumn getRight() {
+ return right;
+ }
+
+ public void setRight(final FCColumn right) {
+ this.right = right;
+ right.setHint(FCColumn.Hint.RIGHT);
+ }
+
+
+ interface Visitor {
+ void visit(final FCGrid fcPage);
+ void visit(final FCTabGroup fcTabGroup);
+ void visit(final FCTab fcTab);
+ void visit(final FCColumn fcColumn);
+ void visit(final FieldSet fieldSet);
+ void visit(final PropertyLayoutData propertyLayoutData);
+ void visit(final CollectionLayoutData collectionLayoutData);
+ void visit(final ActionLayoutData actionLayoutData);
+ }
+
+ public static class VisitorAdapter implements Visitor {
+ @Override
+ public void visit(final FCGrid fcPage) { }
+ @Override
+ public void visit(final FCTabGroup fcTabGroup) { }
+ @Override
+ public void visit(final FCTab fcTab) { }
+ @Override
+ public void visit(final FCColumn fcColumn) { }
+ @Override
+ public void visit(final FieldSet fieldSet) {}
+ @Override
+ public void visit(final PropertyLayoutData propertyLayoutData) {}
+ @Override
+ public void visit(final CollectionLayoutData collectionLayoutData) {}
+ @Override
+ public void visit(final ActionLayoutData actionLayoutData) { }
+ }
+
+
+ /**
+ * Visits all elements of the graph. The {@link Visitor} implementation
+ * can assume that all "owner" references are populated.
+ */
+ public void visit(final FCGrid.Visitor visitor) {
+ visitor.visit(this);
+ traverseActions(this, visitor);
+ traverseColumn(getLeft(), this, visitor);
+ final List<FCTabGroup> tabGroups = getTabGroups();
+ for (final FCTabGroup fcTabGroup : tabGroups) {
+ fcTabGroup.setOwner(this);
+ visitor.visit(fcTabGroup);
+ final List<FCTab> tabs = fcTabGroup.getTabs();
+ for (final FCTab fcTab : tabs) {
+ fcTab.setOwner(fcTabGroup);
+ visitor.visit(fcTab);
+ traverseColumn(fcTab.getLeft(), fcTab, visitor);
+ traverseColumn(fcTab.getMiddle(), fcTab, visitor);
+ traverseColumn(fcTab.getRight(), fcTab, visitor);
+ }
+ }
+ traverseColumn(getRight(), this, visitor);
+ }
+
+ private void traverseColumn(
+ final FCColumn fcColumn, final FCColumnOwner fcColumnOwner, final Visitor visitor) {
+ if(fcColumn == null) {
+ return;
+ }
+ fcColumn.setOwner(fcColumnOwner);
+ visitor.visit(fcColumn);
+ traverseFieldSets(fcColumn, visitor);
+ traverseCollections(fcColumn, visitor);
+ }
+
+ private void traverseFieldSets(final FCColumn fcColumn, final Visitor visitor) {
+ for (final FieldSet fieldSet : fcColumn.getFieldSets()) {
+ fieldSet.setOwner(fcColumn);
+ visitor.visit(fieldSet);
+ traverseActions(fieldSet, visitor);
+ final List<PropertyLayoutData> properties = fieldSet.getProperties();
+ for (final PropertyLayoutData propertyLayoutData : properties) {
+ propertyLayoutData.setOwner(fieldSet);
+ visitor.visit(propertyLayoutData);
+ traverseActions(propertyLayoutData, visitor);
+ }
+ }
+ }
+
+ private void traverseCollections(final FCColumn fcColumn, final Visitor visitor) {
+ for (final CollectionLayoutData collectionLayoutData : fcColumn.getCollections()) {
+ collectionLayoutData.setOwner(fcColumn);
+ visitor.visit(collectionLayoutData);
+ traverseActions(collectionLayoutData, visitor);
+ }
+ }
+
+ private void traverseActions(final ActionLayoutDataOwner actionLayoutDataOwner, final Visitor visitor) {
+ final List<ActionLayoutData> actionLayoutDatas = actionLayoutDataOwner.getActions();
+ if(actionLayoutDatas == null) {
+ return;
+ }
+ for (final ActionLayoutData actionLayoutData : actionLayoutDatas) {
+ actionLayoutData.setOwner(actionLayoutDataOwner);
+ visitor.visit(actionLayoutData);
+ }
+ }
+
+
+ @Programmatic
+ @XmlTransient
+ public LinkedHashMap<String, PropertyLayoutData> getAllPropertiesById() {
+ final LinkedHashMap<String, PropertyLayoutData> propertiesById = Maps.newLinkedHashMap();
+ visit(new FCGrid.VisitorAdapter() {
+ public void visit(final PropertyLayoutData propertyLayoutData) {
+ propertiesById.put(propertyLayoutData.getId(), propertyLayoutData);
+ }
+ });
+ return propertiesById;
+ }
+
+
+ @Programmatic
+ @XmlTransient
+ public LinkedHashMap<String, CollectionLayoutData> getAllCollectionsById() {
+ final LinkedHashMap<String, CollectionLayoutData> collectionsById = Maps.newLinkedHashMap();
+
+ visit(new FCGrid.VisitorAdapter() {
+ @Override
+ public void visit(final CollectionLayoutData collectionLayoutData) {
+ collectionsById.put(collectionLayoutData.getId(), collectionLayoutData);
+ }
+ });
+ return collectionsById;
+ }
+
+
+ @Programmatic
+ @XmlTransient
+ public LinkedHashMap<String, ActionLayoutData> getAllActionsById() {
+ final LinkedHashMap<String, ActionLayoutData> actionsById = Maps.newLinkedHashMap();
+
+ visit(new FCGrid.VisitorAdapter() {
+ @Override
+ public void visit(final ActionLayoutData actionLayoutData) {
+ actionsById.put(actionLayoutData.getId(), actionLayoutData);
+ }
+ });
+ return actionsById;
+ }
+
+
+ @Programmatic
+ @XmlTransient
+ public LinkedHashMap<String, FieldSet> getAllFieldSetsByName() {
+ final LinkedHashMap<String, FieldSet> fieldSetsByName = Maps.newLinkedHashMap();
+
+ visit(new FCGrid.VisitorAdapter() {
+ @Override
+ public void visit(final FieldSet fieldSet) {
+ fieldSetsByName.put(fieldSet.getName(), fieldSet);
+ }
+ });
+ return fieldSetsByName;
+ }
+
+
+ @Programmatic
+ @XmlTransient
+ public LinkedHashMap<String, FCTab> getAllTabsByName() {
+ final LinkedHashMap<String, FCTab> tabsByName = Maps.newLinkedHashMap();
+
+ visit(new FCGrid.VisitorAdapter() {
+ @Override
+ public void visit(final FCTab fcTab) {
+ tabsByName.put(fcTab.getName(), fcTab);
+ }
+ });
+ return tabsByName;
+ }
+
+
+
+ private boolean normalized;
+
+ @Programmatic
+ @XmlTransient
+ public boolean isNormalized() {
+ return normalized;
+ }
+
+ @Programmatic
+ public void setNormalized(final boolean normalized) {
+ this.normalized = normalized;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCPage.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCPage.java b/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCPage.java
deleted file mode 100644
index 5c3ecd0..0000000
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCPage.java
+++ /dev/null
@@ -1,305 +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.applib.layout.fixedcols;
-
-import java.io.Serializable;
-import java.util.LinkedHashMap;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementRef;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.XmlType;
-
-import com.google.common.collect.Maps;
-
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.layout.common.ActionLayoutData;
-import org.apache.isis.applib.layout.common.ActionLayoutDataOwner;
-import org.apache.isis.applib.layout.common.CollectionLayoutData;
-import org.apache.isis.applib.layout.common.FieldSet;
-import org.apache.isis.applib.layout.common.Page;
-import org.apache.isis.applib.layout.common.PropertyLayoutData;
-import org.apache.isis.applib.services.dto.Dto;
-
-/**
- * Top-level page, consisting of an optional {@link FCColumn column} on the far left and another (also optional) on the
- * far right, with the middle consisting of a number of {@link FCTabGroup tabgroup}s, stacked vertically.
- */
-@XmlRootElement(
- name = "page"
-)
-@XmlType(
- name = "page"
- , propOrder = {
- "actions"
- , "left"
- , "tabGroups"
- , "right"
- }
-)
-public class FCPage implements Page, Dto, ActionLayoutDataOwner, Serializable, FCColumnOwner, FCTabGroupOwner {
-
- private static final long serialVersionUID = 1L;
-
- private List<ActionLayoutData> actions;
-
- // no wrapper
- @XmlElementRef(type = ActionLayoutData.class, name="action", required = false)
- public List<ActionLayoutData> getActions() {
- return actions;
- }
-
- public void setActions(List<ActionLayoutData> actionLayoutDatas) {
- this.actions = actionLayoutDatas;
- }
-
-
-
- private FCColumn left;
-
- @XmlElement(required = false)
- public FCColumn getLeft() {
- return left;
- }
-
- public void setLeft(final FCColumn left) {
- this.left = left;
- left.setHint(FCColumn.Hint.LEFT);
- }
-
-
-
- private List<FCTabGroup> tabGroups;
-
- // no wrapper
- @XmlElement(name = "tabGroup", required = true)
- public List<FCTabGroup> getTabGroups() {
- return tabGroups;
- }
-
- public void setTabGroups(List<FCTabGroup> tabGroups) {
- this.tabGroups = tabGroups;
- }
-
-
-
- private FCColumn right;
-
- @XmlElement(required = false)
- public FCColumn getRight() {
- return right;
- }
-
- public void setRight(final FCColumn right) {
- this.right = right;
- right.setHint(FCColumn.Hint.RIGHT);
- }
-
-
- interface Visitor {
- void visit(final FCPage fcPage);
- void visit(final FCTabGroup fcTabGroup);
- void visit(final FCTab fcTab);
- void visit(final FCColumn fcColumn);
- void visit(final FieldSet fieldSet);
- void visit(final PropertyLayoutData propertyLayoutData);
- void visit(final CollectionLayoutData collectionLayoutData);
- void visit(final ActionLayoutData actionLayoutData);
- }
-
- public static class VisitorAdapter implements Visitor {
- @Override
- public void visit(final FCPage fcPage) { }
- @Override
- public void visit(final FCTabGroup fcTabGroup) { }
- @Override
- public void visit(final FCTab fcTab) { }
- @Override
- public void visit(final FCColumn fcColumn) { }
- @Override
- public void visit(final FieldSet fieldSet) {}
- @Override
- public void visit(final PropertyLayoutData propertyLayoutData) {}
- @Override
- public void visit(final CollectionLayoutData collectionLayoutData) {}
- @Override
- public void visit(final ActionLayoutData actionLayoutData) { }
- }
-
-
- /**
- * Visits all elements of the graph. The {@link Visitor} implementation
- * can assume that all "owner" references are populated.
- */
- public void visit(final FCPage.Visitor visitor) {
- visitor.visit(this);
- traverseActions(this, visitor);
- traverseColumn(getLeft(), this, visitor);
- final List<FCTabGroup> tabGroups = getTabGroups();
- for (final FCTabGroup fcTabGroup : tabGroups) {
- fcTabGroup.setOwner(this);
- visitor.visit(fcTabGroup);
- final List<FCTab> tabs = fcTabGroup.getTabs();
- for (final FCTab fcTab : tabs) {
- fcTab.setOwner(fcTabGroup);
- visitor.visit(fcTab);
- traverseColumn(fcTab.getLeft(), fcTab, visitor);
- traverseColumn(fcTab.getMiddle(), fcTab, visitor);
- traverseColumn(fcTab.getRight(), fcTab, visitor);
- }
- }
- traverseColumn(getRight(), this, visitor);
- }
-
- private void traverseColumn(
- final FCColumn fcColumn, final FCColumnOwner fcColumnOwner, final Visitor visitor) {
- if(fcColumn == null) {
- return;
- }
- fcColumn.setOwner(fcColumnOwner);
- visitor.visit(fcColumn);
- traverseFieldSets(fcColumn, visitor);
- traverseCollections(fcColumn, visitor);
- }
-
- private void traverseFieldSets(final FCColumn fcColumn, final Visitor visitor) {
- for (final FieldSet fieldSet : fcColumn.getFieldSets()) {
- fieldSet.setOwner(fcColumn);
- visitor.visit(fieldSet);
- traverseActions(fieldSet, visitor);
- final List<PropertyLayoutData> properties = fieldSet.getProperties();
- for (final PropertyLayoutData propertyLayoutData : properties) {
- propertyLayoutData.setOwner(fieldSet);
- visitor.visit(propertyLayoutData);
- traverseActions(propertyLayoutData, visitor);
- }
- }
- }
-
- private void traverseCollections(final FCColumn fcColumn, final Visitor visitor) {
- for (final CollectionLayoutData collectionLayoutData : fcColumn.getCollections()) {
- collectionLayoutData.setOwner(fcColumn);
- visitor.visit(collectionLayoutData);
- traverseActions(collectionLayoutData, visitor);
- }
- }
-
- private void traverseActions(final ActionLayoutDataOwner actionLayoutDataOwner, final Visitor visitor) {
- final List<ActionLayoutData> actionLayoutDatas = actionLayoutDataOwner.getActions();
- if(actionLayoutDatas == null) {
- return;
- }
- for (final ActionLayoutData actionLayoutData : actionLayoutDatas) {
- actionLayoutData.setOwner(actionLayoutDataOwner);
- visitor.visit(actionLayoutData);
- }
- }
-
-
- @Programmatic
- @XmlTransient
- public LinkedHashMap<String, PropertyLayoutData> getAllPropertiesById() {
- final LinkedHashMap<String, PropertyLayoutData> propertiesById = Maps.newLinkedHashMap();
- visit(new FCPage.VisitorAdapter() {
- public void visit(final PropertyLayoutData propertyLayoutData) {
- propertiesById.put(propertyLayoutData.getId(), propertyLayoutData);
- }
- });
- return propertiesById;
- }
-
-
- @Programmatic
- @XmlTransient
- public LinkedHashMap<String, CollectionLayoutData> getAllCollectionsById() {
- final LinkedHashMap<String, CollectionLayoutData> collectionsById = Maps.newLinkedHashMap();
-
- visit(new FCPage.VisitorAdapter() {
- @Override
- public void visit(final CollectionLayoutData collectionLayoutData) {
- collectionsById.put(collectionLayoutData.getId(), collectionLayoutData);
- }
- });
- return collectionsById;
- }
-
-
- @Programmatic
- @XmlTransient
- public LinkedHashMap<String, ActionLayoutData> getAllActionsById() {
- final LinkedHashMap<String, ActionLayoutData> actionsById = Maps.newLinkedHashMap();
-
- visit(new FCPage.VisitorAdapter() {
- @Override
- public void visit(final ActionLayoutData actionLayoutData) {
- actionsById.put(actionLayoutData.getId(), actionLayoutData);
- }
- });
- return actionsById;
- }
-
-
- @Programmatic
- @XmlTransient
- public LinkedHashMap<String, FieldSet> getAllFieldSetsByName() {
- final LinkedHashMap<String, FieldSet> fieldSetsByName = Maps.newLinkedHashMap();
-
- visit(new FCPage.VisitorAdapter() {
- @Override
- public void visit(final FieldSet fieldSet) {
- fieldSetsByName.put(fieldSet.getName(), fieldSet);
- }
- });
- return fieldSetsByName;
- }
-
-
- @Programmatic
- @XmlTransient
- public LinkedHashMap<String, FCTab> getAllTabsByName() {
- final LinkedHashMap<String, FCTab> tabsByName = Maps.newLinkedHashMap();
-
- visit(new FCPage.VisitorAdapter() {
- @Override
- public void visit(final FCTab fcTab) {
- tabsByName.put(fcTab.getName(), fcTab);
- }
- });
- return tabsByName;
- }
-
-
-
- private boolean normalized;
-
- @Programmatic
- @XmlTransient
- public boolean isNormalized() {
- return normalized;
- }
-
- @Programmatic
- public void setNormalized(final boolean normalized) {
- this.normalized = normalized;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/applib/src/main/java/org/apache/isis/applib/services/layout/GridService.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/layout/GridService.java b/core/applib/src/main/java/org/apache/isis/applib/services/layout/GridService.java
new file mode 100644
index 0000000..fbd5062
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/layout/GridService.java
@@ -0,0 +1,46 @@
+/**
+ * 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.services.layout;
+
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.layout.common.Grid;
+
+public interface GridService {
+
+ /**
+ * Whether any metadata exists for this domain class, and if so then whether it is valid or invalid.
+ */
+ @Programmatic
+ boolean exists(Class<?> domainClass);
+
+ /**
+ * Returns (raw unnormalized) metadata, eg per the <code>.layout.xml</code> file.
+ */
+ @Programmatic Grid fromXml(Class<?> domainClass);
+
+ /**
+ * Obtains the (normalized) layout metadata, if any, for the (domain class of the) specified domain object.
+ */
+ @Programmatic Grid toGrid(Object domainObject);
+
+ /**
+ * Obtains the (normalized) layout metadata, if any, for the specified domain class.
+ */
+ @Programmatic Grid toGrid(Class<?> domainClass);
+
+ String schemaLocations(final Grid grid);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_downloadLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_downloadLayoutXml.java b/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_downloadLayoutXml.java
index 5416d1d..be71676 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_downloadLayoutXml.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_downloadLayoutXml.java
@@ -28,7 +28,7 @@ import org.apache.isis.applib.annotation.Mixin;
import org.apache.isis.applib.annotation.ParameterLayout;
import org.apache.isis.applib.annotation.RestrictTo;
import org.apache.isis.applib.annotation.SemanticsOf;
-import org.apache.isis.applib.layout.common.Page;
+import org.apache.isis.applib.layout.common.Grid;
import org.apache.isis.applib.services.jaxb.JaxbService;
import org.apache.isis.applib.value.Clob;
@@ -55,11 +55,11 @@ public class Object_downloadLayoutXml {
public Object $$(
@ParameterLayout(named = "File name")
final String fileName) {
- final Page page = getPage();
- final String xml = jaxbService.toXml(page,
+ final Grid grid = getPage();
+ final String xml = jaxbService.toXml(grid,
ImmutableMap.<String,Object>of(
Marshaller.JAXB_SCHEMA_LOCATION,
- pageService.schemaLocations(page)
+ gridService.schemaLocations(grid)
));
return new Clob(Util.withSuffix(fileName, "xml"), "text/xml", xml);
@@ -72,12 +72,12 @@ public class Object_downloadLayoutXml {
return Util.withSuffix(object.getClass().getSimpleName(), "layout.xml");
}
- protected Page getPage() {
- return pageService.toPage(object);
+ protected Grid getPage() {
+ return gridService.toGrid(object);
}
@Inject
- PageService pageService;
+ GridService gridService;
@Inject
JaxbService jaxbService;
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_viewLayout.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_viewLayout.java b/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_viewLayout.java
index 0576476..df38db2 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_viewLayout.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_viewLayout.java
@@ -25,7 +25,7 @@ import org.apache.isis.applib.annotation.Mixin;
import org.apache.isis.applib.annotation.Programmatic;
import org.apache.isis.applib.annotation.RestrictTo;
import org.apache.isis.applib.annotation.SemanticsOf;
-import org.apache.isis.applib.layout.common.Page;
+import org.apache.isis.applib.layout.common.Grid;
@Mixin
public class Object_viewLayout {
@@ -50,7 +50,7 @@ public class Object_viewLayout {
cssClassFa = "fa-th"
)
@MemberOrder(sequence = "550.2")
- public Page $$() {
+ public Grid $$() {
return getPage();
}
@@ -59,13 +59,13 @@ public class Object_viewLayout {
return getPage() == null;
}
- protected Page getPage() {
- return pageService.toPage(object);
+ protected Grid getPage() {
+ return gridService.toGrid(object);
}
@Inject
- PageService pageService;
+ GridService gridService;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/applib/src/main/java/org/apache/isis/applib/services/layout/PageService.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/layout/PageService.java b/core/applib/src/main/java/org/apache/isis/applib/services/layout/PageService.java
deleted file mode 100644
index d8948eb..0000000
--- a/core/applib/src/main/java/org/apache/isis/applib/services/layout/PageService.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.applib.services.layout;
-
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.layout.common.Page;
-
-public interface PageService {
-
- /**
- * Whether any metadata exists for this domain class, and if so then whether it is valid or invalid.
- */
- @Programmatic
- boolean exists(Class<?> domainClass);
-
- /**
- * Returns (raw unnormalized) metadata, eg per the <code>.layout.xml</code> file.
- */
- @Programmatic
- Page fromXml(Class<?> domainClass);
-
- /**
- * Obtains the (normalized) layout metadata, if any, for the (domain class of the) specified domain object.
- */
- @Programmatic
- Page toPage(Object domainObject);
-
- /**
- * Obtains the (normalized) layout metadata, if any, for the specified domain class.
- */
- @Programmatic
- Page toPage(Class<?> domainClass);
-
- String schemaLocations(final Page page);
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacet.java
new file mode 100644
index 0000000..c3b0dae
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacet.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.core.metamodel.facets.object.grid;
+
+
+import org.apache.isis.applib.layout.common.Grid;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+/**
+ * Corresponds to providing a <code>.layout.xml</code> file for the domain object's class.
+ */
+public interface GridFacet extends Facet {
+
+ Grid getGrid();
+
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacetDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacetDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacetDefault.java
new file mode 100644
index 0000000..7247b8f
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacetDefault.java
@@ -0,0 +1,116 @@
+/*
+ * 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.facets.object.grid;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.layout.common.Grid;
+import org.apache.isis.applib.services.i18n.TranslationService;
+import org.apache.isis.applib.services.layout.GridService;
+import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.services.grid.normalizer.GridNormalizerService;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+
+public class GridFacetDefault
+ extends FacetAbstract
+ implements GridFacet {
+
+ private static final Logger LOG = LoggerFactory.getLogger(GridFacetDefault.class);
+
+
+ public static Class<? extends Facet> type() {
+ return GridFacet.class;
+ }
+
+
+ public static GridFacet create(
+ final FacetHolder facetHolder,
+ final TranslationService translationService,
+ final GridService gridService,
+ final GridNormalizerService gridNormalizerService, final DeploymentCategory deploymentCategory) {
+ return new GridFacetDefault(facetHolder, translationService, gridService, gridNormalizerService,
+ deploymentCategory);
+ }
+
+ private final TranslationService translationService;
+ private final GridNormalizerService gridNormalizerService;
+ private final DeploymentCategory deploymentCategory;
+ private final GridService gridService;
+
+ private Grid grid;
+ private boolean blacklisted;
+
+ private GridFacetDefault(
+ final FacetHolder facetHolder,
+ final TranslationService translationService,
+ final GridService gridService,
+ final GridNormalizerService gridNormalizerService,
+ final DeploymentCategory deploymentCategory) {
+ super(GridFacetDefault.type(), facetHolder, Derivation.NOT_DERIVED);
+ this.gridService = gridService;
+ this.translationService = translationService;
+ this.gridNormalizerService = gridNormalizerService;
+ this.deploymentCategory = deploymentCategory;
+ }
+
+ /**
+ * Blacklisting only occurs if running in production mode.
+ */
+ public Grid getGrid() {
+ if (deploymentCategory.isProduction() || blacklisted) {
+ return this.grid;
+ }
+ final Class<?> domainClass = getSpecification().getCorrespondingClass();
+ final Grid grid = gridService.fromXml(domainClass);
+ if(deploymentCategory.isProduction() && grid == null) {
+ blacklisted = true;
+ }
+ this.grid = normalize(grid);
+ return this.grid;
+ }
+
+ private Grid normalize(final Grid grid) {
+ if(grid == null) {
+ return null;
+ }
+
+ // if have .layout.json and then add a .layout.xml without restarting, then note that
+ // the changes won't be picked up. Normalizing would be required
+ // in order to trample over the .layout.json's original facets
+ if(grid.isNormalized()) {
+ return grid;
+ }
+
+ final Class<?> domainClass = getSpecification().getCorrespondingClass();
+
+ gridNormalizerService.normalize(grid, domainClass);
+ return grid;
+ }
+
+ private ObjectSpecification getSpecification() {
+ return (ObjectSpecification) getFacetHolder();
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacetFactory.java
new file mode 100644
index 0000000..b1674dc
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacetFactory.java
@@ -0,0 +1,63 @@
+/* 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.facets.object.grid;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.services.i18n.TranslationService;
+import org.apache.isis.applib.services.layout.GridService;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjectorAware;
+import org.apache.isis.core.metamodel.services.grid.normalizer.GridNormalizerService;
+
+public class GridFacetFactory extends FacetFactoryAbstract implements ServicesInjectorAware {
+
+ private static final Logger LOG = LoggerFactory.getLogger(GridFacetFactory.class);
+
+ public GridFacetFactory() {
+ super(FeatureType.OBJECTS_ONLY);
+ }
+
+ @Override
+ public void process(final ProcessClassContext processClassContext) {
+ final FacetHolder facetHolder = processClassContext.getFacetHolder();
+
+ final TranslationService translationService =
+ servicesInjector.lookupService(TranslationService.class);
+ final GridService gridService =
+ servicesInjector.lookupService(GridService.class);
+ final GridNormalizerService gridNormalizerService =
+ servicesInjector.lookupService(GridNormalizerService.class);
+
+ FacetUtil.addFacet(
+ GridFacetDefault.create(facetHolder,
+ translationService, gridService, gridNormalizerService, getDeploymentCategory()));
+ }
+
+ private ServicesInjector servicesInjector;
+
+ @Override
+ public void setServicesInjector(final ServicesInjector servicesInjector) {
+ this.servicesInjector = servicesInjector;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutmetadata/PageFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutmetadata/PageFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutmetadata/PageFacet.java
deleted file mode 100644
index c0439af..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutmetadata/PageFacet.java
+++ /dev/null
@@ -1,33 +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.facets.object.layoutmetadata;
-
-
-import org.apache.isis.applib.layout.common.Page;
-import org.apache.isis.core.metamodel.facetapi.Facet;
-
-/**
- * Corresponds to providing a <code>.layout.xml</code> file for the domain object's class.
- */
-public interface PageFacet extends Facet {
-
- Page getPage();
-
-
-}
\ No newline at end of file
[03/15] isis git commit: ISIS-993: use a single layoutMetadata hint
in EntityModel, rather than many different hints. Also,
moved FC classes under a new "fixedcols" layout.
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropertyGroup.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropertyGroup.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropertyGroup.java
new file mode 100644
index 0000000..d2fd5ec
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropertyGroup.java
@@ -0,0 +1,122 @@
+/*
+ * 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.layout.fixedcols;
+
+import java.util.List;
+
+import com.google.common.collect.Lists;
+
+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.ActionLayout;
+import org.apache.isis.applib.layout.common.FieldSet;
+import org.apache.isis.applib.layout.common.PropertyLayoutData;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
+import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
+import org.apache.isis.viewer.wicket.model.mementos.PropertyMemento;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.components.actionmenu.entityactions.AdditionalLinksPanel;
+import org.apache.isis.viewer.wicket.ui.components.actionmenu.entityactions.EntityActionUtil;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+public class PropertyGroup extends PanelAbstract<EntityModel> {
+
+ private static final String ID_MEMBER_GROUP_NAME = "memberGroupName";
+
+ private static final String ID_ASSOCIATED_ACTION_LINKS_PANEL = "associatedActionLinksPanel";
+ private static final String ID_ASSOCIATED_ACTION_LINKS_PANEL_DROPDOWN = "associatedActionLinksPanelDropDown";
+
+ private static final String ID_PROPERTIES = "properties";
+ private static final String ID_PROPERTY = "property";
+
+ private final FieldSet fieldSet;
+
+ public PropertyGroup(final String id, final EntityModel model) {
+ super(id, model);
+ fieldSet = (FieldSet) model.getLayoutMetadata();
+
+ buildGui();
+ }
+
+ public EntityModel getModel() {
+ return (EntityModel) getDefaultModel();
+ }
+
+ private void buildGui() {
+ String groupName = fieldSet.getName();
+ final ObjectAdapter adapter = getModel().getObject();
+
+ add(new Label(ID_MEMBER_GROUP_NAME, groupName));
+
+ final List<LinkAndLabel> memberGroupActions = Lists.newArrayList();
+
+ final RepeatingView propertyRv = new RepeatingView(ID_PROPERTIES);
+ add(propertyRv);
+
+ final List<PropertyLayoutData> properties = fieldSet.getProperties();
+ for (PropertyLayoutData property : properties) {
+ final ObjectAssociation association = adapter.getSpecification().getAssociation(property.getId());
+
+ final WebMarkupContainer propertyRvContainer = new WebMarkupContainer(propertyRv.newChildId());
+ propertyRv.add(propertyRvContainer);
+
+ addPropertyToForm(getModel(), (OneToOneAssociation) association, propertyRvContainer,
+ memberGroupActions);
+ }
+
+ final List<LinkAndLabel> actionsPanel = LinkAndLabel
+ .positioned(memberGroupActions, ActionLayout.Position.PANEL);
+ final List<LinkAndLabel> actionsPanelDropDown = LinkAndLabel
+ .positioned(memberGroupActions, ActionLayout.Position.PANEL_DROPDOWN);
+
+ AdditionalLinksPanel.addAdditionalLinks(
+ this, ID_ASSOCIATED_ACTION_LINKS_PANEL,
+ actionsPanel,
+ AdditionalLinksPanel.Style.INLINE_LIST);
+ AdditionalLinksPanel.addAdditionalLinks(
+ this, ID_ASSOCIATED_ACTION_LINKS_PANEL_DROPDOWN,
+ actionsPanelDropDown,
+ AdditionalLinksPanel.Style.DROPDOWN);
+ }
+
+ private void addPropertyToForm(
+ final EntityModel entityModel,
+ final OneToOneAssociation otoa,
+ final WebMarkupContainer container,
+ final List<LinkAndLabel> entityActions) {
+ final PropertyMemento pm = new PropertyMemento(otoa);
+
+ final ScalarModel scalarModel = entityModel.getPropertyModel(pm);
+ getComponentFactoryRegistry()
+ .addOrReplaceComponent(container, ID_PROPERTY, ComponentType.SCALAR_NAME_AND_VALUE, scalarModel);
+
+ final List<ObjectAction> associatedActions =
+ EntityActionUtil.getObjectActionsForAssociation(entityModel, otoa, getDeploymentCategory());
+
+ entityActions.addAll(
+ EntityActionUtil.asLinkAndLabelsForAdditionalLinksPanel(entityModel, associatedActions));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupListPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupListPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/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/layout/fixedcols/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/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupListPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupListPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupListPanel.java
new file mode 100644
index 0000000..7a07082
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupListPanel.java
@@ -0,0 +1,66 @@
+/*
+ * 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.layout.fixedcols;
+
+import java.util.List;
+
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+
+import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+public class TabGroupListPanel extends PanelAbstract<EntityModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_TAB_GROUPS = "tabGroups";
+
+ // the view metadata
+ private final List<FCTabGroup> tabGroups;
+
+ public TabGroupListPanel(final String id, final EntityModel entityModel) {
+ super(id, entityModel);
+
+ this.tabGroups = (List<FCTabGroup>) entityModel.getLayoutMetadata();
+
+ buildGui();
+ }
+
+ private void buildGui() {
+ final EntityModel model = getModel();
+
+ final ListView<FCTabGroup> tabGroupsList = new ListView<FCTabGroup>(ID_TAB_GROUPS, this.tabGroups) {
+
+ @Override
+ protected void populateItem(final ListItem<FCTabGroup> item) {
+
+ final FCTabGroup tabGroup = item.getModelObject();
+ final EntityModel entityModelWithHints = model.cloneWithLayoutMetadata(tabGroup);
+ final TabGroupPanel tabGroupPanel = new TabGroupPanel(entityModelWithHints);
+ item.add(tabGroupPanel);
+ }
+ };
+
+ add(tabGroupsList);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupPanel.java
new file mode 100644
index 0000000..d0fe9a0
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupPanel.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.viewer.wicket.ui.components.layout.fixedcols;
+
+import java.util.List;
+
+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.panel.Panel;
+import org.apache.wicket.model.Model;
+
+import org.apache.isis.applib.layout.fixedcols.FCTab;
+import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.model.util.ScopedSessionAttribute;
+
+import de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel;
+
+public class TabGroupPanel extends AjaxBootstrapTabbedPanel {
+
+ public static final String SESSION_ATTR_SELECTED_TAB = "selectedTab";
+ private final EntityModel entityModel;
+ // the view metadata
+ private final FCTabGroup tabGroup;
+ private final ScopedSessionAttribute<Integer> selectedTabInSession;
+
+ private static final String ID_TAB_GROUP = "tabGroup";
+
+ private static List<ITab> tabsFor(final EntityModel entityModel) {
+ final List<ITab> tabs = Lists.newArrayList();
+
+ final FCTabGroup tabGroup = (FCTabGroup) entityModel.getLayoutMetadata();
+ final List<FCTab> FCTabList = FluentIterable
+ .from(tabGroup.getTabs())
+ .filter(FCTab.Predicates.notEmpty())
+ .toList();
+
+ for (final FCTab FCTab : FCTabList) {
+ tabs.add(new AbstractTab(Model.of(FCTab.getName())) {
+ private static final long serialVersionUID1 = 1L;
+
+ @Override
+ public Panel getPanel(String panelId) {
+ return new TabPanel(panelId, entityModel, FCTab);
+ }
+ });
+ }
+ return tabs;
+ }
+
+ public TabGroupPanel(final EntityModel entityModel) {
+ super(ID_TAB_GROUP, tabsFor(entityModel));
+
+ this.entityModel = entityModel;
+ this.tabGroup = (FCTabGroup) entityModel.getLayoutMetadata();
+ this.selectedTabInSession = ScopedSessionAttribute.create(entityModel, this, SESSION_ATTR_SELECTED_TAB);
+
+ }
+
+ @Override
+ protected void onInitialize() {
+ setSelectedTabFromSessionIfAny(this);
+ super.onInitialize();
+ }
+
+ @Override
+ public TabbedPanel setSelectedTab(final int index) {
+ selectedTabInSession.set(index);
+ return super.setSelectedTab(index);
+ }
+
+ private void setSelectedTabFromSessionIfAny(
+ final AjaxBootstrapTabbedPanel ajaxBootstrapTabbedPanel) {
+ final Integer tabIndex = selectedTabInSession.get();
+ if (tabIndex != null) {
+ 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);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/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/layout/fixedcols/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/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabPanel.java
new file mode 100644
index 0000000..70dcb03
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabPanel.java
@@ -0,0 +1,24 @@
+package org.apache.isis.viewer.wicket.ui.components.layout.fixedcols;
+
+import org.apache.isis.applib.layout.fixedcols.FCTab;
+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 FCTab FCTab) {
+ super(id);
+
+ final EntityModel modelWithTabHints = model.cloneWithLayoutMetadata(FCTab);
+
+ getComponentFactoryRegistry()
+ .addOrReplaceComponent(this,
+ ID_COLUMN, ComponentType.ENTITY_PROPERTIES, modelWithTabHints);
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-BS3.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-BS3.xml b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-BS3.xml
index 7bc7d20..1697575 100644
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-BS3.xml
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-BS3.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<bs3:page xsi:schemaLocation="http://isis.apache.org/schema/applib/layout/common http://isis.apache.org/schema/applib/layout/common/common.xsd http://isis.apache.org/schema/applib/layout/bootstrap3 http://isis.apache.org/schema/applib/layout/bootstrap3/bootstrap3.xsd" xmlns:common="http://isis.apache.org/schema/applib/layout/common" xmlns:bs3="http://isis.apache.org/schema/applib/layout/bootstrap3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<bs3:page xsi:schemaLocation="http://isis.apache.org/schema/applib/layout/common http://isis.apache.org/schema/applib/layout/common/common.xsd http://isis.apache.org/schema/applib/layout/bootstrap3 http://isis.apache.org/schema/applib/layout/bootstrap3/bootstrap3.xsd" xmlns:c="http://isis.apache.org/schema/applib/layout/common" xmlns:bs3="http://isis.apache.org/schema/applib/layout/bootstrap3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<bs3:row>
<bs3:col span="12">
- <common:domainObject/>
- <common:action id="delete"/>
+ <c:domainObject/>
+ <c:action id="delete"/>
</bs3:col>
</bs3:row>
@@ -14,15 +14,15 @@
<bs3:tab name="Metadata">
<bs3:row>
<bs3:col span="7">
- <common:fieldSet name="General">
- <common:action id="downloadJdoMetadata" position="PANEL"/>
- <common:action id="downloadLayoutXml" position="PANEL_DROPDOWN"/>
- <common:property id="name" labelPosition="TOP">
- <common:action id="updateName">
- <common:describedAs>This allows the name to be updated</common:describedAs>
- </common:action>
- </common:property>
- </common:fieldSet>
+ <c:fieldSet name="General">
+ <c:action id="downloadJdoMetadata" position="PANEL"/>
+ <c:action id="downloadLayoutXml" position="PANEL_DROPDOWN"/>
+ <c:property id="name" labelPosition="TOP">
+ <c:action id="updateName">
+ <c:describedAs>This allows the name to be updated</c:describedAs>
+ </c:action>
+ </c:property>
+ </c:fieldSet>
</bs3:col>
</bs3:row>
</bs3:tab>
@@ -31,8 +31,8 @@
<bs3:tab name="SimilarTo">
<bs3:row>
<bs3:col span="12">
- <common:collection id="similarTo" defaultView="table"/>
- <common:collection id="others" defaultView="hide"/>
+ <c:collection id="similarTo" defaultView="table"/>
+ <c:collection id="others" defaultView="hide"/>
</bs3:col>
</bs3:row>
</bs3:tab>
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
index 9e6d5ac..da9fc4c 100644
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
@@ -24,6 +24,8 @@
</c:fieldSet>
</middle>
</tab>
+ </tabGroup>
+ <tabGroup>
<tab name="Collections">
<left span="6">
<c:collection id="similarTo" defaultView="table"/>
[04/15] isis git commit: ISIS-993: use a single layoutMetadata hint
in EntityModel, rather than many different hints. Also,
moved FC classes under a new "fixedcols" layout.
Posted by da...@apache.org.
ISIS-993: use a single layoutMetadata hint in EntityModel, rather than many different hints. Also, moved FC classes under a new "fixedcols" layout.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/84c9cf75
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/84c9cf75
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/84c9cf75
Branch: refs/heads/ISIS-993
Commit: 84c9cf7585ddb4d8870c423643025bc29ca1df63
Parents: d7a1ee2
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sun Jan 31 20:44:45 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Sun Jan 31 20:45:20 2016 +0100
----------------------------------------------------------------------
.../applib/layout/bootstrap3/bootstrap3.xsd | 6 +-
.../isis/applib/layout/bootstrap3/BS3Col.java | 13 +-
.../isis/applib/layout/fixedcols/FCColumn.java | 10 +-
.../ComponentFactoryRegistrarDefault.java | 2 +-
.../model/models/EntityCollectionModel.java | 2 +-
.../viewer/wicket/model/models/EntityModel.java | 91 +----------
.../components/entity/EntityPanelFactory.java | 2 +-
.../collections/EntityCollectionsPanel.html | 32 ----
.../collections/EntityCollectionsPanel.java | 151 -------------------
.../EntityCollectionsPanelFactory.java | 49 ------
.../components/entity/column/EntityColumn.java | 27 +++-
.../entity/propgroup/PropertyGroup.html | 41 -----
.../entity/propgroup/PropertyGroup.java | 122 ---------------
.../propsandcolls/EntityPropsAndCollsForm.java | 10 +-
.../propsandcolls/EntityPropsAndCollsPanel.java | 2 +-
.../EntityPropsAndCollsPanelFactory.java | 2 +-
.../entity/tabbed/EntityTabbedPanel.html | 34 -----
.../entity/tabbed/EntityTabbedPanel.java | 114 --------------
.../entity/tabgroup/TabGroupPanel.java | 104 -------------
.../entity/tabgrouplist/TabGroupListPanel.html | 28 ----
.../entity/tabgrouplist/TabGroupListPanel.java | 67 --------
.../ui/components/entity/tabpanel/TabPanel.html | 31 ----
.../ui/components/entity/tabpanel/TabPanel.java | 24 ---
.../fixedcols/EntityCollectionsPanel.html | 32 ++++
.../fixedcols/EntityCollectionsPanel.java | 151 +++++++++++++++++++
.../EntityCollectionsPanelFactory.java | 49 ++++++
.../layout/fixedcols/EntityTabbedPanel.html | 34 +++++
.../layout/fixedcols/EntityTabbedPanel.java | 113 ++++++++++++++
.../layout/fixedcols/PropertyGroup.html | 41 +++++
.../layout/fixedcols/PropertyGroup.java | 122 +++++++++++++++
.../layout/fixedcols/TabGroupListPanel.html | 28 ++++
.../layout/fixedcols/TabGroupListPanel.java | 66 ++++++++
.../layout/fixedcols/TabGroupPanel.java | 103 +++++++++++++
.../components/layout/fixedcols/TabPanel.html | 31 ++++
.../components/layout/fixedcols/TabPanel.java | 24 +++
.../dom/simple/SimpleObject.layout-BS3.xml | 28 ++--
.../dom/simple/SimpleObject.layout.xml | 2 +
37 files changed, 857 insertions(+), 931 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/adocs/documentation/src/main/asciidoc/schema/applib/layout/bootstrap3/bootstrap3.xsd
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/schema/applib/layout/bootstrap3/bootstrap3.xsd b/adocs/documentation/src/main/asciidoc/schema/applib/layout/bootstrap3/bootstrap3.xsd
index 0505e4d..db16d1a 100644
--- a/adocs/documentation/src/main/asciidoc/schema/applib/layout/bootstrap3/bootstrap3.xsd
+++ b/adocs/documentation/src/main/asciidoc/schema/applib/layout/bootstrap3/bootstrap3.xsd
@@ -53,9 +53,9 @@
<xs:element ref="ns1:collection" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="span" type="xs:int" use="required"/>
- <xs:attribute name="unreferencedActions" type="xs:boolean" use="required"/>
- <xs:attribute name="unreferencedCollections" type="xs:boolean" use="required"/>
- <xs:attribute name="unreferencedProperties" type="xs:boolean" use="required"/>
+ <xs:attribute name="unreferencedActions" type="xs:boolean" use="optional"/>
+ <xs:attribute name="unreferencedCollections" type="xs:boolean" use="optional"/>
+ <xs:attribute name="unreferencedProperties" type="xs:boolean" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java
index 5f687c8..8118add 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java
@@ -43,13 +43,6 @@ import org.apache.isis.applib.layout.common.FieldSet;
* </p>
*
* <p>
- * It is also possible for them to contain specifically identified {@link ActionLayoutData action}s and even the domain object's
- * {@link DomainObjectLayoutData title and icon}. Most pages however tend to show these elements in a top-level
- * header, and so if that's the case then use the page's {@link BS3Page#setHeader(boolean) header} attribute that
- * is provided as a convenience.
- * </p>
- *
- * <p>
* It is rendered as a (eg) <div class="col-md-4 ...">
* </p>
*/
@@ -94,7 +87,7 @@ public class BS3Col extends BS3RowContent {
* </p>
*/
@XmlAttribute(required = false)
- public boolean isUnreferencedActions() {
+ public boolean getUnreferencedActions() {
return unreferencedActions;
}
@@ -112,7 +105,7 @@ public class BS3Col extends BS3RowContent {
* </p>
*/
@XmlAttribute(required = false)
- public boolean isUnreferencedProperties() {
+ public boolean getUnreferencedProperties() {
return unreferencedProperties;
}
@@ -130,7 +123,7 @@ public class BS3Col extends BS3RowContent {
* </p>
*/
@XmlAttribute(required = false)
- public boolean isUnreferencedCollections() {
+ public boolean getUnreferencedCollections() {
return unreferencedCollections;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCColumn.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCColumn.java b/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCColumn.java
index a11b459..80e5207 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCColumn.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCColumn.java
@@ -162,13 +162,13 @@ public class FCColumn implements Serializable, MemberRegionOwner, Owned<FCColumn
throw new IllegalStateException();
}
- public FCColumn from(final FCTab FCTab) {
- if(FCTab == null) {
+ public FCColumn from(final FCTab fcTab) {
+ if(fcTab == null) {
return null;
}
- if(this == LEFT) return FCTab.getLeft();
- if(this == MIDDLE) return FCTab.getMiddle();
- if(this == RIGHT) return FCTab.getRight();
+ if(this == LEFT) return fcTab.getLeft();
+ if(this == MIDDLE) return fcTab.getMiddle();
+ if(this == RIGHT) return fcTab.getRight();
throw new IllegalStateException();
}
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/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 c150cf0..b328c85 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
@@ -39,7 +39,7 @@ import org.apache.isis.viewer.wicket.ui.components.collectioncontents.multiple.C
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;
-import org.apache.isis.viewer.wicket.ui.components.entity.collections.EntityCollectionsPanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.EntityCollectionsPanelFactory;
import org.apache.isis.viewer.wicket.ui.components.entity.header.EntityHeaderPanelFactory;
import org.apache.isis.viewer.wicket.ui.components.entity.icontitle.EntityIconAndTitlePanelFactory;
import org.apache.isis.viewer.wicket.ui.components.entity.icontitle.EntityIconTitleAndCopyLinkPanelFactory;
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityCollectionModel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityCollectionModel.java b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityCollectionModel.java
index d27f624..76ed8bc 100644
--- a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityCollectionModel.java
+++ b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityCollectionModel.java
@@ -325,7 +325,7 @@ public class EntityCollectionModel extends ModelAbstract<List<ObjectAdapter>> im
}
private EntityCollectionModel(final EntityModel entityModel) {
- this(entityModel.getObjectAdapterMemento(), entityModel.getCollectionLayoutData());
+ this(entityModel.getObjectAdapterMemento(), (CollectionLayoutData) entityModel.getLayoutMetadata());
}
private EntityCollectionModel(final ObjectAdapterMemento parentObjectAdapterMemento, final CollectionLayoutData collectionLayoutData) {
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/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 54ece97..d99b2a4 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
@@ -29,10 +29,7 @@ import org.apache.wicket.model.Model;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.isis.applib.annotation.BookmarkPolicy;
-import org.apache.isis.applib.layout.common.CollectionLayoutData;
-import org.apache.isis.applib.layout.common.FieldSet;
import org.apache.isis.applib.layout.fixedcols.FCColumn.Hint;
-import org.apache.isis.applib.layout.fixedcols.FCTab;
import org.apache.isis.applib.services.memento.MementoService.Memento;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking;
@@ -645,100 +642,22 @@ public class EntityModel extends BookmarkableModel<ObjectAdapter> {
// tab and column metadata (if any)
// //////////////////////////////////////////////////////////
- private Object tabGroupListMetadata;
+ private Object layoutMetadata;
- public Object getTabGroupListMetadata() {
- return tabGroupListMetadata;
+ public Object getLayoutMetadata() {
+ return layoutMetadata;
}
/**
* Returns a new copy that SHARES the property scalar models (for edit form).
*/
- public EntityModel cloneWithTabGroupListMetadata(final Object tabGroupListMetadata) {
+ public EntityModel cloneWithLayoutMetadata(final Object layoutMetadata) {
final EntityModel entityModel = new EntityModel(this.adapterMemento, this.propertyScalarModels);
- entityModel.tabGroupListMetadata = tabGroupListMetadata;
+ entityModel.layoutMetadata = layoutMetadata;
return entityModel;
}
- private Object fcTabGroup;
-
- public Object getFCTabGroup() {
- return fcTabGroup;
- }
-
- /**
- * Returns a new copy that SHARES the property scalar models (for edit form).
- */
- public EntityModel cloneWithTabGroupMetadata(final Object fcTabgroup) {
- final EntityModel entityModel = new EntityModel(this.adapterMemento, this.propertyScalarModels);
- entityModel.fcTabGroup = fcTabgroup;
- return entityModel;
- }
-
-
- private Object fcTab;
-
- public Object getFCTab() {
- return fcTab;
- }
-
- /**
- * Returns a new copy that SHARES the property scalar models (for edit form).
- */
- public EntityModel cloneWithTabMetadata(final FCTab fcTab) {
- final EntityModel entityModel = new EntityModel(this.adapterMemento, this.propertyScalarModels);
- entityModel.fcTab = fcTab;
- return entityModel;
- }
-
-
- private Object fcColumn;
-
- public Object getFCColumn() {
- return fcColumn;
- }
-
- /**
- * Returns a new copy that SHARES the property scalar models (for edit form).
- */
- public EntityModel cloneWithColumnMetadata(final Object fcColumn) {
- final EntityModel entityModel = new EntityModel(this.adapterMemento, this.propertyScalarModels);
- entityModel.fcColumn = fcColumn;
- return entityModel;
- }
-
-
- private FieldSet fieldSet;
- public FieldSet getFieldSet() {
- return fieldSet;
- }
-
- /**
- * Returns a new copy that SHARES the property scalar models (for edit form).
- */
- public EntityModel cloneWithPropertyGroupMetadata(
- final FieldSet fieldSet) {
- final EntityModel entityModel = new EntityModel(this.adapterMemento, this.propertyScalarModels);
- entityModel.fieldSet = fieldSet;
- return entityModel;
- }
-
-
- private CollectionLayoutData collectionLayoutData;
- public CollectionLayoutData getCollectionLayoutData() {
- return collectionLayoutData;
- }
-
- /**
- * Returns a new copy that SHARES the property scalar models.
- */
- public EntityModel cloneWithCollectionLayoutMetadata(
- final CollectionLayoutData collectionLayoutData) {
- final EntityModel entityModel = new EntityModel(this.adapterMemento, this.propertyScalarModels);
- entityModel.collectionLayoutData = collectionLayoutData;
- return entityModel;
- }
@Override
protected void doSetHint(final String scopeKey, final String attributeName, final String value) {
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/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
index c187f2a..1463e80 100644
--- 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
@@ -30,7 +30,7 @@ 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.editable.EntityEditablePanel;
-import org.apache.isis.viewer.wicket.ui.components.entity.tabbed.EntityTabbedPanel;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.EntityTabbedPanel;
/**
* {@link ComponentFactory} for {@link EntityTabbedPanel}.
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
deleted file mode 100644
index 0e03ea9..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.html
+++ /dev/null
@@ -1,32 +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="entityCollectionsPanel entityCollectionsComponentType">
- <div wicket:id="collections">
- <div wicket:id="collection">
- [collection]
- </div>
- </div>
- </div>
- </wicket:panel>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
deleted file mode 100644
index 61fb3f3..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
+++ /dev/null
@@ -1,151 +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.collections;
-
-import java.util.Comparator;
-import java.util.List;
-
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.ImmutableList;
-
-import org.apache.wicket.markup.html.WebMarkupContainer;
-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;
-import org.apache.isis.applib.layout.common.CollectionLayoutData;
-import org.apache.isis.applib.layout.fixedcols.FCColumn;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.consent.InteractionInitiatedBy;
-import org.apache.isis.core.metamodel.facets.members.order.MemberOrderFacet;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.services.DeweyOrderComparator;
-import org.apache.isis.viewer.wicket.model.models.EntityModel;
-import org.apache.isis.viewer.wicket.ui.components.entity.collection.EntityCollectionPanel;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-
-/**
- * {@link PanelAbstract Panel} representing the properties of an entity, as per
- * the provided {@link EntityModel}.
- */
-public class EntityCollectionsPanel extends PanelAbstract<EntityModel> {
-
- private static final long serialVersionUID = 1L;
-
- private static final String ID_ENTITY_COLLECTIONS = "entityCollections";
- private static final String ID_COLLECTIONS = "collections";
- private static final String ID_COLLECTION = "collection";
-
- // view metadata (if any available)
- private final FCColumn FCColumnIfAny;
-
- public EntityCollectionsPanel(final String id, final EntityModel entityModel) {
- super(id, entityModel);
-
- FCColumnIfAny = (FCColumn) entityModel.getFCColumn();
-
- buildGui();
- }
-
- private void buildGui() {
- buildEntityPropertiesAndOrCollectionsGui();
- setOutputMarkupId(true); // so can repaint via ajax
- }
-
- private void buildEntityPropertiesAndOrCollectionsGui() {
- final EntityModel model = getModel();
- final ObjectAdapter adapter = model.getObject();
- if (adapter != null) {
- addCollections();
- } else {
- permanentlyHide(ID_ENTITY_COLLECTIONS);
- }
- }
-
- private void addCollections() {
- final EntityModel entityModel = getModel();
- final ObjectAdapter adapter = entityModel.getObject();
-
- final Filter<ObjectAssociation> filter;
- if (FCColumnIfAny != null) {
- final ImmutableList<String> collectionIds = FluentIterable
- .from(FCColumnIfAny.getCollections())
- .transform(CollectionLayoutData.Functions.id())
- .toList();
- filter = new Filter<ObjectAssociation>() {
- @Override
- public boolean accept(final ObjectAssociation objectAssociation) {
- return collectionIds.contains(objectAssociation.getId());
- }
- };
- } else {
- filter = Filters.any();
- }
-
- final List<ObjectAssociation> associations = visibleCollections(adapter, filter);
- associations.sort(new Comparator<ObjectAssociation>() {
- private final DeweyOrderComparator deweyOrderComparator = new DeweyOrderComparator();
- @Override
- public int compare(final ObjectAssociation o1, final ObjectAssociation o2) {
- final MemberOrderFacet o1Facet = o1.getFacet(MemberOrderFacet.class);
- final MemberOrderFacet o2Facet = o2.getFacet(MemberOrderFacet.class);
- return o1Facet == null? +1:
- o2Facet == null? -1:
- deweyOrderComparator.compare(o1Facet.sequence(), o2Facet.sequence());
- }
- });
-
- final RepeatingView collectionRv = new RepeatingView(ID_COLLECTIONS);
- add(collectionRv);
-
- for (final ObjectAssociation association : associations) {
-
- final WebMarkupContainer collectionRvContainer = new WebMarkupContainer(collectionRv.newChildId());
- collectionRv.add(collectionRvContainer);
-
- final CollectionLayoutData collectionLayoutData = new CollectionLayoutData(association.getId());
- final EntityModel entityModelWithCollectionLayoutMetadata =
- entityModel.cloneWithCollectionLayoutMetadata(collectionLayoutData);
-
- collectionRvContainer.add(new EntityCollectionPanel(ID_COLLECTION, entityModelWithCollectionLayoutMetadata));
- }
- }
-
- private static List<ObjectAssociation> visibleCollections(
- final ObjectAdapter adapter,
- final Filter<ObjectAssociation> filter) {
- return adapter.getSpecification().getAssociations(
- Contributed.INCLUDED, visibleCollectionsFilter(adapter, filter));
- }
-
- @SuppressWarnings("unchecked")
- private static Filter<ObjectAssociation> visibleCollectionsFilter(
- final ObjectAdapter adapter,
- final Filter<ObjectAssociation> filter) {
- return Filters.and(
- ObjectAssociation.Filters.COLLECTIONS,
- ObjectAssociation.Filters.dynamicallyVisible(
- adapter, InteractionInitiatedBy.USER, Where.PARENTED_TABLES),
- filter);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanelFactory.java
deleted file mode 100644
index e2947a0..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanelFactory.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.viewer.wicket.ui.components.entity.collections;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.model.IModel;
-
-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;
-
-/**
- * {@link ComponentFactory} for {@link EntityCollectionsPanel}.
- */
-public class EntityCollectionsPanelFactory extends EntityComponentFactoryAbstract {
-
- private static final long serialVersionUID = 1L;
-
- public EntityCollectionsPanelFactory() {
- super(ComponentType.ENTITY_COLLECTIONS, EntityCollectionsPanel.class);
- }
-
- @Override
- public Component createComponent(final String id, final IModel<?> model) {
- final EntityModel entityModel = (EntityModel) model;
- return new EntityCollectionsPanel(id, entityModel);
- }
-}
-
-
-
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.java
index 07fd0e9..e1cfe87 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.java
@@ -31,9 +31,9 @@ import org.apache.wicket.MarkupContainer;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.repeater.RepeatingView;
-import org.apache.isis.applib.layout.fixedcols.FCColumn;
import org.apache.isis.applib.layout.common.FieldSet;
import org.apache.isis.applib.layout.common.PropertyLayoutData;
+import org.apache.isis.applib.layout.fixedcols.FCColumn;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.facets.object.membergroups.MemberGroupLayoutFacet;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
@@ -44,6 +44,7 @@ import org.apache.isis.core.runtime.system.context.IsisContext;
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.PropUtil;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.PropertyGroup;
import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
import org.apache.isis.viewer.wicket.ui.util.Components;
@@ -66,18 +67,32 @@ public class EntityColumn extends PanelAbstract<EntityModel> {
// view metadata (populated for EntityTabbedPanel, absent for EntityEditablePanel)
private final FCColumn columnMetaDataIfAny;
+
// which column to render (populated for EntityEditablePanel, not required and so absent for EntityTabbedPanel)
final FCColumn.Hint hint;
+ private static FCColumn.Hint hintFrom(final EntityModel entityModel) {
+ final FCColumn fcColumn = (FCColumn) entityModel.getLayoutMetadata();
+ return fcColumn.getHint();
+ }
+
+
public EntityColumn(
final String id,
final EntityModel entityModel) {
+ this(id, entityModel, hintFrom(entityModel));
+ }
+
+ public EntityColumn(
+ final String id,
+ final EntityModel entityModel,
+ final FCColumn.Hint hint) {
+
super(id, entityModel);
- columnMetaDataIfAny = (FCColumn) entityModel.getFCColumn();
- final FCColumn fcColumn = (FCColumn) entityModel.getFCColumn();
- hint = fcColumn.getHint();
+ columnMetaDataIfAny = (FCColumn) entityModel.getLayoutMetadata();
+ this.hint = hint;
buildGui();
}
@@ -143,8 +158,8 @@ public class EntityColumn extends PanelAbstract<EntityModel> {
final String id = memberGroupRv.newChildId();
- final EntityModel entityModelWithHints = entityModel.cloneWithPropertyGroupMetadata(fieldSet);
- final WebMarkupContainer memberGroupRvContainer = new org.apache.isis.viewer.wicket.ui.components.entity.propgroup.PropertyGroup(id, entityModelWithHints);
+ final EntityModel entityModelWithHints = entityModel.cloneWithLayoutMetadata(fieldSet);
+ final WebMarkupContainer memberGroupRvContainer = new PropertyGroup(id, entityModelWithHints);
memberGroupRv.add(memberGroupRvContainer);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propgroup/PropertyGroup.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propgroup/PropertyGroup.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propgroup/PropertyGroup.html
deleted file mode 100644
index 38245a0..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propgroup/PropertyGroup.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.
--->
-<html xmlns:wicket="http://wicket.apache.org">
- <body>
- <wicket:panel>
- <fieldset class="memberGroup">
- <div class="panel panel-default">
- <div class="panel-heading">
- <span wicket:id="memberGroupName" class="panel-title">[group name]</span>
- <div class="pull-right additionalLinks">
- <div wicket:id="associatedActionLinksPanel"></div>
- <div wicket:id="associatedActionLinksPanelDropDown"></div>
- </div>
- </div>
- <div class="properties panel-body">
- <div wicket:id="properties">
- <div wicket:id="property" class="property">[property]</div>
- </div>
- </div>
- </div>
- </fieldset>
- </wicket:panel>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propgroup/PropertyGroup.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propgroup/PropertyGroup.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propgroup/PropertyGroup.java
deleted file mode 100644
index 6a13547..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propgroup/PropertyGroup.java
+++ /dev/null
@@ -1,122 +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.propgroup;
-
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-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.ActionLayout;
-import org.apache.isis.applib.layout.common.FieldSet;
-import org.apache.isis.applib.layout.common.PropertyLayoutData;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
-import org.apache.isis.viewer.wicket.model.mementos.PropertyMemento;
-import org.apache.isis.viewer.wicket.model.models.EntityModel;
-import org.apache.isis.viewer.wicket.model.models.ScalarModel;
-import org.apache.isis.viewer.wicket.ui.ComponentType;
-import org.apache.isis.viewer.wicket.ui.components.actionmenu.entityactions.AdditionalLinksPanel;
-import org.apache.isis.viewer.wicket.ui.components.actionmenu.entityactions.EntityActionUtil;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-
-public class PropertyGroup extends PanelAbstract<EntityModel> {
-
- private static final String ID_MEMBER_GROUP_NAME = "memberGroupName";
-
- private static final String ID_ASSOCIATED_ACTION_LINKS_PANEL = "associatedActionLinksPanel";
- private static final String ID_ASSOCIATED_ACTION_LINKS_PANEL_DROPDOWN = "associatedActionLinksPanelDropDown";
-
- private static final String ID_PROPERTIES = "properties";
- private static final String ID_PROPERTY = "property";
-
- private final FieldSet fieldSet;
-
- public PropertyGroup(final String id, final EntityModel model) {
- super(id, model);
- fieldSet = model.getFieldSet();
-
- buildGui();
- }
-
- public EntityModel getModel() {
- return (EntityModel) getDefaultModel();
- }
-
- private void buildGui() {
- String groupName = fieldSet.getName();
- final ObjectAdapter adapter = getModel().getObject();
-
- add(new Label(ID_MEMBER_GROUP_NAME, groupName));
-
- final List<LinkAndLabel> memberGroupActions = Lists.newArrayList();
-
- final RepeatingView propertyRv = new RepeatingView(ID_PROPERTIES);
- add(propertyRv);
-
- final List<PropertyLayoutData> properties = fieldSet.getProperties();
- for (PropertyLayoutData property : properties) {
- final ObjectAssociation association = adapter.getSpecification().getAssociation(property.getId());
-
- final WebMarkupContainer propertyRvContainer = new WebMarkupContainer(propertyRv.newChildId());
- propertyRv.add(propertyRvContainer);
-
- addPropertyToForm(getModel(), (OneToOneAssociation) association, propertyRvContainer,
- memberGroupActions);
- }
-
- final List<LinkAndLabel> actionsPanel = LinkAndLabel
- .positioned(memberGroupActions, ActionLayout.Position.PANEL);
- final List<LinkAndLabel> actionsPanelDropDown = LinkAndLabel
- .positioned(memberGroupActions, ActionLayout.Position.PANEL_DROPDOWN);
-
- AdditionalLinksPanel.addAdditionalLinks(
- this, ID_ASSOCIATED_ACTION_LINKS_PANEL,
- actionsPanel,
- AdditionalLinksPanel.Style.INLINE_LIST);
- AdditionalLinksPanel.addAdditionalLinks(
- this, ID_ASSOCIATED_ACTION_LINKS_PANEL_DROPDOWN,
- actionsPanelDropDown,
- AdditionalLinksPanel.Style.DROPDOWN);
- }
-
- private void addPropertyToForm(
- final EntityModel entityModel,
- final OneToOneAssociation otoa,
- final WebMarkupContainer container,
- final List<LinkAndLabel> entityActions) {
- final PropertyMemento pm = new PropertyMemento(otoa);
-
- final ScalarModel scalarModel = entityModel.getPropertyModel(pm);
- getComponentFactoryRegistry()
- .addOrReplaceComponent(container, ID_PROPERTY, ComponentType.SCALAR_NAME_AND_VALUE, scalarModel);
-
- final List<ObjectAction> associatedActions =
- EntityActionUtil.getObjectActionsForAssociation(entityModel, otoa, getDeploymentCategory());
-
- entityActions.addAll(
- EntityActionUtil.asLinkAndLabelsForAdditionalLinksPanel(entityModel, associatedActions));
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.java
index c850a2d..6952325 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.java
@@ -127,7 +127,7 @@ public class EntityPropsAndCollsForm extends FormAbstract<ObjectAdapter> impleme
private void buildGui() {
final EntityModel entityModel = (EntityModel) getModel();
- final FCTab FCTabMetaDataIfAny = (FCTab) entityModel.getFCTab();
+ final FCTab FCTabMetaDataIfAny = (FCTab) entityModel.getLayoutMetadata();
final ColumnSpans columnSpans;
if(FCTabMetaDataIfAny != null) {
@@ -233,14 +233,14 @@ public class EntityPropsAndCollsForm extends FormAbstract<ObjectAdapter> impleme
private void addPropertiesAndCollections(
final MarkupContainer markupContainer,
final EntityModel entityModel,
- final FCTab FCTabMetaDataIfAny,
+ final FCTab fcTabMetaDataIfAny,
final Hint hint) {
- final FCColumn columnMetaDataIfAny = hint.from(FCTabMetaDataIfAny);
+ final FCColumn columnMetaDataIfAny = hint.from(fcTabMetaDataIfAny);
- final EntityModel entityModelWithHints = entityModel.cloneWithColumnMetadata(columnMetaDataIfAny);
+ final EntityModel entityModelWithHints = entityModel.cloneWithLayoutMetadata(columnMetaDataIfAny);
final EntityColumn columnMembers =
- new EntityColumn(ID_ENTITY_COLUMN, entityModelWithHints);
+ new EntityColumn(ID_ENTITY_COLUMN, entityModelWithHints, hint);
markupContainer.add(columnMembers);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanel.java
index a11a234..62d188e 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanel.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanel.java
@@ -22,7 +22,7 @@ package org.apache.isis.viewer.wicket.ui.components.entity.propsandcolls;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.viewer.wicket.model.models.EntityModel;
import org.apache.isis.viewer.wicket.ui.components.entity.editable.EntityEditablePanel;
-import org.apache.isis.viewer.wicket.ui.components.entity.tabbed.EntityTabbedPanel;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.EntityTabbedPanel;
import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
/**
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanelFactory.java
index bdaeeda..3352bb7 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanelFactory.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanelFactory.java
@@ -27,7 +27,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.entity.EntityComponentFactoryAbstract;
import org.apache.isis.viewer.wicket.ui.components.entity.editable.EntityEditablePanel;
-import org.apache.isis.viewer.wicket.ui.components.entity.tabbed.EntityTabbedPanel;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.EntityTabbedPanel;
/**
* {@link ComponentFactory} for {@link EntityPropsAndCollsPanel}.
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.html
deleted file mode 100644
index 7b172aa..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.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/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.java
deleted file mode 100644
index 38aa516..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.java
+++ /dev/null
@@ -1,114 +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.tabbed;
-
-import java.util.List;
-
-import com.google.common.collect.FluentIterable;
-
-import org.apache.isis.applib.layout.fixedcols.FCColumn;
-import org.apache.isis.applib.layout.fixedcols.FCPage;
-import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
-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.PageFacet;
-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.column.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 <div> regions.
- */
-public class EntityTabbedPanel 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 EntityTabbedPanel(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 PageFacet PageFacet = model.getTypeOfSpecification().getFacet(PageFacet.class);
- final FCPage page = (FCPage) PageFacet.getPage();
-
-
- addOrReplace(ComponentType.ENTITY_SUMMARY, model);
-
- final int leftSpan = addColumnIfRequired(ID_LEFT_COLUMN, page.getLeft());
-
- final TabGroupListPanel middleTabs = addTabGroups(ID_MIDDLE_COLUMN, page.getTabGroups());
-
- final int rightSpan = addColumnIfRequired(ID_RIGHT_COLUMN, page.getRight());
-
- 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<FCTabGroup> tabGroupList) {
- final EntityModel model = getModel();
- final List<FCTabGroup> tabGroups = FluentIterable
- .from(tabGroupList)
- .filter(FCTabGroup.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 FCColumn col) {
- if(col != null) {
- final EntityModel entityModel =
- getModel().cloneWithColumnMetadata(col);
- final FCColumn fcColumn = (FCColumn) entityModel.getFCColumn();
- final int span = fcColumn.getSpan();
- if(span > 0) {
- final EntityColumn entityColumn = new EntityColumn(id, entityModel);
- addOrReplace(entityColumn);
- CssClassAppender.appendCssClassTo(entityColumn, "col-xs-" + span);
- return span;
- }
- }
- permanentlyHide(id);
- return 0;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroup/TabGroupPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroup/TabGroupPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroup/TabGroupPanel.java
deleted file mode 100644
index fd6ca06..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroup/TabGroupPanel.java
+++ /dev/null
@@ -1,104 +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.tabgroup;
-
-import java.util.List;
-
-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.panel.Panel;
-import org.apache.wicket.model.Model;
-
-import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
-import org.apache.isis.applib.layout.fixedcols.FCTab;
-import org.apache.isis.viewer.wicket.model.models.EntityModel;
-import org.apache.isis.viewer.wicket.model.util.ScopedSessionAttribute;
-import org.apache.isis.viewer.wicket.ui.components.entity.tabpanel.TabPanel;
-
-import de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel;
-
-public class TabGroupPanel extends AjaxBootstrapTabbedPanel {
-
- public static final String SESSION_ATTR_SELECTED_TAB = "selectedTab";
- private final EntityModel entityModel;
- // the view metadata
- private final FCTabGroup tabGroup;
- private final ScopedSessionAttribute<Integer> selectedTabInSession;
-
- private static final String ID_TAB_GROUP = "tabGroup";
-
- private static List<ITab> tabsFor(final EntityModel entityModel) {
- final List<ITab> tabs = Lists.newArrayList();
-
- final FCTabGroup tabGroup = (FCTabGroup) entityModel.getFCTabGroup();
- final List<FCTab> FCTabList = FluentIterable
- .from(tabGroup.getTabs())
- .filter(FCTab.Predicates.notEmpty())
- .toList();
-
- for (final FCTab FCTab : FCTabList) {
- tabs.add(new AbstractTab(Model.of(FCTab.getName())) {
- private static final long serialVersionUID1 = 1L;
-
- @Override
- public Panel getPanel(String panelId) {
- return new TabPanel(panelId, entityModel, FCTab);
- }
- });
- }
- return tabs;
- }
-
- public TabGroupPanel(final EntityModel entityModel) {
- super(ID_TAB_GROUP, tabsFor(entityModel));
-
- this.entityModel = entityModel;
- this.tabGroup = (FCTabGroup) entityModel.getFCTabGroup();
- this.selectedTabInSession = ScopedSessionAttribute.create(entityModel, this, SESSION_ATTR_SELECTED_TAB);
-
- }
-
- @Override
- protected void onInitialize() {
- setSelectedTabFromSessionIfAny(this);
- super.onInitialize();
- }
-
- @Override
- public TabbedPanel setSelectedTab(final int index) {
- selectedTabInSession.set(index);
- return super.setSelectedTab(index);
- }
-
- private void setSelectedTabFromSessionIfAny(
- final AjaxBootstrapTabbedPanel ajaxBootstrapTabbedPanel) {
- final Integer tabIndex = selectedTabInSession.get();
- if (tabIndex != null) {
- 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);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/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
deleted file mode 100644
index 6699518..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgrouplist/TabGroupListPanel.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/84c9cf75/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
deleted file mode 100644
index 952c3ad..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgrouplist/TabGroupListPanel.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.entity.tabgrouplist;
-
-import java.util.List;
-
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-
-import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
-import org.apache.isis.viewer.wicket.model.models.EntityModel;
-import org.apache.isis.viewer.wicket.ui.components.entity.tabgroup.TabGroupPanel;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-
-public class TabGroupListPanel extends PanelAbstract<EntityModel> {
-
- private static final long serialVersionUID = 1L;
-
- private static final String ID_TAB_GROUPS = "tabGroups";
-
- // the view metadata
- private final List<FCTabGroup> tabGroups;
-
- public TabGroupListPanel(final String id, final EntityModel entityModel) {
- super(id, entityModel);
-
- this.tabGroups = (List<FCTabGroup>) entityModel.getTabGroupListMetadata();
-
- buildGui();
- }
-
- private void buildGui() {
- final EntityModel model = getModel();
-
- final ListView<FCTabGroup> tabGroupsList = new ListView<FCTabGroup>(ID_TAB_GROUPS, this.tabGroups) {
-
- @Override
- protected void populateItem(final ListItem<FCTabGroup> item) {
-
- final FCTabGroup tabGroup = item.getModelObject();
- final EntityModel entityModelWithHints = model.cloneWithTabGroupMetadata(tabGroup);
- final TabGroupPanel tabGroupPanel = new TabGroupPanel(entityModelWithHints);
- item.add(tabGroupPanel);
- }
- };
-
- add(tabGroupsList);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/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
deleted file mode 100644
index 111fc68..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabpanel/TabPanel.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/84c9cf75/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
deleted file mode 100644
index 6b6d9d7..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabpanel/TabPanel.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.apache.isis.viewer.wicket.ui.components.entity.tabpanel;
-
-import org.apache.isis.applib.layout.fixedcols.FCTab;
-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 FCTab FCTab) {
- super(id);
-
- final EntityModel modelWithTabHints = model.cloneWithTabMetadata(FCTab);
-
- getComponentFactoryRegistry()
- .addOrReplaceComponent(this,
- ID_COLUMN, ComponentType.ENTITY_PROPERTIES, modelWithTabHints);
-
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanel.html
new file mode 100644
index 0000000..0e03ea9
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanel.html
@@ -0,0 +1,32 @@
+<?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="entityCollectionsPanel entityCollectionsComponentType">
+ <div wicket:id="collections">
+ <div wicket:id="collection">
+ [collection]
+ </div>
+ </div>
+ </div>
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanel.java
new file mode 100644
index 0000000..fd706cd
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanel.java
@@ -0,0 +1,151 @@
+/*
+ * 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.layout.fixedcols;
+
+import java.util.Comparator;
+import java.util.List;
+
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.ImmutableList;
+
+import org.apache.wicket.markup.html.WebMarkupContainer;
+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;
+import org.apache.isis.applib.layout.common.CollectionLayoutData;
+import org.apache.isis.applib.layout.fixedcols.FCColumn;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.consent.InteractionInitiatedBy;
+import org.apache.isis.core.metamodel.facets.members.order.MemberOrderFacet;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.services.DeweyOrderComparator;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.components.entity.collection.EntityCollectionPanel;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+/**
+ * {@link PanelAbstract Panel} representing the properties of an entity, as per
+ * the provided {@link EntityModel}.
+ */
+public class EntityCollectionsPanel extends PanelAbstract<EntityModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_ENTITY_COLLECTIONS = "entityCollections";
+ private static final String ID_COLLECTIONS = "collections";
+ private static final String ID_COLLECTION = "collection";
+
+ // view metadata (if any available)
+ private final FCColumn fcColumnIfAny;
+
+ public EntityCollectionsPanel(final String id, final EntityModel entityModel) {
+ super(id, entityModel);
+
+ fcColumnIfAny = (FCColumn) entityModel.getLayoutMetadata();
+
+ buildGui();
+ }
+
+ private void buildGui() {
+ buildEntityPropertiesAndOrCollectionsGui();
+ setOutputMarkupId(true); // so can repaint via ajax
+ }
+
+ private void buildEntityPropertiesAndOrCollectionsGui() {
+ final EntityModel model = getModel();
+ final ObjectAdapter adapter = model.getObject();
+ if (adapter != null) {
+ addCollections();
+ } else {
+ permanentlyHide(ID_ENTITY_COLLECTIONS);
+ }
+ }
+
+ private void addCollections() {
+ final EntityModel entityModel = getModel();
+ final ObjectAdapter adapter = entityModel.getObject();
+
+ final Filter<ObjectAssociation> filter;
+ if (fcColumnIfAny != null) {
+ final ImmutableList<String> collectionIds = FluentIterable
+ .from(fcColumnIfAny.getCollections())
+ .transform(CollectionLayoutData.Functions.id())
+ .toList();
+ filter = new Filter<ObjectAssociation>() {
+ @Override
+ public boolean accept(final ObjectAssociation objectAssociation) {
+ return collectionIds.contains(objectAssociation.getId());
+ }
+ };
+ } else {
+ filter = Filters.any();
+ }
+
+ final List<ObjectAssociation> associations = visibleCollections(adapter, filter);
+ associations.sort(new Comparator<ObjectAssociation>() {
+ private final DeweyOrderComparator deweyOrderComparator = new DeweyOrderComparator();
+ @Override
+ public int compare(final ObjectAssociation o1, final ObjectAssociation o2) {
+ final MemberOrderFacet o1Facet = o1.getFacet(MemberOrderFacet.class);
+ final MemberOrderFacet o2Facet = o2.getFacet(MemberOrderFacet.class);
+ return o1Facet == null? +1:
+ o2Facet == null? -1:
+ deweyOrderComparator.compare(o1Facet.sequence(), o2Facet.sequence());
+ }
+ });
+
+ final RepeatingView collectionRv = new RepeatingView(ID_COLLECTIONS);
+ add(collectionRv);
+
+ for (final ObjectAssociation association : associations) {
+
+ final WebMarkupContainer collectionRvContainer = new WebMarkupContainer(collectionRv.newChildId());
+ collectionRv.add(collectionRvContainer);
+
+ final CollectionLayoutData collectionLayoutData = new CollectionLayoutData(association.getId());
+ final EntityModel entityModelWithCollectionLayoutMetadata =
+ entityModel.cloneWithLayoutMetadata(collectionLayoutData);
+
+ collectionRvContainer.add(new EntityCollectionPanel(ID_COLLECTION, entityModelWithCollectionLayoutMetadata));
+ }
+ }
+
+ private static List<ObjectAssociation> visibleCollections(
+ final ObjectAdapter adapter,
+ final Filter<ObjectAssociation> filter) {
+ return adapter.getSpecification().getAssociations(
+ Contributed.INCLUDED, visibleCollectionsFilter(adapter, filter));
+ }
+
+ @SuppressWarnings("unchecked")
+ private static Filter<ObjectAssociation> visibleCollectionsFilter(
+ final ObjectAdapter adapter,
+ final Filter<ObjectAssociation> filter) {
+ return Filters.and(
+ ObjectAssociation.Filters.COLLECTIONS,
+ ObjectAssociation.Filters.dynamicallyVisible(
+ adapter, InteractionInitiatedBy.USER, Where.PARENTED_TABLES),
+ filter);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanelFactory.java
new file mode 100644
index 0000000..980fe6c
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanelFactory.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.viewer.wicket.ui.components.layout.fixedcols;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+
+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;
+
+/**
+ * {@link ComponentFactory} for {@link EntityCollectionsPanel}.
+ */
+public class EntityCollectionsPanelFactory extends EntityComponentFactoryAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public EntityCollectionsPanelFactory() {
+ super(ComponentType.ENTITY_COLLECTIONS, EntityCollectionsPanel.class);
+ }
+
+ @Override
+ public Component createComponent(final String id, final IModel<?> model) {
+ final EntityModel entityModel = (EntityModel) model;
+ return new EntityCollectionsPanel(id, entityModel);
+ }
+}
+
+
+
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityTabbedPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityTabbedPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityTabbedPanel.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/layout/fixedcols/EntityTabbedPanel.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/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityTabbedPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityTabbedPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityTabbedPanel.java
new file mode 100644
index 0000000..c7a3905
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityTabbedPanel.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.layout.fixedcols;
+
+import java.util.List;
+
+import com.google.common.collect.FluentIterable;
+
+import org.apache.isis.applib.layout.fixedcols.FCColumn;
+import org.apache.isis.applib.layout.fixedcols.FCPage;
+import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
+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.PageFacet;
+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.column.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 <div> regions.
+ */
+public class EntityTabbedPanel 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 EntityTabbedPanel(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 PageFacet PageFacet = model.getTypeOfSpecification().getFacet(PageFacet.class);
+ final FCPage page = (FCPage) PageFacet.getPage();
+
+
+ addOrReplace(ComponentType.ENTITY_SUMMARY, model);
+
+ final int leftSpan = addColumnIfRequired(ID_LEFT_COLUMN, page.getLeft());
+
+ final TabGroupListPanel middleTabs = addTabGroups(ID_MIDDLE_COLUMN, page.getTabGroups());
+
+ final int rightSpan = addColumnIfRequired(ID_RIGHT_COLUMN, page.getRight());
+
+ 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<FCTabGroup> tabGroupList) {
+ final EntityModel model = getModel();
+ final List<FCTabGroup> tabGroups = FluentIterable
+ .from(tabGroupList)
+ .filter(FCTabGroup.Predicates.notEmpty())
+ .toList();
+ final EntityModel entityModelWitHints = model.cloneWithLayoutMetadata(tabGroups);
+ final TabGroupListPanel middleComponent = new TabGroupListPanel(id, entityModelWitHints);
+ addOrReplace(middleComponent);
+ return middleComponent;
+ }
+
+ private int addColumnIfRequired(final String id, final FCColumn col) {
+ if(col != null) {
+ final EntityModel entityModel =
+ getModel().cloneWithLayoutMetadata(col);
+ final FCColumn fcColumn = (FCColumn) entityModel.getLayoutMetadata();
+ final int span = fcColumn.getSpan();
+ if(span > 0) {
+ final EntityColumn entityColumn = new EntityColumn(id, entityModel);
+ addOrReplace(entityColumn);
+ CssClassAppender.appendCssClassTo(entityColumn, "col-xs-" + span);
+ return span;
+ }
+ }
+ permanentlyHide(id);
+ return 0;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/84c9cf75/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropertyGroup.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropertyGroup.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropertyGroup.html
new file mode 100644
index 0000000..38245a0
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropertyGroup.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.
+-->
+<html xmlns:wicket="http://wicket.apache.org">
+ <body>
+ <wicket:panel>
+ <fieldset class="memberGroup">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <span wicket:id="memberGroupName" class="panel-title">[group name]</span>
+ <div class="pull-right additionalLinks">
+ <div wicket:id="associatedActionLinksPanel"></div>
+ <div wicket:id="associatedActionLinksPanelDropDown"></div>
+ </div>
+ </div>
+ <div class="properties panel-body">
+ <div wicket:id="properties">
+ <div wicket:id="property" class="property">[property]</div>
+ </div>
+ </div>
+ </div>
+ </fieldset>
+ </wicket:panel>
+ </body>
+</html>
[12/15] isis git commit: ISIS-993: renamed Page to Grid,
PageFacet to GridFacet, PageService to GridService,
PageNormalizerService to GridNormalizerService, BS3PagePanel to BS3GridPanel,
FCPagePanel to FCGridPanel,
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutmetadata/PageFacetDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutmetadata/PageFacetDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutmetadata/PageFacetDefault.java
deleted file mode 100644
index f8772ce..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutmetadata/PageFacetDefault.java
+++ /dev/null
@@ -1,117 +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.facets.object.layoutmetadata;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.applib.layout.common.Page;
-import org.apache.isis.applib.services.i18n.TranslationService;
-import org.apache.isis.applib.services.layout.PageService;
-import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.services.layout.provider.PageNormalizerService;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-
-public class PageFacetDefault
- extends FacetAbstract
- implements PageFacet {
-
- private static final Logger LOG = LoggerFactory.getLogger(PageFacetDefault.class);
-
-
- public static Class<? extends Facet> type() {
- return PageFacet.class;
- }
-
-
- public static PageFacet create(
- final FacetHolder facetHolder,
- final TranslationService translationService,
- final PageService pageService,
- final PageNormalizerService pageNormalizerService, final DeploymentCategory deploymentCategory) {
- return new PageFacetDefault(facetHolder, translationService, pageService, pageNormalizerService,
- deploymentCategory);
- }
-
- private final TranslationService translationService;
- private final PageNormalizerService pageNormalizerService;
- private final DeploymentCategory deploymentCategory;
- private final PageService pageService;
-
- private Page page;
- private boolean blacklisted;
-
- private PageFacetDefault(
- final FacetHolder facetHolder,
- final TranslationService translationService,
- final PageService pageService,
- final PageNormalizerService pageNormalizerService,
- final DeploymentCategory deploymentCategory) {
- super(PageFacetDefault.type(), facetHolder, Derivation.NOT_DERIVED);
- this.pageService = pageService;
- this.translationService = translationService;
- this.pageNormalizerService = pageNormalizerService;
- this.deploymentCategory = deploymentCategory;
- }
-
- /**
- * Blacklisting only occurs if running in production mode.
- */
- @Override
- public Page getPage() {
- if (deploymentCategory.isProduction() || blacklisted) {
- return page;
- }
- final Class<?> domainClass = getSpecification().getCorrespondingClass();
- final Page page = pageService.fromXml(domainClass);
- if(deploymentCategory.isProduction() && page == null) {
- blacklisted = true;
- }
- this.page = normalize(page);
- return this.page;
- }
-
- private Page normalize(final Page page) {
- if(page == null) {
- return null;
- }
-
- // if have .layout.json and then add a .layout.xml without restarting, then note that
- // the changes won't be picked up. Normalizing would be required
- // in order to trample over the .layout.json's original facets
- if(page.isNormalized()) {
- return page;
- }
-
- final Class<?> domainClass = getSpecification().getCorrespondingClass();
-
- pageNormalizerService.normalize(page, domainClass);
- return page;
- }
-
- private ObjectSpecification getSpecification() {
- return (ObjectSpecification) getFacetHolder();
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutmetadata/PageFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutmetadata/PageFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutmetadata/PageFacetFactory.java
deleted file mode 100644
index 60c7ad3..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutmetadata/PageFacetFactory.java
+++ /dev/null
@@ -1,63 +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.facets.object.layoutmetadata;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.applib.services.i18n.TranslationService;
-import org.apache.isis.applib.services.layout.PageService;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facetapi.FacetUtil;
-import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
-import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
-import org.apache.isis.core.metamodel.runtimecontext.ServicesInjectorAware;
-import org.apache.isis.core.metamodel.services.layout.provider.PageNormalizerService;
-
-public class PageFacetFactory extends FacetFactoryAbstract implements ServicesInjectorAware {
-
- private static final Logger LOG = LoggerFactory.getLogger(PageFacetFactory.class);
-
- public PageFacetFactory() {
- super(FeatureType.OBJECTS_ONLY);
- }
-
- @Override
- public void process(final ProcessClassContext processClassContext) {
- final FacetHolder facetHolder = processClassContext.getFacetHolder();
-
- final TranslationService translationService =
- servicesInjector.lookupService(TranslationService.class);
- final PageService pageService =
- servicesInjector.lookupService(PageService.class);
- final PageNormalizerService pageNormalizerService =
- servicesInjector.lookupService(PageNormalizerService.class);
-
- FacetUtil.addFacet(
- PageFacetDefault.create(facetHolder,
- translationService, pageService, pageNormalizerService, getDeploymentCategory()));
- }
-
- private ServicesInjector servicesInjector;
-
- @Override
- public void setServicesInjector(final ServicesInjector servicesInjector) {
- this.servicesInjector = servicesInjector;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java
index a97a969..779cf66 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java
@@ -43,7 +43,7 @@ import org.apache.isis.applib.annotation.Render.Type;
import org.apache.isis.applib.annotation.When;
import org.apache.isis.applib.annotation.Where;
import org.apache.isis.applib.filter.Filter;
-import org.apache.isis.applib.services.layout.PageService;
+import org.apache.isis.applib.services.layout.GridService;
import org.apache.isis.core.commons.lang.ClassExtensions;
import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet;
import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet;
@@ -415,8 +415,8 @@ public class LayoutMetadataReaderFromJson implements LayoutMetadataReader2, Serv
}
try {
- final PageService pageService = getObjectLayoutMetadataService();
- if(pageService.exists(domainClass)) {
+ final GridService gridService = getObjectLayoutMetadataService();
+ if(gridService.exists(domainClass)) {
blacklisted.add(domainClass);
return null;
}
@@ -699,8 +699,8 @@ public class LayoutMetadataReaderFromJson implements LayoutMetadataReader2, Serv
- private PageService getObjectLayoutMetadataService() {
- return servicesInjector.lookupService(PageService.class);
+ private GridService getObjectLayoutMetadataService() {
+ return servicesInjector.lookupService(GridService.class);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/GridServiceDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/GridServiceDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/GridServiceDefault.java
new file mode 100644
index 0000000..b69bdef
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/GridServiceDefault.java
@@ -0,0 +1,189 @@
+/**
+ * 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.services.grid;
+
+import java.io.IOException;
+import java.net.URL;
+import java.nio.charset.Charset;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+import javax.inject.Inject;
+import javax.xml.bind.JAXBContext;
+
+import com.google.common.collect.Maps;
+import com.google.common.io.Resources;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.NatureOfService;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.layout.common.Grid;
+import org.apache.isis.applib.services.jaxb.JaxbService;
+import org.apache.isis.applib.services.layout.GridService;
+import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
+import org.apache.isis.core.metamodel.deployment.DeploymentCategoryAware;
+import org.apache.isis.core.metamodel.facets.object.grid.GridFacet;
+import org.apache.isis.core.metamodel.services.grid.normalizer.GridNormalizerService;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderAware;
+
+@DomainService(
+ nature = NatureOfService.DOMAIN
+)
+public class GridServiceDefault
+ implements GridService, SpecificationLoaderAware, DeploymentCategoryAware {
+
+ private static final Logger LOG = LoggerFactory.getLogger(GridServiceDefault.class);
+
+ // for better logging messages (used only in prototyping mode)
+ private final Map<Class<?>, String> badXmlByClass = Maps.newHashMap();
+
+ // cache (used only in prototyping mode)
+ private final Map<String, Grid> pageByXml = Maps.newHashMap();
+
+ @Override
+ @Programmatic
+ public boolean exists(final Class<?> domainClass) {
+ final URL resource = Resources.getResource(domainClass, resourceNameFor(domainClass));
+ return resource != null;
+ }
+
+ @Override
+ @Programmatic
+ public Grid fromXml(Class<?> domainClass) {
+
+ final String resourceName = resourceNameFor(domainClass);
+ final String xml;
+ try {
+ xml = resourceContentOf(domainClass, resourceName);
+ } catch (IOException | IllegalArgumentException ex) {
+
+ final String message = String .format(
+ "Failed to locate file %s (relative to %s.class); ex: %s)",
+ resourceName, domainClass.getName(), ex.getMessage());
+
+ LOG.debug(message);
+ return null;
+ }
+
+
+ if(!deploymentCategory.isProduction()) {
+ final Grid grid = pageByXml.get(xml);
+ if(grid != null) {
+ return grid;
+ }
+
+ final String badXml = badXmlByClass.get(domainClass);
+ if(badXml != null) {
+ if(Objects.equals(xml, badXml)) {
+ // seen this before and already logged; just quit
+ return null;
+ } else {
+ // this different XML might be good
+ badXmlByClass.remove(domainClass);
+ }
+ }
+
+ }
+
+ try {
+ // all known implementations of Page
+ List<Class<? extends Grid>> pageImplementations = gridNormalizerService.pageImplementations();
+ final JAXBContext context = JAXBContext.newInstance(pageImplementations.toArray(new Class[0]));
+
+ final Grid metadata = (Grid) jaxbService.fromXml(context, xml);
+ if(!deploymentCategory.isProduction()) {
+ pageByXml.put(xml, metadata);
+ }
+ return metadata;
+ } catch(Exception ex) {
+
+ if(!deploymentCategory.isProduction()) {
+ // save fact that this was bad XML, so that we don't log again if called next time
+ badXmlByClass.put(domainClass, xml);
+ }
+
+ // note that we don't blacklist if the file exists but couldn't be parsed;
+ // the developer might fix so we will want to retry.
+ final String message = "Failed to parse " + resourceName + " file (" + ex.getMessage() + ")";
+ LOG.warn(message);
+
+ return null;
+ }
+ }
+
+ private static String resourceContentOf(final Class<?> cls, final String resourceName) throws IOException {
+ final URL url = Resources.getResource(cls, resourceName);
+ return Resources.toString(url, Charset.defaultCharset());
+ }
+
+ private String resourceNameFor(final Class<?> domainClass) {
+ return domainClass.getSimpleName() + ".layout.xml";
+ }
+
+
+ @Override
+ @Programmatic
+ public Grid toGrid(final Object domainObject) {
+ return toGrid(domainObject.getClass());
+ }
+
+ @Override
+ public Grid toGrid(final Class<?> domainClass) {
+ final ObjectSpecification objectSpec = specificationLookup.loadSpecification(domainClass);
+ final GridFacet facet = objectSpec.getFacet(GridFacet.class);
+ return facet != null? facet.getGrid(): null;
+ }
+
+
+ @Override
+ public String schemaLocations(final Grid grid) {
+ return gridNormalizerService.schemaLocationsFor(grid);
+ }
+
+ ////////////////////////////////////////////////////////
+
+
+ //region > injected dependencies
+
+ private SpecificationLoader specificationLookup;
+
+ @Override
+ public void setSpecificationLoader(final SpecificationLoader specificationLookup) {
+ this.specificationLookup = specificationLookup;
+ }
+
+ private DeploymentCategory deploymentCategory;
+
+ @Override
+ public void setDeploymentCategory(final DeploymentCategory deploymentCategory) {
+ this.deploymentCategory = deploymentCategory;
+ }
+
+ @Inject
+ JaxbService jaxbService;
+
+ @Inject
+ GridNormalizerService gridNormalizerService;
+ //endregion
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizer.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizer.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizer.java
new file mode 100644
index 0000000..0a748a7
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizer.java
@@ -0,0 +1,25 @@
+/**
+ * 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.services.grid.normalizer;
+
+import org.apache.isis.applib.layout.common.Grid;
+
+public interface GridNormalizer<G extends Grid> {
+
+ void normalize(final G page, final Class<?> domainClass);
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerAbstract.java
new file mode 100644
index 0000000..02ae566
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerAbstract.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.metamodel.services.grid.normalizer;
+
+import org.apache.isis.applib.layout.common.Grid;
+import org.apache.isis.applib.services.i18n.TranslationService;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+
+public abstract class GridNormalizerAbstract<P extends Grid> implements GridNormalizer<P> {
+
+ protected final SpecificationLoader specificationLookup;
+ protected final TranslationService translationService;
+
+ public GridNormalizerAbstract(
+ final TranslationService translationService,
+ final SpecificationLoader specificationLookup) {
+ this.specificationLookup = specificationLookup;
+ this.translationService = translationService;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerBS3.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerBS3.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerBS3.java
new file mode 100644
index 0000000..216b441
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerBS3.java
@@ -0,0 +1,39 @@
+/**
+ * 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.services.grid.normalizer;
+
+import org.apache.isis.applib.layout.bootstrap3.BS3Grid;
+import org.apache.isis.applib.services.i18n.TranslationService;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+
+public class GridNormalizerBS3 extends GridNormalizerAbstract<BS3Grid> {
+
+ public static final String TNS = "http://isis.apache.org/schema/applib/layout/bootstrap3";
+ public static final String SCHEMA_LOCATION = "http://isis.apache.org/schema/applib/layout/bootstrap3/bootstrap3.xsd";
+
+
+ public GridNormalizerBS3(
+ final TranslationService translationService,
+ final SpecificationLoader specificationLookup) {
+ super(translationService, specificationLookup);
+ }
+
+ @Override
+ public void normalize(final BS3Grid page, final Class<?> domainClass) {
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerFC.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerFC.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerFC.java
new file mode 100644
index 0000000..c80ffcf
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerFC.java
@@ -0,0 +1,399 @@
+/**
+ * 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.services.grid.normalizer;
+
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+import org.apache.isis.applib.layout.fixedcols.FCColumn;
+import org.apache.isis.applib.layout.fixedcols.FCColumnOwner;
+import org.apache.isis.applib.layout.fixedcols.FCGrid;
+import org.apache.isis.applib.layout.fixedcols.FCTab;
+import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
+import org.apache.isis.applib.layout.common.MemberRegionOwner;
+import org.apache.isis.applib.layout.common.ActionLayoutData;
+import org.apache.isis.applib.layout.common.ActionLayoutDataOwner;
+import org.apache.isis.applib.layout.common.CollectionLayoutData;
+import org.apache.isis.applib.layout.common.FieldSet;
+import org.apache.isis.applib.layout.common.PropertyLayoutData;
+import org.apache.isis.applib.services.i18n.TranslationService;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facets.actions.layout.ActionPositionFacetForActionXml;
+import org.apache.isis.core.metamodel.facets.actions.layout.BookmarkPolicyFacetForActionXml;
+import org.apache.isis.core.metamodel.facets.actions.layout.CssClassFaFacetForActionXml;
+import org.apache.isis.core.metamodel.facets.actions.layout.CssClassFacetForActionXml;
+import org.apache.isis.core.metamodel.facets.actions.layout.DescribedAsFacetForActionXml;
+import org.apache.isis.core.metamodel.facets.actions.layout.HiddenFacetForActionLayoutXml;
+import org.apache.isis.core.metamodel.facets.actions.layout.NamedFacetForActionXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.CssClassFacetForCollectionXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.DefaultViewFacetForCollectionXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.DescribedAsFacetForCollectionXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.HiddenFacetForCollectionXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.NamedFacetForCollectionXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.PagedFacetForCollectionXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.SortedByFacetForCollectionXml;
+import org.apache.isis.core.metamodel.facets.members.order.annotprop.MemberOrderFacetXml;
+import org.apache.isis.core.metamodel.facets.object.membergroups.MemberGroupLayoutFacet;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.CssClassFacetForPropertyXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.DescribedAsFacetForPropertyXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.HiddenFacetForPropertyXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.LabelAtFacetForPropertyXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.MultiLineFacetForPropertyXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.NamedFacetForPropertyXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.RenderedAdjustedFacetForPropertyXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.TypicalLengthFacetForPropertyXml;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+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.metamodel.spec.feature.ObjectMember;
+import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
+
+public class GridNormalizerFC extends GridNormalizerAbstract<FCGrid> {
+
+ public static final String TNS = "http://isis.apache.org/schema/applib/layout/fixedcols";
+ public static final String SCHEMA_LOCATION = "http://isis.apache.org/schema/applib/layout/fixedcols/fixedcols.xsd";
+
+
+ public GridNormalizerFC(
+ final TranslationService translationService,
+ final SpecificationLoader specificationLookup) {
+ super(translationService, specificationLookup);
+ }
+
+ @Override
+ public void normalize(final FCGrid page, final Class<?> domainClass) {
+
+ final ObjectSpecification objectSpec = specificationLookup.loadSpecification(domainClass);
+
+ final Map<String, OneToOneAssociation> oneToOneAssociationById =
+ ObjectMember.Util.mapById(getOneToOneAssociations(objectSpec));
+ final Map<String, OneToManyAssociation> oneToManyAssociationById =
+ ObjectMember.Util.mapById(getOneToManyAssociations(objectSpec));
+ final Map<String, ObjectAction> objectActionById =
+ ObjectMember.Util.mapById(objectSpec.getObjectActions(Contributed.INCLUDED));
+
+ derive(page, oneToOneAssociationById, oneToManyAssociationById, objectActionById);
+ overwrite(page, oneToOneAssociationById, oneToManyAssociationById, objectActionById);
+ }
+
+ /**
+ * Ensures that all object members (properties, collections and actions) are in the metadata.
+ *
+ * <p>
+ * If they are missing then they will be added to default tabs (created on the fly if need be).
+ * </p>
+ */
+ private static void derive(
+ final FCGrid metadata,
+ final Map<String, OneToOneAssociation> oneToOneAssociationById,
+ final Map<String, OneToManyAssociation> oneToManyAssociationById,
+ final Map<String, ObjectAction> objectActionById) {
+
+ final LinkedHashMap<String, PropertyLayoutData> propertyIds = metadata.getAllPropertiesById();
+ final LinkedHashMap<String, CollectionLayoutData> collectionIds = metadata.getAllCollectionsById();
+ final LinkedHashMap<String, ActionLayoutData> actionIds = metadata.getAllActionsById();
+
+ final AtomicReference<FieldSet> defaultPropertyGroupRef = new AtomicReference<>();
+ final AtomicReference<FCColumn> firstColumnRef = new AtomicReference<>();
+ final AtomicReference<FCTabGroup> lastTabGroupRef = new AtomicReference<>();
+
+ // capture the first column, and also
+ // capture the first property group (if any) with the default name ('General')
+ metadata.visit(new FCGrid.VisitorAdapter() {
+ @Override
+ public void visit(final FCColumn fcColumn) {
+ firstColumnRef.compareAndSet(null, fcColumn);
+ }
+ @Override
+ public void visit(final FieldSet fieldSet) {
+ if(MemberGroupLayoutFacet.DEFAULT_GROUP.equals(fieldSet.getName())) {
+ defaultPropertyGroupRef.compareAndSet(null, fieldSet);
+ }
+ }
+ @Override
+ public void visit(final FCTabGroup fcTabGroup) {
+ lastTabGroupRef.set(fcTabGroup);
+ }
+ });
+
+ // any missing properties will be added to the (first) 'General' property group found
+ // if there is no default ('General') property group
+ // then one will be added to the first Column of the first Tab.
+ final Tuple<List<String>> propertyIdTuple = surplusAndMissing(propertyIds.keySet(), oneToOneAssociationById.keySet());
+ final List<String> surplusPropertyIds = propertyIdTuple.first;
+ final List<String> missingPropertyIds = propertyIdTuple.second;
+
+ for (String surplusPropertyId : surplusPropertyIds) {
+ propertyIds.get(surplusPropertyId).setMetadataError("No such property");
+ }
+
+ if(!missingPropertyIds.isEmpty()) {
+ // ensure that there is a property group to use
+ boolean wasSet = defaultPropertyGroupRef.compareAndSet(null, new FieldSet(MemberGroupLayoutFacet.DEFAULT_GROUP));
+ final FieldSet defaultFieldSet = defaultPropertyGroupRef.get();
+ if(wasSet) {
+ firstColumnRef.get().getFieldSets().add(defaultFieldSet);
+ }
+ for (final String propertyId : missingPropertyIds) {
+ defaultFieldSet.getProperties().add(new PropertyLayoutData(propertyId));
+ }
+ }
+
+
+ // any missing collections will be added as tabs to the last TabGroup.
+ // If there is only a single tab group then a new TabGroup will be added first
+ final Tuple<List<String>> collectionIdTuple = surplusAndMissing(collectionIds.keySet(), oneToManyAssociationById.keySet());
+ final List<String> surplusCollectionIds = collectionIdTuple.first;
+ final List<String> missingCollectionIds = collectionIdTuple.second;
+
+ for (String surplusCollectionId : surplusCollectionIds) {
+ collectionIds.get(surplusCollectionId).setMetadataError("No such collection");
+ }
+
+ if(!missingCollectionIds.isEmpty()) {
+ while(metadata.getTabGroups().size() < 2) {
+ final FCTabGroup tabGroup = new FCTabGroup();
+ metadata.getTabGroups().add(tabGroup);
+ lastTabGroupRef.set(tabGroup);
+ }
+ final FCTabGroup lastTabGroup = lastTabGroupRef.get();
+ for (final String collectionId : missingCollectionIds) {
+ final FCTab FCTab = new FCTab();
+ lastTabGroup.getTabs().add(FCTab);
+ FCColumn left = new FCColumn(12);
+ FCTab.setLeft(left);
+ final CollectionLayoutData layoutMetadata = new CollectionLayoutData(collectionId);
+ layoutMetadata.setDefaultView("table");
+ left.getCollections().add(layoutMetadata);
+ }
+ }
+
+ // any missing actions will be added as domain object actions (in the header)
+ final Tuple<List<String>> actionIdTuple = surplusAndMissing(actionIds.keySet(), objectActionById.keySet());
+ final List<String> surplusActionIds = actionIdTuple.first;
+ final List<String> missingActionIds = actionIdTuple.second;
+
+ for (String surplusActionId : surplusActionIds) {
+ actionIds.get(surplusActionId).setMetadataError("No such action");
+ }
+
+ if(!missingActionIds.isEmpty()) {
+ for (String actionId : missingActionIds) {
+ List<ActionLayoutData> actions = metadata.getActions();
+ if(actions == null) {
+ actions = Lists.newArrayList();
+ metadata.setActions(actions);
+ }
+ actions.add(new ActionLayoutData(actionId));
+ }
+ }
+ }
+
+ static class Tuple<T> {
+ final T first;
+ final T second;
+ private Tuple(final T first, final T second) {
+ this.first = first;
+ this.second = second;
+ }
+ public static <T> Tuple<T> of(final T first, final T second) {
+ return new Tuple<>(first, second);
+ }
+ }
+ /**
+ * Returns a 2-element tuple of [first-second, second-first]
+ */
+ static <T> Tuple<List<T>> surplusAndMissing(final Collection<T> first, final Collection<T> second){
+ final List<T> firstNotSecond = Lists.newArrayList(first);
+ firstNotSecond.removeAll(second);
+ final List<T> secondNotFirst = Lists.newArrayList(second);
+ secondNotFirst.removeAll(first);
+ return Tuple.of(firstNotSecond, secondNotFirst);
+ }
+
+ private void overwrite(
+ final FCGrid page,
+ final Map<String, OneToOneAssociation> oneToOneAssociationById,
+ final Map<String, OneToManyAssociation> oneToManyAssociationById,
+ final Map<String, ObjectAction> objectActionById) {
+
+ final Map<String, int[]> propertySequenceByGroup = Maps.newHashMap();
+
+ page.visit(new FCGrid.VisitorAdapter() {
+ private int collectionSequence = 1;
+ private int actionDomainObjectSequence = 1;
+ private int actionPropertyGroupSequence = 1;
+ private int actionPropertySequence = 1;
+ private int actionCollectionSequence = 1;
+
+ @Override
+ public void visit(final ActionLayoutData actionLayoutData) {
+ final ActionLayoutDataOwner actionLayoutDataOwner = actionLayoutData.getOwner();
+ final ObjectAction objectAction = objectActionById.get(actionLayoutData.getId());
+ if(objectAction == null) {
+ return;
+ }
+
+ final String memberOrderName;
+ final int memberOrderSequence;
+ if(actionLayoutDataOwner instanceof FieldSet) {
+ final FieldSet fieldSet = (FieldSet) actionLayoutDataOwner;
+ final List<PropertyLayoutData> properties = fieldSet.getProperties();
+ final PropertyLayoutData propertyLayoutData = properties.get(0); // any will do
+ memberOrderName = propertyLayoutData.getId();
+ memberOrderSequence = actionPropertyGroupSequence++;
+ } else if(actionLayoutDataOwner instanceof PropertyLayoutData) {
+ final PropertyLayoutData propertyLayoutData = (PropertyLayoutData) actionLayoutDataOwner;
+ memberOrderName = propertyLayoutData.getId();
+ memberOrderSequence = actionPropertySequence++;
+ } else if(actionLayoutDataOwner instanceof CollectionLayoutData) {
+ final CollectionLayoutData collectionLayoutData = (CollectionLayoutData) actionLayoutDataOwner;
+ memberOrderName = collectionLayoutData.getId();
+ memberOrderSequence = actionCollectionSequence++;
+ } else {
+ // DomainObject
+ memberOrderName = null;
+ memberOrderSequence = actionDomainObjectSequence++;
+ }
+ FacetUtil.addFacet(
+ new MemberOrderFacetXml(memberOrderName, ""+memberOrderSequence, translationService, objectAction));
+
+
+ if(actionLayoutDataOwner instanceof FieldSet) {
+ if(actionLayoutData.getPosition() == null ||
+ actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.BELOW ||
+ actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.RIGHT) {
+ actionLayoutData.setPosition(org.apache.isis.applib.annotation.ActionLayout.Position.PANEL);
+ }
+ } else if(actionLayoutDataOwner instanceof PropertyLayoutData) {
+ if(actionLayoutData.getPosition() == null ||
+ actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.PANEL_DROPDOWN ||
+ actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.PANEL) {
+ actionLayoutData.setPosition(org.apache.isis.applib.annotation.ActionLayout.Position.BELOW);
+ }
+ } else {
+ // doesn't do anything for DomainObject or Collection
+ actionLayoutData.setPosition(null);
+ }
+
+ FacetUtil.addFacet(ActionPositionFacetForActionXml.create(actionLayoutData, objectAction));
+ FacetUtil.addFacet(BookmarkPolicyFacetForActionXml.create(actionLayoutData, objectAction));
+ FacetUtil.addFacet(CssClassFacetForActionXml.create(actionLayoutData, objectAction));
+ FacetUtil.addFacet(CssClassFaFacetForActionXml.create(actionLayoutData, objectAction));
+ FacetUtil.addFacet(DescribedAsFacetForActionXml.create(actionLayoutData, objectAction));
+ FacetUtil.addFacet(HiddenFacetForActionLayoutXml.create(actionLayoutData, objectAction));
+ FacetUtil.addFacet(NamedFacetForActionXml.create(actionLayoutData, objectAction));
+ }
+
+ @Override
+ public void visit(final PropertyLayoutData propertyLayoutData) {
+ final OneToOneAssociation oneToOneAssociation = oneToOneAssociationById.get(propertyLayoutData.getId());
+ if(oneToOneAssociation == null) {
+ return;
+ }
+
+ FacetUtil.addFacet(CssClassFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
+ FacetUtil.addFacet(DescribedAsFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
+ FacetUtil.addFacet(HiddenFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
+ FacetUtil.addFacet(LabelAtFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
+ FacetUtil.addFacet(MultiLineFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
+ FacetUtil.addFacet(NamedFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
+ FacetUtil.addFacet(
+ RenderedAdjustedFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
+ FacetUtil.addFacet(TypicalLengthFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
+
+ // @MemberOrder#name based on owning property group, @MemberOrder#sequence monotonically increasing
+ final FieldSet fieldSet = propertyLayoutData.getOwner();
+ final String groupName = fieldSet.getName();
+ final String sequence = nextInSequenceFor(groupName, propertySequenceByGroup);
+ FacetUtil.addFacet(
+ new MemberOrderFacetXml(groupName, sequence, translationService, oneToOneAssociation));
+ }
+
+ @Override
+ public void visit(final CollectionLayoutData collectionLayoutData) {
+ final OneToManyAssociation oneToManyAssociation = oneToManyAssociationById.get(collectionLayoutData.getId());
+ if(oneToManyAssociation == null) {
+ return;
+ }
+
+ FacetUtil.addFacet(CssClassFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
+ FacetUtil.addFacet(
+ DefaultViewFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
+ FacetUtil.addFacet(
+ DescribedAsFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
+ FacetUtil.addFacet(HiddenFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
+ FacetUtil.addFacet(NamedFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
+ FacetUtil.addFacet(PagedFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
+ FacetUtil.addFacet(SortedByFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
+
+ // @MemberOrder#name based on the collection's id (so that each has a single "member group")
+ final String groupName = collectionLayoutData.getId();
+ final String sequence = "" + collectionSequence++;
+ FacetUtil.addFacet(
+ new MemberOrderFacetXml(groupName, sequence, translationService, oneToManyAssociation));
+
+ // if there is only a single column and no other contents, then copy the collection Id onto the tab'
+ final MemberRegionOwner memberRegionOwner = collectionLayoutData.getOwner();
+ if(memberRegionOwner instanceof FCColumn) {
+ final FCColumn FCColumn = (FCColumn) memberRegionOwner;
+ final FCColumnOwner holder = FCColumn.getOwner();
+ if(holder instanceof FCTab) {
+ final FCTab FCTab = (FCTab) holder;
+ if(FCTab.getContents().size() == 1 && Strings.isNullOrEmpty(FCTab.getName()) ) {
+ final String collectionName = oneToManyAssociation.getName();
+ FCTab.setName(collectionName);
+ }
+ }
+ }
+ }
+ });
+ }
+
+ private String nextInSequenceFor(
+ final String key, final Map<String, int[]> seqByKey) {
+ synchronized (seqByKey) {
+ int[] holder = seqByKey.get(key);
+ if(holder == null) {
+ holder = new int[]{0};
+ seqByKey.put(key, holder);
+ }
+ holder[0]++;
+ return ""+holder[0];
+ }
+ }
+
+ private static List<OneToOneAssociation> getOneToOneAssociations(final ObjectSpecification objectSpec) {
+ List associations = objectSpec.getAssociations(Contributed.INCLUDED, ObjectAssociation.Filters.PROPERTIES);
+ return associations;
+ }
+ private static List<OneToManyAssociation> getOneToManyAssociations(final ObjectSpecification objectSpec) {
+ List associations = objectSpec.getAssociations(Contributed.INCLUDED, ObjectAssociation.Filters.COLLECTIONS);
+ return associations;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerService.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerService.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerService.java
new file mode 100644
index 0000000..fc18a15
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerService.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.core.metamodel.services.grid.normalizer;
+
+import java.util.List;
+
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.layout.common.Grid;
+import org.apache.isis.core.metamodel.services.grid.GridServiceDefault;
+
+/**
+ * Internal SPI used by {@link GridServiceDefault}.
+ */
+public interface GridNormalizerService {
+
+ @Programmatic
+ List<Class<? extends Grid>> pageImplementations();
+
+ @Programmatic
+ void normalize(Grid grid, Class<?> domainClass);
+
+ String schemaLocationsFor(final Grid fcGrid);
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerServiceDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerServiceDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerServiceDefault.java
new file mode 100644
index 0000000..61f8426
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerServiceDefault.java
@@ -0,0 +1,110 @@
+/**
+ * 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.services.grid.normalizer;
+
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.Lists;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.NatureOfService;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.layout.bootstrap3.BS3Grid;
+import org.apache.isis.applib.layout.fixedcols.FCGrid;
+import org.apache.isis.applib.layout.common.Grid;
+import org.apache.isis.applib.services.i18n.TranslationService;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderAware;
+
+@DomainService(
+ nature = NatureOfService.DOMAIN
+)
+public class GridNormalizerServiceDefault implements GridNormalizerService, SpecificationLoaderAware {
+
+ private static final Logger LOG = LoggerFactory.getLogger(GridNormalizerServiceDefault.class);
+
+ public static final String COMMON_TNS = "http://isis.apache.org/schema/applib/layout/common";
+ public static final String COMMON_SCHEMA_LOCATION = "http://isis.apache.org/schema/applib/layout/common/common.xsd";
+
+ private SpecificationLoader specificationLookup;
+
+ private GridNormalizerFC pageNormalizerFC;
+ private GridNormalizerBS3 pageNormalizerBS3;
+
+ @PostConstruct
+ @Programmatic
+ public void init() {
+ pageNormalizerFC = new GridNormalizerFC(translationService, specificationLookup);
+ pageNormalizerBS3 = new GridNormalizerBS3(translationService, specificationLookup);
+ }
+
+ @Programmatic
+ @Override
+ public List<Class<? extends Grid>> pageImplementations() {
+ List<Class<? extends Grid>> ar = Lists.newArrayList();
+ ar.add(FCGrid.class);
+ ar.add(BS3Grid.class);
+ return ar;
+ }
+
+ @Override
+ public void normalize(final Grid grid, final Class<?> domainClass) {
+
+ if(grid instanceof FCGrid) {
+ final FCGrid fcPage = (FCGrid) grid;
+ pageNormalizerFC.normalize(fcPage, domainClass);
+ } else
+ if(grid instanceof BS3Grid) {
+ final BS3Grid bs3Page = (BS3Grid) grid;
+ pageNormalizerBS3.normalize(bs3Page, domainClass);
+ }
+
+ grid.setNormalized(true);
+ }
+
+ @Override
+ public String schemaLocationsFor(final Grid grid) {
+ final List<String> parts = Lists.newArrayList();
+ parts.add(COMMON_TNS);
+ parts.add(COMMON_SCHEMA_LOCATION);
+ if(grid instanceof FCGrid) {
+ parts.add(GridNormalizerFC.TNS);
+ parts.add(GridNormalizerFC.SCHEMA_LOCATION);
+ }
+ if(grid instanceof BS3Grid) {
+ parts.add(GridNormalizerBS3.TNS);
+ parts.add(GridNormalizerBS3.SCHEMA_LOCATION);
+ }
+ return Joiner.on(" ").join(parts);
+ }
+
+ @Override
+ public void setSpecificationLoader(final SpecificationLoader specificationLookup) {
+ this.specificationLookup = specificationLookup;
+ }
+
+ @Inject
+ TranslationService translationService;
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/PageServiceDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/PageServiceDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/PageServiceDefault.java
deleted file mode 100644
index 6978bc0..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/PageServiceDefault.java
+++ /dev/null
@@ -1,189 +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.services.layout;
-
-import java.io.IOException;
-import java.net.URL;
-import java.nio.charset.Charset;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-import javax.inject.Inject;
-import javax.xml.bind.JAXBContext;
-
-import com.google.common.collect.Maps;
-import com.google.common.io.Resources;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.NatureOfService;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.layout.common.Page;
-import org.apache.isis.applib.services.jaxb.JaxbService;
-import org.apache.isis.applib.services.layout.PageService;
-import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
-import org.apache.isis.core.metamodel.deployment.DeploymentCategoryAware;
-import org.apache.isis.core.metamodel.facets.object.layoutmetadata.PageFacet;
-import org.apache.isis.core.metamodel.services.layout.provider.PageNormalizerService;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.SpecificationLoader;
-import org.apache.isis.core.metamodel.spec.SpecificationLoaderAware;
-
-@DomainService(
- nature = NatureOfService.DOMAIN
-)
-public class PageServiceDefault
- implements PageService, SpecificationLoaderAware, DeploymentCategoryAware {
-
- private static final Logger LOG = LoggerFactory.getLogger(PageServiceDefault.class);
-
- // for better logging messages (used only in prototyping mode)
- private final Map<Class<?>, String> badXmlByClass = Maps.newHashMap();
-
- // cache (used only in prototyping mode)
- private final Map<String, Page> pageByXml = Maps.newHashMap();
-
- @Override
- @Programmatic
- public boolean exists(final Class<?> domainClass) {
- final URL resource = Resources.getResource(domainClass, resourceNameFor(domainClass));
- return resource != null;
- }
-
- @Override
- @Programmatic
- public Page fromXml(Class<?> domainClass) {
-
- final String resourceName = resourceNameFor(domainClass);
- final String xml;
- try {
- xml = resourceContentOf(domainClass, resourceName);
- } catch (IOException | IllegalArgumentException ex) {
-
- final String message = String .format(
- "Failed to locate file %s (relative to %s.class); ex: %s)",
- resourceName, domainClass.getName(), ex.getMessage());
-
- LOG.debug(message);
- return null;
- }
-
-
- if(!deploymentCategory.isProduction()) {
- final Page page = pageByXml.get(xml);
- if(page != null) {
- return page;
- }
-
- final String badXml = badXmlByClass.get(domainClass);
- if(badXml != null) {
- if(Objects.equals(xml, badXml)) {
- // seen this before and already logged; just quit
- return null;
- } else {
- // this different XML might be good
- badXmlByClass.remove(domainClass);
- }
- }
-
- }
-
- try {
- // all known implementations of Page
- List<Class<? extends Page>> pageImplementations = pageNormalizerService.pageImplementations();
- final JAXBContext context = JAXBContext.newInstance(pageImplementations.toArray(new Class[0]));
-
- final Page metadata = (Page) jaxbService.fromXml(context, xml);
- if(!deploymentCategory.isProduction()) {
- pageByXml.put(xml, metadata);
- }
- return metadata;
- } catch(Exception ex) {
-
- if(!deploymentCategory.isProduction()) {
- // save fact that this was bad XML, so that we don't log again if called next time
- badXmlByClass.put(domainClass, xml);
- }
-
- // note that we don't blacklist if the file exists but couldn't be parsed;
- // the developer might fix so we will want to retry.
- final String message = "Failed to parse " + resourceName + " file (" + ex.getMessage() + ")";
- LOG.warn(message);
-
- return null;
- }
- }
-
- private static String resourceContentOf(final Class<?> cls, final String resourceName) throws IOException {
- final URL url = Resources.getResource(cls, resourceName);
- return Resources.toString(url, Charset.defaultCharset());
- }
-
- private String resourceNameFor(final Class<?> domainClass) {
- return domainClass.getSimpleName() + ".layout.xml";
- }
-
-
- @Override
- @Programmatic
- public Page toPage(final Object domainObject) {
- return toPage(domainObject.getClass());
- }
-
- @Override
- public Page toPage(final Class<?> domainClass) {
- final ObjectSpecification objectSpec = specificationLookup.loadSpecification(domainClass);
- final PageFacet facet = objectSpec.getFacet(PageFacet.class);
- return facet != null? facet.getPage(): null;
- }
-
-
- @Override
- public String schemaLocations(final Page page) {
- return pageNormalizerService.schemaLocationsFor(page);
- }
-
- ////////////////////////////////////////////////////////
-
-
- //region > injected dependencies
-
- private SpecificationLoader specificationLookup;
-
- @Override
- public void setSpecificationLoader(final SpecificationLoader specificationLookup) {
- this.specificationLookup = specificationLookup;
- }
-
- private DeploymentCategory deploymentCategory;
-
- @Override
- public void setDeploymentCategory(final DeploymentCategory deploymentCategory) {
- this.deploymentCategory = deploymentCategory;
- }
-
- @Inject
- JaxbService jaxbService;
-
- @Inject
- PageNormalizerService pageNormalizerService;
- //endregion
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizer.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizer.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizer.java
deleted file mode 100644
index 2cc4e62..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizer.java
+++ /dev/null
@@ -1,25 +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.services.layout.provider;
-
-import org.apache.isis.applib.layout.common.Page;
-
-public interface PageNormalizer<P extends Page> {
-
- void normalize(final P page, final Class<?> domainClass);
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerAbstract.java
deleted file mode 100644
index df32cdb..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerAbstract.java
+++ /dev/null
@@ -1,35 +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.services.layout.provider;
-
-import org.apache.isis.applib.layout.common.Page;
-import org.apache.isis.applib.services.i18n.TranslationService;
-import org.apache.isis.core.metamodel.spec.SpecificationLoader;
-
-public abstract class PageNormalizerAbstract<P extends Page> implements PageNormalizer<P> {
-
- protected final SpecificationLoader specificationLookup;
- protected final TranslationService translationService;
-
- public PageNormalizerAbstract(
- final TranslationService translationService,
- final SpecificationLoader specificationLookup) {
- this.specificationLookup = specificationLookup;
- this.translationService = translationService;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerBS3.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerBS3.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerBS3.java
deleted file mode 100644
index ed1514b..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerBS3.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.metamodel.services.layout.provider;
-
-import org.apache.isis.applib.layout.bootstrap3.BS3Page;
-import org.apache.isis.applib.services.i18n.TranslationService;
-import org.apache.isis.core.metamodel.spec.SpecificationLoader;
-
-public class PageNormalizerBS3 extends PageNormalizerAbstract<BS3Page> {
-
- public static final String TNS = "http://isis.apache.org/schema/applib/layout/bootstrap3";
- public static final String SCHEMA_LOCATION = "http://isis.apache.org/schema/applib/layout/bootstrap3/bootstrap3.xsd";
-
-
- public PageNormalizerBS3(
- final TranslationService translationService,
- final SpecificationLoader specificationLookup) {
- super(translationService, specificationLookup);
- }
-
- @Override
- public void normalize(final BS3Page page, final Class<?> domainClass) {
-
- }
-}
[14/15] isis git commit: ISIS-993: converting GridNormalizer into a
service.
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/63d03d29/core/metamodel/src/test/java/org/apache/isis/core/metamodel/services/grid/BS3GridTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/services/grid/BS3GridTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/services/grid/BS3GridTest.java
new file mode 100644
index 0000000..3d9d6b2
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/services/grid/BS3GridTest.java
@@ -0,0 +1,154 @@
+/*
+ * 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.services.grid;
+
+import java.util.Arrays;
+import java.util.Map;
+
+import javax.xml.bind.Marshaller;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.isis.applib.layout.bootstrap3.BS3Col;
+import org.apache.isis.applib.layout.bootstrap3.BS3Grid;
+import org.apache.isis.applib.layout.bootstrap3.BS3Row;
+import org.apache.isis.applib.layout.bootstrap3.BS3Tab;
+import org.apache.isis.applib.layout.bootstrap3.BS3TabGroup;
+import org.apache.isis.applib.layout.common.ActionLayoutData;
+import org.apache.isis.applib.layout.common.CollectionLayoutData;
+import org.apache.isis.applib.layout.common.DomainObjectLayoutData;
+import org.apache.isis.applib.layout.common.FieldSet;
+import org.apache.isis.applib.layout.common.PropertyLayoutData;
+import org.apache.isis.applib.services.jaxb.JaxbService;
+import org.apache.isis.core.metamodel.services.grid.bootstrap3.GridNormalizerServiceBS3;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class BS3GridTest {
+
+ private JaxbService jaxbService;
+ private GridServiceDefault gridServiceDefault;
+ private GridNormalizerServiceBS3 gridNormalizerServiceBS3;
+
+ @Before
+ public void setUp() throws Exception {
+ jaxbService = new JaxbService.Simple();
+ gridServiceDefault = new GridServiceDefault();
+ gridNormalizerServiceBS3 = new GridNormalizerServiceBS3();
+ gridServiceDefault.gridNormalizerServices = Arrays.<GridNormalizerService>asList(gridNormalizerServiceBS3);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void xxx() throws Exception {
+
+ final BS3Grid bs3Grid = new BS3Grid();
+
+ // header
+ final BS3Row headerRow = bs3Grid.getRows().get(0);
+ final BS3Col headerCol = (BS3Col) headerRow.getCols().get(0);
+ headerCol.setSpan(12);
+
+ final DomainObjectLayoutData objectLayoutData = new DomainObjectLayoutData();
+ headerCol.setDomainObject(objectLayoutData);
+
+ final ActionLayoutData deleteActionLayoutData = new ActionLayoutData();
+ deleteActionLayoutData.setId("delete");
+ headerCol.setActions(Lists.<ActionLayoutData>newArrayList());
+ headerCol.getActions().add(deleteActionLayoutData);
+
+ // content
+ final BS3Row contentRow = new BS3Row();
+ bs3Grid.getRows().add(contentRow);
+
+ final BS3Col contentCol = (BS3Col) contentRow.getCols().get(0);
+ contentCol.setSpan(12);
+
+ // a tabgroup containing a 'Common' tab
+ final BS3TabGroup tabGroup = new BS3TabGroup();
+ contentCol.getTabGroups().add(tabGroup);
+ BS3Tab bs3Tab = tabGroup.getTabs().get(0);
+ bs3Tab.setName("Common");
+
+ // with a left col...
+ final BS3Row tabRow = bs3Tab.getRows().get(0);
+ final BS3Col tabLeftCol = (BS3Col) tabRow.getCols().get(0);
+ tabLeftCol.setSpan(6);
+
+ // containing a fieldset
+ final FieldSet leftPropGroup = new FieldSet("General");
+ tabLeftCol.setFieldSets(Lists.<FieldSet>newArrayList());
+ tabLeftCol.getFieldSets().add(leftPropGroup);
+ leftPropGroup.setName("General");
+
+ // with a single property
+ final PropertyLayoutData namePropertyLayoutData = leftPropGroup.getProperties().get(0);
+ namePropertyLayoutData.setNamed("name");
+
+ // and its associated action
+ final ActionLayoutData updateNameActionLayoutData = new ActionLayoutData();
+ updateNameActionLayoutData.setId("updateName");
+ namePropertyLayoutData.setActions(Lists.<ActionLayoutData>newArrayList());
+ namePropertyLayoutData.getActions().add(updateNameActionLayoutData);
+
+ // and the tab also has a right col...
+ final BS3Col tabRightCol = (BS3Col) tabRow.getCols().get(0);
+ tabRightCol.setSpan(6);
+
+ // containing a collection
+ final CollectionLayoutData similarToColl = new CollectionLayoutData();
+ tabRightCol.setCollections(Lists.<CollectionLayoutData>newArrayList());
+ tabRightCol.getCollections().add(similarToColl);
+ similarToColl.setId("similarTo");
+
+ final String schemaLocations = gridServiceDefault.tnsAndSchemaLocation(bs3Grid);
+ String xml = jaxbService.toXml(bs3Grid,
+ ImmutableMap.<String,Object>of(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocations));
+ System.out.println(xml);
+
+ BS3Grid bs3Pageroundtripped = jaxbService.fromXml(BS3Grid.class, xml);
+ String xmlRoundtripped = jaxbService.toXml(bs3Pageroundtripped,
+ ImmutableMap.<String,Object>of(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocations));
+ assertThat(xml, is(equalTo(xmlRoundtripped)));
+
+
+ System.out.println("==========");
+
+ dumpXsd(bs3Grid);
+ }
+
+ protected void dumpXsd(final BS3Grid bs3Page) {
+ Map<String, String> schemas = jaxbService.toXsd(bs3Page, JaxbService.IsisSchemas.INCLUDE);
+ for (Map.Entry<String, String> entry : schemas.entrySet()) {
+ System.out.println(entry.getKey() + ":");
+ System.out.println(entry.getValue());
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/63d03d29/core/metamodel/src/test/java/org/apache/isis/core/metamodel/services/grid/FCGridTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/services/grid/FCGridTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/services/grid/FCGridTest.java
new file mode 100644
index 0000000..5cb1ed6
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/services/grid/FCGridTest.java
@@ -0,0 +1,126 @@
+/*
+ * 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.services.grid;
+
+import java.util.Arrays;
+import java.util.Map;
+
+import javax.xml.bind.Marshaller;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.isis.applib.layout.common.ActionLayoutData;
+import org.apache.isis.applib.layout.common.CollectionLayoutData;
+import org.apache.isis.applib.layout.common.FieldSet;
+import org.apache.isis.applib.layout.common.PropertyLayoutData;
+import org.apache.isis.applib.layout.fixedcols.FCColumn;
+import org.apache.isis.applib.layout.fixedcols.FCGrid;
+import org.apache.isis.applib.layout.fixedcols.FCTab;
+import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
+import org.apache.isis.applib.services.jaxb.JaxbService;
+import org.apache.isis.core.metamodel.services.grid.fixedcols.GridNormalizerServiceFC;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class FCGridTest {
+
+ private JaxbService jaxbService;
+ private GridServiceDefault gridServiceDefault;
+ private GridNormalizerServiceFC gridNormalizerServiceFC;
+
+ @Before
+ public void setUp() throws Exception {
+ jaxbService = new JaxbService.Simple();
+ gridServiceDefault = new GridServiceDefault();
+ gridNormalizerServiceFC = new GridNormalizerServiceFC();
+ gridServiceDefault.gridNormalizerServices = Arrays.<GridNormalizerService>asList(gridNormalizerServiceFC);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void xxx() throws Exception {
+
+ final FCGrid fcPage = new FCGrid();
+
+ fcPage.setTabGroups(Lists.<FCTabGroup>newArrayList());
+ fcPage.getTabGroups().add(new FCTabGroup());
+ FCTabGroup tabGroup = fcPage.getTabGroups().get(0);
+ FCTab FCTab = tabGroup.getTabs().get(0);
+ FCTab.setName("Common");
+ FCColumn left = FCTab.getLeft();
+
+ FieldSet leftPropGroup = new FieldSet();
+ left.setFieldSets(Lists.<FieldSet>newArrayList());
+ left.getFieldSets().add(leftPropGroup);
+ leftPropGroup.setName("General");
+
+ CollectionLayoutData similarToColl = new CollectionLayoutData();
+ left.setCollections(Lists.<CollectionLayoutData>newArrayList());
+ left.getCollections().add(similarToColl);
+ similarToColl.setId("similarTo");
+
+ left.getFieldSets().add(new FieldSet("General"));
+ PropertyLayoutData namePropertyLayoutData = new PropertyLayoutData("name");
+ left.getFieldSets().get(0).getProperties().add(namePropertyLayoutData);
+
+ ActionLayoutData updateNameActionLayoutData = new ActionLayoutData();
+ updateNameActionLayoutData.setId("updateName");
+ namePropertyLayoutData.setActions(Lists.<ActionLayoutData>newArrayList());
+ namePropertyLayoutData.getActions().add(updateNameActionLayoutData);
+
+ ActionLayoutData deleteActionLayoutData = new ActionLayoutData();
+ deleteActionLayoutData.setId("delete");
+ fcPage.setActions(Lists.<ActionLayoutData>newArrayList());
+ fcPage.getActions().add(deleteActionLayoutData);
+
+ final String schemaLocations = gridServiceDefault.tnsAndSchemaLocation(fcPage);
+ String xml = jaxbService.toXml(fcPage,
+ ImmutableMap.<String,Object>of(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocations));
+ System.out.println(xml);
+
+ FCGrid fcPageRoundtripped = jaxbService.fromXml(FCGrid.class, xml);
+ String xmlRoundtripped = jaxbService.toXml(fcPageRoundtripped,
+ ImmutableMap.<String,Object>of(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocations));
+ assertThat(xml, is(equalTo(xmlRoundtripped)));
+
+
+ System.out.println("==========");
+
+ dumpXsd(fcPage);
+ }
+
+ protected void dumpXsd(final FCGrid fcPage) {
+ Map<String, String> schemas = jaxbService.toXsd(fcPage, JaxbService.IsisSchemas.INCLUDE);
+ for (Map.Entry<String, String> entry : schemas.entrySet()) {
+ System.out.println(entry.getKey() + ":");
+ System.out.println(entry.getValue());
+ }
+ }
+}
\ No newline at end of file
[08/15] isis git commit: ISIS-993: bootstrap3 layout working,
more or less. Still need to do the normalization phase.
Posted by da...@apache.org.
ISIS-993: bootstrap3 layout working, more or less. Still need to do the normalization phase.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/c57d8cd8
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/c57d8cd8
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/c57d8cd8
Branch: refs/heads/ISIS-993
Commit: c57d8cd8ed656813ae9f17da68f9098450633b74
Parents: 84c9cf7
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Feb 1 00:57:00 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Feb 1 00:57:00 2016 +0100
----------------------------------------------------------------------
.../applib/layout/bootstrap3/BS3ClearFix.java | 1 +
.../layout/bootstrap3/BS3ClearFixHidden.java | 4 +
.../layout/bootstrap3/BS3ClearFixVisible.java | 6 +
.../isis/applib/layout/bootstrap3/BS3Col.java | 5 +
.../applib/layout/bootstrap3/BS3RowContent.java | 8 +-
.../isis/applib/layout/bootstrap3/BS3Tab.java | 14 +
.../ComponentFactoryRegistrarDefault.java | 6 +-
.../components/entity/EntityPanelFactory.java | 65 --
.../wicket/ui/components/entity/PropUtil.java | 91 ---
.../components/entity/column/EntityColumn.html | 31 -
.../components/entity/column/EntityColumn.java | 190 -----
.../entity/editable/EntityEditablePanel.html | 29 -
.../entity/editable/EntityEditablePanel.java | 60 --
.../entity/fieldset/PropertyGroup.html | 41 ++
.../entity/fieldset/PropertyGroup.java | 124 ++++
.../entity/header/EntityHeaderPanel.java | 6 +-
.../propsandcolls/EntityPropsAndCollsForm.java | 710 -------------------
.../EntityPropsAndCollsForm.properties | 22 -
.../propsandcolls/EntityPropsAndCollsPanel.html | 54 --
.../propsandcolls/EntityPropsAndCollsPanel.java | 67 --
.../EntityPropsAndCollsPanelFactory.java | 53 --
.../links/EntityLinksSelectorPanelFactory.java | 22 +-
.../components/layout/EntityPanelFactory.java | 50 ++
.../ui/components/layout/bs3/BS3PagePanel.html | 28 +
.../ui/components/layout/bs3/BS3PagePanel.java | 66 ++
.../wicket/ui/components/layout/bs3/Util.java | 41 ++
.../layout/bs3/clearfix/ClearFix.html | 26 +
.../layout/bs3/clearfix/ClearFix.java | 69 ++
.../ui/components/layout/bs3/col/Col.html | 46 ++
.../ui/components/layout/bs3/col/Col.java | 207 ++++++
.../ui/components/layout/bs3/row/Row.html | 28 +
.../ui/components/layout/bs3/row/Row.java | 89 +++
.../layout/bs3/tabs/TabGroupPanel.java | 97 +++
.../ui/components/layout/bs3/tabs/TabPanel.html | 30 +
.../ui/components/layout/bs3/tabs/TabPanel.java | 42 ++
.../layout/fallback/EntityEditablePanel.html | 29 +
.../layout/fallback/EntityEditablePanel.java | 60 ++
.../fixedcols/EntityCollectionsPanel.html | 32 -
.../fixedcols/EntityCollectionsPanel.java | 151 ----
.../EntityCollectionsPanelFactory.java | 49 --
.../layout/fixedcols/EntityTabbedPanel.html | 34 -
.../layout/fixedcols/EntityTabbedPanel.java | 113 ---
.../layout/fixedcols/FCPagePanel.html | 34 +
.../layout/fixedcols/FCPagePanel.java | 114 +++
.../components/layout/fixedcols/PropUtil.java | 91 +++
.../layout/fixedcols/PropertyGroup.html | 41 --
.../layout/fixedcols/PropertyGroup.java | 122 ----
.../layout/fixedcols/TabGroupListPanel.html | 28 -
.../layout/fixedcols/TabGroupListPanel.java | 66 --
.../layout/fixedcols/TabGroupPanel.java | 103 ---
.../components/layout/fixedcols/TabPanel.html | 31 -
.../components/layout/fixedcols/TabPanel.java | 24 -
.../collections/EntityCollectionsPanel.html | 32 +
.../collections/EntityCollectionsPanel.java | 151 ++++
.../EntityCollectionsPanelFactory.java | 49 ++
.../layout/fixedcols/columns/EntityColumn.html | 31 +
.../layout/fixedcols/columns/EntityColumn.java | 190 +++++
.../propsandcolls/EntityPropsAndCollsForm.java | 710 +++++++++++++++++++
.../EntityPropsAndCollsForm.properties | 22 +
.../propsandcolls/EntityPropsAndCollsPanel.html | 54 ++
.../propsandcolls/EntityPropsAndCollsPanel.java | 67 ++
.../EntityPropsAndCollsPanelFactory.java | 53 ++
.../tabgrouplist/TabGroupListPanel.html | 28 +
.../tabgrouplist/TabGroupListPanel.java | 67 ++
.../layout/fixedcols/tabs/TabGroupPanel.java | 105 +++
.../layout/fixedcols/tabs/TabPanel.html | 31 +
.../layout/fixedcols/tabs/TabPanel.java | 24 +
.../components/scalars/ScalarPanelAbstract.html | 2 +-
.../wicket/ui/pages/bootstrap-overrides.css | 4 +-
.../dom/simple/SimpleObject.layout-BS3.xml | 42 --
.../dom/simple/SimpleObject.layout-FC.xml | 38 +
.../dom/simple/SimpleObject.layout.xml | 96 ++-
72 files changed, 3092 insertions(+), 2254 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3ClearFix.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3ClearFix.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3ClearFix.java
index abe186b..29bf036 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3ClearFix.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3ClearFix.java
@@ -20,4 +20,5 @@ package org.apache.isis.applib.layout.bootstrap3;
public abstract class BS3ClearFix extends BS3RowContent {
+ public abstract String toCssClass();
}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3ClearFixHidden.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3ClearFixHidden.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3ClearFixHidden.java
index 4590d1b..0cf84ba 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3ClearFixHidden.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3ClearFixHidden.java
@@ -31,4 +31,8 @@ public class BS3ClearFixHidden extends BS3ClearFix {
private static final long serialVersionUID = 1L;
+ @Override
+ public String toCssClass() {
+ return "clearfix hidden-" + getSize().toCssClassFragment();
+ }
}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3ClearFixVisible.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3ClearFixVisible.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3ClearFixVisible.java
index 903a180..523e668 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3ClearFixVisible.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3ClearFixVisible.java
@@ -50,4 +50,10 @@ public class BS3ClearFixVisible extends BS3ClearFix {
this.cssDisplay = cssDisplay;
}
+
+ @Override
+ public String toCssClass() {
+ return "clearfix visible-" + getSize().toCssClassFragment() + "-" + getCssClass().toLowerCase().replace('_', '-');
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java
index 8118add..1395c99 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java
@@ -220,4 +220,9 @@ public class BS3Col extends BS3RowContent {
+
+ public String toCssClass() {
+ final Size size = getSize() != null? getSize(): Size.MD;
+ return "col-" + size.toCssClassFragment() + "-" + getSpan();
+ }
}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3RowContent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3RowContent.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3RowContent.java
index 9caf07d..88e9a69 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3RowContent.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3RowContent.java
@@ -37,11 +37,15 @@ public abstract class BS3RowContent extends BS3ElementAbstract {
* As per <a href="http://getbootstrap.com/css/#grid-options">grid options</a>, also used in
* <a href="http://getbootstrap.com/css/#responsive-utilities">responsive utility</a> classes.
*/
- public static enum Size {
+ public enum Size {
XS,
SM,
MD,
- LG
+ LG;
+
+ public String toCssClassFragment() {
+ return name().toLowerCase();
+ }
}
private Size size;
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Tab.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Tab.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Tab.java
index 8830bd1..4489531 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Tab.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Tab.java
@@ -25,6 +25,8 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
+import com.google.common.base.Predicate;
+
/**
* Represents a tab within a {@link BS3TabGroup tab group}.
*
@@ -69,4 +71,16 @@ public class BS3Tab extends BS3ElementAbstract {
this.rows = rows;
}
+
+ public static class Predicates {
+ public static Predicate<BS3Tab> notEmpty() {
+ return new Predicate<BS3Tab>() {
+ @Override
+ public boolean apply(final BS3Tab bs3Tab) {
+ return !bs3Tab.getRows().isEmpty();
+ }
+ };
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/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 b328c85..eacb114 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
@@ -39,13 +39,13 @@ import org.apache.isis.viewer.wicket.ui.components.collectioncontents.multiple.C
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;
-import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.EntityCollectionsPanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.collections.EntityCollectionsPanelFactory;
import org.apache.isis.viewer.wicket.ui.components.entity.header.EntityHeaderPanelFactory;
import org.apache.isis.viewer.wicket.ui.components.entity.icontitle.EntityIconAndTitlePanelFactory;
import org.apache.isis.viewer.wicket.ui.components.entity.icontitle.EntityIconTitleAndCopyLinkPanelFactory;
-import org.apache.isis.viewer.wicket.ui.components.entity.propsandcolls.EntityPropsAndCollsPanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.propsandcolls.EntityPropsAndCollsPanelFactory;
import org.apache.isis.viewer.wicket.ui.components.entity.selector.links.EntityLinksSelectorPanelFactory;
-import org.apache.isis.viewer.wicket.ui.components.entity.EntityPanelFactory;
+import org.apache.isis.viewer.wicket.ui.components.layout.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;
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/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
deleted file mode 100644
index 1463e80..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/EntityPanelFactory.java
+++ /dev/null
@@ -1,65 +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;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.model.IModel;
-
-import org.apache.isis.applib.layout.fixedcols.FCPage;
-import org.apache.isis.applib.layout.common.Page;
-import org.apache.isis.core.metamodel.facets.object.layoutmetadata.PageFacet;
-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.editable.EntityEditablePanel;
-import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.EntityTabbedPanel;
-
-/**
- * {@link ComponentFactory} for {@link EntityTabbedPanel}.
- */
-public class EntityPanelFactory extends EntityComponentFactoryAbstract {
-
- private static final long serialVersionUID = 1L;
-
- private static final String NAME = "tabbed";
-
- public EntityPanelFactory() {
- super(ComponentType.ENTITY, NAME, EntityTabbedPanel.class);
- }
-
- @Override
- public Component createComponent(final String id, final IModel<?> model) {
-
- final EntityModel entityModel = (EntityModel) model;
-
- final ObjectSpecification specification = entityModel.getTypeOfSpecification();
- final PageFacet facet = specification.getFacet(PageFacet.class);
- final Page page = facet.getPage();
- if (page != null) {
- if(page instanceof FCPage) {
- return new EntityTabbedPanel(id, entityModel);
- }
- // TODO: support BS3Page here...
- }
- // fallback
- return new EntityEditablePanel(id, entityModel);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/PropUtil.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/PropUtil.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/PropUtil.java
deleted file mode 100644
index f846e26..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/PropUtil.java
+++ /dev/null
@@ -1,91 +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;
-
-import java.util.List;
-import java.util.Map;
-
-import com.google.common.collect.FluentIterable;
-
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.filter.Filter;
-import org.apache.isis.applib.filter.Filters;
-import org.apache.isis.applib.layout.fixedcols.FCColumn;
-import org.apache.isis.applib.layout.common.FieldSet;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.consent.InteractionInitiatedBy;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.ObjectSpecifications;
-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.EntityModel;
-
-public final class PropUtil {
-
- private PropUtil() {
- }
-
- public static List<String> propertyGroupNames(
- final EntityModel entityModel,
- final FCColumn.Hint hint, final FCColumn columnMetaDataIfAny) {
- final ObjectAdapter adapter = entityModel.getObject();
- final ObjectSpecification objSpec = adapter.getSpecification();
-
- final Map<String, List<ObjectAssociation>> associationsByGroup =
- propertiesByMemberOrder(adapter);
-
- return columnMetaDataIfAny != null
- ? FluentIterable
- .from(columnMetaDataIfAny.getFieldSets())
- .transform(FieldSet.Util.nameOf())
- .toList()
- : ObjectSpecifications.orderByMemberGroups(objSpec, associationsByGroup.keySet(),
- hint);
- }
-
- public static Map<String, List<ObjectAssociation>> propertiesByMemberOrder(final ObjectAdapter adapter) {
- final List<ObjectAssociation> properties = visibleProperties(adapter);
- return ObjectAssociation.Util.groupByMemberOrderName(properties);
- }
-
- private static List<ObjectAssociation> visibleProperties(final ObjectAdapter adapter) {
- return visibleProperties(adapter, Filters.<ObjectAssociation>any());
- }
-
- private static List<ObjectAssociation> visibleProperties(
- final ObjectAdapter adapter,
- final Filter<ObjectAssociation> filter) {
- final ObjectSpecification objSpec = adapter.getSpecification();
-
- return objSpec.getAssociations(
- Contributed.INCLUDED, visiblePropertiesFilter(adapter, filter));
- }
-
- @SuppressWarnings("unchecked")
- private static Filter<ObjectAssociation> visiblePropertiesFilter(
- final ObjectAdapter adapter,
- final Filter<ObjectAssociation> filter) {
- return Filters.and(
- ObjectAssociation.Filters.PROPERTIES,
- ObjectAssociation.Filters.dynamicallyVisible(
- adapter, InteractionInitiatedBy.USER, Where.OBJECT_FORMS),
- filter);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.html
deleted file mode 100644
index 44e3a23..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.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="columnMembers">
- <div class="inputFormTable properties">
- <div wicket:id="propertyGroup">[propertyGroup]</div>
- </div>
- <div wicket:id="collections"></div>
- </div>
- </wicket:panel>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.java
deleted file mode 100644
index e1cfe87..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.java
+++ /dev/null
@@ -1,190 +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.column;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import com.google.common.base.Function;
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-
-import org.apache.wicket.MarkupContainer;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.repeater.RepeatingView;
-
-import org.apache.isis.applib.layout.common.FieldSet;
-import org.apache.isis.applib.layout.common.PropertyLayoutData;
-import org.apache.isis.applib.layout.fixedcols.FCColumn;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.object.membergroups.MemberGroupLayoutFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.ObjectSpecifications;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.system.DeploymentType;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-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.PropUtil;
-import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.PropertyGroup;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-import org.apache.isis.viewer.wicket.ui.util.Components;
-
-/**
- * Adds properties (in property groups) and collections to a column.
- *
- * <p>
- * If {@link FCColumn} is present, then only those properties and collections for that
- * column metadata are rendered. Otherwise the {@link MemberGroupLayoutFacet} on the
- * {@link ObjectSpecification} in conjunction with the provided {@link FCColumn.Hint} is
- * used to filter down to just those properties/collections in the column.
- * </p>
- */
-public class EntityColumn extends PanelAbstract<EntityModel> {
-
- private static final long serialVersionUID = 1L;
-
- private static final String ID_PROPERTY_GROUP = "propertyGroup";
-
-
- // view metadata (populated for EntityTabbedPanel, absent for EntityEditablePanel)
- private final FCColumn columnMetaDataIfAny;
-
- // which column to render (populated for EntityEditablePanel, not required and so absent for EntityTabbedPanel)
- final FCColumn.Hint hint;
-
- private static FCColumn.Hint hintFrom(final EntityModel entityModel) {
- final FCColumn fcColumn = (FCColumn) entityModel.getLayoutMetadata();
- return fcColumn.getHint();
- }
-
-
- public EntityColumn(
- final String id,
- final EntityModel entityModel) {
-
- this(id, entityModel, hintFrom(entityModel));
- }
-
- public EntityColumn(
- final String id,
- final EntityModel entityModel,
- final FCColumn.Hint hint) {
-
- super(id, entityModel);
-
- columnMetaDataIfAny = (FCColumn) entityModel.getLayoutMetadata();
- this.hint = hint;
-
- buildGui();
- }
-
- private void buildGui() {
- addPropertiesAndCollections(this, getModel());
- }
-
- private void addPropertiesAndCollections(
- final MarkupContainer col,
- final EntityModel entityModel) {
- addPropertiesInColumn(col, entityModel);
- addCollectionsIfRequired(col, entityModel);
- }
-
- private void addPropertiesInColumn(
- final MarkupContainer markupContainer,
- final EntityModel entityModel) {
-
- final ObjectAdapter adapter = entityModel.getObject();
- final ObjectSpecification objSpec = adapter.getSpecification();
-
- final Map<String, List<ObjectAssociation>> associationsByGroup = PropUtil.propertiesByMemberOrder(adapter);
-
- final RepeatingView memberGroupRv = new RepeatingView(ID_PROPERTY_GROUP);
- markupContainer.add(memberGroupRv);
-
- final ImmutableMap<String, FieldSet> propertyGroupMetadataByNameIfAny =
- columnMetaDataIfAny != null
- ? Maps.uniqueIndex(columnMetaDataIfAny.getFieldSets(), FieldSet.Util.nameOf())
- : null;
-
- final Collection<String> groupNames =
- propertyGroupMetadataByNameIfAny != null
- ? propertyGroupMetadataByNameIfAny.keySet()
- : ObjectSpecifications.orderByMemberGroups(objSpec, associationsByGroup.keySet(), hint);
-
- for(final String groupName: groupNames) {
-
-
- final FieldSet fieldSet;
- if (propertyGroupMetadataByNameIfAny != null) {
- fieldSet = propertyGroupMetadataByNameIfAny.get(groupName);
- }
- else {
- final List<ObjectAssociation> associationsInGroup = associationsByGroup.get(groupName);
- fieldSet = new FieldSet(groupName);
- fieldSet.setProperties(
- FluentIterable
- .from(associationsInGroup)
- .transform(
- new Function<ObjectAssociation, PropertyLayoutData>() {
- @Override
- public PropertyLayoutData apply(final ObjectAssociation assoc) {
- return new PropertyLayoutData(assoc.getId());
- }
- }).toList());
- }
-
- if(fieldSet.getProperties().isEmpty()) {
- continue;
- }
-
- final String id = memberGroupRv.newChildId();
-
- final EntityModel entityModelWithHints = entityModel.cloneWithLayoutMetadata(fieldSet);
- final WebMarkupContainer memberGroupRvContainer = new PropertyGroup(id, entityModelWithHints);
-
- memberGroupRv.add(memberGroupRvContainer);
- }
- }
-
- private void addCollectionsIfRequired(
- final MarkupContainer column,
- final EntityModel entityModel) {
-
- if(columnMetaDataIfAny != null) {
- getComponentFactoryRegistry()
- .addOrReplaceComponent(column, "collections", ComponentType.ENTITY_COLLECTIONS, entityModel);
- } else {
- Components.permanentlyHide(column, "collections");
- }
- }
-
-
-
- ///////////////////////////////////////////////////////
- // Dependencies (from context)
- ///////////////////////////////////////////////////////
-
- protected DeploymentType getDeploymentType() {
- return IsisContext.getDeploymentType();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/editable/EntityEditablePanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/editable/EntityEditablePanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/editable/EntityEditablePanel.html
deleted file mode 100644
index 540bb11..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/editable/EntityEditablePanel.html
+++ /dev/null
@@ -1,29 +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="entityCombined">
- <div wicket:id="entitySummary"></div>
- <div wicket:id="entityPropertiesAndCollections"></div>
- </div>
-</wicket:panel>
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/editable/EntityEditablePanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/editable/EntityEditablePanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/editable/EntityEditablePanel.java
deleted file mode 100644
index 2db68d8..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/editable/EntityEditablePanel.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.editable;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
-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;
-import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
-
-/**
- * {@link PanelAbstract Panel} to represent an entity on a single page made up
- * of several <div> regions.
- */
-public class EntityEditablePanel extends PanelAbstract<EntityModel> {
-
- private static final long serialVersionUID = 1L;
-
- private static final String ID_ENTITY_PROPERTIES_AND_COLLECTIONS = "entityPropertiesAndCollections";
-
-
- public EntityEditablePanel(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);
- }
-
- addOrReplace(ComponentType.ENTITY_SUMMARY, model);
-
- getComponentFactoryRegistry().addOrReplaceComponent(this, ID_ENTITY_PROPERTIES_AND_COLLECTIONS, ComponentType.ENTITY_PROPERTIES, model);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/fieldset/PropertyGroup.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/fieldset/PropertyGroup.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/fieldset/PropertyGroup.html
new file mode 100644
index 0000000..38245a0
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/fieldset/PropertyGroup.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.
+-->
+<html xmlns:wicket="http://wicket.apache.org">
+ <body>
+ <wicket:panel>
+ <fieldset class="memberGroup">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <span wicket:id="memberGroupName" class="panel-title">[group name]</span>
+ <div class="pull-right additionalLinks">
+ <div wicket:id="associatedActionLinksPanel"></div>
+ <div wicket:id="associatedActionLinksPanelDropDown"></div>
+ </div>
+ </div>
+ <div class="properties panel-body">
+ <div wicket:id="properties">
+ <div wicket:id="property" class="property">[property]</div>
+ </div>
+ </div>
+ </div>
+ </fieldset>
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/fieldset/PropertyGroup.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/fieldset/PropertyGroup.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/fieldset/PropertyGroup.java
new file mode 100644
index 0000000..57bc89c
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/fieldset/PropertyGroup.java
@@ -0,0 +1,124 @@
+/*
+ * 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.fieldset;
+
+import java.util.List;
+
+import com.google.common.collect.Lists;
+
+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.ActionLayout;
+import org.apache.isis.applib.layout.common.FieldSet;
+import org.apache.isis.applib.layout.common.PropertyLayoutData;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
+import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
+import org.apache.isis.viewer.wicket.model.mementos.PropertyMemento;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.model.models.ScalarModel;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.components.actionmenu.entityactions.AdditionalLinksPanel;
+import org.apache.isis.viewer.wicket.ui.components.actionmenu.entityactions.EntityActionUtil;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+public class PropertyGroup extends PanelAbstract<EntityModel> {
+
+ private static final String ID_MEMBER_GROUP_NAME = "memberGroupName";
+
+ private static final String ID_ASSOCIATED_ACTION_LINKS_PANEL = "associatedActionLinksPanel";
+ private static final String ID_ASSOCIATED_ACTION_LINKS_PANEL_DROPDOWN = "associatedActionLinksPanelDropDown";
+
+ private static final String ID_PROPERTIES = "properties";
+ private static final String ID_PROPERTY = "property";
+
+ private final FieldSet fieldSet;
+
+ public PropertyGroup(final String id, final EntityModel model) {
+ super(id, model);
+ fieldSet = (FieldSet) model.getLayoutMetadata();
+
+ buildGui();
+ }
+
+ public EntityModel getModel() {
+ return (EntityModel) getDefaultModel();
+ }
+
+ private void buildGui() {
+ String groupName = fieldSet.getName();
+ // changed to NO_CHECK because more complex BS3 layouts trip concurrency exception (haven't investigated as to why).
+ final ObjectAdapter adapter = getModel().load(AdapterManager.ConcurrencyChecking.NO_CHECK);
+
+ add(new Label(ID_MEMBER_GROUP_NAME, groupName));
+
+ final List<LinkAndLabel> memberGroupActions = Lists.newArrayList();
+
+ final RepeatingView propertyRv = new RepeatingView(ID_PROPERTIES);
+ add(propertyRv);
+
+ final List<PropertyLayoutData> properties = fieldSet.getProperties();
+ for (PropertyLayoutData property : properties) {
+ final ObjectAssociation association = adapter.getSpecification().getAssociation(property.getId());
+
+ final WebMarkupContainer propertyRvContainer = new WebMarkupContainer(propertyRv.newChildId());
+ propertyRv.add(propertyRvContainer);
+
+ addPropertyToForm(getModel(), (OneToOneAssociation) association, propertyRvContainer,
+ memberGroupActions);
+ }
+
+ final List<LinkAndLabel> actionsPanel = LinkAndLabel
+ .positioned(memberGroupActions, ActionLayout.Position.PANEL);
+ final List<LinkAndLabel> actionsPanelDropDown = LinkAndLabel
+ .positioned(memberGroupActions, ActionLayout.Position.PANEL_DROPDOWN);
+
+ AdditionalLinksPanel.addAdditionalLinks(
+ this, ID_ASSOCIATED_ACTION_LINKS_PANEL,
+ actionsPanel,
+ AdditionalLinksPanel.Style.INLINE_LIST);
+ AdditionalLinksPanel.addAdditionalLinks(
+ this, ID_ASSOCIATED_ACTION_LINKS_PANEL_DROPDOWN,
+ actionsPanelDropDown,
+ AdditionalLinksPanel.Style.DROPDOWN);
+ }
+
+ private void addPropertyToForm(
+ final EntityModel entityModel,
+ final OneToOneAssociation otoa,
+ final WebMarkupContainer container,
+ final List<LinkAndLabel> entityActions) {
+ final PropertyMemento pm = new PropertyMemento(otoa);
+
+ final ScalarModel scalarModel = entityModel.getPropertyModel(pm);
+ getComponentFactoryRegistry()
+ .addOrReplaceComponent(container, ID_PROPERTY, ComponentType.SCALAR_NAME_AND_VALUE, scalarModel);
+
+ final List<ObjectAction> associatedActions =
+ EntityActionUtil.getObjectActionsForAssociation(entityModel, otoa, getDeploymentCategory());
+
+ entityActions.addAll(
+ EntityActionUtil.asLinkAndLabelsForAdditionalLinksPanel(entityModel, associatedActions));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanel.java
index dbd9b61..5f382a9 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanel.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/header/EntityHeaderPanel.java
@@ -20,19 +20,20 @@
package org.apache.isis.viewer.wicket.ui.components.entity.header;
import java.util.List;
+
import org.apache.wicket.Component;
+
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
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.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.actionmenu.entityactions.AdditionalLinksPanel;
-import org.apache.isis.viewer.wicket.ui.components.actionmenu.entityactions.EntityActionUtil;
import org.apache.isis.viewer.wicket.ui.components.actionmenu.entityactions.EntityActionLinkFactory;
+import org.apache.isis.viewer.wicket.ui.components.actionmenu.entityactions.EntityActionUtil;
import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
/**
@@ -81,7 +82,6 @@ public class EntityHeaderPanel extends PanelAbstract<EntityModel> {
private void buildEntityActionsGui() {
final EntityModel model = getModel();
final ObjectAdapter adapter = model.getObject();
- final ObjectAdapterMemento adapterMemento = model.getObjectAdapterMemento();
if (adapter != null) {
final List<ObjectAction> topLevelActions = EntityActionUtil.getTopLevelActions(adapter, getDeploymentType());
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.java
deleted file mode 100644
index 6952325..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.java
+++ /dev/null
@@ -1,710 +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.propsandcolls;
-
-import java.util.List;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.MarkupContainer;
-import org.apache.wicket.Session;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
-import org.apache.wicket.ajax.markup.html.form.AjaxButton;
-import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
-import org.apache.wicket.markup.ComponentTag;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-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.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;
-import org.apache.isis.applib.annotation.Where;
-import org.apache.isis.applib.filter.Filter;
-import org.apache.isis.applib.filter.Filters;
-import org.apache.isis.applib.layout.fixedcols.FCColumn;
-import org.apache.isis.applib.layout.fixedcols.FCColumn.Hint;
-import org.apache.isis.applib.layout.fixedcols.FCTab;
-import org.apache.isis.applib.services.exceprecog.ExceptionRecognizer;
-import org.apache.isis.applib.services.exceprecog.ExceptionRecognizerComposite;
-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.consent.InteractionInitiatedBy;
-import org.apache.isis.core.metamodel.facets.object.membergroups.MemberGroupLayoutFacet;
-import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
-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.memento.Memento;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
-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.EntityModel;
-import org.apache.isis.viewer.wicket.ui.ComponentType;
-import org.apache.isis.viewer.wicket.ui.components.entity.PropUtil;
-import org.apache.isis.viewer.wicket.ui.components.entity.column.EntityColumn;
-import org.apache.isis.viewer.wicket.ui.components.widgets.formcomponent.CancelHintRequired;
-import org.apache.isis.viewer.wicket.ui.errors.JGrowlBehaviour;
-import org.apache.isis.viewer.wicket.ui.pages.entity.EntityPage;
-import org.apache.isis.viewer.wicket.ui.panels.FormAbstract;
-import org.apache.isis.viewer.wicket.ui.panels.IFormSubmitterWithPreValidateHook;
-import org.apache.isis.viewer.wicket.ui.util.Components;
-import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
-
-import de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationPanel;
-import de.agilecoders.wicket.core.util.Attributes;
-
-public class EntityPropsAndCollsForm extends FormAbstract<ObjectAdapter> implements ActionPromptProvider {
-
- 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";
-
- private static final String ID_ENTITY_COLUMN = "entityColumn";
- private static final String ID_ENTITY_COLLECTIONS = "entityCollections";
- private static final String ID_ENTITY_COLLECTIONS_OVERFLOW = "entityCollectionsOverflow";
-
- private static final String ID_EDIT_BUTTON = "edit";
- private static final String ID_OK_BUTTON = "ok";
- private static final String ID_CANCEL_BUTTON = "cancel";
-
- private static final String ID_FEEDBACK = "feedback";
-
- private final Component owningPanel;
-
- private Button editButton;
- private Button okButton;
- private Button cancelButton;
-
- private NotificationPanel feedback;
-
-
- public EntityPropsAndCollsForm(
- final String id,
- final EntityModel entityModel,
- final Component owningPanel) {
-
- super(id, entityModel);
- this.owningPanel = owningPanel; // for repainting
-
- buildGui();
-
- // add any concurrency exception that might have been propagated into the entity model
- // as a result of a previous action invocation
- final String concurrencyExceptionIfAny = entityModel.getAndClearConcurrencyExceptionIfAny();
- if(concurrencyExceptionIfAny != null) {
- error(concurrencyExceptionIfAny);
- }
- }
-
- private void buildGui() {
-
- final EntityModel entityModel = (EntityModel) getModel();
- final FCTab FCTabMetaDataIfAny = (FCTab) entityModel.getLayoutMetadata();
-
- final ColumnSpans columnSpans;
- if(FCTabMetaDataIfAny != null) {
- final FCColumn middle = FCTabMetaDataIfAny.getMiddle();
- final FCColumn right = FCTabMetaDataIfAny.getRight();
- columnSpans = ColumnSpans.asSpans(
- FCTabMetaDataIfAny.getLeft().getSpan(),
- middle != null? middle.getSpan(): 0,
- right != null? right.getSpan(): 0);
- } else {
- final MemberGroupLayoutFacet memberGroupLayoutFacet =
- entityModel.getObject().getSpecification().getFacet(MemberGroupLayoutFacet.class);
- columnSpans = memberGroupLayoutFacet.getColumnSpans();
- }
-
- // left column
- // (unlike middle and right columns, the left column is always added to hold the edit buttons and feedback)
- MarkupContainer leftColumn = new WebMarkupContainer(ID_LEFT_COLUMN);
- add(leftColumn);
-
- if(columnSpans.getLeft() > 0) {
- addPropertiesAndCollections(leftColumn, entityModel, FCTabMetaDataIfAny, Hint.LEFT);
- } else {
- Components.permanentlyHide(this, ID_LEFT_COLUMN);
- }
-
- // middle column
- MarkupContainer middleColumn;
- if(columnSpans.getMiddle() > 0) {
- middleColumn = new WebMarkupContainer(ID_MIDDLE_COLUMN);
- add(middleColumn);
- addPropertiesAndCollections(middleColumn, entityModel, FCTabMetaDataIfAny, Hint.MIDDLE);
- } else {
- middleColumn = null;
- Components.permanentlyHide(this, ID_MIDDLE_COLUMN);
- }
-
- // right column
- MarkupContainer rightColumn;
- if(columnSpans.getRight() > 0) {
- rightColumn = new WebMarkupContainer(ID_RIGHT_COLUMN);
- add(rightColumn);
- addPropertiesAndCollections(rightColumn, entityModel, FCTabMetaDataIfAny, Hint.RIGHT);
- } else {
- rightColumn = null;
- Components.permanentlyHide(this, ID_RIGHT_COLUMN);
- }
-
- // column spans
- if(columnSpans.getLeft() > 0) {
- addClassForSpan(leftColumn, Hint.LEFT.from(columnSpans));
- }
- if(columnSpans.getMiddle() > 0) {
- addClassForSpan(middleColumn, Hint.MIDDLE.from(columnSpans));
- }
- if(columnSpans.getRight() > 0) {
- addClassForSpan(rightColumn, Hint.RIGHT.from(columnSpans));
- }
-
- // edit buttons and feedback (not supported on tabbed view)
- final Hint leftHint = Hint.LEFT;
- final FCColumn leftColumnMetaDataIfAny = leftHint.from(FCTabMetaDataIfAny);
- final boolean hasProperties = leftColumnMetaDataIfAny == null && !PropUtil
- .propertyGroupNames(entityModel, leftHint, leftColumnMetaDataIfAny).isEmpty();
- if (hasProperties) {
- addButtons(leftColumn);
- addFeedbackGui(leftColumn);
-
- } else {
- Components.permanentlyHide(leftColumn,
- ID_EDIT_BUTTON, ID_OK_BUTTON, ID_CANCEL_BUTTON,
- ID_FEEDBACK);
- }
-
-
- // collections (only if not being added to a tab)
- if(FCTabMetaDataIfAny == null && columnSpans.getCollections() > 0) {
- final String idCollectionsToShow;
- final String idCollectionsToHide;
- int collectionSpan;
- if (columnSpans.exceedsRow()) {
- idCollectionsToShow = ID_ENTITY_COLLECTIONS_OVERFLOW;
- idCollectionsToHide = ID_ENTITY_COLLECTIONS;
- collectionSpan = 12;
- } else {
- idCollectionsToShow = ID_ENTITY_COLLECTIONS;
- idCollectionsToHide = ID_ENTITY_COLLECTIONS_OVERFLOW;
- collectionSpan = columnSpans.getCollections();
- }
-
- final Component collectionsColumn =
- getComponentFactoryRegistry().addOrReplaceComponent(
- this, idCollectionsToShow, ComponentType.ENTITY_COLLECTIONS, entityModel);
- addClassForSpan(collectionsColumn, collectionSpan);
-
- Components.permanentlyHide(this, idCollectionsToHide);
- } else {
- Components.permanentlyHide(this, ID_ENTITY_COLLECTIONS);
- Components.permanentlyHide(this, ID_ENTITY_COLLECTIONS_OVERFLOW);
- }
- }
-
- private void addPropertiesAndCollections(
- final MarkupContainer markupContainer,
- final EntityModel entityModel,
- final FCTab fcTabMetaDataIfAny,
- final Hint hint) {
- final FCColumn columnMetaDataIfAny = hint.from(fcTabMetaDataIfAny);
-
- final EntityModel entityModelWithHints = entityModel.cloneWithLayoutMetadata(columnMetaDataIfAny);
-
- final EntityColumn columnMembers =
- new EntityColumn(ID_ENTITY_COLUMN, entityModelWithHints, hint);
- markupContainer.add(columnMembers);
- }
-
-
- @Override
- protected void onComponentTag(ComponentTag tag) {
- super.onComponentTag(tag);
-
- Attributes.addClass(tag, "form-horizontal");
- }
-
- @Override
- public ActionPrompt getActionPrompt() {
- return ActionPromptProvider.Util.getFrom(this).getActionPrompt();
- }
-
- abstract class AjaxButtonWithOnError extends AjaxButton {
-
- public AjaxButtonWithOnError(String id, IModel<String> model) {
- super(id, model);
- }
-
- @Override
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- 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 {
- private static final long serialVersionUID = 1L;
- public AjaxButtonForValidate(String id, IModel<String> model) {
- super(id, model);
- }
-
- @Override
- public String preValidate() {
- // attempt to load with concurrency checking, catching recognized exceptions
- try {
- getEntityModel().load(ConcurrencyChecking.CHECK); // could have also just called #getObject(), since CHECK is the default
-
- } catch(ConcurrencyException ex){
- String recognizedErrorMessage = recognizeException(ex);
- if(recognizedErrorMessage == null) {
- throw ex;
- }
-
- // reload
- getEntityModel().load(ConcurrencyChecking.NO_CHECK);
-
- getForm().clearInput();
- getEntityModel().resetPropertyModels();
-
- toViewMode(null);
- toEditMode(null);
-
- return recognizedErrorMessage;
- }
-
- return null;
- }
-
- @Override
- public void validate() {
- // add in any error message that we might have recognized from above
- EntityPropsAndCollsForm form = EntityPropsAndCollsForm.this;
- String preValidationErrorIfAny = form.getPreValidationErrorIfAny();
-
- if(preValidationErrorIfAny != null) {
- feedbackOrNotifyAnyRecognizedError(preValidationErrorIfAny, form);
- // skip validation, because would relate to old values
-
- final EntityPage entityPage = new EntityPage(EntityPropsAndCollsForm.this.getModelObject(), null);
- EntityPropsAndCollsForm.this.setResponsePage(entityPage);
- } else {
- // run Wicket's validation
- super.validate();
- }
- }
-
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
-
- if (getForm().hasError()) {
- // stay in edit mode
- return;
- }
-
- doPreApply();
- if (applyFormChangesElse(target)) return;
- final Object redirectIfAny = doPostApply();
-
- if (flushChangesElse(target)) return;
-
-
- getEntityModel().resetPropertyModels();
-
- toViewMode(null);
-
- // "redirect-after-post"
- //
- // RequestCycle.get().getActiveRequestHandler() indicates this is handled by the ListenerInterfaceRequestHandler
- // which renders page at end.
- //
- // it's necessary to zap the page parameters (so mapping is to just wicket/page?nn)
- // otherwise (what I think happens) is that the httpServletResponse.sendRedirect ends up being to the same URL,
- // and this is rejected as invalid either by the browser or by the servlet container (perhaps only if running remotely).
- //
-
- final ObjectAdapter objectAdapter;
- if(redirectIfAny != null) {
- objectAdapter = getPersistenceSession().adapterFor(redirectIfAny);
- } else {
- // we obtain the adapter from the entity model because (if a view model) then the entity model may contain
- // a different adapter (the cloned view model) to the one with which we started with.
- objectAdapter = getEntityModel().getObjectAdapterMemento().getObjectAdapter(ConcurrencyChecking.NO_CHECK);
- }
-
- final EntityPage entityPage = new EntityPage(objectAdapter, null);
- EntityPropsAndCollsForm.this.setResponsePage(entityPage);
- }
-
- /**
- * Optional hook to override.
- *
- * <p>
- * If a non-null value is returned, then transition to it (ie eg the finish() transition for a wizard).
- * </p>
- */
- protected void doPreApply() {
- }
-
- /**
- * Optional hook to override.
- *
- * <p>
- * If a non-null value is returned, then transition to it (ie eg the finish() transition for a wizard).
- * </p>
- */
- protected Object doPostApply() {
- return null;
- }
-
- }
-
- abstract class AjaxButtonForCancel extends AjaxButtonWithOnError {
-
- public AjaxButtonForCancel(String id, IModel<String> model) {
- super(id, model);
- setDefaultFormProcessing(false);
- }
- }
-
-
- private void addButtons(MarkupContainer markupContainer) {
-
- // edit button
- editButton = new AjaxButtonWithOnError(ID_EDIT_BUTTON, new ResourceModel("editLabel")) {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void validate() {
-
- // same logic as in cancelButton; should this be factored out?
- try {
- getEntityModel().load(ConcurrencyChecking.CHECK);
- } catch(ConcurrencyException ex) {
- getMessageBroker().addMessage("Object changed by " + ex.getOid().getVersion().getUser() + ", automatically reloading");
- getEntityModel().load(ConcurrencyChecking.NO_CHECK);
- }
-
- super.validate();
- }
-
- @Override
- public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
- getEntityModel().resetPropertyModels();
- toEditMode(target);
- }
-
- @Override
- protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
- super.updateAjaxAttributes(attributes);
- attributes.getAjaxCallListeners().add(new org.apache.wicket.ajax.attributes.AjaxCallListener(){
-
- private static final long serialVersionUID = 1L;
-
- @Override
- public CharSequence getSuccessHandler(Component component) {
- // scroll to the top of the entity panel
- return "$('html, body').animate({"
- + " scrollTop: $('.entityIconAndTitlePanel').offset().top"
- + " }, 1000);";
- }
- });
- }
- };
- editButton.add(new Label("editLabel", editButton.getModel()));
- markupContainer.add(editButton);
-
-
- // ok button
- okButton = new AjaxButtonForValidate(ID_OK_BUTTON, new ResourceModel("okLabel"));
- markupContainer.add(okButton);
-
-
- // cancel button
- cancelButton = new AjaxButtonForCancel(ID_CANCEL_BUTTON, new ResourceModel("cancelLabel")) {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void validate() {
-
- // same logic as in editButton; should this be factored out?
- try {
- getEntityModel().load(ConcurrencyChecking.CHECK);
- } catch(ConcurrencyException ex) {
- getMessageBroker().addMessage("Object changed by " + ex.getOid().getVersion().getUser() + ", automatically reloading");
- getEntityModel().load(ConcurrencyChecking.NO_CHECK);
- }
- super.validate();
- }
-
- @Override
- protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
- Session.get().getFeedbackMessages().clear();
- getForm().clearInput();
- getForm().visitFormComponentsPostOrder(new IVisitor<FormComponent<?>, Void>() {
-
- @Override
- public void component(FormComponent<?> formComponent, IVisit<Void> visit) {
- if (formComponent instanceof CancelHintRequired) {
- final CancelHintRequired cancelHintRequired = (CancelHintRequired) formComponent;
- cancelHintRequired.onCancel();
- }
- }
- });
-
- try {
- getEntityModel().resetPropertyModels();
- } catch(RuntimeException ex) {
- throw ex;
- }
- toViewMode(target);
- }
- };
-
- markupContainer.add(cancelButton);
-
- okButton.setOutputMarkupPlaceholderTag(true);
- editButton.setOutputMarkupPlaceholderTag(true);
- cancelButton.setOutputMarkupPlaceholderTag(true);
-
- // flush any JGrowl messages (typically concurrency exceptions) if they are added.
- okButton.add(new JGrowlBehaviour());
- editButton.add(new JGrowlBehaviour());
- cancelButton.add(new JGrowlBehaviour());
- }
-
- // to perform object-level validation, we must apply the changes first
- // contrast this with ActionPanel (for validating actionarguments) where
- // we do the validation prior to the execution of the action
- private boolean applyFormChangesElse(AjaxRequestTarget target) {
- final ObjectAdapter adapter = getEntityModel().getObject();
- final Memento snapshotToRollbackToIfInvalid = new Memento(adapter);
-
- getEntityModel().apply();
- final String invalidReasonIfAny = getEntityModel().getReasonInvalidIfAny();
- if (invalidReasonIfAny != null) {
- error(invalidReasonIfAny);
- snapshotToRollbackToIfInvalid.recreateObject();
- toEditMode(target);
-
- // abort otherwise the object will have been dirtied and JDO will end up committing,
- // possibly bumping the version and resulting in a subsequent concurrency exception.
- IsisContext.getTransactionManager().abortTransaction();
- return true;
- }
- return false;
- }
-
- private boolean flushChangesElse(AjaxRequestTarget target) {
- try {
- this.getTransactionManager().flushTransaction();
- } catch(RuntimeException ex) {
-
- // There's no need to abort the transaction here, as it will have already been done
- // (in IsisTransactionManager#executeWithinTransaction(...)).
-
- String message = recognizeExceptionAndNotify(ex, this);
- if(message == null) {
- throw ex;
- }
-
- toEditMode(target);
- return true;
- }
- return false;
- }
-
-
- private String recognizeExceptionAndNotify(RuntimeException ex, Component feedbackComponentIfAny) {
-
- // see if the exception is recognized as being a non-serious error
-
- String recognizedErrorMessageIfAny = recognizeException(ex);
- feedbackOrNotifyAnyRecognizedError(recognizedErrorMessageIfAny, feedbackComponentIfAny);
-
- return recognizedErrorMessageIfAny;
- }
-
- private void feedbackOrNotifyAnyRecognizedError(String recognizedErrorMessageIfAny, Component feedbackComponentIfAny) {
- if(recognizedErrorMessageIfAny == null) {
- return;
- }
-
- if(feedbackComponentIfAny != null) {
- feedbackComponentIfAny.error(recognizedErrorMessageIfAny);
- }
- getMessageBroker().addWarning(recognizedErrorMessageIfAny);
-
- // we clear the abort cause because we've handled rendering the exception
- getTransactionManager().getTransaction().clearAbortCause();
- }
-
- private String recognizeException(RuntimeException ex) {
-
- // REVIEW: this code is similar to stuff in EntityPropertiesForm, perhaps move up to superclass?
- // REVIEW: similar code also in WebRequestCycleForIsis; combine?
-
- final List<ExceptionRecognizer> exceptionRecognizers = getServicesInjector().lookupServices(ExceptionRecognizer.class);
- final String message = new ExceptionRecognizerComposite(exceptionRecognizers).recognize(ex);
- return message;
- }
-
- private void requestRepaintPanel(final AjaxRequestTarget target) {
- if (target != null) {
- target.add(owningPanel);
- // TODO: is it necessary to add these too?
- target.add(editButton, okButton, cancelButton, feedback);
- }
- }
-
- private EntityModel getEntityModel() {
- return (EntityModel) getModel();
- }
-
- void toViewMode(final AjaxRequestTarget target) {
-
- getEntityModel().toViewMode();
-
- setVisible(editButton, isAnythingEditable());
- setVisible(okButton, false);
- setVisible(cancelButton, false);
-
- requestRepaintPanel(target);
- }
-
- private void setVisible(Button b, boolean editable) {
- if(b != null) {
- b.setVisible(editable);
- }
- }
-
- private boolean isAnythingEditable() {
- final EntityModel entityModel = (EntityModel) getModel();
- final ObjectAdapter adapter = entityModel.getObject();
-
- return !enabledAssociations(adapter, adapter.getSpecification()).isEmpty();
- }
-
- private List<ObjectAssociation> enabledAssociations(final ObjectAdapter adapter, final ObjectSpecification objSpec) {
- return objSpec.getAssociations(Contributed.EXCLUDED, enabledAssociationFilter(adapter));
- }
-
- @SuppressWarnings("unchecked")
- private Filter<ObjectAssociation> enabledAssociationFilter(final ObjectAdapter adapter) {
- return Filters.and(ObjectAssociation.Filters.PROPERTIES, ObjectAssociation.Filters.enabled(adapter,
- InteractionInitiatedBy.USER, Where.OBJECT_FORMS
- ));
- }
-
- private void toEditMode(final AjaxRequestTarget target) {
- getEntityModel().toEditMode();
-
- editButton.setVisible(false);
- okButton.setVisible(true);
- cancelButton.setVisible(true);
-
- requestRepaintPanel(target);
- }
-
- private void addFeedbackGui(final MarkupContainer markupContainer) {
- feedback = new NotificationPanel(ID_FEEDBACK, this, new ComponentFeedbackMessageFilter(this));
- feedback.setOutputMarkupPlaceholderTag(true);
- markupContainer.addOrReplace(feedback);
-
- // to avoid potential XSS attacks, no longer escape model strings
- // (risk is low but could just happen: error message being rendered might accidentally or deliberately contain rogue Javascript)
- // feedback.setEscapeModelStrings(false);
-
- final ObjectAdapter adapter = getEntityModel().getObject();
- if (adapter == null) {
- feedback.error("cannot locate object:" + getEntityModel().getObjectAdapterMemento().toString());
- }
- }
-
-
- static void addClassForSpan(final Component component, final int numGridCols) {
- component.add(new CssClassAppender("col-xs-"+numGridCols));
- }
-
-
-
- ///////////////////////////////////////////////////////
- // Dependencies (from context)
- ///////////////////////////////////////////////////////
-
- protected IsisTransactionManager getTransactionManager() {
- return IsisContext.getTransactionManager();
- }
-
- protected ServicesInjector getServicesInjector() {
- return IsisContext.getPersistenceSession().getServicesInjector();
- }
-
- protected MessageBroker getMessageBroker() {
- return getAuthenticationSession().getMessageBroker();
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.properties
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.properties b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.properties
deleted file mode 100644
index 71edcd9..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.properties
+++ /dev/null
@@ -1,22 +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.
-#
-
-okLabel=OK
-cancelLabel=Cancel
-editLabel=Edit
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanel.html
deleted file mode 100644
index 449f18d..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanel.html
+++ /dev/null
@@ -1,54 +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="entityPropertiesPanel entityPropertiesComponentType">
- <!-- EntityPropsAndCollsForm:start -->
- <form wicket:id="entityForm" class="inputForm" role="form">
- <div class="row">
- <div wicket:id="leftColumn">
- <div wicket:id="entityColumn"/>
- <div class="feedbackPanel">
- <span wicket:id="feedback"></span>
- </div>
- <div class="buttons">
- <button type="submit" class="edit btn btn-primary btn-md" wicket:id="edit"><span class="fa fa-edit"></span> <wicket:container wicket:id="editLabel"></wicket:container></button>
- <input type="submit" class="ok btn btn-primary btn-md" wicket:id="ok"/>
- <input type="submit" class="cancel btn btn-default btn-md" wicket:id="cancel"/>
- </div>
- </div>
- <div wicket:id="middleColumn">
- <div wicket:id="entityColumn"/>
- </div>
- <div wicket:id="rightColumn">
- <div wicket:id="entityColumn"/>
- </div>
- <div wicket:id="entityCollections"></div>
- </div>
- <div class="row">
- <div wicket:id="entityCollectionsOverflow"></div>
- </div>
- </form>
- <!-- EntityPropsAndCollsForm:end -->
- </div>
- </wicket:panel>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanel.java
deleted file mode 100644
index 62d188e..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanel.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.entity.propsandcolls;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.viewer.wicket.model.models.EntityModel;
-import org.apache.isis.viewer.wicket.ui.components.entity.editable.EntityEditablePanel;
-import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.EntityTabbedPanel;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-
-/**
- * {@link PanelAbstract Panel} representing the properties and collections of an entity, as per
- * the provided {@link EntityModel}.
- *
- * <p>
- * Used by both {@link EntityTabbedPanel} and also {@link EntityEditablePanel}. In the former
- * case the collections are never shown, and edit buttons suppressed. In the latter case the
- * collections are shown, possibly overflowing to region below.
- * </p>
- */
-public class EntityPropsAndCollsPanel extends PanelAbstract<EntityModel> {
-
- private static final long serialVersionUID = 1L;
-
- private static final String ID_ENTITY_FORM = "entityForm";
-
- private EntityPropsAndCollsForm form;
-
- public EntityPropsAndCollsPanel(final String id, final EntityModel entityModel) {
- super(id, entityModel);
- buildGui();
- form.toViewMode(null);
- }
-
- private void buildGui() {
- buildEntityPropertiesAndOrCollectionsGui();
- setOutputMarkupId(true);
- }
-
- private void buildEntityPropertiesAndOrCollectionsGui() {
- final EntityModel model = getModel();
- final ObjectAdapter adapter = model.getObject();
- if (adapter != null) {
- form = new EntityPropsAndCollsForm(ID_ENTITY_FORM, model, this);
- addOrReplace(form);
- } else {
- permanentlyHide(ID_ENTITY_FORM);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanelFactory.java
deleted file mode 100644
index 3352bb7..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsPanelFactory.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.entity.propsandcolls;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.model.IModel;
-
-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.editable.EntityEditablePanel;
-import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.EntityTabbedPanel;
-
-/**
- * {@link ComponentFactory} for {@link EntityPropsAndCollsPanel}.
- *
- *
- * <p>
- * Used by both {@link EntityEditablePanel} and also {@link EntityTabbedPanel}.
- * </p>
- */
-public class EntityPropsAndCollsPanelFactory extends EntityComponentFactoryAbstract {
-
- private static final long serialVersionUID = 1L;
-
- public EntityPropsAndCollsPanelFactory() {
- super(ComponentType.ENTITY_PROPERTIES, EntityPropsAndCollsPanel.class);
- }
-
- @Override
- public Component createComponent(final String id, final IModel<?> model) {
- final EntityModel entityModel = (EntityModel) model;
- return new EntityPropsAndCollsPanel(id, entityModel);
- }
-}
[10/15] isis git commit: ISIS-993: renamed Page to Grid,
PageFacet to GridFacet, PageService to GridService,
PageNormalizerService to GridNormalizerService, BS3PagePanel to BS3GridPanel,
FCPagePanel to FCGridPanel,
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCPagePanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCPagePanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCPagePanel.java
deleted file mode 100644
index 5e232fa..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCPagePanel.java
+++ /dev/null
@@ -1,114 +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.layout.fixedcols;
-
-import java.util.List;
-
-import com.google.common.collect.FluentIterable;
-
-import org.apache.isis.applib.layout.fixedcols.FCColumn;
-import org.apache.isis.applib.layout.fixedcols.FCPage;
-import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
-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.PageFacet;
-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.layout.fixedcols.columns.EntityColumn;
-import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.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 <div> regions.
- */
-public class FCPagePanel 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 FCPagePanel(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 PageFacet PageFacet = model.getTypeOfSpecification().getFacet(PageFacet.class);
- final FCPage page = (FCPage) PageFacet.getPage();
-
-
- addOrReplace(ComponentType.ENTITY_SUMMARY, model);
-
- final int leftSpan = addColumnIfRequired(ID_LEFT_COLUMN, page.getLeft());
-
- final TabGroupListPanel middleTabs = addTabGroups(ID_MIDDLE_COLUMN, page.getTabGroups());
-
- final int rightSpan = addColumnIfRequired(ID_RIGHT_COLUMN, page.getRight());
-
- 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<FCTabGroup> tabGroupList) {
- final EntityModel model = getModel();
- final List<FCTabGroup> tabGroups = FluentIterable
- .from(tabGroupList)
- .filter(FCTabGroup.Predicates.notEmpty())
- .toList();
- final EntityModel entityModelWitHints = model.cloneWithLayoutMetadata(tabGroups);
- final TabGroupListPanel middleComponent = new TabGroupListPanel(id, entityModelWitHints);
- addOrReplace(middleComponent);
- return middleComponent;
- }
-
- private int addColumnIfRequired(final String id, final FCColumn col) {
- if(col != null) {
- final EntityModel entityModel =
- getModel().cloneWithLayoutMetadata(col);
- final FCColumn fcColumn = (FCColumn) entityModel.getLayoutMetadata();
- final int span = fcColumn.getSpan();
- if(span > 0) {
- final EntityColumn entityColumn = new EntityColumn(id, entityModel);
- addOrReplace(entityColumn);
- CssClassAppender.appendCssClassTo(entityColumn, "col-xs-" + span);
- return span;
- }
- }
- permanentlyHide(id);
- return 0;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanel.java
index 8eadd52..82745c1 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanel.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanel.java
@@ -22,7 +22,7 @@ package org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.propsandcol
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.viewer.wicket.model.models.EntityModel;
import org.apache.isis.viewer.wicket.ui.components.layout.fallback.EntityEditablePanel;
-import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.FCPagePanel;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.FCGridPanel;
import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
/**
@@ -30,7 +30,7 @@ import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
* the provided {@link EntityModel}.
*
* <p>
- * Used by both {@link FCPagePanel} and also {@link EntityEditablePanel}. In the former
+ * Used by both {@link FCGridPanel} and also {@link EntityEditablePanel}. In the former
* case the collections are never shown, and edit buttons suppressed. In the latter case the
* collections are shown, possibly overflowing to region below.
* </p>
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanelFactory.java
index ef51ee4..d8e7f11 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanelFactory.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanelFactory.java
@@ -27,14 +27,14 @@ 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.layout.fallback.EntityEditablePanel;
-import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.FCPagePanel;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.FCGridPanel;
/**
* {@link ComponentFactory} for {@link EntityPropsAndCollsPanel}.
*
*
* <p>
- * Used by both {@link EntityEditablePanel} and also {@link FCPagePanel}.
+ * Used by both {@link EntityEditablePanel} and also {@link FCGridPanel}.
* </p>
*/
public class EntityPropsAndCollsPanelFactory extends EntityComponentFactoryAbstract {
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
index 45c42d7..e2b01db 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
@@ -29,13 +29,13 @@ import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.util.string.Strings;
-import org.apache.isis.applib.layout.common.Page;
+import org.apache.isis.applib.layout.common.Grid;
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.consent.InteractionInitiatedBy;
import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
-import org.apache.isis.core.metamodel.facets.object.layoutmetadata.PageFacet;
+import org.apache.isis.core.metamodel.facets.object.grid.GridFacet;
import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
import org.apache.isis.core.runtime.system.DeploymentType;
import org.apache.isis.core.runtime.system.context.IsisContext;
@@ -136,17 +136,17 @@ public class EntityPage extends PageAbstract {
//
// invalidate the cache so that can do dynamic reloading of layout metadata etc.
//
- final PageFacet facet = entityModel.getTypeOfSpecification()
- .getFacet(PageFacet.class);
+ final GridFacet facet = entityModel.getTypeOfSpecification()
+ .getFacet(GridFacet.class);
if(facet != null) {
// the facet should always exist, in fact
// just enough to ask for the metadata.
// This will cause the current ObjectSpec to be updated as a side effect.
- final Page page = facet.getPage();
+ final Grid grid = facet.getGrid();
// if none, then fallback to invalidating entire cache
// (this is the original LayoutMetadataFromJson behaviour)
- if(page == null && !getDeploymentType().isProduction()) {
+ if(grid == null && !getDeploymentType().isProduction()) {
getSpecificationLoader().invalidateCacheFor(objectAdapter.getObject());
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-FC.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-FC.xml b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-FC.xml
index 91a1fd1..f92597a 100644
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-FC.xml
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-FC.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<page xsi:schemaLocation="http://isis.apache.org/schema/applib/layout/common http://isis.apache.org/schema/applib/layout/common/common.xsd http://isis.apache.org/schema/applib/layout/fixedcols http://isis.apache.org/schema/applib/layout/fixedcols/fixedcols.xsd" xmlns="http://isis.apache.org/schema/applib/layout/fixedcols" xmlns:c="http://isis.apache.org/schema/applib/layout/common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<grid xsi:schemaLocation="http://isis.apache.org/schema/applib/layout/common http://isis.apache.org/schema/applib/layout/common/common.xsd http://isis.apache.org/schema/applib/layout/fixedcols http://isis.apache.org/schema/applib/layout/fixedcols/fixedcols.xsd" xmlns="http://isis.apache.org/schema/applib/layout/fixedcols" xmlns:c="http://isis.apache.org/schema/applib/layout/common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<left span="0">
@@ -38,4 +38,4 @@
</right>
</tab>
</tabGroup>
-</page>
\ No newline at end of file
+</grid>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
index c241c08..b1b3ed9 100644
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<bs3:page xsi:schemaLocation="http://isis.apache.org/schema/applib/layout/common http://isis.apache.org/schema/applib/layout/common/common.xsd http://isis.apache.org/schema/applib/layout/bootstrap3 http://isis.apache.org/schema/applib/layout/bootstrap3/bootstrap3.xsd" xmlns:c="http://isis.apache.org/schema/applib/layout/common" xmlns:bs3="http://isis.apache.org/schema/applib/layout/bootstrap3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<bs3:grid xsi:schemaLocation="http://isis.apache.org/schema/applib/layout/common http://isis.apache.org/schema/applib/layout/common/common.xsd http://isis.apache.org/schema/applib/layout/bootstrap3 http://isis.apache.org/schema/applib/layout/bootstrap3/bootstrap3.xsd" xmlns:c="http://isis.apache.org/schema/applib/layout/common" xmlns:bs3="http://isis.apache.org/schema/applib/layout/bootstrap3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<bs3:row cssClass="bishbosh">
<bs3:col span="8">
@@ -17,11 +17,9 @@
<bs3:row>
<bs3:col span="12">
<c:fieldSet name="Metadata">
- <c:action id="downloadJdMetadata">
- </c:action>
+ <c:action id="downloadJdMetadata"/>
<c:action id="downloadLayoutXml" position="PANEL_DROPDOWN"/>
- <c:property id="versionSequence">
- </c:property>
+ <c:property id="versionSequence"/>
</c:fieldSet>
</bs3:col>
<bs3:col span="6">
@@ -63,4 +61,4 @@
</bs3:tabGroup>
</bs3:col>
</bs3:row>
-</bs3:page>
+</bs3:grid>
[11/15] isis git commit: ISIS-993: renamed Page to Grid,
PageFacet to GridFacet, PageService to GridService,
PageNormalizerService to GridNormalizerService, BS3PagePanel to BS3GridPanel,
FCPagePanel to FCGridPanel,
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerFC.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerFC.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerFC.java
deleted file mode 100644
index c86b2d9..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerFC.java
+++ /dev/null
@@ -1,399 +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.services.layout.provider;
-
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicReference;
-
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-import org.apache.isis.applib.layout.fixedcols.FCColumn;
-import org.apache.isis.applib.layout.fixedcols.FCColumnOwner;
-import org.apache.isis.applib.layout.fixedcols.FCPage;
-import org.apache.isis.applib.layout.fixedcols.FCTab;
-import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
-import org.apache.isis.applib.layout.common.MemberRegionOwner;
-import org.apache.isis.applib.layout.common.ActionLayoutData;
-import org.apache.isis.applib.layout.common.ActionLayoutDataOwner;
-import org.apache.isis.applib.layout.common.CollectionLayoutData;
-import org.apache.isis.applib.layout.common.FieldSet;
-import org.apache.isis.applib.layout.common.PropertyLayoutData;
-import org.apache.isis.applib.services.i18n.TranslationService;
-import org.apache.isis.core.metamodel.facetapi.FacetUtil;
-import org.apache.isis.core.metamodel.facets.actions.layout.ActionPositionFacetForActionXml;
-import org.apache.isis.core.metamodel.facets.actions.layout.BookmarkPolicyFacetForActionXml;
-import org.apache.isis.core.metamodel.facets.actions.layout.CssClassFaFacetForActionXml;
-import org.apache.isis.core.metamodel.facets.actions.layout.CssClassFacetForActionXml;
-import org.apache.isis.core.metamodel.facets.actions.layout.DescribedAsFacetForActionXml;
-import org.apache.isis.core.metamodel.facets.actions.layout.HiddenFacetForActionLayoutXml;
-import org.apache.isis.core.metamodel.facets.actions.layout.NamedFacetForActionXml;
-import org.apache.isis.core.metamodel.facets.collections.layout.CssClassFacetForCollectionXml;
-import org.apache.isis.core.metamodel.facets.collections.layout.DefaultViewFacetForCollectionXml;
-import org.apache.isis.core.metamodel.facets.collections.layout.DescribedAsFacetForCollectionXml;
-import org.apache.isis.core.metamodel.facets.collections.layout.HiddenFacetForCollectionXml;
-import org.apache.isis.core.metamodel.facets.collections.layout.NamedFacetForCollectionXml;
-import org.apache.isis.core.metamodel.facets.collections.layout.PagedFacetForCollectionXml;
-import org.apache.isis.core.metamodel.facets.collections.layout.SortedByFacetForCollectionXml;
-import org.apache.isis.core.metamodel.facets.members.order.annotprop.MemberOrderFacetXml;
-import org.apache.isis.core.metamodel.facets.object.membergroups.MemberGroupLayoutFacet;
-import org.apache.isis.core.metamodel.facets.properties.propertylayout.CssClassFacetForPropertyXml;
-import org.apache.isis.core.metamodel.facets.properties.propertylayout.DescribedAsFacetForPropertyXml;
-import org.apache.isis.core.metamodel.facets.properties.propertylayout.HiddenFacetForPropertyXml;
-import org.apache.isis.core.metamodel.facets.properties.propertylayout.LabelAtFacetForPropertyXml;
-import org.apache.isis.core.metamodel.facets.properties.propertylayout.MultiLineFacetForPropertyXml;
-import org.apache.isis.core.metamodel.facets.properties.propertylayout.NamedFacetForPropertyXml;
-import org.apache.isis.core.metamodel.facets.properties.propertylayout.RenderedAdjustedFacetForPropertyXml;
-import org.apache.isis.core.metamodel.facets.properties.propertylayout.TypicalLengthFacetForPropertyXml;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.SpecificationLoader;
-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.metamodel.spec.feature.ObjectMember;
-import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-
-public class PageNormalizerFC extends PageNormalizerAbstract<FCPage> {
-
- public static final String TNS = "http://isis.apache.org/schema/applib/layout/fixedcols";
- public static final String SCHEMA_LOCATION = "http://isis.apache.org/schema/applib/layout/fixedcols/fixedcols.xsd";
-
-
- public PageNormalizerFC(
- final TranslationService translationService,
- final SpecificationLoader specificationLookup) {
- super(translationService, specificationLookup);
- }
-
- @Override
- public void normalize(final FCPage page, final Class<?> domainClass) {
-
- final ObjectSpecification objectSpec = specificationLookup.loadSpecification(domainClass);
-
- final Map<String, OneToOneAssociation> oneToOneAssociationById =
- ObjectMember.Util.mapById(getOneToOneAssociations(objectSpec));
- final Map<String, OneToManyAssociation> oneToManyAssociationById =
- ObjectMember.Util.mapById(getOneToManyAssociations(objectSpec));
- final Map<String, ObjectAction> objectActionById =
- ObjectMember.Util.mapById(objectSpec.getObjectActions(Contributed.INCLUDED));
-
- derive(page, oneToOneAssociationById, oneToManyAssociationById, objectActionById);
- overwrite(page, oneToOneAssociationById, oneToManyAssociationById, objectActionById);
- }
-
- /**
- * Ensures that all object members (properties, collections and actions) are in the metadata.
- *
- * <p>
- * If they are missing then they will be added to default tabs (created on the fly if need be).
- * </p>
- */
- private static void derive(
- final FCPage metadata,
- final Map<String, OneToOneAssociation> oneToOneAssociationById,
- final Map<String, OneToManyAssociation> oneToManyAssociationById,
- final Map<String, ObjectAction> objectActionById) {
-
- final LinkedHashMap<String, PropertyLayoutData> propertyIds = metadata.getAllPropertiesById();
- final LinkedHashMap<String, CollectionLayoutData> collectionIds = metadata.getAllCollectionsById();
- final LinkedHashMap<String, ActionLayoutData> actionIds = metadata.getAllActionsById();
-
- final AtomicReference<FieldSet> defaultPropertyGroupRef = new AtomicReference<>();
- final AtomicReference<FCColumn> firstColumnRef = new AtomicReference<>();
- final AtomicReference<FCTabGroup> lastTabGroupRef = new AtomicReference<>();
-
- // capture the first column, and also
- // capture the first property group (if any) with the default name ('General')
- metadata.visit(new FCPage.VisitorAdapter() {
- @Override
- public void visit(final FCColumn fcColumn) {
- firstColumnRef.compareAndSet(null, fcColumn);
- }
- @Override
- public void visit(final FieldSet fieldSet) {
- if(MemberGroupLayoutFacet.DEFAULT_GROUP.equals(fieldSet.getName())) {
- defaultPropertyGroupRef.compareAndSet(null, fieldSet);
- }
- }
- @Override
- public void visit(final FCTabGroup fcTabGroup) {
- lastTabGroupRef.set(fcTabGroup);
- }
- });
-
- // any missing properties will be added to the (first) 'General' property group found
- // if there is no default ('General') property group
- // then one will be added to the first Column of the first Tab.
- final Tuple<List<String>> propertyIdTuple = surplusAndMissing(propertyIds.keySet(), oneToOneAssociationById.keySet());
- final List<String> surplusPropertyIds = propertyIdTuple.first;
- final List<String> missingPropertyIds = propertyIdTuple.second;
-
- for (String surplusPropertyId : surplusPropertyIds) {
- propertyIds.get(surplusPropertyId).setMetadataError("No such property");
- }
-
- if(!missingPropertyIds.isEmpty()) {
- // ensure that there is a property group to use
- boolean wasSet = defaultPropertyGroupRef.compareAndSet(null, new FieldSet(MemberGroupLayoutFacet.DEFAULT_GROUP));
- final FieldSet defaultFieldSet = defaultPropertyGroupRef.get();
- if(wasSet) {
- firstColumnRef.get().getFieldSets().add(defaultFieldSet);
- }
- for (final String propertyId : missingPropertyIds) {
- defaultFieldSet.getProperties().add(new PropertyLayoutData(propertyId));
- }
- }
-
-
- // any missing collections will be added as tabs to the last TabGroup.
- // If there is only a single tab group then a new TabGroup will be added first
- final Tuple<List<String>> collectionIdTuple = surplusAndMissing(collectionIds.keySet(), oneToManyAssociationById.keySet());
- final List<String> surplusCollectionIds = collectionIdTuple.first;
- final List<String> missingCollectionIds = collectionIdTuple.second;
-
- for (String surplusCollectionId : surplusCollectionIds) {
- collectionIds.get(surplusCollectionId).setMetadataError("No such collection");
- }
-
- if(!missingCollectionIds.isEmpty()) {
- while(metadata.getTabGroups().size() < 2) {
- final FCTabGroup tabGroup = new FCTabGroup();
- metadata.getTabGroups().add(tabGroup);
- lastTabGroupRef.set(tabGroup);
- }
- final FCTabGroup lastTabGroup = lastTabGroupRef.get();
- for (final String collectionId : missingCollectionIds) {
- final FCTab FCTab = new FCTab();
- lastTabGroup.getTabs().add(FCTab);
- FCColumn left = new FCColumn(12);
- FCTab.setLeft(left);
- final CollectionLayoutData layoutMetadata = new CollectionLayoutData(collectionId);
- layoutMetadata.setDefaultView("table");
- left.getCollections().add(layoutMetadata);
- }
- }
-
- // any missing actions will be added as domain object actions (in the header)
- final Tuple<List<String>> actionIdTuple = surplusAndMissing(actionIds.keySet(), objectActionById.keySet());
- final List<String> surplusActionIds = actionIdTuple.first;
- final List<String> missingActionIds = actionIdTuple.second;
-
- for (String surplusActionId : surplusActionIds) {
- actionIds.get(surplusActionId).setMetadataError("No such action");
- }
-
- if(!missingActionIds.isEmpty()) {
- for (String actionId : missingActionIds) {
- List<ActionLayoutData> actions = metadata.getActions();
- if(actions == null) {
- actions = Lists.newArrayList();
- metadata.setActions(actions);
- }
- actions.add(new ActionLayoutData(actionId));
- }
- }
- }
-
- static class Tuple<T> {
- final T first;
- final T second;
- private Tuple(final T first, final T second) {
- this.first = first;
- this.second = second;
- }
- public static <T> Tuple<T> of(final T first, final T second) {
- return new Tuple<>(first, second);
- }
- }
- /**
- * Returns a 2-element tuple of [first-second, second-first]
- */
- static <T> Tuple<List<T>> surplusAndMissing(final Collection<T> first, final Collection<T> second){
- final List<T> firstNotSecond = Lists.newArrayList(first);
- firstNotSecond.removeAll(second);
- final List<T> secondNotFirst = Lists.newArrayList(second);
- secondNotFirst.removeAll(first);
- return Tuple.of(firstNotSecond, secondNotFirst);
- }
-
- private void overwrite(
- final FCPage page,
- final Map<String, OneToOneAssociation> oneToOneAssociationById,
- final Map<String, OneToManyAssociation> oneToManyAssociationById,
- final Map<String, ObjectAction> objectActionById) {
-
- final Map<String, int[]> propertySequenceByGroup = Maps.newHashMap();
-
- page.visit(new FCPage.VisitorAdapter() {
- private int collectionSequence = 1;
- private int actionDomainObjectSequence = 1;
- private int actionPropertyGroupSequence = 1;
- private int actionPropertySequence = 1;
- private int actionCollectionSequence = 1;
-
- @Override
- public void visit(final ActionLayoutData actionLayoutData) {
- final ActionLayoutDataOwner actionLayoutDataOwner = actionLayoutData.getOwner();
- final ObjectAction objectAction = objectActionById.get(actionLayoutData.getId());
- if(objectAction == null) {
- return;
- }
-
- final String memberOrderName;
- final int memberOrderSequence;
- if(actionLayoutDataOwner instanceof FieldSet) {
- final FieldSet fieldSet = (FieldSet) actionLayoutDataOwner;
- final List<PropertyLayoutData> properties = fieldSet.getProperties();
- final PropertyLayoutData propertyLayoutData = properties.get(0); // any will do
- memberOrderName = propertyLayoutData.getId();
- memberOrderSequence = actionPropertyGroupSequence++;
- } else if(actionLayoutDataOwner instanceof PropertyLayoutData) {
- final PropertyLayoutData propertyLayoutData = (PropertyLayoutData) actionLayoutDataOwner;
- memberOrderName = propertyLayoutData.getId();
- memberOrderSequence = actionPropertySequence++;
- } else if(actionLayoutDataOwner instanceof CollectionLayoutData) {
- final CollectionLayoutData collectionLayoutData = (CollectionLayoutData) actionLayoutDataOwner;
- memberOrderName = collectionLayoutData.getId();
- memberOrderSequence = actionCollectionSequence++;
- } else {
- // DomainObject
- memberOrderName = null;
- memberOrderSequence = actionDomainObjectSequence++;
- }
- FacetUtil.addFacet(
- new MemberOrderFacetXml(memberOrderName, ""+memberOrderSequence, translationService, objectAction));
-
-
- if(actionLayoutDataOwner instanceof FieldSet) {
- if(actionLayoutData.getPosition() == null ||
- actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.BELOW ||
- actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.RIGHT) {
- actionLayoutData.setPosition(org.apache.isis.applib.annotation.ActionLayout.Position.PANEL);
- }
- } else if(actionLayoutDataOwner instanceof PropertyLayoutData) {
- if(actionLayoutData.getPosition() == null ||
- actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.PANEL_DROPDOWN ||
- actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.PANEL) {
- actionLayoutData.setPosition(org.apache.isis.applib.annotation.ActionLayout.Position.BELOW);
- }
- } else {
- // doesn't do anything for DomainObject or Collection
- actionLayoutData.setPosition(null);
- }
-
- FacetUtil.addFacet(ActionPositionFacetForActionXml.create(actionLayoutData, objectAction));
- FacetUtil.addFacet(BookmarkPolicyFacetForActionXml.create(actionLayoutData, objectAction));
- FacetUtil.addFacet(CssClassFacetForActionXml.create(actionLayoutData, objectAction));
- FacetUtil.addFacet(CssClassFaFacetForActionXml.create(actionLayoutData, objectAction));
- FacetUtil.addFacet(DescribedAsFacetForActionXml.create(actionLayoutData, objectAction));
- FacetUtil.addFacet(HiddenFacetForActionLayoutXml.create(actionLayoutData, objectAction));
- FacetUtil.addFacet(NamedFacetForActionXml.create(actionLayoutData, objectAction));
- }
-
- @Override
- public void visit(final PropertyLayoutData propertyLayoutData) {
- final OneToOneAssociation oneToOneAssociation = oneToOneAssociationById.get(propertyLayoutData.getId());
- if(oneToOneAssociation == null) {
- return;
- }
-
- FacetUtil.addFacet(CssClassFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
- FacetUtil.addFacet(DescribedAsFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
- FacetUtil.addFacet(HiddenFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
- FacetUtil.addFacet(LabelAtFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
- FacetUtil.addFacet(MultiLineFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
- FacetUtil.addFacet(NamedFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
- FacetUtil.addFacet(
- RenderedAdjustedFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
- FacetUtil.addFacet(TypicalLengthFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
-
- // @MemberOrder#name based on owning property group, @MemberOrder#sequence monotonically increasing
- final FieldSet fieldSet = propertyLayoutData.getOwner();
- final String groupName = fieldSet.getName();
- final String sequence = nextInSequenceFor(groupName, propertySequenceByGroup);
- FacetUtil.addFacet(
- new MemberOrderFacetXml(groupName, sequence, translationService, oneToOneAssociation));
- }
-
- @Override
- public void visit(final CollectionLayoutData collectionLayoutData) {
- final OneToManyAssociation oneToManyAssociation = oneToManyAssociationById.get(collectionLayoutData.getId());
- if(oneToManyAssociation == null) {
- return;
- }
-
- FacetUtil.addFacet(CssClassFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
- FacetUtil.addFacet(
- DefaultViewFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
- FacetUtil.addFacet(
- DescribedAsFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
- FacetUtil.addFacet(HiddenFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
- FacetUtil.addFacet(NamedFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
- FacetUtil.addFacet(PagedFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
- FacetUtil.addFacet(SortedByFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
-
- // @MemberOrder#name based on the collection's id (so that each has a single "member group")
- final String groupName = collectionLayoutData.getId();
- final String sequence = "" + collectionSequence++;
- FacetUtil.addFacet(
- new MemberOrderFacetXml(groupName, sequence, translationService, oneToManyAssociation));
-
- // if there is only a single column and no other contents, then copy the collection Id onto the tab'
- final MemberRegionOwner memberRegionOwner = collectionLayoutData.getOwner();
- if(memberRegionOwner instanceof FCColumn) {
- final FCColumn FCColumn = (FCColumn) memberRegionOwner;
- final FCColumnOwner holder = FCColumn.getOwner();
- if(holder instanceof FCTab) {
- final FCTab FCTab = (FCTab) holder;
- if(FCTab.getContents().size() == 1 && Strings.isNullOrEmpty(FCTab.getName()) ) {
- final String collectionName = oneToManyAssociation.getName();
- FCTab.setName(collectionName);
- }
- }
- }
- }
- });
- }
-
- private String nextInSequenceFor(
- final String key, final Map<String, int[]> seqByKey) {
- synchronized (seqByKey) {
- int[] holder = seqByKey.get(key);
- if(holder == null) {
- holder = new int[]{0};
- seqByKey.put(key, holder);
- }
- holder[0]++;
- return ""+holder[0];
- }
- }
-
- private static List<OneToOneAssociation> getOneToOneAssociations(final ObjectSpecification objectSpec) {
- List associations = objectSpec.getAssociations(Contributed.INCLUDED, ObjectAssociation.Filters.PROPERTIES);
- return associations;
- }
- private static List<OneToManyAssociation> getOneToManyAssociations(final ObjectSpecification objectSpec) {
- List associations = objectSpec.getAssociations(Contributed.INCLUDED, ObjectAssociation.Filters.COLLECTIONS);
- return associations;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerService.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerService.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerService.java
deleted file mode 100644
index c0939f8..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerService.java
+++ /dev/null
@@ -1,37 +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.services.layout.provider;
-
-import java.util.List;
-
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.layout.common.Page;
-import org.apache.isis.core.metamodel.services.layout.PageServiceDefault;
-
-/**
- * Internal SPI used by {@link PageServiceDefault}.
- */
-public interface PageNormalizerService {
-
- @Programmatic
- List<Class<? extends Page>> pageImplementations();
-
- @Programmatic
- void normalize(Page page, Class<?> domainClass);
-
- String schemaLocationsFor(final Page fcPage);
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerServiceDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerServiceDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerServiceDefault.java
deleted file mode 100644
index 918faa2..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerServiceDefault.java
+++ /dev/null
@@ -1,110 +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.services.layout.provider;
-
-import java.util.List;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.Lists;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.NatureOfService;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.layout.bootstrap3.BS3Page;
-import org.apache.isis.applib.layout.fixedcols.FCPage;
-import org.apache.isis.applib.layout.common.Page;
-import org.apache.isis.applib.services.i18n.TranslationService;
-import org.apache.isis.core.metamodel.spec.SpecificationLoader;
-import org.apache.isis.core.metamodel.spec.SpecificationLoaderAware;
-
-@DomainService(
- nature = NatureOfService.DOMAIN
-)
-public class PageNormalizerServiceDefault implements PageNormalizerService, SpecificationLoaderAware {
-
- private static final Logger LOG = LoggerFactory.getLogger(PageNormalizerServiceDefault.class);
-
- public static final String COMMON_TNS = "http://isis.apache.org/schema/applib/layout/common";
- public static final String COMMON_SCHEMA_LOCATION = "http://isis.apache.org/schema/applib/layout/common/common.xsd";
-
- private SpecificationLoader specificationLookup;
-
- private PageNormalizerFC pageNormalizerFC;
- private PageNormalizerBS3 pageNormalizerBS3;
-
- @PostConstruct
- @Programmatic
- public void init() {
- pageNormalizerFC = new PageNormalizerFC(translationService, specificationLookup);
- pageNormalizerBS3 = new PageNormalizerBS3(translationService, specificationLookup);
- }
-
- @Programmatic
- @Override
- public List<Class<? extends Page>> pageImplementations() {
- List<Class<? extends Page>> ar = Lists.newArrayList();
- ar.add(FCPage.class);
- ar.add(BS3Page.class);
- return ar;
- }
-
- @Override
- public void normalize(final Page page, final Class<?> domainClass) {
-
- if(page instanceof FCPage) {
- final FCPage fcPage = (FCPage) page;
- pageNormalizerFC.normalize(fcPage, domainClass);
- } else
- if(page instanceof BS3Page) {
- final BS3Page bs3Page = (BS3Page) page;
- pageNormalizerBS3.normalize(bs3Page, domainClass);
- }
-
- page.setNormalized(true);
- }
-
- @Override
- public String schemaLocationsFor(final Page page) {
- final List<String> parts = Lists.newArrayList();
- parts.add(COMMON_TNS);
- parts.add(COMMON_SCHEMA_LOCATION);
- if(page instanceof FCPage) {
- parts.add(PageNormalizerFC.TNS);
- parts.add(PageNormalizerFC.SCHEMA_LOCATION);
- }
- if(page instanceof BS3Page) {
- parts.add(PageNormalizerBS3.TNS);
- parts.add(PageNormalizerBS3.SCHEMA_LOCATION);
- }
- return Joiner.on(" ").join(parts);
- }
-
- @Override
- public void setSpecificationLoader(final SpecificationLoader specificationLookup) {
- this.specificationLookup = specificationLookup;
- }
-
- @Inject
- TranslationService translationService;
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/metamodel/MetadataMenu.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/metamodel/MetadataMenu.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/metamodel/MetadataMenu.java
index 519867b..c017adf 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/metamodel/MetadataMenu.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/metamodel/MetadataMenu.java
@@ -42,9 +42,9 @@ import org.apache.isis.applib.annotation.NatureOfService;
import org.apache.isis.applib.annotation.Programmatic;
import org.apache.isis.applib.annotation.RestrictTo;
import org.apache.isis.applib.annotation.SemanticsOf;
-import org.apache.isis.applib.layout.common.Page;
+import org.apache.isis.applib.layout.common.Grid;
import org.apache.isis.applib.services.jaxb.JaxbService;
-import org.apache.isis.applib.services.layout.PageService;
+import org.apache.isis.applib.services.layout.GridService;
import org.apache.isis.applib.value.Blob;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
@@ -108,10 +108,10 @@ public class MetadataMenu implements SpecificationLoaderSpiAware {
final OutputStreamWriter writer = new OutputStreamWriter(zos);
for (final ObjectSpecification objectSpec : domainObjectSpecs) {
final Class<?> domainClass = objectSpec.getCorrespondingClass();
- final Page page = pageService.toPage(domainClass);
- if(page != null) {
+ final Grid grid = gridService.toGrid(domainClass);
+ if(grid != null) {
zos.putNextEntry(new ZipEntry(zipEntryNameFor(objectSpec)));
- String xml = jaxbService.toXml(page);
+ String xml = jaxbService.toXml(grid);
writer.write(xml);
writer.flush();
zos.closeEntry();
@@ -134,7 +134,7 @@ public class MetadataMenu implements SpecificationLoaderSpiAware {
// //////////////////////////////////////
@Inject
- PageService pageService;
+ GridService gridService;
@Inject
JaxbService jaxbService;
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java b/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
index 02b20b9..e730939 100644
--- a/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
+++ b/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
@@ -108,7 +108,7 @@ import org.apache.isis.core.metamodel.facets.object.ignore.jdo.RemoveJdoEnhancem
import org.apache.isis.core.metamodel.facets.object.ignore.jdo.RemoveJdoPrefixedMethodsFacetFactory;
import org.apache.isis.core.metamodel.facets.object.immutable.immutableannot.CopyImmutableFacetOntoMembersFactory;
import org.apache.isis.core.metamodel.facets.object.immutable.immutablemarkerifc.ImmutableFacetMarkerInterfaceFactory;
-import org.apache.isis.core.metamodel.facets.object.layoutmetadata.PageFacetFactory;
+import org.apache.isis.core.metamodel.facets.object.grid.GridFacetFactory;
import org.apache.isis.core.metamodel.facets.object.mask.annotation.MaskFacetOnTypeAnnotationFactory;
import org.apache.isis.core.metamodel.facets.object.maxlen.annotation.MaxLengthFacetOnTypeAnnotationFactory;
import org.apache.isis.core.metamodel.facets.object.membergroups.annotprop.MemberGroupLayoutFacetFactory;
@@ -391,7 +391,7 @@ public final class ProgrammingModelFacetsJava5 extends ProgrammingModelAbstract
// must come after DomainObjectAnnotationFacetFactory & MixinFacetFactory
addFactory(NotContributedFacetDerivedFromMixinFacetFactory.class);
- addFactory(PageFacetFactory.class);
+ addFactory(GridFacetFactory.class);
addFactory(DomainServiceLayoutFacetFactory.class);
addFactory(DomainObjectLayoutFacetFactory.class);
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/layoutxml/GridFacetDefaultTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/layoutxml/GridFacetDefaultTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/layoutxml/GridFacetDefaultTest.java
new file mode 100644
index 0000000..aa8b224
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/layoutxml/GridFacetDefaultTest.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.core.metamodel.facets.object.layoutxml;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.junit.Test;
+
+import org.apache.isis.applib.layout.common.FieldSet;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+public class GridFacetDefaultTest {
+
+ @Test
+ public void xxx() throws Exception {
+
+ final AtomicReference<FieldSet> x = new AtomicReference<>();
+
+ FieldSet firstValue = new FieldSet();
+ FieldSet otherValue = new FieldSet();
+
+ assertThat(x.get(), is(nullValue()));
+
+ boolean b = x.compareAndSet(null, firstValue);
+ assertThat(b, is(true));
+ assertThat(x.get(), is(firstValue));
+
+ boolean b2 = x.compareAndSet(null, firstValue);
+ assertThat(b2, is(false));
+ assertThat(x.get(), is(firstValue));
+
+ boolean b3 = x.compareAndSet(null, otherValue);
+ assertThat(b3, is(false));
+ assertThat(x.get(), is(firstValue));
+
+ boolean b4 = x.compareAndSet(firstValue, otherValue);
+ assertThat(b4, is(true));
+ assertThat(x.get(), is(otherValue));
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/layoutxml/PageFacetDefaultTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/layoutxml/PageFacetDefaultTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/layoutxml/PageFacetDefaultTest.java
deleted file mode 100644
index 2ca8356..0000000
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/layoutxml/PageFacetDefaultTest.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.core.metamodel.facets.object.layoutxml;
-
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.junit.Test;
-
-import org.apache.isis.applib.layout.common.FieldSet;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-public class PageFacetDefaultTest {
-
- @Test
- public void xxx() throws Exception {
-
- final AtomicReference<FieldSet> x = new AtomicReference<>();
-
- FieldSet firstValue = new FieldSet();
- FieldSet otherValue = new FieldSet();
-
- assertThat(x.get(), is(nullValue()));
-
- boolean b = x.compareAndSet(null, firstValue);
- assertThat(b, is(true));
- assertThat(x.get(), is(firstValue));
-
- boolean b2 = x.compareAndSet(null, firstValue);
- assertThat(b2, is(false));
- assertThat(x.get(), is(firstValue));
-
- boolean b3 = x.compareAndSet(null, otherValue);
- assertThat(b3, is(false));
- assertThat(x.get(), is(firstValue));
-
- boolean b4 = x.compareAndSet(firstValue, otherValue);
- assertThat(b4, is(true));
- assertThat(x.get(), is(otherValue));
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/bootstrap3/BS3GridTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/bootstrap3/BS3GridTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/bootstrap3/BS3GridTest.java
new file mode 100644
index 0000000..e649ec0
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/bootstrap3/BS3GridTest.java
@@ -0,0 +1,149 @@
+/*
+ * 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.layout.bootstrap3;
+
+import java.util.Map;
+
+import javax.xml.bind.Marshaller;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.isis.applib.layout.bootstrap3.BS3Col;
+import org.apache.isis.applib.layout.bootstrap3.BS3Grid;
+import org.apache.isis.applib.layout.bootstrap3.BS3Row;
+import org.apache.isis.applib.layout.bootstrap3.BS3Tab;
+import org.apache.isis.applib.layout.bootstrap3.BS3TabGroup;
+import org.apache.isis.applib.layout.common.ActionLayoutData;
+import org.apache.isis.applib.layout.common.CollectionLayoutData;
+import org.apache.isis.applib.layout.common.DomainObjectLayoutData;
+import org.apache.isis.applib.layout.common.FieldSet;
+import org.apache.isis.applib.layout.common.PropertyLayoutData;
+import org.apache.isis.applib.services.jaxb.JaxbService;
+import org.apache.isis.core.metamodel.services.grid.normalizer.GridNormalizerServiceDefault;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class BS3GridTest {
+
+ private JaxbService jaxbService;
+
+ @Before
+ public void setUp() throws Exception {
+ jaxbService = new JaxbService.Simple();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void xxx() throws Exception {
+
+ final BS3Grid bs3Page = new BS3Grid();
+
+ // header
+ final BS3Row headerRow = bs3Page.getRows().get(0);
+ final BS3Col headerCol = (BS3Col) headerRow.getCols().get(0);
+ headerCol.setSpan(12);
+
+ final DomainObjectLayoutData objectLayoutData = new DomainObjectLayoutData();
+ headerCol.setDomainObject(objectLayoutData);
+
+ final ActionLayoutData deleteActionLayoutData = new ActionLayoutData();
+ deleteActionLayoutData.setId("delete");
+ headerCol.setActions(Lists.<ActionLayoutData>newArrayList());
+ headerCol.getActions().add(deleteActionLayoutData);
+
+ // content
+ final BS3Row contentRow = new BS3Row();
+ bs3Page.getRows().add(contentRow);
+
+ final BS3Col contentCol = (BS3Col) contentRow.getCols().get(0);
+ contentCol.setSpan(12);
+
+ // a tabgroup containing a 'Common' tab
+ final BS3TabGroup tabGroup = new BS3TabGroup();
+ contentCol.getTabGroups().add(tabGroup);
+ BS3Tab bs3Tab = tabGroup.getTabs().get(0);
+ bs3Tab.setName("Common");
+
+ // with a left col...
+ final BS3Row tabRow = bs3Tab.getRows().get(0);
+ final BS3Col tabLeftCol = (BS3Col) tabRow.getCols().get(0);
+ tabLeftCol.setSpan(6);
+
+ // containing a fieldset
+ final FieldSet leftPropGroup = new FieldSet("General");
+ tabLeftCol.setFieldSets(Lists.<FieldSet>newArrayList());
+ tabLeftCol.getFieldSets().add(leftPropGroup);
+ leftPropGroup.setName("General");
+
+ // with a single property
+ final PropertyLayoutData namePropertyLayoutData = leftPropGroup.getProperties().get(0);
+ namePropertyLayoutData.setNamed("name");
+
+ // and its associated action
+ final ActionLayoutData updateNameActionLayoutData = new ActionLayoutData();
+ updateNameActionLayoutData.setId("updateName");
+ namePropertyLayoutData.setActions(Lists.<ActionLayoutData>newArrayList());
+ namePropertyLayoutData.getActions().add(updateNameActionLayoutData);
+
+ // and the tab also has a right col...
+ final BS3Col tabRightCol = (BS3Col) tabRow.getCols().get(0);
+ tabRightCol.setSpan(6);
+
+ // containing a collection
+ final CollectionLayoutData similarToColl = new CollectionLayoutData();
+ tabRightCol.setCollections(Lists.<CollectionLayoutData>newArrayList());
+ tabRightCol.getCollections().add(similarToColl);
+ similarToColl.setId("similarTo");
+
+
+ final String schemaLocations = new GridNormalizerServiceDefault().schemaLocationsFor(bs3Page);
+ String xml = jaxbService.toXml(bs3Page,
+ ImmutableMap.<String,Object>of(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocations));
+ System.out.println(xml);
+
+ BS3Grid bs3Pageroundtripped = jaxbService.fromXml(BS3Grid.class, xml);
+ String xmlRoundtripped = jaxbService.toXml(bs3Pageroundtripped,
+ ImmutableMap.<String,Object>of(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocations));
+ assertThat(xml, is(equalTo(xmlRoundtripped)));
+
+
+ System.out.println("==========");
+
+ dumpXsd(bs3Page);
+ }
+
+ protected void dumpXsd(final BS3Grid bs3Page) {
+ Map<String, String> schemas = jaxbService.toXsd(bs3Page, JaxbService.IsisSchemas.INCLUDE);
+ for (Map.Entry<String, String> entry : schemas.entrySet()) {
+ System.out.println(entry.getKey() + ":");
+ System.out.println(entry.getValue());
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/bootstrap3/BS3PageTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/bootstrap3/BS3PageTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/bootstrap3/BS3PageTest.java
deleted file mode 100644
index c5a81d6..0000000
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/bootstrap3/BS3PageTest.java
+++ /dev/null
@@ -1,149 +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.layout.bootstrap3;
-
-import java.util.Map;
-
-import javax.xml.bind.Marshaller;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.isis.applib.layout.bootstrap3.BS3Col;
-import org.apache.isis.applib.layout.bootstrap3.BS3Page;
-import org.apache.isis.applib.layout.bootstrap3.BS3Row;
-import org.apache.isis.applib.layout.bootstrap3.BS3Tab;
-import org.apache.isis.applib.layout.bootstrap3.BS3TabGroup;
-import org.apache.isis.applib.layout.common.ActionLayoutData;
-import org.apache.isis.applib.layout.common.CollectionLayoutData;
-import org.apache.isis.applib.layout.common.DomainObjectLayoutData;
-import org.apache.isis.applib.layout.common.FieldSet;
-import org.apache.isis.applib.layout.common.PropertyLayoutData;
-import org.apache.isis.applib.services.jaxb.JaxbService;
-import org.apache.isis.core.metamodel.services.layout.provider.PageNormalizerServiceDefault;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-public class BS3PageTest {
-
- private JaxbService jaxbService;
-
- @Before
- public void setUp() throws Exception {
- jaxbService = new JaxbService.Simple();
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void xxx() throws Exception {
-
- final BS3Page bs3Page = new BS3Page();
-
- // header
- final BS3Row headerRow = bs3Page.getRows().get(0);
- final BS3Col headerCol = (BS3Col) headerRow.getCols().get(0);
- headerCol.setSpan(12);
-
- final DomainObjectLayoutData objectLayoutData = new DomainObjectLayoutData();
- headerCol.setDomainObject(objectLayoutData);
-
- final ActionLayoutData deleteActionLayoutData = new ActionLayoutData();
- deleteActionLayoutData.setId("delete");
- headerCol.setActions(Lists.<ActionLayoutData>newArrayList());
- headerCol.getActions().add(deleteActionLayoutData);
-
- // content
- final BS3Row contentRow = new BS3Row();
- bs3Page.getRows().add(contentRow);
-
- final BS3Col contentCol = (BS3Col) contentRow.getCols().get(0);
- contentCol.setSpan(12);
-
- // a tabgroup containing a 'Common' tab
- final BS3TabGroup tabGroup = new BS3TabGroup();
- contentCol.getTabGroups().add(tabGroup);
- BS3Tab bs3Tab = tabGroup.getTabs().get(0);
- bs3Tab.setName("Common");
-
- // with a left col...
- final BS3Row tabRow = bs3Tab.getRows().get(0);
- final BS3Col tabLeftCol = (BS3Col) tabRow.getCols().get(0);
- tabLeftCol.setSpan(6);
-
- // containing a fieldset
- final FieldSet leftPropGroup = new FieldSet("General");
- tabLeftCol.setFieldSets(Lists.<FieldSet>newArrayList());
- tabLeftCol.getFieldSets().add(leftPropGroup);
- leftPropGroup.setName("General");
-
- // with a single property
- final PropertyLayoutData namePropertyLayoutData = leftPropGroup.getProperties().get(0);
- namePropertyLayoutData.setNamed("name");
-
- // and its associated action
- final ActionLayoutData updateNameActionLayoutData = new ActionLayoutData();
- updateNameActionLayoutData.setId("updateName");
- namePropertyLayoutData.setActions(Lists.<ActionLayoutData>newArrayList());
- namePropertyLayoutData.getActions().add(updateNameActionLayoutData);
-
- // and the tab also has a right col...
- final BS3Col tabRightCol = (BS3Col) tabRow.getCols().get(0);
- tabRightCol.setSpan(6);
-
- // containing a collection
- final CollectionLayoutData similarToColl = new CollectionLayoutData();
- tabRightCol.setCollections(Lists.<CollectionLayoutData>newArrayList());
- tabRightCol.getCollections().add(similarToColl);
- similarToColl.setId("similarTo");
-
-
- final String schemaLocations = new PageNormalizerServiceDefault().schemaLocationsFor(bs3Page);
- String xml = jaxbService.toXml(bs3Page,
- ImmutableMap.<String,Object>of(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocations));
- System.out.println(xml);
-
- BS3Page bs3Pageroundtripped = jaxbService.fromXml(BS3Page.class, xml);
- String xmlRoundtripped = jaxbService.toXml(bs3Pageroundtripped,
- ImmutableMap.<String,Object>of(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocations));
- assertThat(xml, is(equalTo(xmlRoundtripped)));
-
-
- System.out.println("==========");
-
- dumpXsd(bs3Page);
- }
-
- protected void dumpXsd(final BS3Page bs3Page) {
- Map<String, String> schemas = jaxbService.toXsd(bs3Page, JaxbService.IsisSchemas.INCLUDE);
- for (Map.Entry<String, String> entry : schemas.entrySet()) {
- System.out.println(entry.getKey() + ":");
- System.out.println(entry.getValue());
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/fixedcols/FCGridTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/fixedcols/FCGridTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/fixedcols/FCGridTest.java
new file mode 100644
index 0000000..82f6dd3
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/fixedcols/FCGridTest.java
@@ -0,0 +1,120 @@
+/*
+ * 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.layout.fixedcols;
+
+import java.util.Map;
+
+import javax.xml.bind.Marshaller;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.isis.applib.layout.fixedcols.FCColumn;
+import org.apache.isis.applib.layout.fixedcols.FCGrid;
+import org.apache.isis.applib.layout.fixedcols.FCTab;
+import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
+import org.apache.isis.applib.layout.common.ActionLayoutData;
+import org.apache.isis.applib.layout.common.CollectionLayoutData;
+import org.apache.isis.applib.layout.common.FieldSet;
+import org.apache.isis.applib.layout.common.PropertyLayoutData;
+import org.apache.isis.applib.services.jaxb.JaxbService;
+import org.apache.isis.core.metamodel.services.grid.normalizer.GridNormalizerServiceDefault;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class FCGridTest {
+
+ private JaxbService jaxbService;
+
+ @Before
+ public void setUp() throws Exception {
+ jaxbService = new JaxbService.Simple();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ }
+
+ @Test
+ public void xxx() throws Exception {
+
+ final FCGrid fcPage = new FCGrid();
+
+ fcPage.setTabGroups(Lists.<FCTabGroup>newArrayList());
+ fcPage.getTabGroups().add(new FCTabGroup());
+ FCTabGroup tabGroup = fcPage.getTabGroups().get(0);
+ FCTab FCTab = tabGroup.getTabs().get(0);
+ FCTab.setName("Common");
+ FCColumn left = FCTab.getLeft();
+
+ FieldSet leftPropGroup = new FieldSet();
+ left.setFieldSets(Lists.<FieldSet>newArrayList());
+ left.getFieldSets().add(leftPropGroup);
+ leftPropGroup.setName("General");
+
+ CollectionLayoutData similarToColl = new CollectionLayoutData();
+ left.setCollections(Lists.<CollectionLayoutData>newArrayList());
+ left.getCollections().add(similarToColl);
+ similarToColl.setId("similarTo");
+
+ left.getFieldSets().add(new FieldSet("General"));
+ PropertyLayoutData namePropertyLayoutData = new PropertyLayoutData("name");
+ left.getFieldSets().get(0).getProperties().add(namePropertyLayoutData);
+
+ ActionLayoutData updateNameActionLayoutData = new ActionLayoutData();
+ updateNameActionLayoutData.setId("updateName");
+ namePropertyLayoutData.setActions(Lists.<ActionLayoutData>newArrayList());
+ namePropertyLayoutData.getActions().add(updateNameActionLayoutData);
+
+ ActionLayoutData deleteActionLayoutData = new ActionLayoutData();
+ deleteActionLayoutData.setId("delete");
+ fcPage.setActions(Lists.<ActionLayoutData>newArrayList());
+ fcPage.getActions().add(deleteActionLayoutData);
+
+ final String schemaLocations = new GridNormalizerServiceDefault().schemaLocationsFor(fcPage);
+ String xml = jaxbService.toXml(fcPage,
+ ImmutableMap.<String,Object>of(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocations));
+ System.out.println(xml);
+
+ FCGrid fcPageRoundtripped = jaxbService.fromXml(FCGrid.class, xml);
+ String xmlRoundtripped = jaxbService.toXml(fcPageRoundtripped,
+ ImmutableMap.<String,Object>of(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocations));
+ assertThat(xml, is(equalTo(xmlRoundtripped)));
+
+
+ System.out.println("==========");
+
+ dumpXsd(fcPage);
+ }
+
+ protected void dumpXsd(final FCGrid fcPage) {
+ Map<String, String> schemas = jaxbService.toXsd(fcPage, JaxbService.IsisSchemas.INCLUDE);
+ for (Map.Entry<String, String> entry : schemas.entrySet()) {
+ System.out.println(entry.getKey() + ":");
+ System.out.println(entry.getValue());
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/fixedcols/FCPageTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/fixedcols/FCPageTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/fixedcols/FCPageTest.java
deleted file mode 100644
index 9bce74b..0000000
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/fixedcols/FCPageTest.java
+++ /dev/null
@@ -1,120 +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.layout.fixedcols;
-
-import java.util.Map;
-
-import javax.xml.bind.Marshaller;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.isis.applib.layout.fixedcols.FCColumn;
-import org.apache.isis.applib.layout.fixedcols.FCPage;
-import org.apache.isis.applib.layout.fixedcols.FCTab;
-import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
-import org.apache.isis.applib.layout.common.ActionLayoutData;
-import org.apache.isis.applib.layout.common.CollectionLayoutData;
-import org.apache.isis.applib.layout.common.FieldSet;
-import org.apache.isis.applib.layout.common.PropertyLayoutData;
-import org.apache.isis.applib.services.jaxb.JaxbService;
-import org.apache.isis.core.metamodel.services.layout.provider.PageNormalizerServiceDefault;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-public class FCPageTest {
-
- private JaxbService jaxbService;
-
- @Before
- public void setUp() throws Exception {
- jaxbService = new JaxbService.Simple();
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void xxx() throws Exception {
-
- final FCPage fcPage = new FCPage();
-
- fcPage.setTabGroups(Lists.<FCTabGroup>newArrayList());
- fcPage.getTabGroups().add(new FCTabGroup());
- FCTabGroup tabGroup = fcPage.getTabGroups().get(0);
- FCTab FCTab = tabGroup.getTabs().get(0);
- FCTab.setName("Common");
- FCColumn left = FCTab.getLeft();
-
- FieldSet leftPropGroup = new FieldSet();
- left.setFieldSets(Lists.<FieldSet>newArrayList());
- left.getFieldSets().add(leftPropGroup);
- leftPropGroup.setName("General");
-
- CollectionLayoutData similarToColl = new CollectionLayoutData();
- left.setCollections(Lists.<CollectionLayoutData>newArrayList());
- left.getCollections().add(similarToColl);
- similarToColl.setId("similarTo");
-
- left.getFieldSets().add(new FieldSet("General"));
- PropertyLayoutData namePropertyLayoutData = new PropertyLayoutData("name");
- left.getFieldSets().get(0).getProperties().add(namePropertyLayoutData);
-
- ActionLayoutData updateNameActionLayoutData = new ActionLayoutData();
- updateNameActionLayoutData.setId("updateName");
- namePropertyLayoutData.setActions(Lists.<ActionLayoutData>newArrayList());
- namePropertyLayoutData.getActions().add(updateNameActionLayoutData);
-
- ActionLayoutData deleteActionLayoutData = new ActionLayoutData();
- deleteActionLayoutData.setId("delete");
- fcPage.setActions(Lists.<ActionLayoutData>newArrayList());
- fcPage.getActions().add(deleteActionLayoutData);
-
- final String schemaLocations = new PageNormalizerServiceDefault().schemaLocationsFor(fcPage);
- String xml = jaxbService.toXml(fcPage,
- ImmutableMap.<String,Object>of(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocations));
- System.out.println(xml);
-
- FCPage fcPageRoundtripped = jaxbService.fromXml(FCPage.class, xml);
- String xmlRoundtripped = jaxbService.toXml(fcPageRoundtripped,
- ImmutableMap.<String,Object>of(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocations));
- assertThat(xml, is(equalTo(xmlRoundtripped)));
-
-
- System.out.println("==========");
-
- dumpXsd(fcPage);
- }
-
- protected void dumpXsd(final FCPage fcPage) {
- Map<String, String> schemas = jaxbService.toXsd(fcPage, JaxbService.IsisSchemas.INCLUDE);
- for (Map.Entry<String, String> entry : schemas.entrySet()) {
- System.out.println(entry.getKey() + ":");
- System.out.println(entry.getValue());
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanelFactory.java
index f4c3d62..8b2f322 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanelFactory.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanelFactory.java
@@ -22,17 +22,17 @@ package org.apache.isis.viewer.wicket.ui.components.entity.selector.links;
import org.apache.wicket.Component;
import org.apache.wicket.model.IModel;
-import org.apache.isis.applib.layout.bootstrap3.BS3Page;
-import org.apache.isis.applib.layout.common.Page;
-import org.apache.isis.applib.layout.fixedcols.FCPage;
-import org.apache.isis.core.metamodel.facets.object.layoutmetadata.PageFacet;
+import org.apache.isis.applib.layout.bootstrap3.BS3Grid;
+import org.apache.isis.applib.layout.common.Grid;
+import org.apache.isis.applib.layout.fixedcols.FCGrid;
+import org.apache.isis.core.metamodel.facets.object.grid.GridFacet;
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.layout.bs3.BS3PagePanel;
-import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.FCPagePanel;
+import org.apache.isis.viewer.wicket.ui.components.layout.bs3.BS3GridPanel;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.FCGridPanel;
/**
* {@link ComponentFactory} for {@link EntityLinksSelectorPanel}.
@@ -50,16 +50,16 @@ public class EntityLinksSelectorPanelFactory extends EntityComponentFactoryAbstr
final EntityModel entityModel = (EntityModel) model;
final ObjectSpecification specification = entityModel.getTypeOfSpecification();
- final PageFacet facet = specification.getFacet(PageFacet.class);
+ final GridFacet facet = specification.getFacet(GridFacet.class);
- final Page page = facet.getPage();
- if (page != null) {
- final EntityModel entityModelWithLayoutMetadata = entityModel.cloneWithLayoutMetadata(page);
- if(page instanceof FCPage) {
- return new FCPagePanel(id, entityModelWithLayoutMetadata);
+ final Grid grid = facet.getGrid();
+ if (grid != null) {
+ final EntityModel entityModelWithLayoutMetadata = entityModel.cloneWithLayoutMetadata(grid);
+ if(grid instanceof FCGrid) {
+ return new FCGridPanel(id, entityModelWithLayoutMetadata);
}
- if(page instanceof BS3Page) {
- return new BS3PagePanel(id, entityModelWithLayoutMetadata);
+ if(grid instanceof BS3Grid) {
+ return new BS3GridPanel(id, entityModelWithLayoutMetadata);
}
}
return new EntityLinksSelectorPanel(id, entityModel, this);
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/EntityPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/EntityPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/EntityPanelFactory.java
index d2e4a9f..575292c 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/EntityPanelFactory.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/EntityPanelFactory.java
@@ -27,10 +27,10 @@ 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.layout.fallback.EntityEditablePanel;
-import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.FCPagePanel;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.FCGridPanel;
/**
- * {@link ComponentFactory} for {@link FCPagePanel}.
+ * {@link ComponentFactory} for {@link FCGridPanel}.
*/
public class EntityPanelFactory extends EntityComponentFactoryAbstract {
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3GridPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3GridPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3GridPanel.html
new file mode 100644
index 0000000..e21e576
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3GridPanel.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="rows">
+ [rows]
+ </div>
+</wicket:panel>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3GridPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3GridPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3GridPanel.java
new file mode 100644
index 0000000..1be3c4b
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3GridPanel.java
@@ -0,0 +1,66 @@
+/*
+ * 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.layout.bs3;
+
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.repeater.RepeatingView;
+
+import org.apache.isis.applib.layout.bootstrap3.BS3ElementAbstract;
+import org.apache.isis.applib.layout.bootstrap3.BS3Grid;
+import org.apache.isis.applib.layout.bootstrap3.BS3Row;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.components.layout.bs3.row.Row;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+public class BS3GridPanel extends PanelAbstract<EntityModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_ROWS = "rows";
+
+ private final BS3Grid bs3Page;
+
+ public BS3GridPanel(final String id, final EntityModel entityModel) {
+ super(id, entityModel);
+ this.bs3Page = (BS3Grid) entityModel.getLayoutMetadata();
+ buildGui();
+ }
+
+ private void buildGui() {
+
+ Util.appendCssClassIfRequired(this, bs3Page);
+
+ final RepeatingView rv = new RepeatingView(ID_ROWS);
+
+ final BS3ElementAbstract element = this.bs3Page;
+
+ for(final BS3Row bs3Row: this.bs3Page.getRows()) {
+
+ final String id = rv.newChildId();
+ final EntityModel entityModelWithHints = getModel().cloneWithLayoutMetadata(bs3Row);
+
+ final WebMarkupContainer row = new Row(id, entityModelWithHints);
+
+ rv.add(row);
+ }
+ add(rv);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3PagePanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3PagePanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3PagePanel.html
deleted file mode 100644
index e21e576..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3PagePanel.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="rows">
- [rows]
- </div>
-</wicket:panel>
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3PagePanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3PagePanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3PagePanel.java
deleted file mode 100644
index 58dcd2a..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3PagePanel.java
+++ /dev/null
@@ -1,66 +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.layout.bs3;
-
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.repeater.RepeatingView;
-
-import org.apache.isis.applib.layout.bootstrap3.BS3ElementAbstract;
-import org.apache.isis.applib.layout.bootstrap3.BS3Page;
-import org.apache.isis.applib.layout.bootstrap3.BS3Row;
-import org.apache.isis.viewer.wicket.model.models.EntityModel;
-import org.apache.isis.viewer.wicket.ui.components.layout.bs3.row.Row;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-
-public class BS3PagePanel extends PanelAbstract<EntityModel> {
-
- private static final long serialVersionUID = 1L;
-
- private static final String ID_ROWS = "rows";
-
- private final BS3Page bs3Page;
-
- public BS3PagePanel(final String id, final EntityModel entityModel) {
- super(id, entityModel);
- this.bs3Page = (BS3Page) entityModel.getLayoutMetadata();
- buildGui();
- }
-
- private void buildGui() {
-
- Util.appendCssClassIfRequired(this, bs3Page);
-
- final RepeatingView rv = new RepeatingView(ID_ROWS);
-
- final BS3ElementAbstract element = this.bs3Page;
-
- for(final BS3Row bs3Row: this.bs3Page.getRows()) {
-
- final String id = rv.newChildId();
- final EntityModel entityModelWithHints = getModel().cloneWithLayoutMetadata(bs3Row);
-
- final WebMarkupContainer row = new Row(id, entityModelWithHints);
-
- rv.add(row);
- }
- add(rv);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCGridPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCGridPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCGridPanel.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/layout/fixedcols/FCGridPanel.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/7fb63556/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCGridPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCGridPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCGridPanel.java
new file mode 100644
index 0000000..2db578d
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCGridPanel.java
@@ -0,0 +1,114 @@
+/*
+ * 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.layout.fixedcols;
+
+import java.util.List;
+
+import com.google.common.collect.FluentIterable;
+
+import org.apache.isis.applib.layout.fixedcols.FCColumn;
+import org.apache.isis.applib.layout.fixedcols.FCGrid;
+import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
+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.grid.GridFacet;
+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.layout.fixedcols.columns.EntityColumn;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.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 <div> regions.
+ */
+public class FCGridPanel 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 FCGridPanel(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 GridFacet GridFacet = model.getTypeOfSpecification().getFacet(GridFacet.class);
+ final FCGrid page = (FCGrid) GridFacet.getGrid();
+
+
+ addOrReplace(ComponentType.ENTITY_SUMMARY, model);
+
+ final int leftSpan = addColumnIfRequired(ID_LEFT_COLUMN, page.getLeft());
+
+ final TabGroupListPanel middleTabs = addTabGroups(ID_MIDDLE_COLUMN, page.getTabGroups());
+
+ final int rightSpan = addColumnIfRequired(ID_RIGHT_COLUMN, page.getRight());
+
+ 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<FCTabGroup> tabGroupList) {
+ final EntityModel model = getModel();
+ final List<FCTabGroup> tabGroups = FluentIterable
+ .from(tabGroupList)
+ .filter(FCTabGroup.Predicates.notEmpty())
+ .toList();
+ final EntityModel entityModelWitHints = model.cloneWithLayoutMetadata(tabGroups);
+ final TabGroupListPanel middleComponent = new TabGroupListPanel(id, entityModelWitHints);
+ addOrReplace(middleComponent);
+ return middleComponent;
+ }
+
+ private int addColumnIfRequired(final String id, final FCColumn col) {
+ if(col != null) {
+ final EntityModel entityModel =
+ getModel().cloneWithLayoutMetadata(col);
+ final FCColumn fcColumn = (FCColumn) entityModel.getLayoutMetadata();
+ final int span = fcColumn.getSpan();
+ if(span > 0) {
+ final EntityColumn entityColumn = new EntityColumn(id, entityModel);
+ addOrReplace(entityColumn);
+ CssClassAppender.appendCssClassTo(entityColumn, "col-xs-" + span);
+ return span;
+ }
+ }
+ permanentlyHide(id);
+ return 0;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCPagePanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCPagePanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCPagePanel.html
deleted file mode 100644
index 7b172aa..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCPagePanel.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>
[02/15] isis git commit: ISIS-993: working towards storing a single
hint on the EntityModel
Posted by da...@apache.org.
ISIS-993: working towards storing a single hint on the EntityModel
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/d7a1ee2d
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/d7a1ee2d
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/d7a1ee2d
Branch: refs/heads/ISIS-993
Commit: d7a1ee2ddae809ef630d48d32953ae6ae736eedf
Parents: fc59d35
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sun Jan 31 11:46:37 2016 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Sun Jan 31 11:46:37 2016 +0000
----------------------------------------------------------------------
.../viewer/wicket/model/models/EntityModel.java | 42 ++++++++++----------
.../collections/EntityCollectionsPanel.java | 2 +-
.../components/entity/column/EntityColumn.java | 5 ++-
.../propsandcolls/EntityPropsAndCollsForm.java | 2 +-
.../entity/tabbed/EntityTabbedPanel.java | 3 +-
.../entity/tabgroup/TabGroupPanel.java | 4 +-
.../entity/tabgrouplist/TabGroupListPanel.java | 2 +-
7 files changed, 30 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/d7a1ee2d/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 b169164..54ece97 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
@@ -20,7 +20,6 @@
package org.apache.isis.viewer.wicket.model.models;
import java.io.Serializable;
-import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -31,10 +30,8 @@ import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.isis.applib.annotation.BookmarkPolicy;
import org.apache.isis.applib.layout.common.CollectionLayoutData;
-import org.apache.isis.applib.layout.fixedcols.FCColumn;
-import org.apache.isis.applib.layout.fixedcols.FCColumn.Hint;
import org.apache.isis.applib.layout.common.FieldSet;
-import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
+import org.apache.isis.applib.layout.fixedcols.FCColumn.Hint;
import org.apache.isis.applib.layout.fixedcols.FCTab;
import org.apache.isis.applib.services.memento.MementoService.Memento;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -648,68 +645,69 @@ public class EntityModel extends BookmarkableModel<ObjectAdapter> {
// tab and column metadata (if any)
// //////////////////////////////////////////////////////////
- private List<FCTabGroup> tabGroupListMetadata;
+ private Object tabGroupListMetadata;
- public List<FCTabGroup> getTabGroupListMetadata() {
+ public Object getTabGroupListMetadata() {
return tabGroupListMetadata;
}
/**
* Returns a new copy that SHARES the property scalar models (for edit form).
*/
- public EntityModel cloneWithTabGroupListMetadata(final List<FCTabGroup> tabGroupListMetadata) {
+ public EntityModel cloneWithTabGroupListMetadata(final Object tabGroupListMetadata) {
final EntityModel entityModel = new EntityModel(this.adapterMemento, this.propertyScalarModels);
entityModel.tabGroupListMetadata = tabGroupListMetadata;
return entityModel;
}
- private FCTabGroup FCTabGroup;
+ private Object fcTabGroup;
- public FCTabGroup getFCTabGroup() {
- return FCTabGroup;
+ public Object getFCTabGroup() {
+ return fcTabGroup;
}
/**
* Returns a new copy that SHARES the property scalar models (for edit form).
*/
- public EntityModel cloneWithTabGroupMetadata(final FCTabGroup FCTabGroup) {
+ public EntityModel cloneWithTabGroupMetadata(final Object fcTabgroup) {
final EntityModel entityModel = new EntityModel(this.adapterMemento, this.propertyScalarModels);
- entityModel.FCTabGroup = FCTabGroup;
+ entityModel.fcTabGroup = fcTabgroup;
return entityModel;
}
- private FCTab FCTab;
+ private Object fcTab;
- public FCTab getFCTab() {
- return FCTab;
+ public Object getFCTab() {
+ return fcTab;
}
/**
* Returns a new copy that SHARES the property scalar models (for edit form).
*/
- public EntityModel cloneWithTabMetadata(final FCTab FCTab) {
+ public EntityModel cloneWithTabMetadata(final FCTab fcTab) {
final EntityModel entityModel = new EntityModel(this.adapterMemento, this.propertyScalarModels);
- entityModel.FCTab = FCTab;
+ entityModel.fcTab = fcTab;
return entityModel;
}
- private FCColumn fcColumn;
+ private Object fcColumn;
+
+ public Object getFCColumn() {
+ return fcColumn;
+ }
/**
* Returns a new copy that SHARES the property scalar models (for edit form).
*/
- public EntityModel cloneWithColumnMetadata(final FCColumn fcColumn) {
+ public EntityModel cloneWithColumnMetadata(final Object fcColumn) {
final EntityModel entityModel = new EntityModel(this.adapterMemento, this.propertyScalarModels);
entityModel.fcColumn = fcColumn;
return entityModel;
}
- public FCColumn getFCColumn() {
- return fcColumn;
- }
private FieldSet fieldSet;
public FieldSet getFieldSet() {
http://git-wip-us.apache.org/repos/asf/isis/blob/d7a1ee2d/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
index 5bd57d0..61fb3f3 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/collections/EntityCollectionsPanel.java
@@ -61,7 +61,7 @@ public class EntityCollectionsPanel extends PanelAbstract<EntityModel> {
public EntityCollectionsPanel(final String id, final EntityModel entityModel) {
super(id, entityModel);
- FCColumnIfAny = entityModel.getFCColumn();
+ FCColumnIfAny = (FCColumn) entityModel.getFCColumn();
buildGui();
}
http://git-wip-us.apache.org/repos/asf/isis/blob/d7a1ee2d/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.java
index 34eb66f..07fd0e9 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/column/EntityColumn.java
@@ -75,8 +75,9 @@ public class EntityColumn extends PanelAbstract<EntityModel> {
super(id, entityModel);
- columnMetaDataIfAny = entityModel.getFCColumn();
- hint = entityModel.getFCColumn().getHint();
+ columnMetaDataIfAny = (FCColumn) entityModel.getFCColumn();
+ final FCColumn fcColumn = (FCColumn) entityModel.getFCColumn();
+ hint = fcColumn.getHint();
buildGui();
}
http://git-wip-us.apache.org/repos/asf/isis/blob/d7a1ee2d/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.java
index 9668c96..c850a2d 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/propsandcolls/EntityPropsAndCollsForm.java
@@ -127,7 +127,7 @@ public class EntityPropsAndCollsForm extends FormAbstract<ObjectAdapter> impleme
private void buildGui() {
final EntityModel entityModel = (EntityModel) getModel();
- final FCTab FCTabMetaDataIfAny = entityModel.getFCTab();
+ final FCTab FCTabMetaDataIfAny = (FCTab) entityModel.getFCTab();
final ColumnSpans columnSpans;
if(FCTabMetaDataIfAny != null) {
http://git-wip-us.apache.org/repos/asf/isis/blob/d7a1ee2d/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.java
index e9d6fda..38aa516 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.java
@@ -98,7 +98,8 @@ public class EntityTabbedPanel extends PanelAbstract<EntityModel> {
if(col != null) {
final EntityModel entityModel =
getModel().cloneWithColumnMetadata(col);
- final int span = entityModel.getFCColumn().getSpan();
+ final FCColumn fcColumn = (FCColumn) entityModel.getFCColumn();
+ final int span = fcColumn.getSpan();
if(span > 0) {
final EntityColumn entityColumn = new EntityColumn(id, entityModel);
addOrReplace(entityColumn);
http://git-wip-us.apache.org/repos/asf/isis/blob/d7a1ee2d/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroup/TabGroupPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroup/TabGroupPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroup/TabGroupPanel.java
index 1047855..fd6ca06 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroup/TabGroupPanel.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroup/TabGroupPanel.java
@@ -50,7 +50,7 @@ public class TabGroupPanel extends AjaxBootstrapTabbedPanel {
private static List<ITab> tabsFor(final EntityModel entityModel) {
final List<ITab> tabs = Lists.newArrayList();
- final FCTabGroup tabGroup = entityModel.getFCTabGroup();
+ final FCTabGroup tabGroup = (FCTabGroup) entityModel.getFCTabGroup();
final List<FCTab> FCTabList = FluentIterable
.from(tabGroup.getTabs())
.filter(FCTab.Predicates.notEmpty())
@@ -73,7 +73,7 @@ public class TabGroupPanel extends AjaxBootstrapTabbedPanel {
super(ID_TAB_GROUP, tabsFor(entityModel));
this.entityModel = entityModel;
- this.tabGroup = entityModel.getFCTabGroup();
+ this.tabGroup = (FCTabGroup) entityModel.getFCTabGroup();
this.selectedTabInSession = ScopedSessionAttribute.create(entityModel, this, SESSION_ATTR_SELECTED_TAB);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/d7a1ee2d/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
index ff0de4d..952c3ad 100644
--- 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
@@ -41,7 +41,7 @@ public class TabGroupListPanel extends PanelAbstract<EntityModel> {
public TabGroupListPanel(final String id, final EntityModel entityModel) {
super(id, entityModel);
- this.tabGroups = entityModel.getTabGroupListMetadata();
+ this.tabGroups = (List<FCTabGroup>) entityModel.getTabGroupListMetadata();
buildGui();
}
[05/15] isis git commit: ISIS-993: bootstrap3 layout working,
more or less. Still need to do the normalization phase.
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.html
index d03b88b..4d6bd0f 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.html
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelAbstract.html
@@ -33,6 +33,7 @@
<span wicket:id="associatedActionLinksBelow"></span>
</span>
<span wicket:id="associatedActionLinksRight"></span>
+ <div class="clearfix"/>
</div>
<wicket:container wicket:id="scalarIfCompact"></wicket:container>
</div>
@@ -44,7 +45,6 @@
<wicket:fragment wicket:id="compactAsSpan">
<span wicket:id="scalarIfCompact"></span>
</wicket:fragment>
-
</wicket:panel>
</body>
</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
index 235b356..43c615d 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/bootstrap-overrides.css
@@ -484,6 +484,8 @@ div.additionalLinkList {
+.col .additionalLinks,
+.col .additionalLinksAndSelectorDropDown,
.entityPropertiesPanel .additionalLinks,
.entityCollectionsPanel .additionalLinksAndSelectorDropDown {
margin-top: -4px;
@@ -750,6 +752,6 @@ tr.headers th form input {
padding-bottom: 10px;
}
-.entityPage .middleColumn .tabbable {
+.tabbable {
padding-bottom: 10px;
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-BS3.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-BS3.xml b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-BS3.xml
deleted file mode 100644
index 1697575..0000000
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-BS3.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<bs3:page xsi:schemaLocation="http://isis.apache.org/schema/applib/layout/common http://isis.apache.org/schema/applib/layout/common/common.xsd http://isis.apache.org/schema/applib/layout/bootstrap3 http://isis.apache.org/schema/applib/layout/bootstrap3/bootstrap3.xsd" xmlns:c="http://isis.apache.org/schema/applib/layout/common" xmlns:bs3="http://isis.apache.org/schema/applib/layout/bootstrap3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-
- <bs3:row>
- <bs3:col span="12">
- <c:domainObject/>
- <c:action id="delete"/>
- </bs3:col>
- </bs3:row>
-
- <bs3:row>
- <bs3:col span="12">
- <bs3:tabGroup>
- <bs3:tab name="Metadata">
- <bs3:row>
- <bs3:col span="7">
- <c:fieldSet name="General">
- <c:action id="downloadJdoMetadata" position="PANEL"/>
- <c:action id="downloadLayoutXml" position="PANEL_DROPDOWN"/>
- <c:property id="name" labelPosition="TOP">
- <c:action id="updateName">
- <c:describedAs>This allows the name to be updated</c:describedAs>
- </c:action>
- </c:property>
- </c:fieldSet>
- </bs3:col>
- </bs3:row>
- </bs3:tab>
- </bs3:tabGroup>
- <bs3:tabGroup>
- <bs3:tab name="SimilarTo">
- <bs3:row>
- <bs3:col span="12">
- <c:collection id="similarTo" defaultView="table"/>
- <c:collection id="others" defaultView="hide"/>
- </bs3:col>
- </bs3:row>
- </bs3:tab>
- </bs3:tabGroup>
- </bs3:col>
- </bs3:row>
-</bs3:page>
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-FC.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-FC.xml b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-FC.xml
new file mode 100644
index 0000000..da9fc4c
--- /dev/null
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-FC.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<page xsi:schemaLocation="http://isis.apache.org/schema/applib/layout/common http://isis.apache.org/schema/applib/layout/common/common.xsd http://isis.apache.org/schema/applib/layout/fixedcols http://isis.apache.org/schema/applib/layout/fixedcols/fixedcols.xsd" xmlns="http://isis.apache.org/schema/applib/layout/fixedcols" xmlns:c="http://isis.apache.org/schema/applib/layout/common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+
+ <left span="0">
+ </left>
+ <tabGroup>
+ <tab name="Properties">
+ <left span="8">
+ <c:fieldSet name="General">
+ <c:action id="delete"/>
+ <c:property id="name" labelPosition="TOP">
+ <c:action id="updateName">
+ <c:describedAs>This allows the name to be updated</c:describedAs>
+ </c:action>
+ </c:property>
+ </c:fieldSet>
+ </left>
+ <middle span="4">
+ <c:fieldSet name="Foo">
+ <c:action id="downloadJdoMetadata" position="PANEL"/>
+ <c:action id="downloadLayoutXml" position="PANEL"/>
+ <c:property id="versionSequence"/>
+ </c:fieldSet>
+ </middle>
+ </tab>
+ </tabGroup>
+ <tabGroup>
+ <tab name="Collections">
+ <left span="6">
+ <c:collection id="similarTo" defaultView="table"/>
+ </left>
+ <right span="6">
+ <c:collection id="others" defaultView="table"/>
+ </right>
+ </tab>
+ </tabGroup>
+</page>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
index da9fc4c..482f6fa 100644
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
@@ -1,38 +1,64 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<page xsi:schemaLocation="http://isis.apache.org/schema/applib/layout/common http://isis.apache.org/schema/applib/layout/common/common.xsd http://isis.apache.org/schema/applib/layout/fixedcols http://isis.apache.org/schema/applib/layout/fixedcols/fixedcols.xsd" xmlns="http://isis.apache.org/schema/applib/layout/fixedcols" xmlns:c="http://isis.apache.org/schema/applib/layout/common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<bs3:page xsi:schemaLocation="http://isis.apache.org/schema/applib/layout/common http://isis.apache.org/schema/applib/layout/common/common.xsd http://isis.apache.org/schema/applib/layout/bootstrap3 http://isis.apache.org/schema/applib/layout/bootstrap3/bootstrap3.xsd" xmlns:c="http://isis.apache.org/schema/applib/layout/common" xmlns:bs3="http://isis.apache.org/schema/applib/layout/bootstrap3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <bs3:row cssClass="bishbosh">
+ <bs3:col span="8">
+ <c:domainObject/>
+ </bs3:col>
+ <bs3:col span="4" cssClass="foobar">
+ </bs3:col>
+ </bs3:row>
- <left span="0">
- </left>
- <tabGroup>
- <tab name="Properties">
- <left span="8">
- <c:fieldSet name="General">
- <c:action id="delete"/>
- <c:property id="name" labelPosition="TOP">
- <c:action id="updateName">
- <c:describedAs>This allows the name to be updated</c:describedAs>
- </c:action>
- </c:property>
- </c:fieldSet>
- </left>
- <middle span="4">
- <c:fieldSet name="Foo">
- <c:action id="downloadJdoMetadata" position="PANEL"/>
- <c:action id="downloadLayoutXml" position="PANEL"/>
- <c:property id="versionSequence"/>
- </c:fieldSet>
- </middle>
- </tab>
- </tabGroup>
- <tabGroup>
- <tab name="Collections">
- <left span="6">
- <c:collection id="similarTo" defaultView="table"/>
- </left>
- <right span="6">
- <c:collection id="others" defaultView="table"/>
- </right>
- </tab>
- </tabGroup>
-</page>
\ No newline at end of file
+ <bs3:row>
+ <bs3:col span="12">
+ <bs3:tabGroup>
+ <bs3:tab name="Metadata">
+ <bs3:row>
+ <bs3:col span="12">
+ <c:fieldSet name="Metadata">
+ <c:action id="downloadJdoMetadata" position="PANEL"/>
+ <c:action id="downloadLayoutXml" position="PANEL_DROPDOWN"/>
+ <c:property id="versionSequence">
+ </c:property>
+ </c:fieldSet>
+ </bs3:col>
+ <bs3:col span="6">
+ <c:fieldSet name="Xxx">
+ <c:property id="name" labelPosition="TOP">
+ <c:action id="updateName">
+ <c:describedAs>This allows the name to be updated</c:describedAs>
+ </c:action>
+ </c:property>
+ </c:fieldSet>
+ </bs3:col>
+ <bs3:col span="6">
+ <c:fieldSet name="Xxx">
+ <c:property id="name" labelPosition="TOP">
+ <c:action id="updateName">
+ <c:describedAs>This allows the name to be updated</c:describedAs>
+ </c:action>
+ </c:property>
+ </c:fieldSet>
+ </bs3:col>
+ </bs3:row>
+ </bs3:tab>
+ </bs3:tabGroup>
+ <bs3:tabGroup>
+ <bs3:tab name="SimilarTo">
+ <bs3:row>
+ <bs3:col span="12">
+ <c:collection id="similarTo" defaultView="table"/>
+ </bs3:col>
+ </bs3:row>
+ </bs3:tab>
+ <bs3:tab name="Others">
+ <bs3:row>
+ <bs3:col span="12">
+ <c:collection id="others" defaultView="hide"/>
+ </bs3:col>
+ </bs3:row>
+ </bs3:tab>
+ </bs3:tabGroup>
+ </bs3:col>
+ </bs3:row>
+</bs3:page>
[15/15] isis git commit: ISIS-993: converting GridNormalizer into a
service.
Posted by da...@apache.org.
ISIS-993: converting GridNormalizer into a service.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/63d03d29
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/63d03d29
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/63d03d29
Branch: refs/heads/ISIS-993
Commit: 63d03d29b1929b481f72eed943ca22eacb2124f8
Parents: 7fb6355
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Tue Feb 2 00:35:39 2016 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Tue Feb 2 00:35:39 2016 +0000
----------------------------------------------------------------------
.../applib/services/layout/GridService.java | 2 +-
.../layout/Object_downloadLayoutXml.java | 2 +-
.../facets/object/grid/GridFacetDefault.java | 2 +-
.../facets/object/grid/GridFacetFactory.java | 2 +-
.../services/grid/GridNormalizerService.java | 36 ++
.../services/grid/GridServiceDefault.java | 37 +-
.../bootstrap3/GridNormalizerServiceBS3.java | 71 +++
.../grid/fixedcols/GridNormalizerServiceFC.java | 431 +++++++++++++++++++
.../grid/normalizer/GridNormalizer.java | 25 --
.../grid/normalizer/GridNormalizerAbstract.java | 35 --
.../grid/normalizer/GridNormalizerBS3.java | 39 --
.../grid/normalizer/GridNormalizerFC.java | 399 -----------------
.../grid/normalizer/GridNormalizerService.java | 37 --
.../GridNormalizerServiceDefault.java | 110 -----
.../layout/bootstrap3/BS3GridTest.java | 149 -------
.../metamodel/layout/fixedcols/FCGridTest.java | 120 ------
.../metamodel/services/grid/BS3GridTest.java | 154 +++++++
.../metamodel/services/grid/FCGridTest.java | 126 ++++++
18 files changed, 854 insertions(+), 923 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/63d03d29/core/applib/src/main/java/org/apache/isis/applib/services/layout/GridService.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/layout/GridService.java b/core/applib/src/main/java/org/apache/isis/applib/services/layout/GridService.java
index fbd5062..a641889 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/layout/GridService.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/layout/GridService.java
@@ -42,5 +42,5 @@ public interface GridService {
*/
@Programmatic Grid toGrid(Class<?> domainClass);
- String schemaLocations(final Grid grid);
+ String tnsAndSchemaLocation(final Grid grid);
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/63d03d29/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_downloadLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_downloadLayoutXml.java b/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_downloadLayoutXml.java
index be71676..01beb41 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_downloadLayoutXml.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/layout/Object_downloadLayoutXml.java
@@ -59,7 +59,7 @@ public class Object_downloadLayoutXml {
final String xml = jaxbService.toXml(grid,
ImmutableMap.<String,Object>of(
Marshaller.JAXB_SCHEMA_LOCATION,
- gridService.schemaLocations(grid)
+ gridService.tnsAndSchemaLocation(grid)
));
return new Clob(Util.withSuffix(fileName, "xml"), "text/xml", xml);
http://git-wip-us.apache.org/repos/asf/isis/blob/63d03d29/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacetDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacetDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacetDefault.java
index 7247b8f..f2de0fc 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacetDefault.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacetDefault.java
@@ -28,7 +28,7 @@ import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
import org.apache.isis.core.metamodel.facetapi.Facet;
import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.services.grid.normalizer.GridNormalizerService;
+import org.apache.isis.core.metamodel.services.grid.GridNormalizerService;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
public class GridFacetDefault
http://git-wip-us.apache.org/repos/asf/isis/blob/63d03d29/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacetFactory.java
index b1674dc..9c4f9cd 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacetFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/grid/GridFacetFactory.java
@@ -27,7 +27,7 @@ import org.apache.isis.core.metamodel.facetapi.FeatureType;
import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
import org.apache.isis.core.metamodel.runtimecontext.ServicesInjectorAware;
-import org.apache.isis.core.metamodel.services.grid.normalizer.GridNormalizerService;
+import org.apache.isis.core.metamodel.services.grid.GridNormalizerService;
public class GridFacetFactory extends FacetFactoryAbstract implements ServicesInjectorAware {
http://git-wip-us.apache.org/repos/asf/isis/blob/63d03d29/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/GridNormalizerService.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/GridNormalizerService.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/GridNormalizerService.java
new file mode 100644
index 0000000..d2436db
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/GridNormalizerService.java
@@ -0,0 +1,36 @@
+/**
+ * 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.services.grid;
+
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.layout.common.Grid;
+
+public interface GridNormalizerService {
+
+ @Programmatic
+ Class<? extends Grid> gridImplementation();
+
+ @Programmatic
+ String tns();
+
+ @Programmatic
+ String schemaLocation();
+
+ @Programmatic
+ void normalize(Grid grid, Class<?> domainClass);
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/63d03d29/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/GridServiceDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/GridServiceDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/GridServiceDefault.java
index b69bdef..66d4f9e 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/GridServiceDefault.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/GridServiceDefault.java
@@ -23,9 +23,14 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
+import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.xml.bind.JAXBContext;
+import com.google.common.base.Function;
+import com.google.common.base.Joiner;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.io.Resources;
@@ -41,7 +46,6 @@ import org.apache.isis.applib.services.layout.GridService;
import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
import org.apache.isis.core.metamodel.deployment.DeploymentCategoryAware;
import org.apache.isis.core.metamodel.facets.object.grid.GridFacet;
-import org.apache.isis.core.metamodel.services.grid.normalizer.GridNormalizerService;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.metamodel.spec.SpecificationLoader;
import org.apache.isis.core.metamodel.spec.SpecificationLoaderAware;
@@ -54,6 +58,9 @@ public class GridServiceDefault
private static final Logger LOG = LoggerFactory.getLogger(GridServiceDefault.class);
+ public static final String COMMON_TNS = "http://isis.apache.org/schema/applib/layout/common";
+ public static final String COMMON_SCHEMA_LOCATION = "http://isis.apache.org/schema/applib/layout/common/common.xsd";
+
// for better logging messages (used only in prototyping mode)
private final Map<Class<?>, String> badXmlByClass = Maps.newHashMap();
@@ -107,7 +114,15 @@ public class GridServiceDefault
try {
// all known implementations of Page
- List<Class<? extends Grid>> pageImplementations = gridNormalizerService.pageImplementations();
+ List<Class<? extends Grid>> pageImplementations =
+ FluentIterable.from(gridNormalizerServices)
+ .transform(new Function<GridNormalizerService, Class<? extends Grid>>() {
+ @Override
+ public Class<? extends Grid> apply(final GridNormalizerService gridNormalizer) {
+ return gridNormalizer.gridImplementation();
+ }
+ })
+ .toList();
final JAXBContext context = JAXBContext.newInstance(pageImplementations.toArray(new Class[0]));
final Grid metadata = (Grid) jaxbService.fromXml(context, xml);
@@ -156,8 +171,20 @@ public class GridServiceDefault
@Override
- public String schemaLocations(final Grid grid) {
- return gridNormalizerService.schemaLocationsFor(grid);
+ public String tnsAndSchemaLocation(final Grid grid) {
+ final List<String> parts = Lists.newArrayList();
+ parts.add(COMMON_TNS);
+ parts.add(COMMON_SCHEMA_LOCATION);
+ FluentIterable.from(gridNormalizerServices)
+ .transform(new Function<GridNormalizerService, Void>() {
+ @Nullable @Override
+ public Void apply(final GridNormalizerService gridNormalizerService) {
+ parts.add(gridNormalizerService.tns());
+ parts.add(gridNormalizerService.schemaLocation());
+ return null;
+ }
+ });
+ return Joiner.on(" ").join(parts);
}
////////////////////////////////////////////////////////
@@ -183,7 +210,7 @@ public class GridServiceDefault
JaxbService jaxbService;
@Inject
- GridNormalizerService gridNormalizerService;
+ List<GridNormalizerService> gridNormalizerServices;
//endregion
}
http://git-wip-us.apache.org/repos/asf/isis/blob/63d03d29/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/bootstrap3/GridNormalizerServiceBS3.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/bootstrap3/GridNormalizerServiceBS3.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/bootstrap3/GridNormalizerServiceBS3.java
new file mode 100644
index 0000000..0b69210
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/bootstrap3/GridNormalizerServiceBS3.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.core.metamodel.services.grid.bootstrap3;
+
+import javax.inject.Inject;
+
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.NatureOfService;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.layout.bootstrap3.BS3Grid;
+import org.apache.isis.applib.layout.common.Grid;
+import org.apache.isis.applib.services.i18n.TranslationService;
+import org.apache.isis.core.metamodel.services.grid.GridNormalizerService;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+
+@DomainService(
+ nature = NatureOfService.DOMAIN
+)
+public class GridNormalizerServiceBS3 implements GridNormalizerService {
+
+ public static final String TNS = "http://isis.apache.org/schema/applib/layout/bootstrap3";
+ public static final String SCHEMA_LOCATION = "http://isis.apache.org/schema/applib/layout/bootstrap3/bootstrap3.xsd";
+
+
+
+ @Programmatic
+ @Override
+ public Class<? extends Grid> gridImplementation() {
+ return BS3Grid.class;
+ }
+
+ @Programmatic
+ @Override
+ public String tns() {
+ return TNS;
+ }
+
+ @Programmatic
+ @Override
+ public String schemaLocation() {
+ return SCHEMA_LOCATION;
+ }
+
+ @Override
+ public void normalize(final Grid grid, final Class<?> domainClass) {
+ BS3Grid bs3Grid = (BS3Grid) grid;
+
+ // TODO
+ }
+
+
+ @Inject
+ SpecificationLoader specificationLookup;
+ @Inject
+ TranslationService translationService;
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/63d03d29/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/fixedcols/GridNormalizerServiceFC.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/fixedcols/GridNormalizerServiceFC.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/fixedcols/GridNormalizerServiceFC.java
new file mode 100644
index 0000000..820f8c0
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/fixedcols/GridNormalizerServiceFC.java
@@ -0,0 +1,431 @@
+/**
+ * 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.services.grid.fixedcols;
+
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.inject.Inject;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.NatureOfService;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.layout.common.ActionLayoutData;
+import org.apache.isis.applib.layout.common.ActionLayoutDataOwner;
+import org.apache.isis.applib.layout.common.CollectionLayoutData;
+import org.apache.isis.applib.layout.common.FieldSet;
+import org.apache.isis.applib.layout.common.Grid;
+import org.apache.isis.applib.layout.common.MemberRegionOwner;
+import org.apache.isis.applib.layout.common.PropertyLayoutData;
+import org.apache.isis.applib.layout.fixedcols.FCColumn;
+import org.apache.isis.applib.layout.fixedcols.FCColumnOwner;
+import org.apache.isis.applib.layout.fixedcols.FCGrid;
+import org.apache.isis.applib.layout.fixedcols.FCTab;
+import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
+import org.apache.isis.applib.services.i18n.TranslationService;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facets.actions.layout.ActionPositionFacetForActionXml;
+import org.apache.isis.core.metamodel.facets.actions.layout.BookmarkPolicyFacetForActionXml;
+import org.apache.isis.core.metamodel.facets.actions.layout.CssClassFaFacetForActionXml;
+import org.apache.isis.core.metamodel.facets.actions.layout.CssClassFacetForActionXml;
+import org.apache.isis.core.metamodel.facets.actions.layout.DescribedAsFacetForActionXml;
+import org.apache.isis.core.metamodel.facets.actions.layout.HiddenFacetForActionLayoutXml;
+import org.apache.isis.core.metamodel.facets.actions.layout.NamedFacetForActionXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.CssClassFacetForCollectionXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.DefaultViewFacetForCollectionXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.DescribedAsFacetForCollectionXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.HiddenFacetForCollectionXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.NamedFacetForCollectionXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.PagedFacetForCollectionXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.SortedByFacetForCollectionXml;
+import org.apache.isis.core.metamodel.facets.members.order.annotprop.MemberOrderFacetXml;
+import org.apache.isis.core.metamodel.facets.object.membergroups.MemberGroupLayoutFacet;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.CssClassFacetForPropertyXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.DescribedAsFacetForPropertyXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.HiddenFacetForPropertyXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.LabelAtFacetForPropertyXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.MultiLineFacetForPropertyXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.NamedFacetForPropertyXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.RenderedAdjustedFacetForPropertyXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.TypicalLengthFacetForPropertyXml;
+import org.apache.isis.core.metamodel.services.grid.GridNormalizerService;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.SpecificationLoader;
+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.metamodel.spec.feature.ObjectMember;
+import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
+
+@DomainService(
+ nature = NatureOfService.DOMAIN
+)
+public class GridNormalizerServiceFC implements GridNormalizerService {
+
+ public static final String TNS = "http://isis.apache.org/schema/applib/layout/fixedcols";
+ public static final String SCHEMA_LOCATION = "http://isis.apache.org/schema/applib/layout/fixedcols/fixedcols.xsd";
+
+
+ @Programmatic
+ @Override
+ public Class<? extends Grid> gridImplementation() {
+ return FCGrid.class;
+ }
+
+ @Programmatic
+ @Override
+ public String tns() {
+ return TNS;
+ }
+
+ @Programmatic
+ @Override
+ public String schemaLocation() {
+ return SCHEMA_LOCATION;
+ }
+
+
+ @Programmatic
+ @Override
+ public void normalize(final Grid grid, final Class<?> domainClass) {
+
+ final FCGrid fcGrid = (FCGrid) grid;
+
+ final ObjectSpecification objectSpec = specificationLookup.loadSpecification(domainClass);
+
+ final Map<String, OneToOneAssociation> oneToOneAssociationById =
+ ObjectMember.Util.mapById(getOneToOneAssociations(objectSpec));
+ final Map<String, OneToManyAssociation> oneToManyAssociationById =
+ ObjectMember.Util.mapById(getOneToManyAssociations(objectSpec));
+ final Map<String, ObjectAction> objectActionById =
+ ObjectMember.Util.mapById(objectSpec.getObjectActions(Contributed.INCLUDED));
+
+ derive(fcGrid, oneToOneAssociationById, oneToManyAssociationById, objectActionById);
+ overwrite(fcGrid, oneToOneAssociationById, oneToManyAssociationById, objectActionById);
+ }
+
+ /**
+ * Ensures that all object members (properties, collections and actions) are in the metadata.
+ *
+ * <p>
+ * If they are missing then they will be added to default tabs (created on the fly if need be).
+ * </p>
+ */
+ private static void derive(
+ final FCGrid metadata,
+ final Map<String, OneToOneAssociation> oneToOneAssociationById,
+ final Map<String, OneToManyAssociation> oneToManyAssociationById,
+ final Map<String, ObjectAction> objectActionById) {
+
+ final LinkedHashMap<String, PropertyLayoutData> propertyIds = metadata.getAllPropertiesById();
+ final LinkedHashMap<String, CollectionLayoutData> collectionIds = metadata.getAllCollectionsById();
+ final LinkedHashMap<String, ActionLayoutData> actionIds = metadata.getAllActionsById();
+
+ final AtomicReference<FieldSet> defaultPropertyGroupRef = new AtomicReference<>();
+ final AtomicReference<FCColumn> firstColumnRef = new AtomicReference<>();
+ final AtomicReference<FCTabGroup> lastTabGroupRef = new AtomicReference<>();
+
+ // capture the first column, and also
+ // capture the first property group (if any) with the default name ('General')
+ metadata.visit(new FCGrid.VisitorAdapter() {
+ @Override
+ public void visit(final FCColumn fcColumn) {
+ firstColumnRef.compareAndSet(null, fcColumn);
+ }
+ @Override
+ public void visit(final FieldSet fieldSet) {
+ if(MemberGroupLayoutFacet.DEFAULT_GROUP.equals(fieldSet.getName())) {
+ defaultPropertyGroupRef.compareAndSet(null, fieldSet);
+ }
+ }
+ @Override
+ public void visit(final FCTabGroup fcTabGroup) {
+ lastTabGroupRef.set(fcTabGroup);
+ }
+ });
+
+ // any missing properties will be added to the (first) 'General' property group found
+ // if there is no default ('General') property group
+ // then one will be added to the first Column of the first Tab.
+ final Tuple<List<String>> propertyIdTuple = surplusAndMissing(propertyIds.keySet(), oneToOneAssociationById.keySet());
+ final List<String> surplusPropertyIds = propertyIdTuple.first;
+ final List<String> missingPropertyIds = propertyIdTuple.second;
+
+ for (String surplusPropertyId : surplusPropertyIds) {
+ propertyIds.get(surplusPropertyId).setMetadataError("No such property");
+ }
+
+ if(!missingPropertyIds.isEmpty()) {
+ // ensure that there is a property group to use
+ boolean wasSet = defaultPropertyGroupRef.compareAndSet(null, new FieldSet(MemberGroupLayoutFacet.DEFAULT_GROUP));
+ final FieldSet defaultFieldSet = defaultPropertyGroupRef.get();
+ if(wasSet) {
+ firstColumnRef.get().getFieldSets().add(defaultFieldSet);
+ }
+ for (final String propertyId : missingPropertyIds) {
+ defaultFieldSet.getProperties().add(new PropertyLayoutData(propertyId));
+ }
+ }
+
+
+ // any missing collections will be added as tabs to the last TabGroup.
+ // If there is only a single tab group then a new TabGroup will be added first
+ final Tuple<List<String>> collectionIdTuple = surplusAndMissing(collectionIds.keySet(), oneToManyAssociationById.keySet());
+ final List<String> surplusCollectionIds = collectionIdTuple.first;
+ final List<String> missingCollectionIds = collectionIdTuple.second;
+
+ for (String surplusCollectionId : surplusCollectionIds) {
+ collectionIds.get(surplusCollectionId).setMetadataError("No such collection");
+ }
+
+ if(!missingCollectionIds.isEmpty()) {
+ while(metadata.getTabGroups().size() < 2) {
+ final FCTabGroup tabGroup = new FCTabGroup();
+ metadata.getTabGroups().add(tabGroup);
+ lastTabGroupRef.set(tabGroup);
+ }
+ final FCTabGroup lastTabGroup = lastTabGroupRef.get();
+ for (final String collectionId : missingCollectionIds) {
+ final FCTab FCTab = new FCTab();
+ lastTabGroup.getTabs().add(FCTab);
+ FCColumn left = new FCColumn(12);
+ FCTab.setLeft(left);
+ final CollectionLayoutData layoutMetadata = new CollectionLayoutData(collectionId);
+ layoutMetadata.setDefaultView("table");
+ left.getCollections().add(layoutMetadata);
+ }
+ }
+
+ // any missing actions will be added as domain object actions (in the header)
+ final Tuple<List<String>> actionIdTuple = surplusAndMissing(actionIds.keySet(), objectActionById.keySet());
+ final List<String> surplusActionIds = actionIdTuple.first;
+ final List<String> missingActionIds = actionIdTuple.second;
+
+ for (String surplusActionId : surplusActionIds) {
+ actionIds.get(surplusActionId).setMetadataError("No such action");
+ }
+
+ if(!missingActionIds.isEmpty()) {
+ for (String actionId : missingActionIds) {
+ List<ActionLayoutData> actions = metadata.getActions();
+ if(actions == null) {
+ actions = Lists.newArrayList();
+ metadata.setActions(actions);
+ }
+ actions.add(new ActionLayoutData(actionId));
+ }
+ }
+ }
+
+ static class Tuple<T> {
+ final T first;
+ final T second;
+ private Tuple(final T first, final T second) {
+ this.first = first;
+ this.second = second;
+ }
+ public static <T> Tuple<T> of(final T first, final T second) {
+ return new Tuple<>(first, second);
+ }
+ }
+ /**
+ * Returns a 2-element tuple of [first-second, second-first]
+ */
+ static <T> Tuple<List<T>> surplusAndMissing(final Collection<T> first, final Collection<T> second){
+ final List<T> firstNotSecond = Lists.newArrayList(first);
+ firstNotSecond.removeAll(second);
+ final List<T> secondNotFirst = Lists.newArrayList(second);
+ secondNotFirst.removeAll(first);
+ return Tuple.of(firstNotSecond, secondNotFirst);
+ }
+
+ private void overwrite(
+ final FCGrid page,
+ final Map<String, OneToOneAssociation> oneToOneAssociationById,
+ final Map<String, OneToManyAssociation> oneToManyAssociationById,
+ final Map<String, ObjectAction> objectActionById) {
+
+ final Map<String, int[]> propertySequenceByGroup = Maps.newHashMap();
+
+ page.visit(new FCGrid.VisitorAdapter() {
+ private int collectionSequence = 1;
+ private int actionDomainObjectSequence = 1;
+ private int actionPropertyGroupSequence = 1;
+ private int actionPropertySequence = 1;
+ private int actionCollectionSequence = 1;
+
+ @Override
+ public void visit(final ActionLayoutData actionLayoutData) {
+ final ActionLayoutDataOwner actionLayoutDataOwner = actionLayoutData.getOwner();
+ final ObjectAction objectAction = objectActionById.get(actionLayoutData.getId());
+ if(objectAction == null) {
+ return;
+ }
+
+ final String memberOrderName;
+ final int memberOrderSequence;
+ if(actionLayoutDataOwner instanceof FieldSet) {
+ final FieldSet fieldSet = (FieldSet) actionLayoutDataOwner;
+ final List<PropertyLayoutData> properties = fieldSet.getProperties();
+ final PropertyLayoutData propertyLayoutData = properties.get(0); // any will do
+ memberOrderName = propertyLayoutData.getId();
+ memberOrderSequence = actionPropertyGroupSequence++;
+ } else if(actionLayoutDataOwner instanceof PropertyLayoutData) {
+ final PropertyLayoutData propertyLayoutData = (PropertyLayoutData) actionLayoutDataOwner;
+ memberOrderName = propertyLayoutData.getId();
+ memberOrderSequence = actionPropertySequence++;
+ } else if(actionLayoutDataOwner instanceof CollectionLayoutData) {
+ final CollectionLayoutData collectionLayoutData = (CollectionLayoutData) actionLayoutDataOwner;
+ memberOrderName = collectionLayoutData.getId();
+ memberOrderSequence = actionCollectionSequence++;
+ } else {
+ // DomainObject
+ memberOrderName = null;
+ memberOrderSequence = actionDomainObjectSequence++;
+ }
+ FacetUtil.addFacet(
+ new MemberOrderFacetXml(memberOrderName, ""+memberOrderSequence, translationService, objectAction));
+
+
+ if(actionLayoutDataOwner instanceof FieldSet) {
+ if(actionLayoutData.getPosition() == null ||
+ actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.BELOW ||
+ actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.RIGHT) {
+ actionLayoutData.setPosition(org.apache.isis.applib.annotation.ActionLayout.Position.PANEL);
+ }
+ } else if(actionLayoutDataOwner instanceof PropertyLayoutData) {
+ if(actionLayoutData.getPosition() == null ||
+ actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.PANEL_DROPDOWN ||
+ actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.PANEL) {
+ actionLayoutData.setPosition(org.apache.isis.applib.annotation.ActionLayout.Position.BELOW);
+ }
+ } else {
+ // doesn't do anything for DomainObject or Collection
+ actionLayoutData.setPosition(null);
+ }
+
+ FacetUtil.addFacet(ActionPositionFacetForActionXml.create(actionLayoutData, objectAction));
+ FacetUtil.addFacet(BookmarkPolicyFacetForActionXml.create(actionLayoutData, objectAction));
+ FacetUtil.addFacet(CssClassFacetForActionXml.create(actionLayoutData, objectAction));
+ FacetUtil.addFacet(CssClassFaFacetForActionXml.create(actionLayoutData, objectAction));
+ FacetUtil.addFacet(DescribedAsFacetForActionXml.create(actionLayoutData, objectAction));
+ FacetUtil.addFacet(HiddenFacetForActionLayoutXml.create(actionLayoutData, objectAction));
+ FacetUtil.addFacet(NamedFacetForActionXml.create(actionLayoutData, objectAction));
+ }
+
+ @Override
+ public void visit(final PropertyLayoutData propertyLayoutData) {
+ final OneToOneAssociation oneToOneAssociation = oneToOneAssociationById.get(propertyLayoutData.getId());
+ if(oneToOneAssociation == null) {
+ return;
+ }
+
+ FacetUtil.addFacet(CssClassFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
+ FacetUtil.addFacet(DescribedAsFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
+ FacetUtil.addFacet(HiddenFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
+ FacetUtil.addFacet(LabelAtFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
+ FacetUtil.addFacet(MultiLineFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
+ FacetUtil.addFacet(NamedFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
+ FacetUtil.addFacet(
+ RenderedAdjustedFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
+ FacetUtil.addFacet(TypicalLengthFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
+
+ // @MemberOrder#name based on owning property group, @MemberOrder#sequence monotonically increasing
+ final FieldSet fieldSet = propertyLayoutData.getOwner();
+ final String groupName = fieldSet.getName();
+ final String sequence = nextInSequenceFor(groupName, propertySequenceByGroup);
+ FacetUtil.addFacet(
+ new MemberOrderFacetXml(groupName, sequence, translationService, oneToOneAssociation));
+ }
+
+ @Override
+ public void visit(final CollectionLayoutData collectionLayoutData) {
+ final OneToManyAssociation oneToManyAssociation = oneToManyAssociationById.get(collectionLayoutData.getId());
+ if(oneToManyAssociation == null) {
+ return;
+ }
+
+ FacetUtil.addFacet(CssClassFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
+ FacetUtil.addFacet(
+ DefaultViewFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
+ FacetUtil.addFacet(
+ DescribedAsFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
+ FacetUtil.addFacet(HiddenFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
+ FacetUtil.addFacet(NamedFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
+ FacetUtil.addFacet(PagedFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
+ FacetUtil.addFacet(SortedByFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
+
+ // @MemberOrder#name based on the collection's id (so that each has a single "member group")
+ final String groupName = collectionLayoutData.getId();
+ final String sequence = "" + collectionSequence++;
+ FacetUtil.addFacet(
+ new MemberOrderFacetXml(groupName, sequence, translationService, oneToManyAssociation));
+
+ // if there is only a single column and no other contents, then copy the collection Id onto the tab'
+ final MemberRegionOwner memberRegionOwner = collectionLayoutData.getOwner();
+ if(memberRegionOwner instanceof FCColumn) {
+ final FCColumn FCColumn = (FCColumn) memberRegionOwner;
+ final FCColumnOwner holder = FCColumn.getOwner();
+ if(holder instanceof FCTab) {
+ final FCTab FCTab = (FCTab) holder;
+ if(FCTab.getContents().size() == 1 && Strings.isNullOrEmpty(FCTab.getName()) ) {
+ final String collectionName = oneToManyAssociation.getName();
+ FCTab.setName(collectionName);
+ }
+ }
+ }
+ }
+ });
+ }
+
+ private String nextInSequenceFor(
+ final String key, final Map<String, int[]> seqByKey) {
+ synchronized (seqByKey) {
+ int[] holder = seqByKey.get(key);
+ if(holder == null) {
+ holder = new int[]{0};
+ seqByKey.put(key, holder);
+ }
+ holder[0]++;
+ return ""+holder[0];
+ }
+ }
+
+ private static List<OneToOneAssociation> getOneToOneAssociations(final ObjectSpecification objectSpec) {
+ List associations = objectSpec.getAssociations(Contributed.INCLUDED, ObjectAssociation.Filters.PROPERTIES);
+ return associations;
+ }
+ private static List<OneToManyAssociation> getOneToManyAssociations(final ObjectSpecification objectSpec) {
+ List associations = objectSpec.getAssociations(Contributed.INCLUDED, ObjectAssociation.Filters.COLLECTIONS);
+ return associations;
+ }
+
+ @Inject
+ SpecificationLoader specificationLookup;
+ @Inject
+ TranslationService translationService;
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/63d03d29/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizer.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizer.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizer.java
deleted file mode 100644
index 0a748a7..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizer.java
+++ /dev/null
@@ -1,25 +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.services.grid.normalizer;
-
-import org.apache.isis.applib.layout.common.Grid;
-
-public interface GridNormalizer<G extends Grid> {
-
- void normalize(final G page, final Class<?> domainClass);
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/63d03d29/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerAbstract.java
deleted file mode 100644
index 02ae566..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerAbstract.java
+++ /dev/null
@@ -1,35 +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.services.grid.normalizer;
-
-import org.apache.isis.applib.layout.common.Grid;
-import org.apache.isis.applib.services.i18n.TranslationService;
-import org.apache.isis.core.metamodel.spec.SpecificationLoader;
-
-public abstract class GridNormalizerAbstract<P extends Grid> implements GridNormalizer<P> {
-
- protected final SpecificationLoader specificationLookup;
- protected final TranslationService translationService;
-
- public GridNormalizerAbstract(
- final TranslationService translationService,
- final SpecificationLoader specificationLookup) {
- this.specificationLookup = specificationLookup;
- this.translationService = translationService;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/63d03d29/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerBS3.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerBS3.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerBS3.java
deleted file mode 100644
index 216b441..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerBS3.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.metamodel.services.grid.normalizer;
-
-import org.apache.isis.applib.layout.bootstrap3.BS3Grid;
-import org.apache.isis.applib.services.i18n.TranslationService;
-import org.apache.isis.core.metamodel.spec.SpecificationLoader;
-
-public class GridNormalizerBS3 extends GridNormalizerAbstract<BS3Grid> {
-
- public static final String TNS = "http://isis.apache.org/schema/applib/layout/bootstrap3";
- public static final String SCHEMA_LOCATION = "http://isis.apache.org/schema/applib/layout/bootstrap3/bootstrap3.xsd";
-
-
- public GridNormalizerBS3(
- final TranslationService translationService,
- final SpecificationLoader specificationLookup) {
- super(translationService, specificationLookup);
- }
-
- @Override
- public void normalize(final BS3Grid page, final Class<?> domainClass) {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/63d03d29/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerFC.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerFC.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerFC.java
deleted file mode 100644
index c80ffcf..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerFC.java
+++ /dev/null
@@ -1,399 +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.services.grid.normalizer;
-
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicReference;
-
-import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-import org.apache.isis.applib.layout.fixedcols.FCColumn;
-import org.apache.isis.applib.layout.fixedcols.FCColumnOwner;
-import org.apache.isis.applib.layout.fixedcols.FCGrid;
-import org.apache.isis.applib.layout.fixedcols.FCTab;
-import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
-import org.apache.isis.applib.layout.common.MemberRegionOwner;
-import org.apache.isis.applib.layout.common.ActionLayoutData;
-import org.apache.isis.applib.layout.common.ActionLayoutDataOwner;
-import org.apache.isis.applib.layout.common.CollectionLayoutData;
-import org.apache.isis.applib.layout.common.FieldSet;
-import org.apache.isis.applib.layout.common.PropertyLayoutData;
-import org.apache.isis.applib.services.i18n.TranslationService;
-import org.apache.isis.core.metamodel.facetapi.FacetUtil;
-import org.apache.isis.core.metamodel.facets.actions.layout.ActionPositionFacetForActionXml;
-import org.apache.isis.core.metamodel.facets.actions.layout.BookmarkPolicyFacetForActionXml;
-import org.apache.isis.core.metamodel.facets.actions.layout.CssClassFaFacetForActionXml;
-import org.apache.isis.core.metamodel.facets.actions.layout.CssClassFacetForActionXml;
-import org.apache.isis.core.metamodel.facets.actions.layout.DescribedAsFacetForActionXml;
-import org.apache.isis.core.metamodel.facets.actions.layout.HiddenFacetForActionLayoutXml;
-import org.apache.isis.core.metamodel.facets.actions.layout.NamedFacetForActionXml;
-import org.apache.isis.core.metamodel.facets.collections.layout.CssClassFacetForCollectionXml;
-import org.apache.isis.core.metamodel.facets.collections.layout.DefaultViewFacetForCollectionXml;
-import org.apache.isis.core.metamodel.facets.collections.layout.DescribedAsFacetForCollectionXml;
-import org.apache.isis.core.metamodel.facets.collections.layout.HiddenFacetForCollectionXml;
-import org.apache.isis.core.metamodel.facets.collections.layout.NamedFacetForCollectionXml;
-import org.apache.isis.core.metamodel.facets.collections.layout.PagedFacetForCollectionXml;
-import org.apache.isis.core.metamodel.facets.collections.layout.SortedByFacetForCollectionXml;
-import org.apache.isis.core.metamodel.facets.members.order.annotprop.MemberOrderFacetXml;
-import org.apache.isis.core.metamodel.facets.object.membergroups.MemberGroupLayoutFacet;
-import org.apache.isis.core.metamodel.facets.properties.propertylayout.CssClassFacetForPropertyXml;
-import org.apache.isis.core.metamodel.facets.properties.propertylayout.DescribedAsFacetForPropertyXml;
-import org.apache.isis.core.metamodel.facets.properties.propertylayout.HiddenFacetForPropertyXml;
-import org.apache.isis.core.metamodel.facets.properties.propertylayout.LabelAtFacetForPropertyXml;
-import org.apache.isis.core.metamodel.facets.properties.propertylayout.MultiLineFacetForPropertyXml;
-import org.apache.isis.core.metamodel.facets.properties.propertylayout.NamedFacetForPropertyXml;
-import org.apache.isis.core.metamodel.facets.properties.propertylayout.RenderedAdjustedFacetForPropertyXml;
-import org.apache.isis.core.metamodel.facets.properties.propertylayout.TypicalLengthFacetForPropertyXml;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.SpecificationLoader;
-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.metamodel.spec.feature.ObjectMember;
-import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-
-public class GridNormalizerFC extends GridNormalizerAbstract<FCGrid> {
-
- public static final String TNS = "http://isis.apache.org/schema/applib/layout/fixedcols";
- public static final String SCHEMA_LOCATION = "http://isis.apache.org/schema/applib/layout/fixedcols/fixedcols.xsd";
-
-
- public GridNormalizerFC(
- final TranslationService translationService,
- final SpecificationLoader specificationLookup) {
- super(translationService, specificationLookup);
- }
-
- @Override
- public void normalize(final FCGrid page, final Class<?> domainClass) {
-
- final ObjectSpecification objectSpec = specificationLookup.loadSpecification(domainClass);
-
- final Map<String, OneToOneAssociation> oneToOneAssociationById =
- ObjectMember.Util.mapById(getOneToOneAssociations(objectSpec));
- final Map<String, OneToManyAssociation> oneToManyAssociationById =
- ObjectMember.Util.mapById(getOneToManyAssociations(objectSpec));
- final Map<String, ObjectAction> objectActionById =
- ObjectMember.Util.mapById(objectSpec.getObjectActions(Contributed.INCLUDED));
-
- derive(page, oneToOneAssociationById, oneToManyAssociationById, objectActionById);
- overwrite(page, oneToOneAssociationById, oneToManyAssociationById, objectActionById);
- }
-
- /**
- * Ensures that all object members (properties, collections and actions) are in the metadata.
- *
- * <p>
- * If they are missing then they will be added to default tabs (created on the fly if need be).
- * </p>
- */
- private static void derive(
- final FCGrid metadata,
- final Map<String, OneToOneAssociation> oneToOneAssociationById,
- final Map<String, OneToManyAssociation> oneToManyAssociationById,
- final Map<String, ObjectAction> objectActionById) {
-
- final LinkedHashMap<String, PropertyLayoutData> propertyIds = metadata.getAllPropertiesById();
- final LinkedHashMap<String, CollectionLayoutData> collectionIds = metadata.getAllCollectionsById();
- final LinkedHashMap<String, ActionLayoutData> actionIds = metadata.getAllActionsById();
-
- final AtomicReference<FieldSet> defaultPropertyGroupRef = new AtomicReference<>();
- final AtomicReference<FCColumn> firstColumnRef = new AtomicReference<>();
- final AtomicReference<FCTabGroup> lastTabGroupRef = new AtomicReference<>();
-
- // capture the first column, and also
- // capture the first property group (if any) with the default name ('General')
- metadata.visit(new FCGrid.VisitorAdapter() {
- @Override
- public void visit(final FCColumn fcColumn) {
- firstColumnRef.compareAndSet(null, fcColumn);
- }
- @Override
- public void visit(final FieldSet fieldSet) {
- if(MemberGroupLayoutFacet.DEFAULT_GROUP.equals(fieldSet.getName())) {
- defaultPropertyGroupRef.compareAndSet(null, fieldSet);
- }
- }
- @Override
- public void visit(final FCTabGroup fcTabGroup) {
- lastTabGroupRef.set(fcTabGroup);
- }
- });
-
- // any missing properties will be added to the (first) 'General' property group found
- // if there is no default ('General') property group
- // then one will be added to the first Column of the first Tab.
- final Tuple<List<String>> propertyIdTuple = surplusAndMissing(propertyIds.keySet(), oneToOneAssociationById.keySet());
- final List<String> surplusPropertyIds = propertyIdTuple.first;
- final List<String> missingPropertyIds = propertyIdTuple.second;
-
- for (String surplusPropertyId : surplusPropertyIds) {
- propertyIds.get(surplusPropertyId).setMetadataError("No such property");
- }
-
- if(!missingPropertyIds.isEmpty()) {
- // ensure that there is a property group to use
- boolean wasSet = defaultPropertyGroupRef.compareAndSet(null, new FieldSet(MemberGroupLayoutFacet.DEFAULT_GROUP));
- final FieldSet defaultFieldSet = defaultPropertyGroupRef.get();
- if(wasSet) {
- firstColumnRef.get().getFieldSets().add(defaultFieldSet);
- }
- for (final String propertyId : missingPropertyIds) {
- defaultFieldSet.getProperties().add(new PropertyLayoutData(propertyId));
- }
- }
-
-
- // any missing collections will be added as tabs to the last TabGroup.
- // If there is only a single tab group then a new TabGroup will be added first
- final Tuple<List<String>> collectionIdTuple = surplusAndMissing(collectionIds.keySet(), oneToManyAssociationById.keySet());
- final List<String> surplusCollectionIds = collectionIdTuple.first;
- final List<String> missingCollectionIds = collectionIdTuple.second;
-
- for (String surplusCollectionId : surplusCollectionIds) {
- collectionIds.get(surplusCollectionId).setMetadataError("No such collection");
- }
-
- if(!missingCollectionIds.isEmpty()) {
- while(metadata.getTabGroups().size() < 2) {
- final FCTabGroup tabGroup = new FCTabGroup();
- metadata.getTabGroups().add(tabGroup);
- lastTabGroupRef.set(tabGroup);
- }
- final FCTabGroup lastTabGroup = lastTabGroupRef.get();
- for (final String collectionId : missingCollectionIds) {
- final FCTab FCTab = new FCTab();
- lastTabGroup.getTabs().add(FCTab);
- FCColumn left = new FCColumn(12);
- FCTab.setLeft(left);
- final CollectionLayoutData layoutMetadata = new CollectionLayoutData(collectionId);
- layoutMetadata.setDefaultView("table");
- left.getCollections().add(layoutMetadata);
- }
- }
-
- // any missing actions will be added as domain object actions (in the header)
- final Tuple<List<String>> actionIdTuple = surplusAndMissing(actionIds.keySet(), objectActionById.keySet());
- final List<String> surplusActionIds = actionIdTuple.first;
- final List<String> missingActionIds = actionIdTuple.second;
-
- for (String surplusActionId : surplusActionIds) {
- actionIds.get(surplusActionId).setMetadataError("No such action");
- }
-
- if(!missingActionIds.isEmpty()) {
- for (String actionId : missingActionIds) {
- List<ActionLayoutData> actions = metadata.getActions();
- if(actions == null) {
- actions = Lists.newArrayList();
- metadata.setActions(actions);
- }
- actions.add(new ActionLayoutData(actionId));
- }
- }
- }
-
- static class Tuple<T> {
- final T first;
- final T second;
- private Tuple(final T first, final T second) {
- this.first = first;
- this.second = second;
- }
- public static <T> Tuple<T> of(final T first, final T second) {
- return new Tuple<>(first, second);
- }
- }
- /**
- * Returns a 2-element tuple of [first-second, second-first]
- */
- static <T> Tuple<List<T>> surplusAndMissing(final Collection<T> first, final Collection<T> second){
- final List<T> firstNotSecond = Lists.newArrayList(first);
- firstNotSecond.removeAll(second);
- final List<T> secondNotFirst = Lists.newArrayList(second);
- secondNotFirst.removeAll(first);
- return Tuple.of(firstNotSecond, secondNotFirst);
- }
-
- private void overwrite(
- final FCGrid page,
- final Map<String, OneToOneAssociation> oneToOneAssociationById,
- final Map<String, OneToManyAssociation> oneToManyAssociationById,
- final Map<String, ObjectAction> objectActionById) {
-
- final Map<String, int[]> propertySequenceByGroup = Maps.newHashMap();
-
- page.visit(new FCGrid.VisitorAdapter() {
- private int collectionSequence = 1;
- private int actionDomainObjectSequence = 1;
- private int actionPropertyGroupSequence = 1;
- private int actionPropertySequence = 1;
- private int actionCollectionSequence = 1;
-
- @Override
- public void visit(final ActionLayoutData actionLayoutData) {
- final ActionLayoutDataOwner actionLayoutDataOwner = actionLayoutData.getOwner();
- final ObjectAction objectAction = objectActionById.get(actionLayoutData.getId());
- if(objectAction == null) {
- return;
- }
-
- final String memberOrderName;
- final int memberOrderSequence;
- if(actionLayoutDataOwner instanceof FieldSet) {
- final FieldSet fieldSet = (FieldSet) actionLayoutDataOwner;
- final List<PropertyLayoutData> properties = fieldSet.getProperties();
- final PropertyLayoutData propertyLayoutData = properties.get(0); // any will do
- memberOrderName = propertyLayoutData.getId();
- memberOrderSequence = actionPropertyGroupSequence++;
- } else if(actionLayoutDataOwner instanceof PropertyLayoutData) {
- final PropertyLayoutData propertyLayoutData = (PropertyLayoutData) actionLayoutDataOwner;
- memberOrderName = propertyLayoutData.getId();
- memberOrderSequence = actionPropertySequence++;
- } else if(actionLayoutDataOwner instanceof CollectionLayoutData) {
- final CollectionLayoutData collectionLayoutData = (CollectionLayoutData) actionLayoutDataOwner;
- memberOrderName = collectionLayoutData.getId();
- memberOrderSequence = actionCollectionSequence++;
- } else {
- // DomainObject
- memberOrderName = null;
- memberOrderSequence = actionDomainObjectSequence++;
- }
- FacetUtil.addFacet(
- new MemberOrderFacetXml(memberOrderName, ""+memberOrderSequence, translationService, objectAction));
-
-
- if(actionLayoutDataOwner instanceof FieldSet) {
- if(actionLayoutData.getPosition() == null ||
- actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.BELOW ||
- actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.RIGHT) {
- actionLayoutData.setPosition(org.apache.isis.applib.annotation.ActionLayout.Position.PANEL);
- }
- } else if(actionLayoutDataOwner instanceof PropertyLayoutData) {
- if(actionLayoutData.getPosition() == null ||
- actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.PANEL_DROPDOWN ||
- actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.PANEL) {
- actionLayoutData.setPosition(org.apache.isis.applib.annotation.ActionLayout.Position.BELOW);
- }
- } else {
- // doesn't do anything for DomainObject or Collection
- actionLayoutData.setPosition(null);
- }
-
- FacetUtil.addFacet(ActionPositionFacetForActionXml.create(actionLayoutData, objectAction));
- FacetUtil.addFacet(BookmarkPolicyFacetForActionXml.create(actionLayoutData, objectAction));
- FacetUtil.addFacet(CssClassFacetForActionXml.create(actionLayoutData, objectAction));
- FacetUtil.addFacet(CssClassFaFacetForActionXml.create(actionLayoutData, objectAction));
- FacetUtil.addFacet(DescribedAsFacetForActionXml.create(actionLayoutData, objectAction));
- FacetUtil.addFacet(HiddenFacetForActionLayoutXml.create(actionLayoutData, objectAction));
- FacetUtil.addFacet(NamedFacetForActionXml.create(actionLayoutData, objectAction));
- }
-
- @Override
- public void visit(final PropertyLayoutData propertyLayoutData) {
- final OneToOneAssociation oneToOneAssociation = oneToOneAssociationById.get(propertyLayoutData.getId());
- if(oneToOneAssociation == null) {
- return;
- }
-
- FacetUtil.addFacet(CssClassFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
- FacetUtil.addFacet(DescribedAsFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
- FacetUtil.addFacet(HiddenFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
- FacetUtil.addFacet(LabelAtFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
- FacetUtil.addFacet(MultiLineFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
- FacetUtil.addFacet(NamedFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
- FacetUtil.addFacet(
- RenderedAdjustedFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
- FacetUtil.addFacet(TypicalLengthFacetForPropertyXml.create(propertyLayoutData, oneToOneAssociation));
-
- // @MemberOrder#name based on owning property group, @MemberOrder#sequence monotonically increasing
- final FieldSet fieldSet = propertyLayoutData.getOwner();
- final String groupName = fieldSet.getName();
- final String sequence = nextInSequenceFor(groupName, propertySequenceByGroup);
- FacetUtil.addFacet(
- new MemberOrderFacetXml(groupName, sequence, translationService, oneToOneAssociation));
- }
-
- @Override
- public void visit(final CollectionLayoutData collectionLayoutData) {
- final OneToManyAssociation oneToManyAssociation = oneToManyAssociationById.get(collectionLayoutData.getId());
- if(oneToManyAssociation == null) {
- return;
- }
-
- FacetUtil.addFacet(CssClassFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
- FacetUtil.addFacet(
- DefaultViewFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
- FacetUtil.addFacet(
- DescribedAsFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
- FacetUtil.addFacet(HiddenFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
- FacetUtil.addFacet(NamedFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
- FacetUtil.addFacet(PagedFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
- FacetUtil.addFacet(SortedByFacetForCollectionXml.create(collectionLayoutData, oneToManyAssociation));
-
- // @MemberOrder#name based on the collection's id (so that each has a single "member group")
- final String groupName = collectionLayoutData.getId();
- final String sequence = "" + collectionSequence++;
- FacetUtil.addFacet(
- new MemberOrderFacetXml(groupName, sequence, translationService, oneToManyAssociation));
-
- // if there is only a single column and no other contents, then copy the collection Id onto the tab'
- final MemberRegionOwner memberRegionOwner = collectionLayoutData.getOwner();
- if(memberRegionOwner instanceof FCColumn) {
- final FCColumn FCColumn = (FCColumn) memberRegionOwner;
- final FCColumnOwner holder = FCColumn.getOwner();
- if(holder instanceof FCTab) {
- final FCTab FCTab = (FCTab) holder;
- if(FCTab.getContents().size() == 1 && Strings.isNullOrEmpty(FCTab.getName()) ) {
- final String collectionName = oneToManyAssociation.getName();
- FCTab.setName(collectionName);
- }
- }
- }
- }
- });
- }
-
- private String nextInSequenceFor(
- final String key, final Map<String, int[]> seqByKey) {
- synchronized (seqByKey) {
- int[] holder = seqByKey.get(key);
- if(holder == null) {
- holder = new int[]{0};
- seqByKey.put(key, holder);
- }
- holder[0]++;
- return ""+holder[0];
- }
- }
-
- private static List<OneToOneAssociation> getOneToOneAssociations(final ObjectSpecification objectSpec) {
- List associations = objectSpec.getAssociations(Contributed.INCLUDED, ObjectAssociation.Filters.PROPERTIES);
- return associations;
- }
- private static List<OneToManyAssociation> getOneToManyAssociations(final ObjectSpecification objectSpec) {
- List associations = objectSpec.getAssociations(Contributed.INCLUDED, ObjectAssociation.Filters.COLLECTIONS);
- return associations;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/63d03d29/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerService.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerService.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerService.java
deleted file mode 100644
index fc18a15..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerService.java
+++ /dev/null
@@ -1,37 +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.services.grid.normalizer;
-
-import java.util.List;
-
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.layout.common.Grid;
-import org.apache.isis.core.metamodel.services.grid.GridServiceDefault;
-
-/**
- * Internal SPI used by {@link GridServiceDefault}.
- */
-public interface GridNormalizerService {
-
- @Programmatic
- List<Class<? extends Grid>> pageImplementations();
-
- @Programmatic
- void normalize(Grid grid, Class<?> domainClass);
-
- String schemaLocationsFor(final Grid fcGrid);
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/63d03d29/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerServiceDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerServiceDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerServiceDefault.java
deleted file mode 100644
index 61f8426..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/grid/normalizer/GridNormalizerServiceDefault.java
+++ /dev/null
@@ -1,110 +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.services.grid.normalizer;
-
-import java.util.List;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.Lists;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.NatureOfService;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.layout.bootstrap3.BS3Grid;
-import org.apache.isis.applib.layout.fixedcols.FCGrid;
-import org.apache.isis.applib.layout.common.Grid;
-import org.apache.isis.applib.services.i18n.TranslationService;
-import org.apache.isis.core.metamodel.spec.SpecificationLoader;
-import org.apache.isis.core.metamodel.spec.SpecificationLoaderAware;
-
-@DomainService(
- nature = NatureOfService.DOMAIN
-)
-public class GridNormalizerServiceDefault implements GridNormalizerService, SpecificationLoaderAware {
-
- private static final Logger LOG = LoggerFactory.getLogger(GridNormalizerServiceDefault.class);
-
- public static final String COMMON_TNS = "http://isis.apache.org/schema/applib/layout/common";
- public static final String COMMON_SCHEMA_LOCATION = "http://isis.apache.org/schema/applib/layout/common/common.xsd";
-
- private SpecificationLoader specificationLookup;
-
- private GridNormalizerFC pageNormalizerFC;
- private GridNormalizerBS3 pageNormalizerBS3;
-
- @PostConstruct
- @Programmatic
- public void init() {
- pageNormalizerFC = new GridNormalizerFC(translationService, specificationLookup);
- pageNormalizerBS3 = new GridNormalizerBS3(translationService, specificationLookup);
- }
-
- @Programmatic
- @Override
- public List<Class<? extends Grid>> pageImplementations() {
- List<Class<? extends Grid>> ar = Lists.newArrayList();
- ar.add(FCGrid.class);
- ar.add(BS3Grid.class);
- return ar;
- }
-
- @Override
- public void normalize(final Grid grid, final Class<?> domainClass) {
-
- if(grid instanceof FCGrid) {
- final FCGrid fcPage = (FCGrid) grid;
- pageNormalizerFC.normalize(fcPage, domainClass);
- } else
- if(grid instanceof BS3Grid) {
- final BS3Grid bs3Page = (BS3Grid) grid;
- pageNormalizerBS3.normalize(bs3Page, domainClass);
- }
-
- grid.setNormalized(true);
- }
-
- @Override
- public String schemaLocationsFor(final Grid grid) {
- final List<String> parts = Lists.newArrayList();
- parts.add(COMMON_TNS);
- parts.add(COMMON_SCHEMA_LOCATION);
- if(grid instanceof FCGrid) {
- parts.add(GridNormalizerFC.TNS);
- parts.add(GridNormalizerFC.SCHEMA_LOCATION);
- }
- if(grid instanceof BS3Grid) {
- parts.add(GridNormalizerBS3.TNS);
- parts.add(GridNormalizerBS3.SCHEMA_LOCATION);
- }
- return Joiner.on(" ").join(parts);
- }
-
- @Override
- public void setSpecificationLoader(final SpecificationLoader specificationLookup) {
- this.specificationLookup = specificationLookup;
- }
-
- @Inject
- TranslationService translationService;
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/63d03d29/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/bootstrap3/BS3GridTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/bootstrap3/BS3GridTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/bootstrap3/BS3GridTest.java
deleted file mode 100644
index e649ec0..0000000
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/bootstrap3/BS3GridTest.java
+++ /dev/null
@@ -1,149 +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.layout.bootstrap3;
-
-import java.util.Map;
-
-import javax.xml.bind.Marshaller;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.isis.applib.layout.bootstrap3.BS3Col;
-import org.apache.isis.applib.layout.bootstrap3.BS3Grid;
-import org.apache.isis.applib.layout.bootstrap3.BS3Row;
-import org.apache.isis.applib.layout.bootstrap3.BS3Tab;
-import org.apache.isis.applib.layout.bootstrap3.BS3TabGroup;
-import org.apache.isis.applib.layout.common.ActionLayoutData;
-import org.apache.isis.applib.layout.common.CollectionLayoutData;
-import org.apache.isis.applib.layout.common.DomainObjectLayoutData;
-import org.apache.isis.applib.layout.common.FieldSet;
-import org.apache.isis.applib.layout.common.PropertyLayoutData;
-import org.apache.isis.applib.services.jaxb.JaxbService;
-import org.apache.isis.core.metamodel.services.grid.normalizer.GridNormalizerServiceDefault;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-public class BS3GridTest {
-
- private JaxbService jaxbService;
-
- @Before
- public void setUp() throws Exception {
- jaxbService = new JaxbService.Simple();
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void xxx() throws Exception {
-
- final BS3Grid bs3Page = new BS3Grid();
-
- // header
- final BS3Row headerRow = bs3Page.getRows().get(0);
- final BS3Col headerCol = (BS3Col) headerRow.getCols().get(0);
- headerCol.setSpan(12);
-
- final DomainObjectLayoutData objectLayoutData = new DomainObjectLayoutData();
- headerCol.setDomainObject(objectLayoutData);
-
- final ActionLayoutData deleteActionLayoutData = new ActionLayoutData();
- deleteActionLayoutData.setId("delete");
- headerCol.setActions(Lists.<ActionLayoutData>newArrayList());
- headerCol.getActions().add(deleteActionLayoutData);
-
- // content
- final BS3Row contentRow = new BS3Row();
- bs3Page.getRows().add(contentRow);
-
- final BS3Col contentCol = (BS3Col) contentRow.getCols().get(0);
- contentCol.setSpan(12);
-
- // a tabgroup containing a 'Common' tab
- final BS3TabGroup tabGroup = new BS3TabGroup();
- contentCol.getTabGroups().add(tabGroup);
- BS3Tab bs3Tab = tabGroup.getTabs().get(0);
- bs3Tab.setName("Common");
-
- // with a left col...
- final BS3Row tabRow = bs3Tab.getRows().get(0);
- final BS3Col tabLeftCol = (BS3Col) tabRow.getCols().get(0);
- tabLeftCol.setSpan(6);
-
- // containing a fieldset
- final FieldSet leftPropGroup = new FieldSet("General");
- tabLeftCol.setFieldSets(Lists.<FieldSet>newArrayList());
- tabLeftCol.getFieldSets().add(leftPropGroup);
- leftPropGroup.setName("General");
-
- // with a single property
- final PropertyLayoutData namePropertyLayoutData = leftPropGroup.getProperties().get(0);
- namePropertyLayoutData.setNamed("name");
-
- // and its associated action
- final ActionLayoutData updateNameActionLayoutData = new ActionLayoutData();
- updateNameActionLayoutData.setId("updateName");
- namePropertyLayoutData.setActions(Lists.<ActionLayoutData>newArrayList());
- namePropertyLayoutData.getActions().add(updateNameActionLayoutData);
-
- // and the tab also has a right col...
- final BS3Col tabRightCol = (BS3Col) tabRow.getCols().get(0);
- tabRightCol.setSpan(6);
-
- // containing a collection
- final CollectionLayoutData similarToColl = new CollectionLayoutData();
- tabRightCol.setCollections(Lists.<CollectionLayoutData>newArrayList());
- tabRightCol.getCollections().add(similarToColl);
- similarToColl.setId("similarTo");
-
-
- final String schemaLocations = new GridNormalizerServiceDefault().schemaLocationsFor(bs3Page);
- String xml = jaxbService.toXml(bs3Page,
- ImmutableMap.<String,Object>of(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocations));
- System.out.println(xml);
-
- BS3Grid bs3Pageroundtripped = jaxbService.fromXml(BS3Grid.class, xml);
- String xmlRoundtripped = jaxbService.toXml(bs3Pageroundtripped,
- ImmutableMap.<String,Object>of(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocations));
- assertThat(xml, is(equalTo(xmlRoundtripped)));
-
-
- System.out.println("==========");
-
- dumpXsd(bs3Page);
- }
-
- protected void dumpXsd(final BS3Grid bs3Page) {
- Map<String, String> schemas = jaxbService.toXsd(bs3Page, JaxbService.IsisSchemas.INCLUDE);
- for (Map.Entry<String, String> entry : schemas.entrySet()) {
- System.out.println(entry.getKey() + ":");
- System.out.println(entry.getValue());
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/63d03d29/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/fixedcols/FCGridTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/fixedcols/FCGridTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/fixedcols/FCGridTest.java
deleted file mode 100644
index 82f6dd3..0000000
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layout/fixedcols/FCGridTest.java
+++ /dev/null
@@ -1,120 +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.layout.fixedcols;
-
-import java.util.Map;
-
-import javax.xml.bind.Marshaller;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.isis.applib.layout.fixedcols.FCColumn;
-import org.apache.isis.applib.layout.fixedcols.FCGrid;
-import org.apache.isis.applib.layout.fixedcols.FCTab;
-import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
-import org.apache.isis.applib.layout.common.ActionLayoutData;
-import org.apache.isis.applib.layout.common.CollectionLayoutData;
-import org.apache.isis.applib.layout.common.FieldSet;
-import org.apache.isis.applib.layout.common.PropertyLayoutData;
-import org.apache.isis.applib.services.jaxb.JaxbService;
-import org.apache.isis.core.metamodel.services.grid.normalizer.GridNormalizerServiceDefault;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-public class FCGridTest {
-
- private JaxbService jaxbService;
-
- @Before
- public void setUp() throws Exception {
- jaxbService = new JaxbService.Simple();
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
- @Test
- public void xxx() throws Exception {
-
- final FCGrid fcPage = new FCGrid();
-
- fcPage.setTabGroups(Lists.<FCTabGroup>newArrayList());
- fcPage.getTabGroups().add(new FCTabGroup());
- FCTabGroup tabGroup = fcPage.getTabGroups().get(0);
- FCTab FCTab = tabGroup.getTabs().get(0);
- FCTab.setName("Common");
- FCColumn left = FCTab.getLeft();
-
- FieldSet leftPropGroup = new FieldSet();
- left.setFieldSets(Lists.<FieldSet>newArrayList());
- left.getFieldSets().add(leftPropGroup);
- leftPropGroup.setName("General");
-
- CollectionLayoutData similarToColl = new CollectionLayoutData();
- left.setCollections(Lists.<CollectionLayoutData>newArrayList());
- left.getCollections().add(similarToColl);
- similarToColl.setId("similarTo");
-
- left.getFieldSets().add(new FieldSet("General"));
- PropertyLayoutData namePropertyLayoutData = new PropertyLayoutData("name");
- left.getFieldSets().get(0).getProperties().add(namePropertyLayoutData);
-
- ActionLayoutData updateNameActionLayoutData = new ActionLayoutData();
- updateNameActionLayoutData.setId("updateName");
- namePropertyLayoutData.setActions(Lists.<ActionLayoutData>newArrayList());
- namePropertyLayoutData.getActions().add(updateNameActionLayoutData);
-
- ActionLayoutData deleteActionLayoutData = new ActionLayoutData();
- deleteActionLayoutData.setId("delete");
- fcPage.setActions(Lists.<ActionLayoutData>newArrayList());
- fcPage.getActions().add(deleteActionLayoutData);
-
- final String schemaLocations = new GridNormalizerServiceDefault().schemaLocationsFor(fcPage);
- String xml = jaxbService.toXml(fcPage,
- ImmutableMap.<String,Object>of(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocations));
- System.out.println(xml);
-
- FCGrid fcPageRoundtripped = jaxbService.fromXml(FCGrid.class, xml);
- String xmlRoundtripped = jaxbService.toXml(fcPageRoundtripped,
- ImmutableMap.<String,Object>of(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocations));
- assertThat(xml, is(equalTo(xmlRoundtripped)));
-
-
- System.out.println("==========");
-
- dumpXsd(fcPage);
- }
-
- protected void dumpXsd(final FCGrid fcPage) {
- Map<String, String> schemas = jaxbService.toXsd(fcPage, JaxbService.IsisSchemas.INCLUDE);
- for (Map.Entry<String, String> entry : schemas.entrySet()) {
- System.out.println(entry.getKey() + ":");
- System.out.println(entry.getValue());
- }
- }
-}
\ No newline at end of file
[07/15] isis git commit: ISIS-993: bootstrap3 layout working,
more or less. Still need to do the normalization phase.
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanelFactory.java
index 30b2ce3..f4c3d62 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanelFactory.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/selector/links/EntityLinksSelectorPanelFactory.java
@@ -22,10 +22,17 @@ package org.apache.isis.viewer.wicket.ui.components.entity.selector.links;
import org.apache.wicket.Component;
import org.apache.wicket.model.IModel;
+import org.apache.isis.applib.layout.bootstrap3.BS3Page;
+import org.apache.isis.applib.layout.common.Page;
+import org.apache.isis.applib.layout.fixedcols.FCPage;
+import org.apache.isis.core.metamodel.facets.object.layoutmetadata.PageFacet;
+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.layout.bs3.BS3PagePanel;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.FCPagePanel;
/**
* {@link ComponentFactory} for {@link EntityLinksSelectorPanel}.
@@ -41,7 +48,20 @@ public class EntityLinksSelectorPanelFactory extends EntityComponentFactoryAbstr
@Override
public Component createComponent(final String id, final IModel<?> model) {
final EntityModel entityModel = (EntityModel) model;
+
+ final ObjectSpecification specification = entityModel.getTypeOfSpecification();
+ final PageFacet facet = specification.getFacet(PageFacet.class);
+
+ final Page page = facet.getPage();
+ if (page != null) {
+ final EntityModel entityModelWithLayoutMetadata = entityModel.cloneWithLayoutMetadata(page);
+ if(page instanceof FCPage) {
+ return new FCPagePanel(id, entityModelWithLayoutMetadata);
+ }
+ if(page instanceof BS3Page) {
+ return new BS3PagePanel(id, entityModelWithLayoutMetadata);
+ }
+ }
return new EntityLinksSelectorPanel(id, entityModel, this);
}
-
}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/EntityPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/EntityPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/EntityPanelFactory.java
new file mode 100644
index 0000000..d2e4a9f
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/EntityPanelFactory.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.viewer.wicket.ui.components.layout;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+
+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.layout.fallback.EntityEditablePanel;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.FCPagePanel;
+
+/**
+ * {@link ComponentFactory} for {@link FCPagePanel}.
+ */
+public class EntityPanelFactory extends EntityComponentFactoryAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String NAME = "tabbed";
+
+ public EntityPanelFactory() {
+ super(ComponentType.ENTITY, NAME, EntityEditablePanel.class);
+ }
+
+ @Override
+ public Component createComponent(final String id, final IModel<?> model) {
+ final EntityModel entityModel = (EntityModel) model;
+ return new EntityEditablePanel(id, entityModel);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3PagePanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3PagePanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3PagePanel.html
new file mode 100644
index 0000000..e21e576
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3PagePanel.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="rows">
+ [rows]
+ </div>
+</wicket:panel>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3PagePanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3PagePanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3PagePanel.java
new file mode 100644
index 0000000..58dcd2a
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/BS3PagePanel.java
@@ -0,0 +1,66 @@
+/*
+ * 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.layout.bs3;
+
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.repeater.RepeatingView;
+
+import org.apache.isis.applib.layout.bootstrap3.BS3ElementAbstract;
+import org.apache.isis.applib.layout.bootstrap3.BS3Page;
+import org.apache.isis.applib.layout.bootstrap3.BS3Row;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.components.layout.bs3.row.Row;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+public class BS3PagePanel extends PanelAbstract<EntityModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_ROWS = "rows";
+
+ private final BS3Page bs3Page;
+
+ public BS3PagePanel(final String id, final EntityModel entityModel) {
+ super(id, entityModel);
+ this.bs3Page = (BS3Page) entityModel.getLayoutMetadata();
+ buildGui();
+ }
+
+ private void buildGui() {
+
+ Util.appendCssClassIfRequired(this, bs3Page);
+
+ final RepeatingView rv = new RepeatingView(ID_ROWS);
+
+ final BS3ElementAbstract element = this.bs3Page;
+
+ for(final BS3Row bs3Row: this.bs3Page.getRows()) {
+
+ final String id = rv.newChildId();
+ final EntityModel entityModelWithHints = getModel().cloneWithLayoutMetadata(bs3Row);
+
+ final WebMarkupContainer row = new Row(id, entityModelWithHints);
+
+ rv.add(row);
+ }
+ add(rv);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/Util.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/Util.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/Util.java
new file mode 100644
index 0000000..0b189e3
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/Util.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.viewer.wicket.ui.components.layout.bs3;
+
+import org.apache.wicket.MarkupContainer;
+
+import org.apache.isis.applib.layout.bootstrap3.BS3ElementAbstract;
+import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
+
+public class Util {
+
+ private Util(){}
+
+ public static void appendCssClassIfRequired(final MarkupContainer markupContainer, final BS3ElementAbstract element) {
+ final String cssClass = element.getCssClass();
+ if(cssClass != null) {
+ CssClassAppender.appendCssClassTo(markupContainer, cssClass);
+ }
+ }
+ public static void appendCssClass(final MarkupContainer markupContainer, final BS3ElementAbstract element, final String existingCssClass) {
+ final String cssClass = existingCssClass + " " + element.getCssClass();
+ CssClassAppender.appendCssClassTo(markupContainer, cssClass);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/clearfix/ClearFix.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/clearfix/ClearFix.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/clearfix/ClearFix.html
new file mode 100644
index 0000000..4502685
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/clearfix/ClearFix.html
@@ -0,0 +1,26 @@
+<?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="clearfix"/>
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/clearfix/ClearFix.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/clearfix/ClearFix.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/clearfix/ClearFix.java
new file mode 100644
index 0000000..e33c5fd
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/clearfix/ClearFix.java
@@ -0,0 +1,69 @@
+/*
+ * 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.layout.bs3.clearfix;
+
+import org.apache.wicket.markup.html.WebMarkupContainer;
+
+import org.apache.isis.applib.layout.bootstrap3.BS3ClearFix;
+import org.apache.isis.core.runtime.system.DeploymentType;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.components.layout.bs3.Util;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
+
+public class ClearFix extends PanelAbstract<EntityModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_COL = "clearfix";
+
+ private final BS3ClearFix bs3ClearFix;
+
+ public ClearFix(
+ final String id,
+ final EntityModel entityModel) {
+
+ super(id, entityModel);
+
+ bs3ClearFix = (BS3ClearFix) entityModel.getLayoutMetadata();
+
+ buildGui();
+ }
+
+ private void buildGui() {
+
+ setRenderBodyOnly(true);
+ Util.appendCssClassIfRequired(this, bs3ClearFix);
+
+ final WebMarkupContainer div = new WebMarkupContainer(ID_COL);
+ CssClassAppender.appendCssClassTo(div, bs3ClearFix.toCssClass());
+
+ this.addOrReplace(div);
+ }
+
+ ///////////////////////////////////////////////////////
+ // Dependencies (from context)
+ ///////////////////////////////////////////////////////
+
+ protected DeploymentType getDeploymentType() {
+ return IsisContext.getDeploymentType();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/col/Col.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/col/Col.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/col/Col.html
new file mode 100644
index 0000000..7c84140
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/col/Col.html
@@ -0,0 +1,46 @@
+<?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="col">
+ <div class="entityHeaderPanel" wicket:id="entityHeaderPanel">
+ <h4 class="iconAndTitle">
+ <div wicket:id="entityIconTitleAndCopylink" class="iconAndTitleLabel entityIconTitleAndCopylink">[icon and title]</div>
+ <div class="entityActions" wicket:id="entityActions"></div>
+ <div class="clearfix"></div>
+ </h4>
+ </div>
+ <div class="actions" wicket:id="actions">
+ [actions]
+ </div>
+ <div class="tabGroups" wicket:id="tabGroups">
+ [tab groups]
+ </div>
+ <div class="fieldSets" wicket:id="fieldSets">
+ [fieldsets]
+ </div>
+ <div class="collections" wicket:id="collections">
+ [collections]
+ </div>
+ </div>
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/col/Col.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/col/Col.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/col/Col.java
new file mode 100644
index 0000000..dec8da6
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/col/Col.java
@@ -0,0 +1,207 @@
+/*
+ * 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.layout.bs3.col;
+
+import java.util.List;
+
+import javax.annotation.Nullable;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicates;
+import com.google.common.collect.FluentIterable;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.repeater.RepeatingView;
+
+import org.apache.isis.applib.layout.bootstrap3.BS3Col;
+import org.apache.isis.applib.layout.bootstrap3.BS3TabGroup;
+import org.apache.isis.applib.layout.common.ActionLayoutData;
+import org.apache.isis.applib.layout.common.CollectionLayoutData;
+import org.apache.isis.applib.layout.common.DomainObjectLayoutData;
+import org.apache.isis.applib.layout.common.FieldSet;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+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.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.actionmenu.entityactions.AdditionalLinksPanel;
+import org.apache.isis.viewer.wicket.ui.components.actionmenu.entityactions.EntityActionUtil;
+import org.apache.isis.viewer.wicket.ui.components.entity.collection.EntityCollectionPanel;
+import org.apache.isis.viewer.wicket.ui.components.entity.fieldset.PropertyGroup;
+import org.apache.isis.viewer.wicket.ui.components.layout.bs3.Util;
+import org.apache.isis.viewer.wicket.ui.components.layout.bs3.tabs.TabGroupPanel;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+import org.apache.isis.viewer.wicket.ui.util.Components;
+import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
+
+public class Col extends PanelAbstract<EntityModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_COL = "col";
+
+ private final BS3Col bs3Col;
+
+ public Col(
+ final String id,
+ final EntityModel entityModel) {
+
+ super(id, entityModel);
+
+ bs3Col = (BS3Col) entityModel.getLayoutMetadata();
+
+ buildGui();
+ }
+
+ private void buildGui() {
+
+ setRenderBodyOnly(true);
+
+ final WebMarkupContainer div = new WebMarkupContainer(ID_COL);
+
+ CssClassAppender.appendCssClassTo(div, bs3Col.toCssClass());
+ Util.appendCssClass(div, bs3Col, "col");
+
+ this.addOrReplace(div);
+
+ // icon/title
+ final DomainObjectLayoutData domainObject = bs3Col.getDomainObject();
+
+ final WebMarkupContainer actionOwner;
+ final String actionIdToUse;
+ final String actionIdToHide;
+ if(domainObject != null) {
+ final WebMarkupContainer entityHeaderPanel = new WebMarkupContainer("entityHeaderPanel");
+ div.add(entityHeaderPanel);
+ final ComponentFactory componentFactory =
+ getComponentFactoryRegistry().findComponentFactory(ComponentType.ENTITY_ICON_TITLE_AND_COPYLINK, getModel());
+ final Component component = componentFactory.createComponent(getModel());
+ entityHeaderPanel.addOrReplace(component);
+
+ actionOwner = entityHeaderPanel;
+ actionIdToUse = "entityActions";
+ actionIdToHide = "actions";
+ } else {
+ Components.permanentlyHide(div, "entityHeaderPanel");
+ actionOwner = div;
+ actionIdToUse = "actions";
+ actionIdToHide = null;
+ }
+
+
+ // actions
+ // (rendering depends on whether also showing the icon/title)
+ final List<ActionLayoutData> actionLayoutDatas = bs3Col.getActions();
+ final List<ObjectAction> objectActions =
+ FluentIterable.from(actionLayoutDatas)
+ .transform(new Function<ActionLayoutData, ObjectAction>() {
+ @Nullable @Override public ObjectAction apply(@Nullable final ActionLayoutData actionLayoutData) {
+ return getModel().getTypeOfSpecification().getObjectAction(actionLayoutData.getId());
+ }
+ })
+ .filter(Predicates.<ObjectAction>notNull())
+ .toList();
+ final List<LinkAndLabel> entityActionLinks = EntityActionUtil.asLinkAndLabelsForAdditionalLinksPanel(getModel(), objectActions);
+
+ if(!entityActionLinks.isEmpty()) {
+ AdditionalLinksPanel.addAdditionalLinks(actionOwner, actionIdToUse, entityActionLinks, AdditionalLinksPanel.Style.INLINE_LIST);
+ } else {
+ Components.permanentlyHide(actionOwner, actionIdToUse);
+ }
+ if(actionIdToHide != null) {
+ Components.permanentlyHide(div, actionIdToHide);
+ }
+
+
+
+ // tab groups
+ final List<BS3TabGroup> tabGroups = bs3Col.getTabGroups();
+ if(!tabGroups.isEmpty()) {
+ final RepeatingView rv = new RepeatingView("tabGroups");
+
+ for (BS3TabGroup bs3TabGroup : tabGroups) {
+
+ final String id = rv.newChildId();
+ final EntityModel entityModelWithHints = getModel().cloneWithLayoutMetadata(bs3TabGroup);
+
+ final WebMarkupContainer tabGroup = new TabGroupPanel(id, entityModelWithHints);
+
+ rv.add(tabGroup);
+ }
+ div.add(rv);
+ } else {
+ Components.permanentlyHide(div, "tabGroups");
+ }
+
+
+
+ // fieldsets
+ final List<FieldSet> fieldSets = bs3Col.getFieldSets();
+ if(!fieldSets.isEmpty()) {
+ final RepeatingView rv = new RepeatingView("fieldSets");
+
+ for (FieldSet fieldSet : fieldSets) {
+
+ final String id = rv.newChildId();
+ final EntityModel entityModelWithHints = getModel().cloneWithLayoutMetadata(fieldSet);
+
+ final WebMarkupContainer propertyGroup = new PropertyGroup(id, entityModelWithHints);
+ rv.add(propertyGroup);
+ }
+ div.add(rv);
+ } else {
+ Components.permanentlyHide(div, "fieldSets");
+ }
+
+
+
+ // collections
+ final List<CollectionLayoutData> collections = bs3Col.getCollections();
+ if(!collections.isEmpty()) {
+ final RepeatingView rv = new RepeatingView("collections");
+
+ for (CollectionLayoutData collection : collections) {
+
+ final String id = rv.newChildId();
+ final EntityModel entityModelWithHints = getModel().cloneWithLayoutMetadata(collection);
+
+ final WebMarkupContainer collectionPanel = new EntityCollectionPanel(id, entityModelWithHints);
+ rv.add(collectionPanel);
+ }
+ div.add(rv);
+ } else {
+ Components.permanentlyHide(div, "collections");
+ }
+
+ }
+
+
+
+ ///////////////////////////////////////////////////////
+ // Dependencies (from context)
+ ///////////////////////////////////////////////////////
+
+ protected DeploymentType getDeploymentType() {
+ return IsisContext.getDeploymentType();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/row/Row.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/row/Row.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/row/Row.html
new file mode 100644
index 0000000..cbda393
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/row/Row.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 class="row" wicket:id="rowContents">
+ [row content]
+ </div>
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/row/Row.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/row/Row.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/row/Row.java
new file mode 100644
index 0000000..c54c58f
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/row/Row.java
@@ -0,0 +1,89 @@
+/*
+ * 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.layout.bs3.row;
+
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.repeater.RepeatingView;
+
+import org.apache.isis.applib.layout.bootstrap3.BS3ClearFix;
+import org.apache.isis.applib.layout.bootstrap3.BS3Col;
+import org.apache.isis.applib.layout.bootstrap3.BS3Row;
+import org.apache.isis.applib.layout.bootstrap3.BS3RowContent;
+import org.apache.isis.core.runtime.system.DeploymentType;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.components.layout.bs3.Util;
+import org.apache.isis.viewer.wicket.ui.components.layout.bs3.clearfix.ClearFix;
+import org.apache.isis.viewer.wicket.ui.components.layout.bs3.col.Col;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+public class Row extends PanelAbstract<EntityModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_ROW_CONTENTS = "rowContents";
+
+ private final BS3Row bs3Row;
+
+ public Row(
+ final String id,
+ final EntityModel entityModel) {
+
+ super(id, entityModel);
+
+ bs3Row = (BS3Row) entityModel.getLayoutMetadata();
+
+ buildGui();
+ }
+
+ private void buildGui() {
+
+ Util.appendCssClass(this, bs3Row, "row");
+
+ final RepeatingView rv = new RepeatingView(ID_ROW_CONTENTS);
+
+ for(final BS3RowContent bs3RowContent: bs3Row.getCols()) {
+
+ final String id = rv.newChildId();
+ final EntityModel entityModelWithHints = getModel().cloneWithLayoutMetadata(bs3RowContent);
+
+ final WebMarkupContainer rowContent;
+ if(bs3RowContent instanceof BS3Col) {
+ rowContent = new Col(id, entityModelWithHints);
+ } else if (bs3RowContent instanceof BS3ClearFix) {
+ rowContent = new ClearFix(id, entityModelWithHints);
+ } else {
+ throw new IllegalStateException("Unrecognized implementation of BS3RowContent");
+ }
+
+ rv.add(rowContent);
+ }
+
+ add(rv);
+ }
+
+ ///////////////////////////////////////////////////////
+ // Dependencies (from context)
+ ///////////////////////////////////////////////////////
+
+ protected DeploymentType getDeploymentType() {
+ return IsisContext.getDeploymentType();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/tabs/TabGroupPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/tabs/TabGroupPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/tabs/TabGroupPanel.java
new file mode 100644
index 0000000..e1bf0d2
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/tabs/TabGroupPanel.java
@@ -0,0 +1,97 @@
+/*
+ * 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.layout.bs3.tabs;
+
+import java.util.List;
+
+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.panel.Panel;
+import org.apache.wicket.model.Model;
+
+import org.apache.isis.applib.layout.bootstrap3.BS3Tab;
+import org.apache.isis.applib.layout.bootstrap3.BS3TabGroup;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.model.util.ScopedSessionAttribute;
+
+import de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel;
+
+public class TabGroupPanel extends AjaxBootstrapTabbedPanel {
+
+ public static final String SESSION_ATTR_SELECTED_TAB = "selectedTab";
+
+ // the view metadata
+ private final ScopedSessionAttribute<Integer> selectedTabInSession;
+
+ private static List<ITab> tabsFor(final EntityModel entityModel) {
+ final List<ITab> tabs = Lists.newArrayList();
+
+ final BS3TabGroup tabGroup = (BS3TabGroup) entityModel.getLayoutMetadata();
+ final List<BS3Tab> tablist = FluentIterable
+ .from(tabGroup.getTabs())
+ .filter(BS3Tab.Predicates.notEmpty())
+ .toList();
+
+ for (final BS3Tab bs3Tab : tablist) {
+ tabs.add(new AbstractTab(Model.of(bs3Tab.getName())) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public Panel getPanel(String panelId) {
+ return new TabPanel(panelId, entityModel, bs3Tab);
+ }
+ });
+ }
+ return tabs;
+ }
+
+ public TabGroupPanel(String id, final EntityModel entityModel) {
+ super(id, tabsFor(entityModel));
+
+ this.selectedTabInSession = ScopedSessionAttribute.create(entityModel, this, SESSION_ATTR_SELECTED_TAB);
+ }
+
+ @Override
+ protected void onInitialize() {
+ setSelectedTabFromSessionIfAny(this);
+ super.onInitialize();
+ }
+
+ @Override
+ public TabbedPanel setSelectedTab(final int index) {
+ selectedTabInSession.set(index);
+ return super.setSelectedTab(index);
+ }
+
+ private void setSelectedTabFromSessionIfAny(
+ final AjaxBootstrapTabbedPanel ajaxBootstrapTabbedPanel) {
+ final Integer tabIndex = selectedTabInSession.get();
+ if (tabIndex != null) {
+ 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);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/tabs/TabPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/tabs/TabPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/tabs/TabPanel.html
new file mode 100644
index 0000000..2a47546
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/tabs/TabPanel.html
@@ -0,0 +1,30 @@
+<?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">
+ <div wicket:id="rows">
+ [rows]
+ </div>
+ </div>
+</wicket:panel>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/tabs/TabPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/tabs/TabPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/tabs/TabPanel.java
new file mode 100644
index 0000000..994fb4b
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/tabs/TabPanel.java
@@ -0,0 +1,42 @@
+package org.apache.isis.viewer.wicket.ui.components.layout.bs3.tabs;
+
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.repeater.RepeatingView;
+
+import org.apache.isis.applib.layout.bootstrap3.BS3Row;
+import org.apache.isis.applib.layout.bootstrap3.BS3Tab;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.components.layout.bs3.Util;
+import org.apache.isis.viewer.wicket.ui.components.layout.bs3.row.Row;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+public class TabPanel extends PanelAbstract {
+
+ private static final long serialVersionUID = 1L;
+ private final BS3Tab bs3Tab;
+
+ public TabPanel(String id, final EntityModel model, final BS3Tab bs3Tab) {
+ super(id);
+
+ this.bs3Tab = bs3Tab;
+ buildGui(model, bs3Tab);
+ }
+
+ protected void buildGui(final EntityModel model, final BS3Tab bs3Tab) {
+
+ Util.appendCssClassIfRequired(this, bs3Tab);
+
+ final RepeatingView rv = new RepeatingView("rows");
+
+ for(final BS3Row bs3Row: bs3Tab.getRows()) {
+
+ final String newChildId = rv.newChildId();
+ final EntityModel entityModelWithHints = model.cloneWithLayoutMetadata(bs3Row);
+
+ final WebMarkupContainer row = new Row(newChildId, entityModelWithHints);
+
+ rv.add(row);
+ }
+ add(rv);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fallback/EntityEditablePanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fallback/EntityEditablePanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fallback/EntityEditablePanel.html
new file mode 100644
index 0000000..540bb11
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fallback/EntityEditablePanel.html
@@ -0,0 +1,29 @@
+<?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="entityCombined">
+ <div wicket:id="entitySummary"></div>
+ <div wicket:id="entityPropertiesAndCollections"></div>
+ </div>
+</wicket:panel>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fallback/EntityEditablePanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fallback/EntityEditablePanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fallback/EntityEditablePanel.java
new file mode 100644
index 0000000..4e892b5
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fallback/EntityEditablePanel.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.layout.fallback;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
+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;
+import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
+
+/**
+ * {@link PanelAbstract Panel} to represent an entity on a single page made up
+ * of several <div> regions.
+ */
+public class EntityEditablePanel extends PanelAbstract<EntityModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_ENTITY_PROPERTIES_AND_COLLECTIONS = "entityPropertiesAndCollections";
+
+
+ public EntityEditablePanel(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);
+ }
+
+ addOrReplace(ComponentType.ENTITY_SUMMARY, model);
+
+ getComponentFactoryRegistry().addOrReplaceComponent(this, ID_ENTITY_PROPERTIES_AND_COLLECTIONS, ComponentType.ENTITY_PROPERTIES, model);
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanel.html
deleted file mode 100644
index 0e03ea9..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanel.html
+++ /dev/null
@@ -1,32 +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="entityCollectionsPanel entityCollectionsComponentType">
- <div wicket:id="collections">
- <div wicket:id="collection">
- [collection]
- </div>
- </div>
- </div>
- </wicket:panel>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanel.java
deleted file mode 100644
index fd706cd..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanel.java
+++ /dev/null
@@ -1,151 +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.layout.fixedcols;
-
-import java.util.Comparator;
-import java.util.List;
-
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.ImmutableList;
-
-import org.apache.wicket.markup.html.WebMarkupContainer;
-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;
-import org.apache.isis.applib.layout.common.CollectionLayoutData;
-import org.apache.isis.applib.layout.fixedcols.FCColumn;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.consent.InteractionInitiatedBy;
-import org.apache.isis.core.metamodel.facets.members.order.MemberOrderFacet;
-import org.apache.isis.core.metamodel.spec.feature.Contributed;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.runtime.services.DeweyOrderComparator;
-import org.apache.isis.viewer.wicket.model.models.EntityModel;
-import org.apache.isis.viewer.wicket.ui.components.entity.collection.EntityCollectionPanel;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-
-/**
- * {@link PanelAbstract Panel} representing the properties of an entity, as per
- * the provided {@link EntityModel}.
- */
-public class EntityCollectionsPanel extends PanelAbstract<EntityModel> {
-
- private static final long serialVersionUID = 1L;
-
- private static final String ID_ENTITY_COLLECTIONS = "entityCollections";
- private static final String ID_COLLECTIONS = "collections";
- private static final String ID_COLLECTION = "collection";
-
- // view metadata (if any available)
- private final FCColumn fcColumnIfAny;
-
- public EntityCollectionsPanel(final String id, final EntityModel entityModel) {
- super(id, entityModel);
-
- fcColumnIfAny = (FCColumn) entityModel.getLayoutMetadata();
-
- buildGui();
- }
-
- private void buildGui() {
- buildEntityPropertiesAndOrCollectionsGui();
- setOutputMarkupId(true); // so can repaint via ajax
- }
-
- private void buildEntityPropertiesAndOrCollectionsGui() {
- final EntityModel model = getModel();
- final ObjectAdapter adapter = model.getObject();
- if (adapter != null) {
- addCollections();
- } else {
- permanentlyHide(ID_ENTITY_COLLECTIONS);
- }
- }
-
- private void addCollections() {
- final EntityModel entityModel = getModel();
- final ObjectAdapter adapter = entityModel.getObject();
-
- final Filter<ObjectAssociation> filter;
- if (fcColumnIfAny != null) {
- final ImmutableList<String> collectionIds = FluentIterable
- .from(fcColumnIfAny.getCollections())
- .transform(CollectionLayoutData.Functions.id())
- .toList();
- filter = new Filter<ObjectAssociation>() {
- @Override
- public boolean accept(final ObjectAssociation objectAssociation) {
- return collectionIds.contains(objectAssociation.getId());
- }
- };
- } else {
- filter = Filters.any();
- }
-
- final List<ObjectAssociation> associations = visibleCollections(adapter, filter);
- associations.sort(new Comparator<ObjectAssociation>() {
- private final DeweyOrderComparator deweyOrderComparator = new DeweyOrderComparator();
- @Override
- public int compare(final ObjectAssociation o1, final ObjectAssociation o2) {
- final MemberOrderFacet o1Facet = o1.getFacet(MemberOrderFacet.class);
- final MemberOrderFacet o2Facet = o2.getFacet(MemberOrderFacet.class);
- return o1Facet == null? +1:
- o2Facet == null? -1:
- deweyOrderComparator.compare(o1Facet.sequence(), o2Facet.sequence());
- }
- });
-
- final RepeatingView collectionRv = new RepeatingView(ID_COLLECTIONS);
- add(collectionRv);
-
- for (final ObjectAssociation association : associations) {
-
- final WebMarkupContainer collectionRvContainer = new WebMarkupContainer(collectionRv.newChildId());
- collectionRv.add(collectionRvContainer);
-
- final CollectionLayoutData collectionLayoutData = new CollectionLayoutData(association.getId());
- final EntityModel entityModelWithCollectionLayoutMetadata =
- entityModel.cloneWithLayoutMetadata(collectionLayoutData);
-
- collectionRvContainer.add(new EntityCollectionPanel(ID_COLLECTION, entityModelWithCollectionLayoutMetadata));
- }
- }
-
- private static List<ObjectAssociation> visibleCollections(
- final ObjectAdapter adapter,
- final Filter<ObjectAssociation> filter) {
- return adapter.getSpecification().getAssociations(
- Contributed.INCLUDED, visibleCollectionsFilter(adapter, filter));
- }
-
- @SuppressWarnings("unchecked")
- private static Filter<ObjectAssociation> visibleCollectionsFilter(
- final ObjectAdapter adapter,
- final Filter<ObjectAssociation> filter) {
- return Filters.and(
- ObjectAssociation.Filters.COLLECTIONS,
- ObjectAssociation.Filters.dynamicallyVisible(
- adapter, InteractionInitiatedBy.USER, Where.PARENTED_TABLES),
- filter);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanelFactory.java
deleted file mode 100644
index 980fe6c..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityCollectionsPanelFactory.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.viewer.wicket.ui.components.layout.fixedcols;
-
-import org.apache.wicket.Component;
-import org.apache.wicket.model.IModel;
-
-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;
-
-/**
- * {@link ComponentFactory} for {@link EntityCollectionsPanel}.
- */
-public class EntityCollectionsPanelFactory extends EntityComponentFactoryAbstract {
-
- private static final long serialVersionUID = 1L;
-
- public EntityCollectionsPanelFactory() {
- super(ComponentType.ENTITY_COLLECTIONS, EntityCollectionsPanel.class);
- }
-
- @Override
- public Component createComponent(final String id, final IModel<?> model) {
- final EntityModel entityModel = (EntityModel) model;
- return new EntityCollectionsPanel(id, entityModel);
- }
-}
-
-
-
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityTabbedPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityTabbedPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityTabbedPanel.html
deleted file mode 100644
index 7b172aa..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityTabbedPanel.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/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityTabbedPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityTabbedPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityTabbedPanel.java
deleted file mode 100644
index c7a3905..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/EntityTabbedPanel.java
+++ /dev/null
@@ -1,113 +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.layout.fixedcols;
-
-import java.util.List;
-
-import com.google.common.collect.FluentIterable;
-
-import org.apache.isis.applib.layout.fixedcols.FCColumn;
-import org.apache.isis.applib.layout.fixedcols.FCPage;
-import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
-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.PageFacet;
-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.column.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 <div> regions.
- */
-public class EntityTabbedPanel 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 EntityTabbedPanel(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 PageFacet PageFacet = model.getTypeOfSpecification().getFacet(PageFacet.class);
- final FCPage page = (FCPage) PageFacet.getPage();
-
-
- addOrReplace(ComponentType.ENTITY_SUMMARY, model);
-
- final int leftSpan = addColumnIfRequired(ID_LEFT_COLUMN, page.getLeft());
-
- final TabGroupListPanel middleTabs = addTabGroups(ID_MIDDLE_COLUMN, page.getTabGroups());
-
- final int rightSpan = addColumnIfRequired(ID_RIGHT_COLUMN, page.getRight());
-
- 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<FCTabGroup> tabGroupList) {
- final EntityModel model = getModel();
- final List<FCTabGroup> tabGroups = FluentIterable
- .from(tabGroupList)
- .filter(FCTabGroup.Predicates.notEmpty())
- .toList();
- final EntityModel entityModelWitHints = model.cloneWithLayoutMetadata(tabGroups);
- final TabGroupListPanel middleComponent = new TabGroupListPanel(id, entityModelWitHints);
- addOrReplace(middleComponent);
- return middleComponent;
- }
-
- private int addColumnIfRequired(final String id, final FCColumn col) {
- if(col != null) {
- final EntityModel entityModel =
- getModel().cloneWithLayoutMetadata(col);
- final FCColumn fcColumn = (FCColumn) entityModel.getLayoutMetadata();
- final int span = fcColumn.getSpan();
- if(span > 0) {
- final EntityColumn entityColumn = new EntityColumn(id, entityModel);
- addOrReplace(entityColumn);
- CssClassAppender.appendCssClassTo(entityColumn, "col-xs-" + span);
- return span;
- }
- }
- permanentlyHide(id);
- return 0;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCPagePanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCPagePanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCPagePanel.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/layout/fixedcols/FCPagePanel.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/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCPagePanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCPagePanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCPagePanel.java
new file mode 100644
index 0000000..5e232fa
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCPagePanel.java
@@ -0,0 +1,114 @@
+/*
+ * 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.layout.fixedcols;
+
+import java.util.List;
+
+import com.google.common.collect.FluentIterable;
+
+import org.apache.isis.applib.layout.fixedcols.FCColumn;
+import org.apache.isis.applib.layout.fixedcols.FCPage;
+import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
+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.PageFacet;
+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.layout.fixedcols.columns.EntityColumn;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.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 <div> regions.
+ */
+public class FCPagePanel 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 FCPagePanel(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 PageFacet PageFacet = model.getTypeOfSpecification().getFacet(PageFacet.class);
+ final FCPage page = (FCPage) PageFacet.getPage();
+
+
+ addOrReplace(ComponentType.ENTITY_SUMMARY, model);
+
+ final int leftSpan = addColumnIfRequired(ID_LEFT_COLUMN, page.getLeft());
+
+ final TabGroupListPanel middleTabs = addTabGroups(ID_MIDDLE_COLUMN, page.getTabGroups());
+
+ final int rightSpan = addColumnIfRequired(ID_RIGHT_COLUMN, page.getRight());
+
+ 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<FCTabGroup> tabGroupList) {
+ final EntityModel model = getModel();
+ final List<FCTabGroup> tabGroups = FluentIterable
+ .from(tabGroupList)
+ .filter(FCTabGroup.Predicates.notEmpty())
+ .toList();
+ final EntityModel entityModelWitHints = model.cloneWithLayoutMetadata(tabGroups);
+ final TabGroupListPanel middleComponent = new TabGroupListPanel(id, entityModelWitHints);
+ addOrReplace(middleComponent);
+ return middleComponent;
+ }
+
+ private int addColumnIfRequired(final String id, final FCColumn col) {
+ if(col != null) {
+ final EntityModel entityModel =
+ getModel().cloneWithLayoutMetadata(col);
+ final FCColumn fcColumn = (FCColumn) entityModel.getLayoutMetadata();
+ final int span = fcColumn.getSpan();
+ if(span > 0) {
+ final EntityColumn entityColumn = new EntityColumn(id, entityModel);
+ addOrReplace(entityColumn);
+ CssClassAppender.appendCssClassTo(entityColumn, "col-xs-" + span);
+ return span;
+ }
+ }
+ permanentlyHide(id);
+ return 0;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropUtil.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropUtil.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropUtil.java
new file mode 100644
index 0000000..0cafe36
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropUtil.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.viewer.wicket.ui.components.layout.fixedcols;
+
+import java.util.List;
+import java.util.Map;
+
+import com.google.common.collect.FluentIterable;
+
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.applib.filter.Filter;
+import org.apache.isis.applib.filter.Filters;
+import org.apache.isis.applib.layout.fixedcols.FCColumn;
+import org.apache.isis.applib.layout.common.FieldSet;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.consent.InteractionInitiatedBy;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.ObjectSpecifications;
+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.EntityModel;
+
+public final class PropUtil {
+
+ private PropUtil() {
+ }
+
+ public static List<String> propertyGroupNames(
+ final EntityModel entityModel,
+ final FCColumn.Hint hint, final FCColumn columnMetaDataIfAny) {
+ final ObjectAdapter adapter = entityModel.getObject();
+ final ObjectSpecification objSpec = adapter.getSpecification();
+
+ final Map<String, List<ObjectAssociation>> associationsByGroup =
+ propertiesByMemberOrder(adapter);
+
+ return columnMetaDataIfAny != null
+ ? FluentIterable
+ .from(columnMetaDataIfAny.getFieldSets())
+ .transform(FieldSet.Util.nameOf())
+ .toList()
+ : ObjectSpecifications.orderByMemberGroups(objSpec, associationsByGroup.keySet(),
+ hint);
+ }
+
+ public static Map<String, List<ObjectAssociation>> propertiesByMemberOrder(final ObjectAdapter adapter) {
+ final List<ObjectAssociation> properties = visibleProperties(adapter);
+ return ObjectAssociation.Util.groupByMemberOrderName(properties);
+ }
+
+ private static List<ObjectAssociation> visibleProperties(final ObjectAdapter adapter) {
+ return visibleProperties(adapter, Filters.<ObjectAssociation>any());
+ }
+
+ private static List<ObjectAssociation> visibleProperties(
+ final ObjectAdapter adapter,
+ final Filter<ObjectAssociation> filter) {
+ final ObjectSpecification objSpec = adapter.getSpecification();
+
+ return objSpec.getAssociations(
+ Contributed.INCLUDED, visiblePropertiesFilter(adapter, filter));
+ }
+
+ @SuppressWarnings("unchecked")
+ private static Filter<ObjectAssociation> visiblePropertiesFilter(
+ final ObjectAdapter adapter,
+ final Filter<ObjectAssociation> filter) {
+ return Filters.and(
+ ObjectAssociation.Filters.PROPERTIES,
+ ObjectAssociation.Filters.dynamicallyVisible(
+ adapter, InteractionInitiatedBy.USER, Where.OBJECT_FORMS),
+ filter);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropertyGroup.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropertyGroup.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropertyGroup.html
deleted file mode 100644
index 38245a0..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropertyGroup.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.
--->
-<html xmlns:wicket="http://wicket.apache.org">
- <body>
- <wicket:panel>
- <fieldset class="memberGroup">
- <div class="panel panel-default">
- <div class="panel-heading">
- <span wicket:id="memberGroupName" class="panel-title">[group name]</span>
- <div class="pull-right additionalLinks">
- <div wicket:id="associatedActionLinksPanel"></div>
- <div wicket:id="associatedActionLinksPanelDropDown"></div>
- </div>
- </div>
- <div class="properties panel-body">
- <div wicket:id="properties">
- <div wicket:id="property" class="property">[property]</div>
- </div>
- </div>
- </div>
- </fieldset>
- </wicket:panel>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropertyGroup.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropertyGroup.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropertyGroup.java
deleted file mode 100644
index d2fd5ec..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/PropertyGroup.java
+++ /dev/null
@@ -1,122 +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.layout.fixedcols;
-
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-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.ActionLayout;
-import org.apache.isis.applib.layout.common.FieldSet;
-import org.apache.isis.applib.layout.common.PropertyLayoutData;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
-import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.viewer.wicket.model.links.LinkAndLabel;
-import org.apache.isis.viewer.wicket.model.mementos.PropertyMemento;
-import org.apache.isis.viewer.wicket.model.models.EntityModel;
-import org.apache.isis.viewer.wicket.model.models.ScalarModel;
-import org.apache.isis.viewer.wicket.ui.ComponentType;
-import org.apache.isis.viewer.wicket.ui.components.actionmenu.entityactions.AdditionalLinksPanel;
-import org.apache.isis.viewer.wicket.ui.components.actionmenu.entityactions.EntityActionUtil;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-
-public class PropertyGroup extends PanelAbstract<EntityModel> {
-
- private static final String ID_MEMBER_GROUP_NAME = "memberGroupName";
-
- private static final String ID_ASSOCIATED_ACTION_LINKS_PANEL = "associatedActionLinksPanel";
- private static final String ID_ASSOCIATED_ACTION_LINKS_PANEL_DROPDOWN = "associatedActionLinksPanelDropDown";
-
- private static final String ID_PROPERTIES = "properties";
- private static final String ID_PROPERTY = "property";
-
- private final FieldSet fieldSet;
-
- public PropertyGroup(final String id, final EntityModel model) {
- super(id, model);
- fieldSet = (FieldSet) model.getLayoutMetadata();
-
- buildGui();
- }
-
- public EntityModel getModel() {
- return (EntityModel) getDefaultModel();
- }
-
- private void buildGui() {
- String groupName = fieldSet.getName();
- final ObjectAdapter adapter = getModel().getObject();
-
- add(new Label(ID_MEMBER_GROUP_NAME, groupName));
-
- final List<LinkAndLabel> memberGroupActions = Lists.newArrayList();
-
- final RepeatingView propertyRv = new RepeatingView(ID_PROPERTIES);
- add(propertyRv);
-
- final List<PropertyLayoutData> properties = fieldSet.getProperties();
- for (PropertyLayoutData property : properties) {
- final ObjectAssociation association = adapter.getSpecification().getAssociation(property.getId());
-
- final WebMarkupContainer propertyRvContainer = new WebMarkupContainer(propertyRv.newChildId());
- propertyRv.add(propertyRvContainer);
-
- addPropertyToForm(getModel(), (OneToOneAssociation) association, propertyRvContainer,
- memberGroupActions);
- }
-
- final List<LinkAndLabel> actionsPanel = LinkAndLabel
- .positioned(memberGroupActions, ActionLayout.Position.PANEL);
- final List<LinkAndLabel> actionsPanelDropDown = LinkAndLabel
- .positioned(memberGroupActions, ActionLayout.Position.PANEL_DROPDOWN);
-
- AdditionalLinksPanel.addAdditionalLinks(
- this, ID_ASSOCIATED_ACTION_LINKS_PANEL,
- actionsPanel,
- AdditionalLinksPanel.Style.INLINE_LIST);
- AdditionalLinksPanel.addAdditionalLinks(
- this, ID_ASSOCIATED_ACTION_LINKS_PANEL_DROPDOWN,
- actionsPanelDropDown,
- AdditionalLinksPanel.Style.DROPDOWN);
- }
-
- private void addPropertyToForm(
- final EntityModel entityModel,
- final OneToOneAssociation otoa,
- final WebMarkupContainer container,
- final List<LinkAndLabel> entityActions) {
- final PropertyMemento pm = new PropertyMemento(otoa);
-
- final ScalarModel scalarModel = entityModel.getPropertyModel(pm);
- getComponentFactoryRegistry()
- .addOrReplaceComponent(container, ID_PROPERTY, ComponentType.SCALAR_NAME_AND_VALUE, scalarModel);
-
- final List<ObjectAction> associatedActions =
- EntityActionUtil.getObjectActionsForAssociation(entityModel, otoa, getDeploymentCategory());
-
- entityActions.addAll(
- EntityActionUtil.asLinkAndLabelsForAdditionalLinksPanel(entityModel, associatedActions));
- }
-}
[09/15] isis git commit: ISIS-993: starting on the
visitor/normalization stuff for BS3 grid.
Posted by da...@apache.org.
ISIS-993: starting on the visitor/normalization stuff for BS3 grid.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/25a267a6
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/25a267a6
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/25a267a6
Branch: refs/heads/ISIS-993
Commit: 25a267a61cf6d4c9ef297f19f134e25dd17e7a91
Parents: c57d8cd
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Feb 1 22:48:27 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Feb 1 22:48:27 2016 +0100
----------------------------------------------------------------------
.../isis/applib/layout/bootstrap3/BS3Col.java | 26 +-
.../isis/applib/layout/bootstrap3/BS3Page.java | 244 ++++++++++++++++++-
.../isis/applib/layout/bootstrap3/BS3Row.java | 41 +++-
.../applib/layout/bootstrap3/BS3RowContent.java | 20 ++
.../layout/bootstrap3/BS3RowContentOwner.java | 25 ++
.../applib/layout/bootstrap3/BS3RowOwner.java | 28 +++
.../isis/applib/layout/bootstrap3/BS3Tab.java | 23 +-
.../applib/layout/bootstrap3/BS3TabGroup.java | 24 +-
.../layout/bootstrap3/BS3TabGroupOwner.java | 28 +++
.../applib/layout/bootstrap3/BS3TabOwner.java | 28 +++
.../isis/applib/layout/bootstrap3/HasCssId.java | 28 +++
.../applib/layout/common/ActionLayoutData.java | 8 +-
.../layout/common/ActionLayoutDataOwner.java | 25 ++
.../isis/applib/layout/common/ActionOwner.java | 25 --
.../layout/common/CollectionLayoutData.java | 2 +-
.../layout/common/DomainObjectLayoutData.java | 20 ++
.../common/DomainObjectLayoutDataOwner.java | 23 ++
.../isis/applib/layout/common/FieldSet.java | 2 +-
.../apache/isis/applib/layout/common/Page.java | 21 +-
.../layout/common/PropertyLayoutData.java | 2 +-
.../isis/applib/layout/fixedcols/FCPage.java | 95 ++++----
.../layout/provider/PageNormalizerFC.java | 28 +--
.../viewer/wicket/ui/util/CssIdAppender.java | 70 ++++++
.../dom/simple/SimpleObject.layout-FC.xml | 13 +-
.../dom/simple/SimpleObject.layout.xml | 6 +-
25 files changed, 743 insertions(+), 112 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java
index 1395c99..90ae5db 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Col.java
@@ -29,9 +29,11 @@ import javax.xml.bind.annotation.XmlType;
import com.google.common.collect.Lists;
import org.apache.isis.applib.layout.common.ActionLayoutData;
+import org.apache.isis.applib.layout.common.ActionLayoutDataOwner;
import org.apache.isis.applib.layout.common.CollectionLayoutData;
import org.apache.isis.applib.layout.common.DomainObjectLayoutData;
import org.apache.isis.applib.layout.common.FieldSet;
+import org.apache.isis.applib.layout.common.MemberRegionOwner;
/**
* A column within a row which, depending on its {@link #getSpan()}, could be as narrow as 1/12th of the page's width, all the way up to spanning the entire page.
@@ -60,11 +62,27 @@ import org.apache.isis.applib.layout.common.FieldSet;
"collections",
}
)
-public class BS3Col extends BS3RowContent {
+public class BS3Col extends BS3RowContent implements ActionLayoutDataOwner, BS3TabGroupOwner, BS3RowOwner, MemberRegionOwner, HasCssId {
private static final long serialVersionUID = 1L;
+
+ private String id;
+
+ /**
+ * As per <div id="...">...</div> : must be unique across entire page.
+ */
+ @XmlAttribute(required = false)
+ public String getId() {
+ return id;
+ }
+
+ public void setId(final String id) {
+ this.id = id;
+ }
+
+
private int span;
@XmlAttribute(required = true)
@@ -87,7 +105,7 @@ public class BS3Col extends BS3RowContent {
* </p>
*/
@XmlAttribute(required = false)
- public boolean getUnreferencedActions() {
+ public boolean isUnreferencedActions() {
return unreferencedActions;
}
@@ -105,7 +123,7 @@ public class BS3Col extends BS3RowContent {
* </p>
*/
@XmlAttribute(required = false)
- public boolean getUnreferencedProperties() {
+ public boolean isUnreferencedProperties() {
return unreferencedProperties;
}
@@ -123,7 +141,7 @@ public class BS3Col extends BS3RowContent {
* </p>
*/
@XmlAttribute(required = false)
- public boolean getUnreferencedCollections() {
+ public boolean isUnreferencedCollections() {
return unreferencedCollections;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Page.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Page.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Page.java
index 7796500..6dd559b 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Page.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Page.java
@@ -19,6 +19,7 @@
package org.apache.isis.applib.layout.bootstrap3;
import java.util.ArrayList;
+import java.util.LinkedHashMap;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
@@ -27,9 +28,16 @@ import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.layout.common.ActionLayoutData;
+import org.apache.isis.applib.layout.common.ActionLayoutDataOwner;
+import org.apache.isis.applib.layout.common.CollectionLayoutData;
+import org.apache.isis.applib.layout.common.DomainObjectLayoutData;
+import org.apache.isis.applib.layout.common.FieldSet;
import org.apache.isis.applib.layout.common.Page;
+import org.apache.isis.applib.layout.common.PropertyLayoutData;
import org.apache.isis.applib.services.dto.Dto;
/**
@@ -50,7 +58,7 @@ import org.apache.isis.applib.services.dto.Dto;
, "metadataErrors"
}
)
-public class BS3Page extends BS3ElementAbstract implements Page, Dto {
+public class BS3Page extends BS3ElementAbstract implements Page, Dto, BS3RowOwner {
private static final long serialVersionUID = 1L;
@@ -83,9 +91,6 @@ public class BS3Page extends BS3ElementAbstract implements Page, Dto {
this.normalized = normalized;
}
-
-
-
private List<String> metadataErrors = Lists.newArrayList();
/**
@@ -106,4 +111,235 @@ public class BS3Page extends BS3ElementAbstract implements Page, Dto {
public void setMetadataErrors(final List<String> metadataErrors) {
this.metadataErrors = metadataErrors;
}
+
+ interface Visitor {
+ void visit(final BS3Page bs3Page);
+ void visit(final BS3Row bs3Row);
+ void visit(final BS3Col bs3Col);
+ void visit(final BS3ClearFix bs3ClearFix);
+ void visit(final BS3TabGroup bs3TabGroup);
+ void visit(final BS3Tab bs3Tab);
+ void visit(final FieldSet fieldSet);
+ void visit(final DomainObjectLayoutData domainObjectLayout);
+ void visit(final PropertyLayoutData propertyLayoutData);
+ void visit(final CollectionLayoutData collectionLayoutData);
+ void visit(final ActionLayoutData actionLayoutData);
+ }
+
+ public static class VisitorAdapter implements Visitor {
+ @Override
+ public void visit(final BS3Page bs3Page) { }
+ @Override
+ public void visit(final BS3Row bs3Row) { }
+ @Override
+ public void visit(final BS3Col bs3Col) { }
+ @Override
+ public void visit(final BS3ClearFix bs3ClearFix) { }
+ @Override
+ public void visit(final BS3TabGroup bs3TabGroup) { }
+ @Override
+ public void visit(final BS3Tab bs3Tab) { }
+ @Override
+ public void visit(final DomainObjectLayoutData domainObjectLayout) { }
+ @Override
+ public void visit(final FieldSet fieldSet) {}
+ @Override
+ public void visit(final PropertyLayoutData propertyLayoutData) {}
+ @Override
+ public void visit(final CollectionLayoutData collectionLayoutData) {}
+ @Override
+ public void visit(final ActionLayoutData actionLayoutData) { }
+ }
+
+ public void visit(final BS3Page.Visitor visitor) {
+ visitor.visit(this);
+ traverseRows(this, visitor);
+ }
+
+ protected void traverseRows(final BS3RowOwner rowOwner, final Visitor visitor) {
+ for (BS3Row bs3Row : rowOwner.getRows()) {
+ bs3Row.setOwner(this);
+ visitor.visit(bs3Row);
+ final List<BS3RowContent> cols = bs3Row.getCols();
+ for (BS3RowContent rowContent : cols) {
+ rowContent.setOwner(bs3Row);
+ if(rowContent instanceof BS3Col) {
+ final BS3Col bs3Col = (BS3Col) rowContent;
+ visitor.visit(bs3Col);
+ traverseDomainObject(bs3Col, visitor);
+ traverseTabGroups(bs3Col, visitor);
+ traverseActions(bs3Col, visitor);
+ traverseFieldSets(bs3Col, visitor);
+ traverseCollections(bs3Col, visitor);
+ traverseRows(bs3Col, visitor);
+ } else if (rowContent instanceof BS3ClearFix) {
+ final BS3ClearFix bs3ClearFix = (BS3ClearFix) rowContent;
+ visitor.visit(bs3ClearFix);
+ } else {
+ throw new IllegalStateException(
+ "Unrecognized implementation of BS3RowContent, " + rowContent);
+ }
+ }
+ }
+ }
+
+ private void traverseDomainObject(final BS3Col bs3Col, final Visitor visitor) {
+ final DomainObjectLayoutData domainObject = bs3Col.getDomainObject();
+ if(domainObject == null) {
+ return;
+ }
+ domainObject.setOwner(bs3Col);
+ visitor.visit(domainObject);
+ }
+
+ private void traverseTabGroups(
+ final BS3TabGroupOwner bs3TabGroupOwner,
+ final Visitor visitor) {
+ final List<BS3TabGroup> tabGroups = bs3TabGroupOwner.getTabGroups();
+ for (BS3TabGroup bs3TabGroup : tabGroups) {
+ bs3TabGroup.setOwner(bs3TabGroupOwner);
+ visitor.visit(bs3TabGroup);
+ traverseTabs(bs3TabGroup, visitor);
+ }
+ }
+
+ private void traverseTabs(
+ final BS3TabOwner bs3TabOwner,
+ final Visitor visitor) {
+ final List<BS3Tab> tabs = bs3TabOwner.getTabs();
+ for (BS3Tab tab : tabs) {
+ tab.setOwner(bs3TabOwner);
+ visitor.visit(tab);
+ traverseRows(tab, visitor);
+ }
+ }
+
+ private void traverseActions(
+ final ActionLayoutDataOwner actionLayoutDataOwner,
+ final Visitor visitor) {
+ final List<ActionLayoutData> actionLayoutDatas = actionLayoutDataOwner.getActions();
+ if(actionLayoutDatas == null) {
+ return;
+ }
+ for (final ActionLayoutData actionLayoutData : actionLayoutDatas) {
+ actionLayoutData.setOwner(actionLayoutDataOwner);
+ visitor.visit(actionLayoutData);
+ }
+ }
+
+ private void traverseFieldSets(final BS3Col bs3Col, final Visitor visitor) {
+ final List<FieldSet> fieldSets = bs3Col.getFieldSets();
+ for (FieldSet fieldSet : fieldSets) {
+ fieldSet.setOwner(bs3Col);
+ visitor.visit(fieldSet);
+ traverseActions(fieldSet, visitor);
+ final List<PropertyLayoutData> properties = fieldSet.getProperties();
+ for (final PropertyLayoutData property : properties) {
+ property.setOwner(fieldSet);
+ visitor.visit(property);
+ traverseActions(property, visitor);
+ }
+ }
+ }
+
+ private void traverseCollections(final BS3Col bs3Col, final Visitor visitor) {
+ final List<CollectionLayoutData> collections = bs3Col.getCollections();
+ for (CollectionLayoutData collection : collections) {
+ collection.setOwner(bs3Col);
+ visitor.visit(collection);
+ traverseActions(collection, visitor);
+ }
+ }
+
+
+
+ @Programmatic
+ @XmlTransient
+ public LinkedHashMap<String, PropertyLayoutData> getAllPropertiesById() {
+ final LinkedHashMap<String, PropertyLayoutData> propertiesById = Maps.newLinkedHashMap();
+ visit(new BS3Page.VisitorAdapter() {
+ public void visit(final PropertyLayoutData propertyLayoutData) {
+ propertiesById.put(propertyLayoutData.getId(), propertyLayoutData);
+ }
+ });
+ return propertiesById;
+ }
+
+
+ @Programmatic
+ @XmlTransient
+ public LinkedHashMap<String, CollectionLayoutData> getAllCollectionsById() {
+ final LinkedHashMap<String, CollectionLayoutData> collectionsById = Maps.newLinkedHashMap();
+
+ visit(new BS3Page.VisitorAdapter() {
+ @Override
+ public void visit(final CollectionLayoutData collectionLayoutData) {
+ collectionsById.put(collectionLayoutData.getId(), collectionLayoutData);
+ }
+ });
+ return collectionsById;
+ }
+
+
+ @Programmatic
+ @XmlTransient
+ public LinkedHashMap<String, ActionLayoutData> getAllActionsById() {
+ final LinkedHashMap<String, ActionLayoutData> actionsById = Maps.newLinkedHashMap();
+
+ visit(new BS3Page.VisitorAdapter() {
+ @Override
+ public void visit(final ActionLayoutData actionLayoutData) {
+ actionsById.put(actionLayoutData.getId(), actionLayoutData);
+ }
+ });
+ return actionsById;
+ }
+
+
+ @Programmatic
+ @XmlTransient
+ public LinkedHashMap<String, FieldSet> getAllFieldSetsByName() {
+ final LinkedHashMap<String, FieldSet> fieldSetsByName = Maps.newLinkedHashMap();
+
+ visit(new BS3Page.VisitorAdapter() {
+ @Override
+ public void visit(final FieldSet fieldSet) {
+ fieldSetsByName.put(fieldSet.getName(), fieldSet);
+ }
+ });
+ return fieldSetsByName;
+ }
+
+
+ @Programmatic
+ @XmlTransient
+ public LinkedHashMap<String, BS3Tab> getAllTabsByName() {
+ final LinkedHashMap<String, BS3Tab> tabsByName = Maps.newLinkedHashMap();
+
+ visit(new BS3Page.VisitorAdapter() {
+ @Override
+ public void visit(final BS3Tab bS3Tab) {
+ tabsByName.put(bS3Tab.getName(), bS3Tab);
+ }
+ });
+ return tabsByName;
+ }
+
+
+ // TODO: need to figure out where the checking that can't have multiple divs with the same CSS id should go...
+ @Programmatic
+ @XmlTransient
+ public LinkedHashMap<String, HasCssId> getAllCssId() {
+ final LinkedHashMap<String, HasCssId> divsByCssId = Maps.newLinkedHashMap();
+
+ visit(new BS3Page.VisitorAdapter() {
+ @Override
+ public void visit(final BS3Row bs3Row) {
+ final String id = bs3Row.getId();
+ divsByCssId.put(id, bs3Row);
+ }
+ });
+ return divsByCssId;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Row.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Row.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Row.java
index 821db69..dee70d4 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Row.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Row.java
@@ -21,8 +21,10 @@ package org.apache.isis.applib.layout.bootstrap3;
import java.util.ArrayList;
import java.util.List;
+import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementRefs;
+import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
/**
@@ -39,10 +41,27 @@ import javax.xml.bind.annotation.XmlType;
"cols"
}
)
-public class BS3Row extends BS3ElementAbstract {
+public class BS3Row extends BS3ElementAbstract implements HasCssId, BS3RowContentOwner {
private static final long serialVersionUID = 1L;
+
+ private String id;
+
+ /**
+ * As per <div id="...">...</div> : must be unique across entire page.
+ */
+ @XmlAttribute(required = false)
+ public String getId() {
+ return id;
+ }
+
+ public void setId(final String id) {
+ this.id = id;
+ }
+
+
+
private List<BS3RowContent> cols = new ArrayList<BS3RowContent>(){{
add(new BS3Col());
}};
@@ -61,4 +80,24 @@ public class BS3Row extends BS3ElementAbstract {
this.cols = cols;
}
+
+
+ private BS3RowOwner owner;
+
+ /**
+ * Owner.
+ *
+ * <p>
+ * Set programmatically by framework after reading in from XML.
+ * </p>
+ */
+ @XmlTransient
+ public BS3RowOwner getOwner() {
+ return owner;
+ }
+
+ public void setOwner(final BS3RowOwner owner) {
+ this.owner = owner;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3RowContent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3RowContent.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3RowContent.java
index 88e9a69..b537ed9 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3RowContent.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3RowContent.java
@@ -19,6 +19,7 @@
package org.apache.isis.applib.layout.bootstrap3;
import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlTransient;
/**
* Common superclass for any content of a row.
@@ -62,4 +63,23 @@ public abstract class BS3RowContent extends BS3ElementAbstract {
this.size = size;
}
+
+ private BS3RowContentOwner owner;
+
+ /**
+ * Owner.
+ *
+ * <p>
+ * Set programmatically by framework after reading in from XML.
+ * </p>
+ */
+ @XmlTransient
+ public BS3RowContentOwner getOwner() {
+ return owner;
+ }
+
+ public void setOwner(final BS3RowContentOwner owner) {
+ this.owner = owner;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3RowContentOwner.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3RowContentOwner.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3RowContentOwner.java
new file mode 100644
index 0000000..70c1bf2
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3RowContentOwner.java
@@ -0,0 +1,25 @@
+/*
+ * 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.layout.bootstrap3;
+
+import org.apache.isis.applib.layout.common.Owner;
+
+public interface BS3RowContentOwner extends Owner {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3RowOwner.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3RowOwner.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3RowOwner.java
new file mode 100644
index 0000000..222f4f6
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3RowOwner.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.applib.layout.bootstrap3;
+
+import java.util.List;
+
+import org.apache.isis.applib.layout.common.Owner;
+
+public interface BS3RowOwner extends Owner {
+
+ List<BS3Row> getRows();
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Tab.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Tab.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Tab.java
index 4489531..57e7ca5 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Tab.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3Tab.java
@@ -23,6 +23,7 @@ import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Predicate;
@@ -41,7 +42,7 @@ import com.google.common.base.Predicate;
"rows"
}
)
-public class BS3Tab extends BS3ElementAbstract {
+public class BS3Tab extends BS3ElementAbstract implements BS3RowOwner {
private static final long serialVersionUID = 1L;
@@ -72,6 +73,26 @@ public class BS3Tab extends BS3ElementAbstract {
}
+
+ private BS3TabOwner owner;
+
+ /**
+ * Owner.
+ *
+ * <p>
+ * Set programmatically by framework after reading in from XML.
+ * </p>
+ */
+ @XmlTransient
+ public BS3TabOwner getOwner() {
+ return owner;
+ }
+
+ public void setOwner(final BS3TabOwner owner) {
+ this.owner = owner;
+ }
+
+
public static class Predicates {
public static Predicate<BS3Tab> notEmpty() {
return new Predicate<BS3Tab>() {
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3TabGroup.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3TabGroup.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3TabGroup.java
index 7fae67b..c96634a 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3TabGroup.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3TabGroup.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
/**
@@ -33,7 +34,7 @@ import javax.xml.bind.annotation.XmlType;
"tabs"
}
)
-public class BS3TabGroup extends BS3ElementAbstract{
+public class BS3TabGroup extends BS3ElementAbstract implements BS3TabOwner {
private static final long serialVersionUID = 1L;
@@ -51,4 +52,25 @@ public class BS3TabGroup extends BS3ElementAbstract{
public void setTabs(final List<BS3Tab> tabs) {
this.tabs = tabs;
}
+
+
+ private BS3TabGroupOwner owner;
+
+ /**
+ * Owner.
+ *
+ * <p>
+ * Set programmatically by framework after reading in from XML.
+ * </p>
+ */
+ @XmlTransient
+ public BS3TabGroupOwner getOwner() {
+ return owner;
+ }
+
+ public void setOwner(final BS3TabGroupOwner owner) {
+ this.owner = owner;
+ }
+
}
+
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3TabGroupOwner.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3TabGroupOwner.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3TabGroupOwner.java
new file mode 100644
index 0000000..1e4ba07
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3TabGroupOwner.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.applib.layout.bootstrap3;
+
+import java.util.List;
+
+import org.apache.isis.applib.layout.common.Owner;
+
+public interface BS3TabGroupOwner extends Owner {
+
+ List<BS3TabGroup> getTabGroups();
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3TabOwner.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3TabOwner.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3TabOwner.java
new file mode 100644
index 0000000..c6de978
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/BS3TabOwner.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.applib.layout.bootstrap3;
+
+import java.util.List;
+
+import org.apache.isis.applib.layout.common.Owner;
+
+public interface BS3TabOwner extends Owner {
+
+ List<BS3Tab> getTabs();
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/HasCssId.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/HasCssId.java b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/HasCssId.java
new file mode 100644
index 0000000..e671d5b
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/bootstrap3/HasCssId.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.applib.layout.bootstrap3;
+
+public interface HasCssId {
+
+ /**
+ * As per <div id="...">...</div> : must be unique across entire page.
+ */
+ String getId();
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/common/ActionLayoutData.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/common/ActionLayoutData.java b/core/applib/src/main/java/org/apache/isis/applib/layout/common/ActionLayoutData.java
index f8088fc..8b6cdac 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/common/ActionLayoutData.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/common/ActionLayoutData.java
@@ -48,7 +48,7 @@ import org.apache.isis.applib.annotation.Where;
, "metadataError"
}
)
-public class ActionLayoutData implements Serializable, Owned<ActionOwner> {
+public class ActionLayoutData implements Serializable, Owned<ActionLayoutDataOwner> {
private static final long serialVersionUID = 1L;
@@ -192,7 +192,7 @@ public class ActionLayoutData implements Serializable, Owned<ActionOwner> {
- private ActionOwner owner;
+ private ActionLayoutDataOwner owner;
/**
* Owner.
*
@@ -201,11 +201,11 @@ public class ActionLayoutData implements Serializable, Owned<ActionOwner> {
* </p>
*/
@XmlTransient
- public ActionOwner getOwner() {
+ public ActionLayoutDataOwner getOwner() {
return owner;
}
- public void setOwner(final ActionOwner owner) {
+ public void setOwner(final ActionLayoutDataOwner owner) {
this.owner = owner;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/common/ActionLayoutDataOwner.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/common/ActionLayoutDataOwner.java b/core/applib/src/main/java/org/apache/isis/applib/layout/common/ActionLayoutDataOwner.java
new file mode 100644
index 0000000..bf2c9ca
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/common/ActionLayoutDataOwner.java
@@ -0,0 +1,25 @@
+/*
+ * 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.layout.common;
+
+import java.util.List;
+
+public interface ActionLayoutDataOwner extends Owner {
+ List<ActionLayoutData> getActions();
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/common/ActionOwner.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/common/ActionOwner.java b/core/applib/src/main/java/org/apache/isis/applib/layout/common/ActionOwner.java
deleted file mode 100644
index 71ce307..0000000
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/common/ActionOwner.java
+++ /dev/null
@@ -1,25 +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.applib.layout.common;
-
-import java.util.List;
-
-public interface ActionOwner extends Owner {
- List<ActionLayoutData> getActions();
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/common/CollectionLayoutData.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/common/CollectionLayoutData.java b/core/applib/src/main/java/org/apache/isis/applib/layout/common/CollectionLayoutData.java
index e3b53cb..7ba3d5d 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/common/CollectionLayoutData.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/common/CollectionLayoutData.java
@@ -53,7 +53,7 @@ import org.apache.isis.applib.annotation.Where;
, "metadataError"
}
)
-public class CollectionLayoutData implements MemberRegion, ActionOwner, Serializable {
+public class CollectionLayoutData implements MemberRegion, ActionLayoutDataOwner, Serializable {
private static final long serialVersionUID = 1L;
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/common/DomainObjectLayoutData.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/common/DomainObjectLayoutData.java b/core/applib/src/main/java/org/apache/isis/applib/layout/common/DomainObjectLayoutData.java
index 764d7d6..0db726a 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/common/DomainObjectLayoutData.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/common/DomainObjectLayoutData.java
@@ -23,6 +23,7 @@ import java.io.Serializable;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import org.apache.isis.applib.annotation.BookmarkPolicy;
@@ -158,5 +159,24 @@ public class DomainObjectLayoutData implements Serializable {
+ private MemberRegionOwner owner;
+ /**
+ * Owner.
+ *
+ * <p>
+ * Set programmatically by framework after reading in from XML.
+ * </p>
+ */
+ @XmlTransient
+ public MemberRegionOwner getOwner() {
+ return owner;
+ }
+
+ public void setOwner(final MemberRegionOwner owner) {
+ this.owner = owner;
+ }
+
+
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/common/DomainObjectLayoutDataOwner.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/common/DomainObjectLayoutDataOwner.java b/core/applib/src/main/java/org/apache/isis/applib/layout/common/DomainObjectLayoutDataOwner.java
new file mode 100644
index 0000000..2b719e9
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/common/DomainObjectLayoutDataOwner.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.applib.layout.common;
+
+public interface DomainObjectLayoutDataOwner extends Owner {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/common/FieldSet.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/common/FieldSet.java b/core/applib/src/main/java/org/apache/isis/applib/layout/common/FieldSet.java
index d6e56ba..fe0a3fb 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/common/FieldSet.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/common/FieldSet.java
@@ -51,7 +51,7 @@ import org.apache.isis.applib.annotation.Programmatic;
, "properties"
}
)
-public class FieldSet implements MemberRegion, ActionOwner, Serializable {
+public class FieldSet implements MemberRegion, ActionLayoutDataOwner, Serializable {
private static final long serialVersionUID = 1L;
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/common/Page.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/common/Page.java b/core/applib/src/main/java/org/apache/isis/applib/layout/common/Page.java
index 7034321..8ed1d88 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/common/Page.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/common/Page.java
@@ -18,6 +18,15 @@
*/
package org.apache.isis.applib.layout.common;
+import java.util.LinkedHashMap;
+
+import javax.xml.bind.annotation.XmlTransient;
+
+import com.google.common.collect.Maps;
+
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.layout.fixedcols.FCPage;
+import org.apache.isis.applib.layout.fixedcols.FCTab;
import org.apache.isis.applib.services.layout.PageService;
/**
@@ -29,10 +38,20 @@ import org.apache.isis.applib.services.layout.PageService;
*/
public interface Page {
-
boolean isNormalized();
void setNormalized(final boolean normalized);
+ @Programmatic
+ LinkedHashMap<String, PropertyLayoutData> getAllPropertiesById();
+
+ @Programmatic
+ LinkedHashMap<String, CollectionLayoutData> getAllCollectionsById();
+
+ @Programmatic
+ LinkedHashMap<String, ActionLayoutData> getAllActionsById();
+
+ @Programmatic
+ LinkedHashMap<String, FieldSet> getAllFieldSetsByName();
}
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/common/PropertyLayoutData.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/common/PropertyLayoutData.java b/core/applib/src/main/java/org/apache/isis/applib/layout/common/PropertyLayoutData.java
index fdc57e0..c9274b6 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/common/PropertyLayoutData.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/common/PropertyLayoutData.java
@@ -46,7 +46,7 @@ import org.apache.isis.applib.annotation.Where;
, "metadataError"
}
)
-public class PropertyLayoutData implements ActionOwner, Serializable, Owned<FieldSet> {
+public class PropertyLayoutData implements ActionLayoutDataOwner, Serializable, Owned<FieldSet> {
private static final long serialVersionUID = 1L;
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCPage.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCPage.java b/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCPage.java
index a86ea88..5c3ecd0 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCPage.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/fixedcols/FCPage.java
@@ -32,7 +32,7 @@ import com.google.common.collect.Maps;
import org.apache.isis.applib.annotation.Programmatic;
import org.apache.isis.applib.layout.common.ActionLayoutData;
-import org.apache.isis.applib.layout.common.ActionOwner;
+import org.apache.isis.applib.layout.common.ActionLayoutDataOwner;
import org.apache.isis.applib.layout.common.CollectionLayoutData;
import org.apache.isis.applib.layout.common.FieldSet;
import org.apache.isis.applib.layout.common.Page;
@@ -55,7 +55,7 @@ import org.apache.isis.applib.services.dto.Dto;
, "right"
}
)
-public class FCPage implements Page, Dto, ActionOwner, Serializable, FCColumnOwner, FCTabGroupOwner {
+public class FCPage implements Page, Dto, ActionLayoutDataOwner, Serializable, FCColumnOwner, FCTabGroupOwner {
private static final long serialVersionUID = 1L;
@@ -115,10 +115,10 @@ public class FCPage implements Page, Dto, ActionOwner, Serializable, FCColumnOwn
interface Visitor {
- void visit(final FCPage FCPage);
- void visit(final FCTabGroup tabGroup);
- void visit(final FCTab FCTab);
- void visit(final FCColumn FCColumn);
+ void visit(final FCPage fcPage);
+ void visit(final FCTabGroup fcTabGroup);
+ void visit(final FCTab fcTab);
+ void visit(final FCColumn fcColumn);
void visit(final FieldSet fieldSet);
void visit(final PropertyLayoutData propertyLayoutData);
void visit(final CollectionLayoutData collectionLayoutData);
@@ -127,13 +127,13 @@ public class FCPage implements Page, Dto, ActionOwner, Serializable, FCColumnOwn
public static class VisitorAdapter implements Visitor {
@Override
- public void visit(final FCPage FCPage) { }
+ public void visit(final FCPage fcPage) { }
@Override
- public void visit(final FCTabGroup tabGroup) { }
+ public void visit(final FCTabGroup fcTabGroup) { }
@Override
- public void visit(final FCTab FCTab) { }
+ public void visit(final FCTab fcTab) { }
@Override
- public void visit(final FCColumn FCColumn) { }
+ public void visit(final FCColumn fcColumn) { }
@Override
public void visit(final FieldSet fieldSet) {}
@Override
@@ -149,39 +149,40 @@ public class FCPage implements Page, Dto, ActionOwner, Serializable, FCColumnOwn
* Visits all elements of the graph. The {@link Visitor} implementation
* can assume that all "owner" references are populated.
*/
- public void visit(final Visitor visitor) {
+ public void visit(final FCPage.Visitor visitor) {
visitor.visit(this);
traverseActions(this, visitor);
traverseColumn(getLeft(), this, visitor);
final List<FCTabGroup> tabGroups = getTabGroups();
- for (final FCTabGroup tabGroup : tabGroups) {
- tabGroup.setOwner(this);
- visitor.visit(tabGroup);
- final List<FCTab> tabs = tabGroup.getTabs();
- for (final FCTab FCTab : tabs) {
- FCTab.setOwner(tabGroup);
- visitor.visit(FCTab);
- traverseColumn(FCTab.getLeft(), FCTab, visitor);
- traverseColumn(FCTab.getMiddle(), FCTab, visitor);
- traverseColumn(FCTab.getRight(), FCTab, visitor);
+ for (final FCTabGroup fcTabGroup : tabGroups) {
+ fcTabGroup.setOwner(this);
+ visitor.visit(fcTabGroup);
+ final List<FCTab> tabs = fcTabGroup.getTabs();
+ for (final FCTab fcTab : tabs) {
+ fcTab.setOwner(fcTabGroup);
+ visitor.visit(fcTab);
+ traverseColumn(fcTab.getLeft(), fcTab, visitor);
+ traverseColumn(fcTab.getMiddle(), fcTab, visitor);
+ traverseColumn(fcTab.getRight(), fcTab, visitor);
}
}
traverseColumn(getRight(), this, visitor);
}
- private void traverseColumn(final FCColumn FCColumn, final FCColumnOwner FCColumnOwner, final Visitor visitor) {
- if(FCColumn == null) {
+ private void traverseColumn(
+ final FCColumn fcColumn, final FCColumnOwner fcColumnOwner, final Visitor visitor) {
+ if(fcColumn == null) {
return;
}
- FCColumn.setOwner(FCColumnOwner);
- visitor.visit(FCColumn);
- traversePropertyGroups(FCColumn, visitor);
- traverseCollections(FCColumn, visitor);
+ fcColumn.setOwner(fcColumnOwner);
+ visitor.visit(fcColumn);
+ traverseFieldSets(fcColumn, visitor);
+ traverseCollections(fcColumn, visitor);
}
- private void traversePropertyGroups(final FCColumn FCColumn, final Visitor visitor) {
- for (final FieldSet fieldSet : FCColumn.getFieldSets()) {
- fieldSet.setOwner(FCColumn);
+ private void traverseFieldSets(final FCColumn fcColumn, final Visitor visitor) {
+ for (final FieldSet fieldSet : fcColumn.getFieldSets()) {
+ fieldSet.setOwner(fcColumn);
visitor.visit(fieldSet);
traverseActions(fieldSet, visitor);
final List<PropertyLayoutData> properties = fieldSet.getProperties();
@@ -193,21 +194,21 @@ public class FCPage implements Page, Dto, ActionOwner, Serializable, FCColumnOwn
}
}
- private void traverseCollections(final FCColumn FCColumn, final Visitor visitor) {
- for (final CollectionLayoutData collectionLayoutData : FCColumn.getCollections()) {
- collectionLayoutData.setOwner(FCColumn);
+ private void traverseCollections(final FCColumn fcColumn, final Visitor visitor) {
+ for (final CollectionLayoutData collectionLayoutData : fcColumn.getCollections()) {
+ collectionLayoutData.setOwner(fcColumn);
visitor.visit(collectionLayoutData);
traverseActions(collectionLayoutData, visitor);
}
}
- private void traverseActions(final ActionOwner actionOwner, final Visitor visitor) {
- final List<ActionLayoutData> actionLayoutDatas = actionOwner.getActions();
+ private void traverseActions(final ActionLayoutDataOwner actionLayoutDataOwner, final Visitor visitor) {
+ final List<ActionLayoutData> actionLayoutDatas = actionLayoutDataOwner.getActions();
if(actionLayoutDatas == null) {
return;
}
for (final ActionLayoutData actionLayoutData : actionLayoutDatas) {
- actionLayoutData.setOwner(actionOwner);
+ actionLayoutData.setOwner(actionLayoutDataOwner);
visitor.visit(actionLayoutData);
}
}
@@ -258,36 +259,35 @@ public class FCPage implements Page, Dto, ActionOwner, Serializable, FCColumnOwn
@Programmatic
@XmlTransient
- public LinkedHashMap<String, FCTab> getAllTabsByName() {
- final LinkedHashMap<String, FCTab> tabsByName = Maps.newLinkedHashMap();
+ public LinkedHashMap<String, FieldSet> getAllFieldSetsByName() {
+ final LinkedHashMap<String, FieldSet> fieldSetsByName = Maps.newLinkedHashMap();
visit(new FCPage.VisitorAdapter() {
@Override
- public void visit(final FCTab FCTab) {
- tabsByName.put(FCTab.getName(), FCTab);
+ public void visit(final FieldSet fieldSet) {
+ fieldSetsByName.put(fieldSet.getName(), fieldSet);
}
});
- return tabsByName;
+ return fieldSetsByName;
}
@Programmatic
@XmlTransient
- public LinkedHashMap<String, FieldSet> getAllPropertyGroupsByName() {
- final LinkedHashMap<String, FieldSet> propertyGroupsByName = Maps.newLinkedHashMap();
+ public LinkedHashMap<String, FCTab> getAllTabsByName() {
+ final LinkedHashMap<String, FCTab> tabsByName = Maps.newLinkedHashMap();
visit(new FCPage.VisitorAdapter() {
@Override
- public void visit(final FieldSet fieldSet) {
- propertyGroupsByName.put(fieldSet.getName(), fieldSet);
+ public void visit(final FCTab fcTab) {
+ tabsByName.put(fcTab.getName(), fcTab);
}
});
- return propertyGroupsByName;
+ return tabsByName;
}
-
private boolean normalized;
@Programmatic
@@ -301,4 +301,5 @@ public class FCPage implements Page, Dto, ActionOwner, Serializable, FCColumnOwn
this.normalized = normalized;
}
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerFC.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerFC.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerFC.java
index 813fb37..c86b2d9 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerFC.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/layout/provider/PageNormalizerFC.java
@@ -33,7 +33,7 @@ import org.apache.isis.applib.layout.fixedcols.FCTab;
import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
import org.apache.isis.applib.layout.common.MemberRegionOwner;
import org.apache.isis.applib.layout.common.ActionLayoutData;
-import org.apache.isis.applib.layout.common.ActionOwner;
+import org.apache.isis.applib.layout.common.ActionLayoutDataOwner;
import org.apache.isis.applib.layout.common.CollectionLayoutData;
import org.apache.isis.applib.layout.common.FieldSet;
import org.apache.isis.applib.layout.common.PropertyLayoutData;
@@ -125,8 +125,8 @@ public class PageNormalizerFC extends PageNormalizerAbstract<FCPage> {
// capture the first property group (if any) with the default name ('General')
metadata.visit(new FCPage.VisitorAdapter() {
@Override
- public void visit(final FCColumn FCColumn) {
- firstColumnRef.compareAndSet(null, FCColumn);
+ public void visit(final FCColumn fcColumn) {
+ firstColumnRef.compareAndSet(null, fcColumn);
}
@Override
public void visit(final FieldSet fieldSet) {
@@ -135,8 +135,8 @@ public class PageNormalizerFC extends PageNormalizerAbstract<FCPage> {
}
}
@Override
- public void visit(final FCTabGroup tabGroup) {
- lastTabGroupRef.set(tabGroup);
+ public void visit(final FCTabGroup fcTabGroup) {
+ lastTabGroupRef.set(fcTabGroup);
}
});
@@ -252,7 +252,7 @@ public class PageNormalizerFC extends PageNormalizerAbstract<FCPage> {
@Override
public void visit(final ActionLayoutData actionLayoutData) {
- final ActionOwner actionOwner = actionLayoutData.getOwner();
+ final ActionLayoutDataOwner actionLayoutDataOwner = actionLayoutData.getOwner();
final ObjectAction objectAction = objectActionById.get(actionLayoutData.getId());
if(objectAction == null) {
return;
@@ -260,18 +260,18 @@ public class PageNormalizerFC extends PageNormalizerAbstract<FCPage> {
final String memberOrderName;
final int memberOrderSequence;
- if(actionOwner instanceof FieldSet) {
- final FieldSet fieldSet = (FieldSet) actionOwner;
+ if(actionLayoutDataOwner instanceof FieldSet) {
+ final FieldSet fieldSet = (FieldSet) actionLayoutDataOwner;
final List<PropertyLayoutData> properties = fieldSet.getProperties();
final PropertyLayoutData propertyLayoutData = properties.get(0); // any will do
memberOrderName = propertyLayoutData.getId();
memberOrderSequence = actionPropertyGroupSequence++;
- } else if(actionOwner instanceof PropertyLayoutData) {
- final PropertyLayoutData propertyLayoutData = (PropertyLayoutData) actionOwner;
+ } else if(actionLayoutDataOwner instanceof PropertyLayoutData) {
+ final PropertyLayoutData propertyLayoutData = (PropertyLayoutData) actionLayoutDataOwner;
memberOrderName = propertyLayoutData.getId();
memberOrderSequence = actionPropertySequence++;
- } else if(actionOwner instanceof CollectionLayoutData) {
- final CollectionLayoutData collectionLayoutData = (CollectionLayoutData) actionOwner;
+ } else if(actionLayoutDataOwner instanceof CollectionLayoutData) {
+ final CollectionLayoutData collectionLayoutData = (CollectionLayoutData) actionLayoutDataOwner;
memberOrderName = collectionLayoutData.getId();
memberOrderSequence = actionCollectionSequence++;
} else {
@@ -283,13 +283,13 @@ public class PageNormalizerFC extends PageNormalizerAbstract<FCPage> {
new MemberOrderFacetXml(memberOrderName, ""+memberOrderSequence, translationService, objectAction));
- if(actionOwner instanceof FieldSet) {
+ if(actionLayoutDataOwner instanceof FieldSet) {
if(actionLayoutData.getPosition() == null ||
actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.BELOW ||
actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.RIGHT) {
actionLayoutData.setPosition(org.apache.isis.applib.annotation.ActionLayout.Position.PANEL);
}
- } else if(actionOwner instanceof PropertyLayoutData) {
+ } else if(actionLayoutDataOwner instanceof PropertyLayoutData) {
if(actionLayoutData.getPosition() == null ||
actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.PANEL_DROPDOWN ||
actionLayoutData.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.PANEL) {
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/CssIdAppender.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/CssIdAppender.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/CssIdAppender.java
new file mode 100644
index 0000000..1d78137
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/util/CssIdAppender.java
@@ -0,0 +1,70 @@
+/*
+ * 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.util;
+
+import com.google.common.base.Strings;
+
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.behavior.AttributeAppender;
+import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+
+/**
+ * Implementation of {@link AttributeAppender} that appends the provided CSS
+ * <tt>id</tt> attribute.
+ */
+public class CssIdAppender extends AttributeAppender {
+
+ private static final long serialVersionUID = 1L;
+
+ public CssIdAppender(final IModel<String> appendModel) {
+ super("id", appendModel, " ");
+ }
+
+ public CssIdAppender(final String append) {
+ this(Model.of(append));
+ }
+
+ /**
+ * Adds CSS id to tag (providing that the id is non-null and non-empty).
+ */
+ public static void appendCssIdTo(
+ final ComponentTag tag,
+ final String cssId) {
+ if(Strings.isNullOrEmpty(cssId)) {
+ return;
+ }
+ tag.append("id", cssId, " ");
+ }
+
+ /**
+ * Adds CSS class to container (providing that the class is non-null and non-empty).
+ */
+ public static void appendCssIdTo(
+ final MarkupContainer markupContainer,
+ final String cssClass) {
+ if(Strings.isNullOrEmpty(cssClass)) {
+ return;
+ }
+ markupContainer.add(new CssIdAppender(cssClass));
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-FC.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-FC.xml b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-FC.xml
index da9fc4c..91a1fd1 100644
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-FC.xml
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-FC.xml
@@ -6,9 +6,9 @@
</left>
<tabGroup>
<tab name="Properties">
- <left span="8">
+ <left span="12">
<c:fieldSet name="General">
- <c:action id="delete"/>
+ <c:action id="delete" position="PANEL_DROPDOWN"/>
<c:property id="name" labelPosition="TOP">
<c:action id="updateName">
<c:describedAs>This allows the name to be updated</c:describedAs>
@@ -16,18 +16,21 @@
</c:property>
</c:fieldSet>
</left>
- <middle span="4">
+ </tab>
+ <tab name="Metadata">
+ <left span="12">
<c:fieldSet name="Foo">
<c:action id="downloadJdoMetadata" position="PANEL"/>
<c:action id="downloadLayoutXml" position="PANEL"/>
<c:property id="versionSequence"/>
</c:fieldSet>
- </middle>
+
+ </left>
</tab>
</tabGroup>
<tabGroup>
<tab name="Collections">
- <left span="6">
+ <left span="12">
<c:collection id="similarTo" defaultView="table"/>
</left>
<right span="6">
http://git-wip-us.apache.org/repos/asf/isis/blob/25a267a6/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
index 482f6fa..c241c08 100644
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
@@ -5,7 +5,8 @@
<bs3:col span="8">
<c:domainObject/>
</bs3:col>
- <bs3:col span="4" cssClass="foobar">
+ <bs3:col span="4" cssClass="foobar" unreferencedActions="true">
+ <c:action id="delete" cssClassFa="fa-trash"/>
</bs3:col>
</bs3:row>
@@ -16,7 +17,8 @@
<bs3:row>
<bs3:col span="12">
<c:fieldSet name="Metadata">
- <c:action id="downloadJdoMetadata" position="PANEL"/>
+ <c:action id="downloadJdMetadata">
+ </c:action>
<c:action id="downloadLayoutXml" position="PANEL_DROPDOWN"/>
<c:property id="versionSequence">
</c:property>
[06/15] isis git commit: ISIS-993: bootstrap3 layout working,
more or less. Still need to do the normalization phase.
Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupListPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupListPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupListPanel.html
deleted file mode 100644
index 6699518..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupListPanel.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/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupListPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupListPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupListPanel.java
deleted file mode 100644
index 7a07082..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupListPanel.java
+++ /dev/null
@@ -1,66 +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.layout.fixedcols;
-
-import java.util.List;
-
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-
-import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
-import org.apache.isis.viewer.wicket.model.models.EntityModel;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-
-public class TabGroupListPanel extends PanelAbstract<EntityModel> {
-
- private static final long serialVersionUID = 1L;
-
- private static final String ID_TAB_GROUPS = "tabGroups";
-
- // the view metadata
- private final List<FCTabGroup> tabGroups;
-
- public TabGroupListPanel(final String id, final EntityModel entityModel) {
- super(id, entityModel);
-
- this.tabGroups = (List<FCTabGroup>) entityModel.getLayoutMetadata();
-
- buildGui();
- }
-
- private void buildGui() {
- final EntityModel model = getModel();
-
- final ListView<FCTabGroup> tabGroupsList = new ListView<FCTabGroup>(ID_TAB_GROUPS, this.tabGroups) {
-
- @Override
- protected void populateItem(final ListItem<FCTabGroup> item) {
-
- final FCTabGroup tabGroup = item.getModelObject();
- final EntityModel entityModelWithHints = model.cloneWithLayoutMetadata(tabGroup);
- final TabGroupPanel tabGroupPanel = new TabGroupPanel(entityModelWithHints);
- item.add(tabGroupPanel);
- }
- };
-
- add(tabGroupsList);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupPanel.java
deleted file mode 100644
index d0fe9a0..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabGroupPanel.java
+++ /dev/null
@@ -1,103 +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.layout.fixedcols;
-
-import java.util.List;
-
-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.panel.Panel;
-import org.apache.wicket.model.Model;
-
-import org.apache.isis.applib.layout.fixedcols.FCTab;
-import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
-import org.apache.isis.viewer.wicket.model.models.EntityModel;
-import org.apache.isis.viewer.wicket.model.util.ScopedSessionAttribute;
-
-import de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel;
-
-public class TabGroupPanel extends AjaxBootstrapTabbedPanel {
-
- public static final String SESSION_ATTR_SELECTED_TAB = "selectedTab";
- private final EntityModel entityModel;
- // the view metadata
- private final FCTabGroup tabGroup;
- private final ScopedSessionAttribute<Integer> selectedTabInSession;
-
- private static final String ID_TAB_GROUP = "tabGroup";
-
- private static List<ITab> tabsFor(final EntityModel entityModel) {
- final List<ITab> tabs = Lists.newArrayList();
-
- final FCTabGroup tabGroup = (FCTabGroup) entityModel.getLayoutMetadata();
- final List<FCTab> FCTabList = FluentIterable
- .from(tabGroup.getTabs())
- .filter(FCTab.Predicates.notEmpty())
- .toList();
-
- for (final FCTab FCTab : FCTabList) {
- tabs.add(new AbstractTab(Model.of(FCTab.getName())) {
- private static final long serialVersionUID1 = 1L;
-
- @Override
- public Panel getPanel(String panelId) {
- return new TabPanel(panelId, entityModel, FCTab);
- }
- });
- }
- return tabs;
- }
-
- public TabGroupPanel(final EntityModel entityModel) {
- super(ID_TAB_GROUP, tabsFor(entityModel));
-
- this.entityModel = entityModel;
- this.tabGroup = (FCTabGroup) entityModel.getLayoutMetadata();
- this.selectedTabInSession = ScopedSessionAttribute.create(entityModel, this, SESSION_ATTR_SELECTED_TAB);
-
- }
-
- @Override
- protected void onInitialize() {
- setSelectedTabFromSessionIfAny(this);
- super.onInitialize();
- }
-
- @Override
- public TabbedPanel setSelectedTab(final int index) {
- selectedTabInSession.set(index);
- return super.setSelectedTab(index);
- }
-
- private void setSelectedTabFromSessionIfAny(
- final AjaxBootstrapTabbedPanel ajaxBootstrapTabbedPanel) {
- final Integer tabIndex = selectedTabInSession.get();
- if (tabIndex != null) {
- 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);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabPanel.html
deleted file mode 100644
index 111fc68..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabPanel.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/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabPanel.java
deleted file mode 100644
index 70dcb03..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/TabPanel.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.apache.isis.viewer.wicket.ui.components.layout.fixedcols;
-
-import org.apache.isis.applib.layout.fixedcols.FCTab;
-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 FCTab FCTab) {
- super(id);
-
- final EntityModel modelWithTabHints = model.cloneWithLayoutMetadata(FCTab);
-
- getComponentFactoryRegistry()
- .addOrReplaceComponent(this,
- ID_COLUMN, ComponentType.ENTITY_PROPERTIES, modelWithTabHints);
-
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/collections/EntityCollectionsPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/collections/EntityCollectionsPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/collections/EntityCollectionsPanel.html
new file mode 100644
index 0000000..0e03ea9
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/collections/EntityCollectionsPanel.html
@@ -0,0 +1,32 @@
+<?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="entityCollectionsPanel entityCollectionsComponentType">
+ <div wicket:id="collections">
+ <div wicket:id="collection">
+ [collection]
+ </div>
+ </div>
+ </div>
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/collections/EntityCollectionsPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/collections/EntityCollectionsPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/collections/EntityCollectionsPanel.java
new file mode 100644
index 0000000..21c2ed0
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/collections/EntityCollectionsPanel.java
@@ -0,0 +1,151 @@
+/*
+ * 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.layout.fixedcols.collections;
+
+import java.util.Comparator;
+import java.util.List;
+
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.ImmutableList;
+
+import org.apache.wicket.markup.html.WebMarkupContainer;
+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;
+import org.apache.isis.applib.layout.common.CollectionLayoutData;
+import org.apache.isis.applib.layout.fixedcols.FCColumn;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.consent.InteractionInitiatedBy;
+import org.apache.isis.core.metamodel.facets.members.order.MemberOrderFacet;
+import org.apache.isis.core.metamodel.spec.feature.Contributed;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.services.DeweyOrderComparator;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.components.entity.collection.EntityCollectionPanel;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+/**
+ * {@link PanelAbstract Panel} representing the properties of an entity, as per
+ * the provided {@link EntityModel}.
+ */
+public class EntityCollectionsPanel extends PanelAbstract<EntityModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_ENTITY_COLLECTIONS = "entityCollections";
+ private static final String ID_COLLECTIONS = "collections";
+ private static final String ID_COLLECTION = "collection";
+
+ // view metadata (if any available)
+ private final FCColumn fcColumnIfAny;
+
+ public EntityCollectionsPanel(final String id, final EntityModel entityModel) {
+ super(id, entityModel);
+
+ fcColumnIfAny = (FCColumn) entityModel.getLayoutMetadata();
+
+ buildGui();
+ }
+
+ private void buildGui() {
+ buildEntityPropertiesAndOrCollectionsGui();
+ setOutputMarkupId(true); // so can repaint via ajax
+ }
+
+ private void buildEntityPropertiesAndOrCollectionsGui() {
+ final EntityModel model = getModel();
+ final ObjectAdapter adapter = model.getObject();
+ if (adapter != null) {
+ addCollections();
+ } else {
+ permanentlyHide(ID_ENTITY_COLLECTIONS);
+ }
+ }
+
+ private void addCollections() {
+ final EntityModel entityModel = getModel();
+ final ObjectAdapter adapter = entityModel.getObject();
+
+ final Filter<ObjectAssociation> filter;
+ if (fcColumnIfAny != null) {
+ final ImmutableList<String> collectionIds = FluentIterable
+ .from(fcColumnIfAny.getCollections())
+ .transform(CollectionLayoutData.Functions.id())
+ .toList();
+ filter = new Filter<ObjectAssociation>() {
+ @Override
+ public boolean accept(final ObjectAssociation objectAssociation) {
+ return collectionIds.contains(objectAssociation.getId());
+ }
+ };
+ } else {
+ filter = Filters.any();
+ }
+
+ final List<ObjectAssociation> associations = visibleCollections(adapter, filter);
+ associations.sort(new Comparator<ObjectAssociation>() {
+ private final DeweyOrderComparator deweyOrderComparator = new DeweyOrderComparator();
+ @Override
+ public int compare(final ObjectAssociation o1, final ObjectAssociation o2) {
+ final MemberOrderFacet o1Facet = o1.getFacet(MemberOrderFacet.class);
+ final MemberOrderFacet o2Facet = o2.getFacet(MemberOrderFacet.class);
+ return o1Facet == null? +1:
+ o2Facet == null? -1:
+ deweyOrderComparator.compare(o1Facet.sequence(), o2Facet.sequence());
+ }
+ });
+
+ final RepeatingView collectionRv = new RepeatingView(ID_COLLECTIONS);
+ add(collectionRv);
+
+ for (final ObjectAssociation association : associations) {
+
+ final WebMarkupContainer collectionRvContainer = new WebMarkupContainer(collectionRv.newChildId());
+ collectionRv.add(collectionRvContainer);
+
+ final CollectionLayoutData collectionLayoutData = new CollectionLayoutData(association.getId());
+ final EntityModel entityModelWithCollectionLayoutMetadata =
+ entityModel.cloneWithLayoutMetadata(collectionLayoutData);
+
+ collectionRvContainer.add(new EntityCollectionPanel(ID_COLLECTION, entityModelWithCollectionLayoutMetadata));
+ }
+ }
+
+ private static List<ObjectAssociation> visibleCollections(
+ final ObjectAdapter adapter,
+ final Filter<ObjectAssociation> filter) {
+ return adapter.getSpecification().getAssociations(
+ Contributed.INCLUDED, visibleCollectionsFilter(adapter, filter));
+ }
+
+ @SuppressWarnings("unchecked")
+ private static Filter<ObjectAssociation> visibleCollectionsFilter(
+ final ObjectAdapter adapter,
+ final Filter<ObjectAssociation> filter) {
+ return Filters.and(
+ ObjectAssociation.Filters.COLLECTIONS,
+ ObjectAssociation.Filters.dynamicallyVisible(
+ adapter, InteractionInitiatedBy.USER, Where.PARENTED_TABLES),
+ filter);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/collections/EntityCollectionsPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/collections/EntityCollectionsPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/collections/EntityCollectionsPanelFactory.java
new file mode 100644
index 0000000..797720b
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/collections/EntityCollectionsPanelFactory.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.collections;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+
+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;
+
+/**
+ * {@link ComponentFactory} for {@link EntityCollectionsPanel}.
+ */
+public class EntityCollectionsPanelFactory extends EntityComponentFactoryAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public EntityCollectionsPanelFactory() {
+ super(ComponentType.ENTITY_COLLECTIONS, EntityCollectionsPanel.class);
+ }
+
+ @Override
+ public Component createComponent(final String id, final IModel<?> model) {
+ final EntityModel entityModel = (EntityModel) model;
+ return new EntityCollectionsPanel(id, entityModel);
+ }
+}
+
+
+
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/columns/EntityColumn.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/columns/EntityColumn.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/columns/EntityColumn.html
new file mode 100644
index 0000000..44e3a23
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/columns/EntityColumn.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="columnMembers">
+ <div class="inputFormTable properties">
+ <div wicket:id="propertyGroup">[propertyGroup]</div>
+ </div>
+ <div wicket:id="collections"></div>
+ </div>
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/columns/EntityColumn.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/columns/EntityColumn.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/columns/EntityColumn.java
new file mode 100644
index 0000000..cfb9bfa
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/columns/EntityColumn.java
@@ -0,0 +1,190 @@
+/*
+ * 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.layout.fixedcols.columns;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import com.google.common.base.Function;
+import com.google.common.collect.FluentIterable;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.repeater.RepeatingView;
+
+import org.apache.isis.applib.layout.common.FieldSet;
+import org.apache.isis.applib.layout.common.PropertyLayoutData;
+import org.apache.isis.applib.layout.fixedcols.FCColumn;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facets.object.membergroups.MemberGroupLayoutFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.ObjectSpecifications;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.system.DeploymentType;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+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.layout.fixedcols.PropUtil;
+import org.apache.isis.viewer.wicket.ui.components.entity.fieldset.PropertyGroup;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+import org.apache.isis.viewer.wicket.ui.util.Components;
+
+/**
+ * Adds properties (in property groups) and collections to a column.
+ *
+ * <p>
+ * If {@link FCColumn} is present, then only those properties and collections for that
+ * column metadata are rendered. Otherwise the {@link MemberGroupLayoutFacet} on the
+ * {@link ObjectSpecification} in conjunction with the provided {@link FCColumn.Hint} is
+ * used to filter down to just those properties/collections in the column.
+ * </p>
+ */
+public class EntityColumn extends PanelAbstract<EntityModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_PROPERTY_GROUP = "propertyGroup";
+
+
+ // view metadata (populated for EntityTabbedPanel, absent for EntityEditablePanel)
+ private final FCColumn columnMetaDataIfAny;
+
+ // which column to render (populated for EntityEditablePanel, not required and so absent for EntityTabbedPanel)
+ final FCColumn.Hint hint;
+
+ private static FCColumn.Hint hintFrom(final EntityModel entityModel) {
+ final FCColumn fcColumn = (FCColumn) entityModel.getLayoutMetadata();
+ return fcColumn.getHint();
+ }
+
+
+ public EntityColumn(
+ final String id,
+ final EntityModel entityModel) {
+
+ this(id, entityModel, hintFrom(entityModel));
+ }
+
+ public EntityColumn(
+ final String id,
+ final EntityModel entityModel,
+ final FCColumn.Hint hint) {
+
+ super(id, entityModel);
+
+ columnMetaDataIfAny = (FCColumn) entityModel.getLayoutMetadata();
+ this.hint = hint;
+
+ buildGui();
+ }
+
+ private void buildGui() {
+ addPropertiesAndCollections(this, getModel());
+ }
+
+ private void addPropertiesAndCollections(
+ final MarkupContainer col,
+ final EntityModel entityModel) {
+ addPropertiesInColumn(col, entityModel);
+ addCollectionsIfRequired(col, entityModel);
+ }
+
+ private void addPropertiesInColumn(
+ final MarkupContainer markupContainer,
+ final EntityModel entityModel) {
+
+ final ObjectAdapter adapter = entityModel.getObject();
+ final ObjectSpecification objSpec = adapter.getSpecification();
+
+ final Map<String, List<ObjectAssociation>> associationsByGroup = PropUtil.propertiesByMemberOrder(adapter);
+
+ final RepeatingView memberGroupRv = new RepeatingView(ID_PROPERTY_GROUP);
+ markupContainer.add(memberGroupRv);
+
+ final ImmutableMap<String, FieldSet> propertyGroupMetadataByNameIfAny =
+ columnMetaDataIfAny != null
+ ? Maps.uniqueIndex(columnMetaDataIfAny.getFieldSets(), FieldSet.Util.nameOf())
+ : null;
+
+ final Collection<String> groupNames =
+ propertyGroupMetadataByNameIfAny != null
+ ? propertyGroupMetadataByNameIfAny.keySet()
+ : ObjectSpecifications.orderByMemberGroups(objSpec, associationsByGroup.keySet(), hint);
+
+ for(final String groupName: groupNames) {
+
+
+ final FieldSet fieldSet;
+ if (propertyGroupMetadataByNameIfAny != null) {
+ fieldSet = propertyGroupMetadataByNameIfAny.get(groupName);
+ }
+ else {
+ final List<ObjectAssociation> associationsInGroup = associationsByGroup.get(groupName);
+ fieldSet = new FieldSet(groupName);
+ fieldSet.setProperties(
+ FluentIterable
+ .from(associationsInGroup)
+ .transform(
+ new Function<ObjectAssociation, PropertyLayoutData>() {
+ @Override
+ public PropertyLayoutData apply(final ObjectAssociation assoc) {
+ return new PropertyLayoutData(assoc.getId());
+ }
+ }).toList());
+ }
+
+ if(fieldSet.getProperties().isEmpty()) {
+ continue;
+ }
+
+ final String id = memberGroupRv.newChildId();
+
+ final EntityModel entityModelWithHints = entityModel.cloneWithLayoutMetadata(fieldSet);
+ final WebMarkupContainer memberGroupRvContainer = new PropertyGroup(id, entityModelWithHints);
+
+ memberGroupRv.add(memberGroupRvContainer);
+ }
+ }
+
+ private void addCollectionsIfRequired(
+ final MarkupContainer column,
+ final EntityModel entityModel) {
+
+ if(columnMetaDataIfAny != null) {
+ getComponentFactoryRegistry()
+ .addOrReplaceComponent(column, "collections", ComponentType.ENTITY_COLLECTIONS, entityModel);
+ } else {
+ Components.permanentlyHide(column, "collections");
+ }
+ }
+
+
+
+ ///////////////////////////////////////////////////////
+ // Dependencies (from context)
+ ///////////////////////////////////////////////////////
+
+ protected DeploymentType getDeploymentType() {
+ return IsisContext.getDeploymentType();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsForm.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsForm.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsForm.java
new file mode 100644
index 0000000..f1f2a78
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsForm.java
@@ -0,0 +1,710 @@
+/*
+ * 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.layout.fixedcols.propsandcolls;
+
+import java.util.List;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.Session;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
+import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+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.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;
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.applib.filter.Filter;
+import org.apache.isis.applib.filter.Filters;
+import org.apache.isis.applib.layout.fixedcols.FCColumn;
+import org.apache.isis.applib.layout.fixedcols.FCColumn.Hint;
+import org.apache.isis.applib.layout.fixedcols.FCTab;
+import org.apache.isis.applib.services.exceprecog.ExceptionRecognizer;
+import org.apache.isis.applib.services.exceprecog.ExceptionRecognizerComposite;
+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.consent.InteractionInitiatedBy;
+import org.apache.isis.core.metamodel.facets.object.membergroups.MemberGroupLayoutFacet;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+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.memento.Memento;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
+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.EntityModel;
+import org.apache.isis.viewer.wicket.ui.ComponentType;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.PropUtil;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.columns.EntityColumn;
+import org.apache.isis.viewer.wicket.ui.components.widgets.formcomponent.CancelHintRequired;
+import org.apache.isis.viewer.wicket.ui.errors.JGrowlBehaviour;
+import org.apache.isis.viewer.wicket.ui.pages.entity.EntityPage;
+import org.apache.isis.viewer.wicket.ui.panels.FormAbstract;
+import org.apache.isis.viewer.wicket.ui.panels.IFormSubmitterWithPreValidateHook;
+import org.apache.isis.viewer.wicket.ui.util.Components;
+import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
+
+import de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationPanel;
+import de.agilecoders.wicket.core.util.Attributes;
+
+public class EntityPropsAndCollsForm extends FormAbstract<ObjectAdapter> implements ActionPromptProvider {
+
+ 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";
+
+ private static final String ID_ENTITY_COLUMN = "entityColumn";
+ private static final String ID_ENTITY_COLLECTIONS = "entityCollections";
+ private static final String ID_ENTITY_COLLECTIONS_OVERFLOW = "entityCollectionsOverflow";
+
+ private static final String ID_EDIT_BUTTON = "edit";
+ private static final String ID_OK_BUTTON = "ok";
+ private static final String ID_CANCEL_BUTTON = "cancel";
+
+ private static final String ID_FEEDBACK = "feedback";
+
+ private final Component owningPanel;
+
+ private Button editButton;
+ private Button okButton;
+ private Button cancelButton;
+
+ private NotificationPanel feedback;
+
+
+ public EntityPropsAndCollsForm(
+ final String id,
+ final EntityModel entityModel,
+ final Component owningPanel) {
+
+ super(id, entityModel);
+ this.owningPanel = owningPanel; // for repainting
+
+ buildGui();
+
+ // add any concurrency exception that might have been propagated into the entity model
+ // as a result of a previous action invocation
+ final String concurrencyExceptionIfAny = entityModel.getAndClearConcurrencyExceptionIfAny();
+ if(concurrencyExceptionIfAny != null) {
+ error(concurrencyExceptionIfAny);
+ }
+ }
+
+ private void buildGui() {
+
+ final EntityModel entityModel = (EntityModel) getModel();
+ final FCTab FCTabMetaDataIfAny = (FCTab) entityModel.getLayoutMetadata();
+
+ final ColumnSpans columnSpans;
+ if(FCTabMetaDataIfAny != null) {
+ final FCColumn middle = FCTabMetaDataIfAny.getMiddle();
+ final FCColumn right = FCTabMetaDataIfAny.getRight();
+ columnSpans = ColumnSpans.asSpans(
+ FCTabMetaDataIfAny.getLeft().getSpan(),
+ middle != null? middle.getSpan(): 0,
+ right != null? right.getSpan(): 0);
+ } else {
+ final MemberGroupLayoutFacet memberGroupLayoutFacet =
+ entityModel.getObject().getSpecification().getFacet(MemberGroupLayoutFacet.class);
+ columnSpans = memberGroupLayoutFacet.getColumnSpans();
+ }
+
+ // left column
+ // (unlike middle and right columns, the left column is always added to hold the edit buttons and feedback)
+ MarkupContainer leftColumn = new WebMarkupContainer(ID_LEFT_COLUMN);
+ add(leftColumn);
+
+ if(columnSpans.getLeft() > 0) {
+ addPropertiesAndCollections(leftColumn, entityModel, FCTabMetaDataIfAny, Hint.LEFT);
+ } else {
+ Components.permanentlyHide(this, ID_LEFT_COLUMN);
+ }
+
+ // middle column
+ MarkupContainer middleColumn;
+ if(columnSpans.getMiddle() > 0) {
+ middleColumn = new WebMarkupContainer(ID_MIDDLE_COLUMN);
+ add(middleColumn);
+ addPropertiesAndCollections(middleColumn, entityModel, FCTabMetaDataIfAny, Hint.MIDDLE);
+ } else {
+ middleColumn = null;
+ Components.permanentlyHide(this, ID_MIDDLE_COLUMN);
+ }
+
+ // right column
+ MarkupContainer rightColumn;
+ if(columnSpans.getRight() > 0) {
+ rightColumn = new WebMarkupContainer(ID_RIGHT_COLUMN);
+ add(rightColumn);
+ addPropertiesAndCollections(rightColumn, entityModel, FCTabMetaDataIfAny, Hint.RIGHT);
+ } else {
+ rightColumn = null;
+ Components.permanentlyHide(this, ID_RIGHT_COLUMN);
+ }
+
+ // column spans
+ if(columnSpans.getLeft() > 0) {
+ addClassForSpan(leftColumn, Hint.LEFT.from(columnSpans));
+ }
+ if(columnSpans.getMiddle() > 0) {
+ addClassForSpan(middleColumn, Hint.MIDDLE.from(columnSpans));
+ }
+ if(columnSpans.getRight() > 0) {
+ addClassForSpan(rightColumn, Hint.RIGHT.from(columnSpans));
+ }
+
+ // edit buttons and feedback (not supported on tabbed view)
+ final Hint leftHint = Hint.LEFT;
+ final FCColumn leftColumnMetaDataIfAny = leftHint.from(FCTabMetaDataIfAny);
+ final boolean hasProperties = leftColumnMetaDataIfAny == null && !PropUtil
+ .propertyGroupNames(entityModel, leftHint, leftColumnMetaDataIfAny).isEmpty();
+ if (hasProperties) {
+ addButtons(leftColumn);
+ addFeedbackGui(leftColumn);
+
+ } else {
+ Components.permanentlyHide(leftColumn,
+ ID_EDIT_BUTTON, ID_OK_BUTTON, ID_CANCEL_BUTTON,
+ ID_FEEDBACK);
+ }
+
+
+ // collections (only if not being added to a tab)
+ if(FCTabMetaDataIfAny == null && columnSpans.getCollections() > 0) {
+ final String idCollectionsToShow;
+ final String idCollectionsToHide;
+ int collectionSpan;
+ if (columnSpans.exceedsRow()) {
+ idCollectionsToShow = ID_ENTITY_COLLECTIONS_OVERFLOW;
+ idCollectionsToHide = ID_ENTITY_COLLECTIONS;
+ collectionSpan = 12;
+ } else {
+ idCollectionsToShow = ID_ENTITY_COLLECTIONS;
+ idCollectionsToHide = ID_ENTITY_COLLECTIONS_OVERFLOW;
+ collectionSpan = columnSpans.getCollections();
+ }
+
+ final Component collectionsColumn =
+ getComponentFactoryRegistry().addOrReplaceComponent(
+ this, idCollectionsToShow, ComponentType.ENTITY_COLLECTIONS, entityModel);
+ addClassForSpan(collectionsColumn, collectionSpan);
+
+ Components.permanentlyHide(this, idCollectionsToHide);
+ } else {
+ Components.permanentlyHide(this, ID_ENTITY_COLLECTIONS);
+ Components.permanentlyHide(this, ID_ENTITY_COLLECTIONS_OVERFLOW);
+ }
+ }
+
+ private void addPropertiesAndCollections(
+ final MarkupContainer markupContainer,
+ final EntityModel entityModel,
+ final FCTab fcTabMetaDataIfAny,
+ final Hint hint) {
+ final FCColumn columnMetaDataIfAny = hint.from(fcTabMetaDataIfAny);
+
+ final EntityModel entityModelWithHints = entityModel.cloneWithLayoutMetadata(columnMetaDataIfAny);
+
+ final EntityColumn columnMembers =
+ new EntityColumn(ID_ENTITY_COLUMN, entityModelWithHints, hint);
+ markupContainer.add(columnMembers);
+ }
+
+
+ @Override
+ protected void onComponentTag(ComponentTag tag) {
+ super.onComponentTag(tag);
+
+ Attributes.addClass(tag, "form-horizontal");
+ }
+
+ @Override
+ public ActionPrompt getActionPrompt() {
+ return ActionPromptProvider.Util.getFrom(this).getActionPrompt();
+ }
+
+ abstract class AjaxButtonWithOnError extends AjaxButton {
+
+ public AjaxButtonWithOnError(String id, IModel<String> model) {
+ super(id, model);
+ }
+
+ @Override
+ protected void onError(AjaxRequestTarget target, Form<?> form) {
+ 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 {
+ private static final long serialVersionUID = 1L;
+ public AjaxButtonForValidate(String id, IModel<String> model) {
+ super(id, model);
+ }
+
+ @Override
+ public String preValidate() {
+ // attempt to load with concurrency checking, catching recognized exceptions
+ try {
+ getEntityModel().load(ConcurrencyChecking.CHECK); // could have also just called #getObject(), since CHECK is the default
+
+ } catch(ConcurrencyException ex){
+ String recognizedErrorMessage = recognizeException(ex);
+ if(recognizedErrorMessage == null) {
+ throw ex;
+ }
+
+ // reload
+ getEntityModel().load(ConcurrencyChecking.NO_CHECK);
+
+ getForm().clearInput();
+ getEntityModel().resetPropertyModels();
+
+ toViewMode(null);
+ toEditMode(null);
+
+ return recognizedErrorMessage;
+ }
+
+ return null;
+ }
+
+ @Override
+ public void validate() {
+ // add in any error message that we might have recognized from above
+ EntityPropsAndCollsForm form = EntityPropsAndCollsForm.this;
+ String preValidationErrorIfAny = form.getPreValidationErrorIfAny();
+
+ if(preValidationErrorIfAny != null) {
+ feedbackOrNotifyAnyRecognizedError(preValidationErrorIfAny, form);
+ // skip validation, because would relate to old values
+
+ final EntityPage entityPage = new EntityPage(EntityPropsAndCollsForm.this.getModelObject(), null);
+ EntityPropsAndCollsForm.this.setResponsePage(entityPage);
+ } else {
+ // run Wicket's validation
+ super.validate();
+ }
+ }
+
+ @Override
+ protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
+
+ if (getForm().hasError()) {
+ // stay in edit mode
+ return;
+ }
+
+ doPreApply();
+ if (applyFormChangesElse(target)) return;
+ final Object redirectIfAny = doPostApply();
+
+ if (flushChangesElse(target)) return;
+
+
+ getEntityModel().resetPropertyModels();
+
+ toViewMode(null);
+
+ // "redirect-after-post"
+ //
+ // RequestCycle.get().getActiveRequestHandler() indicates this is handled by the ListenerInterfaceRequestHandler
+ // which renders page at end.
+ //
+ // it's necessary to zap the page parameters (so mapping is to just wicket/page?nn)
+ // otherwise (what I think happens) is that the httpServletResponse.sendRedirect ends up being to the same URL,
+ // and this is rejected as invalid either by the browser or by the servlet container (perhaps only if running remotely).
+ //
+
+ final ObjectAdapter objectAdapter;
+ if(redirectIfAny != null) {
+ objectAdapter = getPersistenceSession().adapterFor(redirectIfAny);
+ } else {
+ // we obtain the adapter from the entity model because (if a view model) then the entity model may contain
+ // a different adapter (the cloned view model) to the one with which we started with.
+ objectAdapter = getEntityModel().getObjectAdapterMemento().getObjectAdapter(ConcurrencyChecking.NO_CHECK);
+ }
+
+ final EntityPage entityPage = new EntityPage(objectAdapter, null);
+ EntityPropsAndCollsForm.this.setResponsePage(entityPage);
+ }
+
+ /**
+ * Optional hook to override.
+ *
+ * <p>
+ * If a non-null value is returned, then transition to it (ie eg the finish() transition for a wizard).
+ * </p>
+ */
+ protected void doPreApply() {
+ }
+
+ /**
+ * Optional hook to override.
+ *
+ * <p>
+ * If a non-null value is returned, then transition to it (ie eg the finish() transition for a wizard).
+ * </p>
+ */
+ protected Object doPostApply() {
+ return null;
+ }
+
+ }
+
+ abstract class AjaxButtonForCancel extends AjaxButtonWithOnError {
+
+ public AjaxButtonForCancel(String id, IModel<String> model) {
+ super(id, model);
+ setDefaultFormProcessing(false);
+ }
+ }
+
+
+ private void addButtons(MarkupContainer markupContainer) {
+
+ // edit button
+ editButton = new AjaxButtonWithOnError(ID_EDIT_BUTTON, new ResourceModel("editLabel")) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void validate() {
+
+ // same logic as in cancelButton; should this be factored out?
+ try {
+ getEntityModel().load(ConcurrencyChecking.CHECK);
+ } catch(ConcurrencyException ex) {
+ getMessageBroker().addMessage("Object changed by " + ex.getOid().getVersion().getUser() + ", automatically reloading");
+ getEntityModel().load(ConcurrencyChecking.NO_CHECK);
+ }
+
+ super.validate();
+ }
+
+ @Override
+ public void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
+ getEntityModel().resetPropertyModels();
+ toEditMode(target);
+ }
+
+ @Override
+ protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
+ super.updateAjaxAttributes(attributes);
+ attributes.getAjaxCallListeners().add(new org.apache.wicket.ajax.attributes.AjaxCallListener(){
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public CharSequence getSuccessHandler(Component component) {
+ // scroll to the top of the entity panel
+ return "$('html, body').animate({"
+ + " scrollTop: $('.entityIconAndTitlePanel').offset().top"
+ + " }, 1000);";
+ }
+ });
+ }
+ };
+ editButton.add(new Label("editLabel", editButton.getModel()));
+ markupContainer.add(editButton);
+
+
+ // ok button
+ okButton = new AjaxButtonForValidate(ID_OK_BUTTON, new ResourceModel("okLabel"));
+ markupContainer.add(okButton);
+
+
+ // cancel button
+ cancelButton = new AjaxButtonForCancel(ID_CANCEL_BUTTON, new ResourceModel("cancelLabel")) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void validate() {
+
+ // same logic as in editButton; should this be factored out?
+ try {
+ getEntityModel().load(ConcurrencyChecking.CHECK);
+ } catch(ConcurrencyException ex) {
+ getMessageBroker().addMessage("Object changed by " + ex.getOid().getVersion().getUser() + ", automatically reloading");
+ getEntityModel().load(ConcurrencyChecking.NO_CHECK);
+ }
+ super.validate();
+ }
+
+ @Override
+ protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
+ Session.get().getFeedbackMessages().clear();
+ getForm().clearInput();
+ getForm().visitFormComponentsPostOrder(new IVisitor<FormComponent<?>, Void>() {
+
+ @Override
+ public void component(FormComponent<?> formComponent, IVisit<Void> visit) {
+ if (formComponent instanceof CancelHintRequired) {
+ final CancelHintRequired cancelHintRequired = (CancelHintRequired) formComponent;
+ cancelHintRequired.onCancel();
+ }
+ }
+ });
+
+ try {
+ getEntityModel().resetPropertyModels();
+ } catch(RuntimeException ex) {
+ throw ex;
+ }
+ toViewMode(target);
+ }
+ };
+
+ markupContainer.add(cancelButton);
+
+ okButton.setOutputMarkupPlaceholderTag(true);
+ editButton.setOutputMarkupPlaceholderTag(true);
+ cancelButton.setOutputMarkupPlaceholderTag(true);
+
+ // flush any JGrowl messages (typically concurrency exceptions) if they are added.
+ okButton.add(new JGrowlBehaviour());
+ editButton.add(new JGrowlBehaviour());
+ cancelButton.add(new JGrowlBehaviour());
+ }
+
+ // to perform object-level validation, we must apply the changes first
+ // contrast this with ActionPanel (for validating actionarguments) where
+ // we do the validation prior to the execution of the action
+ private boolean applyFormChangesElse(AjaxRequestTarget target) {
+ final ObjectAdapter adapter = getEntityModel().getObject();
+ final Memento snapshotToRollbackToIfInvalid = new Memento(adapter);
+
+ getEntityModel().apply();
+ final String invalidReasonIfAny = getEntityModel().getReasonInvalidIfAny();
+ if (invalidReasonIfAny != null) {
+ error(invalidReasonIfAny);
+ snapshotToRollbackToIfInvalid.recreateObject();
+ toEditMode(target);
+
+ // abort otherwise the object will have been dirtied and JDO will end up committing,
+ // possibly bumping the version and resulting in a subsequent concurrency exception.
+ IsisContext.getTransactionManager().abortTransaction();
+ return true;
+ }
+ return false;
+ }
+
+ private boolean flushChangesElse(AjaxRequestTarget target) {
+ try {
+ this.getTransactionManager().flushTransaction();
+ } catch(RuntimeException ex) {
+
+ // There's no need to abort the transaction here, as it will have already been done
+ // (in IsisTransactionManager#executeWithinTransaction(...)).
+
+ String message = recognizeExceptionAndNotify(ex, this);
+ if(message == null) {
+ throw ex;
+ }
+
+ toEditMode(target);
+ return true;
+ }
+ return false;
+ }
+
+
+ private String recognizeExceptionAndNotify(RuntimeException ex, Component feedbackComponentIfAny) {
+
+ // see if the exception is recognized as being a non-serious error
+
+ String recognizedErrorMessageIfAny = recognizeException(ex);
+ feedbackOrNotifyAnyRecognizedError(recognizedErrorMessageIfAny, feedbackComponentIfAny);
+
+ return recognizedErrorMessageIfAny;
+ }
+
+ private void feedbackOrNotifyAnyRecognizedError(String recognizedErrorMessageIfAny, Component feedbackComponentIfAny) {
+ if(recognizedErrorMessageIfAny == null) {
+ return;
+ }
+
+ if(feedbackComponentIfAny != null) {
+ feedbackComponentIfAny.error(recognizedErrorMessageIfAny);
+ }
+ getMessageBroker().addWarning(recognizedErrorMessageIfAny);
+
+ // we clear the abort cause because we've handled rendering the exception
+ getTransactionManager().getTransaction().clearAbortCause();
+ }
+
+ private String recognizeException(RuntimeException ex) {
+
+ // REVIEW: this code is similar to stuff in EntityPropertiesForm, perhaps move up to superclass?
+ // REVIEW: similar code also in WebRequestCycleForIsis; combine?
+
+ final List<ExceptionRecognizer> exceptionRecognizers = getServicesInjector().lookupServices(ExceptionRecognizer.class);
+ final String message = new ExceptionRecognizerComposite(exceptionRecognizers).recognize(ex);
+ return message;
+ }
+
+ private void requestRepaintPanel(final AjaxRequestTarget target) {
+ if (target != null) {
+ target.add(owningPanel);
+ // TODO: is it necessary to add these too?
+ target.add(editButton, okButton, cancelButton, feedback);
+ }
+ }
+
+ private EntityModel getEntityModel() {
+ return (EntityModel) getModel();
+ }
+
+ void toViewMode(final AjaxRequestTarget target) {
+
+ getEntityModel().toViewMode();
+
+ setVisible(editButton, isAnythingEditable());
+ setVisible(okButton, false);
+ setVisible(cancelButton, false);
+
+ requestRepaintPanel(target);
+ }
+
+ private void setVisible(Button b, boolean editable) {
+ if(b != null) {
+ b.setVisible(editable);
+ }
+ }
+
+ private boolean isAnythingEditable() {
+ final EntityModel entityModel = (EntityModel) getModel();
+ final ObjectAdapter adapter = entityModel.getObject();
+
+ return !enabledAssociations(adapter, adapter.getSpecification()).isEmpty();
+ }
+
+ private List<ObjectAssociation> enabledAssociations(final ObjectAdapter adapter, final ObjectSpecification objSpec) {
+ return objSpec.getAssociations(Contributed.EXCLUDED, enabledAssociationFilter(adapter));
+ }
+
+ @SuppressWarnings("unchecked")
+ private Filter<ObjectAssociation> enabledAssociationFilter(final ObjectAdapter adapter) {
+ return Filters.and(ObjectAssociation.Filters.PROPERTIES, ObjectAssociation.Filters.enabled(adapter,
+ InteractionInitiatedBy.USER, Where.OBJECT_FORMS
+ ));
+ }
+
+ private void toEditMode(final AjaxRequestTarget target) {
+ getEntityModel().toEditMode();
+
+ editButton.setVisible(false);
+ okButton.setVisible(true);
+ cancelButton.setVisible(true);
+
+ requestRepaintPanel(target);
+ }
+
+ private void addFeedbackGui(final MarkupContainer markupContainer) {
+ feedback = new NotificationPanel(ID_FEEDBACK, this, new ComponentFeedbackMessageFilter(this));
+ feedback.setOutputMarkupPlaceholderTag(true);
+ markupContainer.addOrReplace(feedback);
+
+ // to avoid potential XSS attacks, no longer escape model strings
+ // (risk is low but could just happen: error message being rendered might accidentally or deliberately contain rogue Javascript)
+ // feedback.setEscapeModelStrings(false);
+
+ final ObjectAdapter adapter = getEntityModel().getObject();
+ if (adapter == null) {
+ feedback.error("cannot locate object:" + getEntityModel().getObjectAdapterMemento().toString());
+ }
+ }
+
+
+ static void addClassForSpan(final Component component, final int numGridCols) {
+ component.add(new CssClassAppender("col-xs-"+numGridCols));
+ }
+
+
+
+ ///////////////////////////////////////////////////////
+ // Dependencies (from context)
+ ///////////////////////////////////////////////////////
+
+ protected IsisTransactionManager getTransactionManager() {
+ return IsisContext.getTransactionManager();
+ }
+
+ protected ServicesInjector getServicesInjector() {
+ return IsisContext.getPersistenceSession().getServicesInjector();
+ }
+
+ protected MessageBroker getMessageBroker() {
+ return getAuthenticationSession().getMessageBroker();
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsForm.properties
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsForm.properties b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsForm.properties
new file mode 100644
index 0000000..71edcd9
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsForm.properties
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+
+okLabel=OK
+cancelLabel=Cancel
+editLabel=Edit
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanel.html
new file mode 100644
index 0000000..449f18d
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanel.html
@@ -0,0 +1,54 @@
+<?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="entityPropertiesPanel entityPropertiesComponentType">
+ <!-- EntityPropsAndCollsForm:start -->
+ <form wicket:id="entityForm" class="inputForm" role="form">
+ <div class="row">
+ <div wicket:id="leftColumn">
+ <div wicket:id="entityColumn"/>
+ <div class="feedbackPanel">
+ <span wicket:id="feedback"></span>
+ </div>
+ <div class="buttons">
+ <button type="submit" class="edit btn btn-primary btn-md" wicket:id="edit"><span class="fa fa-edit"></span> <wicket:container wicket:id="editLabel"></wicket:container></button>
+ <input type="submit" class="ok btn btn-primary btn-md" wicket:id="ok"/>
+ <input type="submit" class="cancel btn btn-default btn-md" wicket:id="cancel"/>
+ </div>
+ </div>
+ <div wicket:id="middleColumn">
+ <div wicket:id="entityColumn"/>
+ </div>
+ <div wicket:id="rightColumn">
+ <div wicket:id="entityColumn"/>
+ </div>
+ <div wicket:id="entityCollections"></div>
+ </div>
+ <div class="row">
+ <div wicket:id="entityCollectionsOverflow"></div>
+ </div>
+ </form>
+ <!-- EntityPropsAndCollsForm:end -->
+ </div>
+ </wicket:panel>
+ </body>
+</html>
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanel.java
new file mode 100644
index 0000000..8eadd52
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanel.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.layout.fixedcols.propsandcolls;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.components.layout.fallback.EntityEditablePanel;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.FCPagePanel;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+/**
+ * {@link PanelAbstract Panel} representing the properties and collections of an entity, as per
+ * the provided {@link EntityModel}.
+ *
+ * <p>
+ * Used by both {@link FCPagePanel} and also {@link EntityEditablePanel}. In the former
+ * case the collections are never shown, and edit buttons suppressed. In the latter case the
+ * collections are shown, possibly overflowing to region below.
+ * </p>
+ */
+public class EntityPropsAndCollsPanel extends PanelAbstract<EntityModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_ENTITY_FORM = "entityForm";
+
+ private EntityPropsAndCollsForm form;
+
+ public EntityPropsAndCollsPanel(final String id, final EntityModel entityModel) {
+ super(id, entityModel);
+ buildGui();
+ form.toViewMode(null);
+ }
+
+ private void buildGui() {
+ buildEntityPropertiesAndOrCollectionsGui();
+ setOutputMarkupId(true);
+ }
+
+ private void buildEntityPropertiesAndOrCollectionsGui() {
+ final EntityModel model = getModel();
+ final ObjectAdapter adapter = model.getObject();
+ if (adapter != null) {
+ form = new EntityPropsAndCollsForm(ID_ENTITY_FORM, model, this);
+ addOrReplace(form);
+ } else {
+ permanentlyHide(ID_ENTITY_FORM);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanelFactory.java
new file mode 100644
index 0000000..ef51ee4
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanelFactory.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.layout.fixedcols.propsandcolls;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.model.IModel;
+
+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.layout.fallback.EntityEditablePanel;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.FCPagePanel;
+
+/**
+ * {@link ComponentFactory} for {@link EntityPropsAndCollsPanel}.
+ *
+ *
+ * <p>
+ * Used by both {@link EntityEditablePanel} and also {@link FCPagePanel}.
+ * </p>
+ */
+public class EntityPropsAndCollsPanelFactory extends EntityComponentFactoryAbstract {
+
+ private static final long serialVersionUID = 1L;
+
+ public EntityPropsAndCollsPanelFactory() {
+ super(ComponentType.ENTITY_PROPERTIES, EntityPropsAndCollsPanel.class);
+ }
+
+ @Override
+ public Component createComponent(final String id, final IModel<?> model) {
+ final EntityModel entityModel = (EntityModel) model;
+ return new EntityPropsAndCollsPanel(id, entityModel);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/tabgrouplist/TabGroupListPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/tabgrouplist/TabGroupListPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/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/layout/fixedcols/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/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/tabgrouplist/TabGroupListPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/tabgrouplist/TabGroupListPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/tabgrouplist/TabGroupListPanel.java
new file mode 100644
index 0000000..0934f80
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/tabgrouplist/TabGroupListPanel.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.layout.fixedcols.tabgrouplist;
+
+import java.util.List;
+
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+
+import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.tabs.TabGroupPanel;
+import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
+
+public class TabGroupListPanel extends PanelAbstract<EntityModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String ID_TAB_GROUPS = "tabGroups";
+
+ // the view metadata
+ private final List<FCTabGroup> tabGroups;
+
+ public TabGroupListPanel(final String id, final EntityModel entityModel) {
+ super(id, entityModel);
+
+ this.tabGroups = (List<FCTabGroup>) entityModel.getLayoutMetadata();
+
+ buildGui();
+ }
+
+ private void buildGui() {
+ final EntityModel model = getModel();
+
+ final ListView<FCTabGroup> tabGroupsList = new ListView<FCTabGroup>(ID_TAB_GROUPS, this.tabGroups) {
+
+ @Override
+ protected void populateItem(final ListItem<FCTabGroup> item) {
+
+ final FCTabGroup tabGroup = item.getModelObject();
+ final EntityModel entityModelWithHints = model.cloneWithLayoutMetadata(tabGroup);
+ final TabGroupPanel tabGroupPanel = new TabGroupPanel(entityModelWithHints);
+ item.add(tabGroupPanel);
+ }
+ };
+
+ add(tabGroupsList);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/tabs/TabGroupPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/tabs/TabGroupPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/tabs/TabGroupPanel.java
new file mode 100644
index 0000000..1e84474
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/tabs/TabGroupPanel.java
@@ -0,0 +1,105 @@
+/*
+ * 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.layout.fixedcols.tabs;
+
+import java.util.List;
+
+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.panel.Panel;
+import org.apache.wicket.model.Model;
+
+import org.apache.isis.applib.layout.fixedcols.FCTab;
+import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
+import org.apache.isis.viewer.wicket.model.models.EntityModel;
+import org.apache.isis.viewer.wicket.model.util.ScopedSessionAttribute;
+
+import de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel;
+
+public class TabGroupPanel extends AjaxBootstrapTabbedPanel {
+
+ public static final String SESSION_ATTR_SELECTED_TAB = "selectedTab";
+
+ private final EntityModel entityModel;
+ // the view metadata
+ private final FCTabGroup tabGroup;
+
+ private final ScopedSessionAttribute<Integer> selectedTabInSession;
+
+ private static final String ID_TAB_GROUP = "tabGroup";
+
+ private static List<ITab> tabsFor(final EntityModel entityModel) {
+ final List<ITab> tabs = Lists.newArrayList();
+
+ final FCTabGroup tabGroup = (FCTabGroup) entityModel.getLayoutMetadata();
+ final List<FCTab> FCTabList = FluentIterable
+ .from(tabGroup.getTabs())
+ .filter(FCTab.Predicates.notEmpty())
+ .toList();
+
+ for (final FCTab fcTab : FCTabList) {
+ tabs.add(new AbstractTab(Model.of(fcTab.getName())) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public Panel getPanel(String panelId) {
+ return new TabPanel(panelId, entityModel, fcTab);
+ }
+ });
+ }
+ return tabs;
+ }
+
+ public TabGroupPanel(final EntityModel entityModel) {
+ super(ID_TAB_GROUP, tabsFor(entityModel));
+
+ this.entityModel = entityModel;
+ this.tabGroup = (FCTabGroup) entityModel.getLayoutMetadata();
+ this.selectedTabInSession = ScopedSessionAttribute.create(entityModel, this, SESSION_ATTR_SELECTED_TAB);
+
+ }
+
+ @Override
+ protected void onInitialize() {
+ setSelectedTabFromSessionIfAny(this);
+ super.onInitialize();
+ }
+
+ @Override
+ public TabbedPanel setSelectedTab(final int index) {
+ selectedTabInSession.set(index);
+ return super.setSelectedTab(index);
+ }
+
+ private void setSelectedTabFromSessionIfAny(
+ final AjaxBootstrapTabbedPanel ajaxBootstrapTabbedPanel) {
+ final Integer tabIndex = selectedTabInSession.get();
+ if (tabIndex != null) {
+ 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);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/tabs/TabPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/tabs/TabPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/tabs/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/layout/fixedcols/tabs/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/c57d8cd8/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/tabs/TabPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/tabs/TabPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/tabs/TabPanel.java
new file mode 100644
index 0000000..1dda0c6
--- /dev/null
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/tabs/TabPanel.java
@@ -0,0 +1,24 @@
+package org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.tabs;
+
+import org.apache.isis.applib.layout.fixedcols.FCTab;
+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 FCTab fcTab) {
+ super(id);
+
+ final EntityModel modelWithTabHints = model.cloneWithLayoutMetadata(fcTab);
+
+ getComponentFactoryRegistry()
+ .addOrReplaceComponent(this,
+ ID_COLUMN, ComponentType.ENTITY_PROPERTIES, modelWithTabHints);
+
+ }
+}