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