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:36:05 UTC
[08/15] isis git commit: ISIS-993: bootstrap3 layout working,
more or less. Still need to do the normalization phase.
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);
- }
-}