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:07 UTC

[10/15] isis git commit: ISIS-993: renamed Page to Grid, PageFacet to GridFacet, PageService to GridService, PageNormalizerService to GridNormalizerService, BS3PagePanel to BS3GridPanel, FCPagePanel to FCGridPanel,

http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCPagePanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCPagePanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCPagePanel.java
deleted file mode 100644
index 5e232fa..0000000
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/FCPagePanel.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.viewer.wicket.ui.components.layout.fixedcols;
-
-import java.util.List;
-
-import com.google.common.collect.FluentIterable;
-
-import org.apache.isis.applib.layout.fixedcols.FCColumn;
-import org.apache.isis.applib.layout.fixedcols.FCPage;
-import org.apache.isis.applib.layout.fixedcols.FCTabGroup;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
-import org.apache.isis.core.metamodel.facets.object.layoutmetadata.PageFacet;
-import org.apache.isis.viewer.wicket.model.models.EntityModel;
-import org.apache.isis.viewer.wicket.ui.ComponentType;
-import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.columns.EntityColumn;
-import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.tabgrouplist.TabGroupListPanel;
-import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
-import org.apache.isis.viewer.wicket.ui.util.CssClassAppender;
-
-/**
- * {@link PanelAbstract Panel} to represent an entity on a single page made up
- * of several <div> regions.
- */
-public class FCPagePanel extends PanelAbstract<EntityModel> {
-
-    private static final long serialVersionUID = 1L;
-
-    private static final String ID_LEFT_COLUMN = "leftColumn";
-    private static final String ID_MIDDLE_COLUMN = "middleColumn";
-    private static final String ID_RIGHT_COLUMN = "rightColumn";
-
-    public FCPagePanel(final String id, final EntityModel entityModel) {
-        super(id, entityModel);
-        buildGui();
-    }
-
-    private void buildGui() {
-        final EntityModel model = getModel();
-        final ObjectAdapter objectAdapter = model.getObject();
-        final CssClassFacet facet = objectAdapter.getSpecification().getFacet(CssClassFacet.class);
-        if(facet != null) {
-            final String cssClass = facet.cssClass(objectAdapter);
-            CssClassAppender.appendCssClassTo(this, cssClass);
-        }
-
-        // forces metadata to be derived && synced
-        final PageFacet PageFacet = model.getTypeOfSpecification().getFacet(PageFacet.class);
-        final FCPage page = (FCPage) PageFacet.getPage();
-
-
-        addOrReplace(ComponentType.ENTITY_SUMMARY, model);
-
-        final int leftSpan = addColumnIfRequired(ID_LEFT_COLUMN, page.getLeft());
-
-        final TabGroupListPanel middleTabs = addTabGroups(ID_MIDDLE_COLUMN, page.getTabGroups());
-
-        final int rightSpan = addColumnIfRequired(ID_RIGHT_COLUMN, page.getRight());
-
-        final int columnSpans = leftSpan + rightSpan;
-        int tabGroupSpan = columnSpans < 12 ? 12 - (columnSpans) : 12;
-        CssClassAppender.appendCssClassTo(middleTabs, "col-xs-" + tabGroupSpan);
-
-    }
-
-    private TabGroupListPanel addTabGroups(
-            final String id, final List<FCTabGroup> tabGroupList) {
-        final EntityModel model = getModel();
-        final List<FCTabGroup> tabGroups = FluentIterable
-                .from(tabGroupList)
-                .filter(FCTabGroup.Predicates.notEmpty())
-                .toList();
-        final EntityModel entityModelWitHints = model.cloneWithLayoutMetadata(tabGroups);
-        final TabGroupListPanel middleComponent = new TabGroupListPanel(id, entityModelWitHints);
-        addOrReplace(middleComponent);
-        return middleComponent;
-    }
-
-    private int addColumnIfRequired(final String id, final FCColumn col) {
-        if(col != null) {
-            final EntityModel entityModel =
-                    getModel().cloneWithLayoutMetadata(col);
-            final FCColumn fcColumn = (FCColumn) entityModel.getLayoutMetadata();
-            final int span = fcColumn.getSpan();
-            if(span > 0) {
-                final EntityColumn entityColumn = new EntityColumn(id, entityModel);
-                addOrReplace(entityColumn);
-                CssClassAppender.appendCssClassTo(entityColumn, "col-xs-" + span);
-                return span;
-            }
-        }
-        permanentlyHide(id);
-        return 0;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanel.java
index 8eadd52..82745c1 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanel.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanel.java
@@ -22,7 +22,7 @@ package org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.propsandcol
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.viewer.wicket.model.models.EntityModel;
 import org.apache.isis.viewer.wicket.ui.components.layout.fallback.EntityEditablePanel;
-import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.FCPagePanel;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.FCGridPanel;
 import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
 
 /**
@@ -30,7 +30,7 @@ import org.apache.isis.viewer.wicket.ui.panels.PanelAbstract;
  * the provided {@link EntityModel}.
  * 
  * <p>
- *     Used by both {@link FCPagePanel} and also {@link EntityEditablePanel}.  In the former
+ *     Used by both {@link FCGridPanel} and also {@link EntityEditablePanel}.  In the former
  *     case the collections are never shown, and edit buttons suppressed. In the latter case the
  *     collections are shown, possibly overflowing to region below.
  * </p>

http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanelFactory.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanelFactory.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanelFactory.java
index ef51ee4..d8e7f11 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanelFactory.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/fixedcols/propsandcolls/EntityPropsAndCollsPanelFactory.java
@@ -27,14 +27,14 @@ import org.apache.isis.viewer.wicket.ui.ComponentFactory;
 import org.apache.isis.viewer.wicket.ui.ComponentType;
 import org.apache.isis.viewer.wicket.ui.components.entity.EntityComponentFactoryAbstract;
 import org.apache.isis.viewer.wicket.ui.components.layout.fallback.EntityEditablePanel;
-import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.FCPagePanel;
+import org.apache.isis.viewer.wicket.ui.components.layout.fixedcols.FCGridPanel;
 
 /**
  * {@link ComponentFactory} for {@link EntityPropsAndCollsPanel}.
  *
  *
  * <p>
- *     Used by both {@link EntityEditablePanel} and also {@link FCPagePanel}.
+ *     Used by both {@link EntityEditablePanel} and also {@link FCGridPanel}.
  * </p>
  */
 public class EntityPropsAndCollsPanelFactory extends EntityComponentFactoryAbstract {

http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
index 45c42d7..e2b01db 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/entity/EntityPage.java
@@ -29,13 +29,13 @@ import org.apache.wicket.model.AbstractReadOnlyModel;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.util.string.Strings;
 
-import org.apache.isis.applib.layout.common.Page;
+import org.apache.isis.applib.layout.common.Grid;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking;
 import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
 import org.apache.isis.core.metamodel.consent.InteractionInitiatedBy;
 import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
-import org.apache.isis.core.metamodel.facets.object.layoutmetadata.PageFacet;
+import org.apache.isis.core.metamodel.facets.object.grid.GridFacet;
 import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.context.IsisContext;
@@ -136,17 +136,17 @@ public class EntityPage extends PageAbstract {
         //
         // invalidate the cache so that can do dynamic reloading of layout metadata etc.
         //
-        final PageFacet facet = entityModel.getTypeOfSpecification()
-                .getFacet(PageFacet.class);
+        final GridFacet facet = entityModel.getTypeOfSpecification()
+                .getFacet(GridFacet.class);
         if(facet != null) {
             // the facet should always exist, in fact
             // just enough to ask for the metadata.
             // This will cause the current ObjectSpec to be updated as a side effect.
-            final Page page = facet.getPage();
+            final Grid grid = facet.getGrid();
 
             // if none, then fallback to invalidating entire cache
             // (this is the original LayoutMetadataFromJson behaviour)
-            if(page == null && !getDeploymentType().isProduction()) {
+            if(grid == null && !getDeploymentType().isProduction()) {
                 getSpecificationLoader().invalidateCacheFor(objectAdapter.getObject());
             }
         }

http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-FC.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-FC.xml b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-FC.xml
index 91a1fd1..f92597a 100644
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-FC.xml
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout-FC.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<page xsi:schemaLocation="http://isis.apache.org/schema/applib/layout/common http://isis.apache.org/schema/applib/layout/common/common.xsd http://isis.apache.org/schema/applib/layout/fixedcols http://isis.apache.org/schema/applib/layout/fixedcols/fixedcols.xsd" xmlns="http://isis.apache.org/schema/applib/layout/fixedcols" xmlns:c="http://isis.apache.org/schema/applib/layout/common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<grid xsi:schemaLocation="http://isis.apache.org/schema/applib/layout/common http://isis.apache.org/schema/applib/layout/common/common.xsd http://isis.apache.org/schema/applib/layout/fixedcols http://isis.apache.org/schema/applib/layout/fixedcols/fixedcols.xsd" xmlns="http://isis.apache.org/schema/applib/layout/fixedcols" xmlns:c="http://isis.apache.org/schema/applib/layout/common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
 
     <left span="0">
@@ -38,4 +38,4 @@
             </right>
         </tab>
     </tabGroup>
-</page>
\ No newline at end of file
+</grid>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/7fb63556/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
index c241c08..b1b3ed9 100644
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<bs3:page xsi:schemaLocation="http://isis.apache.org/schema/applib/layout/common http://isis.apache.org/schema/applib/layout/common/common.xsd http://isis.apache.org/schema/applib/layout/bootstrap3 http://isis.apache.org/schema/applib/layout/bootstrap3/bootstrap3.xsd" xmlns:c="http://isis.apache.org/schema/applib/layout/common" xmlns:bs3="http://isis.apache.org/schema/applib/layout/bootstrap3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<bs3:grid xsi:schemaLocation="http://isis.apache.org/schema/applib/layout/common http://isis.apache.org/schema/applib/layout/common/common.xsd http://isis.apache.org/schema/applib/layout/bootstrap3 http://isis.apache.org/schema/applib/layout/bootstrap3/bootstrap3.xsd" xmlns:c="http://isis.apache.org/schema/applib/layout/common" xmlns:bs3="http://isis.apache.org/schema/applib/layout/bootstrap3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
     <bs3:row cssClass="bishbosh">
         <bs3:col span="8">
@@ -17,11 +17,9 @@
                     <bs3:row>
                         <bs3:col span="12">
                             <c:fieldSet name="Metadata">
-                                <c:action id="downloadJdMetadata">
-                                </c:action>
+                                <c:action id="downloadJdMetadata"/>
                                 <c:action id="downloadLayoutXml" position="PANEL_DROPDOWN"/>
-                                <c:property id="versionSequence">
-                                </c:property>
+                                <c:property id="versionSequence"/>
                             </c:fieldSet>
                         </bs3:col>
                         <bs3:col span="6">
@@ -63,4 +61,4 @@
             </bs3:tabGroup>
         </bs3:col>
     </bs3:row>
-</bs3:page>
+</bs3:grid>