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/01/07 03:19:55 UTC
[1/2] isis git commit: ISIS-993: pretty much there on deriving and
syncing the metamodel with the layout.xml info;
Repository: isis
Updated Branches:
refs/heads/ISIS-993 c10162856 -> 19b7e0eb2
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetForPropertyLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetForPropertyLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetForPropertyLayoutXml.java
new file mode 100644
index 0000000..d36dfa9
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetForPropertyLayoutXml.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.properties.propertylayout;
+
+import com.google.common.base.Strings;
+
+import org.apache.isis.applib.layout.v1_0.PropertyLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet;
+import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacetAbstract;
+
+public class DescribedAsFacetForPropertyLayoutXml extends DescribedAsFacetAbstract {
+
+ public static DescribedAsFacet create(PropertyLayout propertyLayout, FacetHolder holder) {
+ if(propertyLayout == null) {
+ return null;
+ }
+ final String describedAs = Strings.emptyToNull(propertyLayout.getDescribedAs());
+ return describedAs != null ? new DescribedAsFacetForPropertyLayoutXml(describedAs, holder) : null;
+ }
+
+ private DescribedAsFacetForPropertyLayoutXml(String value, FacetHolder holder) {
+ super(value, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyLayoutXml.java
new file mode 100644
index 0000000..7a93898
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyLayoutXml.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.properties.propertylayout;
+
+import org.apache.isis.applib.annotation.When;
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.applib.layout.v1_0.PropertyLayout;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet;
+import org.apache.isis.core.metamodel.facets.members.hidden.HiddenFacetAbstract;
+
+public class HiddenFacetForPropertyLayoutXml extends HiddenFacetAbstract {
+
+ public static HiddenFacet create(final PropertyLayout propertyLayout, final FacetHolder holder) {
+ if (propertyLayout == null) {
+ return null;
+ }
+ final Where where = propertyLayout.getHidden();
+ return where != null && where != Where.NOT_SPECIFIED ? new HiddenFacetForPropertyLayoutXml(where, holder) : null;
+ }
+
+ private HiddenFacetForPropertyLayoutXml(final Where where, final FacetHolder holder) {
+ super(HiddenFacetForPropertyLayoutXml.class, When.ALWAYS, where, holder);
+ }
+
+ @Override
+ public String hiddenReason(final ObjectAdapter targetAdapter, final Where whereContext) {
+ if(!where().includes(whereContext)) {
+ return null;
+ }
+ return "Hidden on " + where().getFriendlyName();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetForPropertyLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetForPropertyLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetForPropertyLayoutXml.java
new file mode 100644
index 0000000..c8a84d0
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetForPropertyLayoutXml.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.properties.propertylayout;
+
+import org.apache.isis.applib.annotation.LabelPosition;
+import org.apache.isis.applib.layout.v1_0.PropertyLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.objectvalue.labelat.LabelAtFacet;
+import org.apache.isis.core.metamodel.facets.objectvalue.labelat.LabelAtFacetAbstract;
+
+public class LabelAtFacetForPropertyLayoutXml extends LabelAtFacetAbstract {
+
+ public static LabelAtFacet create(final PropertyLayout propertyLayout, FacetHolder holder) {
+ if (propertyLayout == null) {
+ return null;
+ }
+ final LabelPosition labelPosition = propertyLayout.getLabelPosition();
+ return labelPosition != null ? new LabelAtFacetForPropertyLayoutXml(labelPosition, holder) : null;
+ }
+
+ private LabelAtFacetForPropertyLayoutXml(final LabelPosition value, final FacetHolder holder) {
+ super(value, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetForPropertyLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetForPropertyLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetForPropertyLayoutXml.java
new file mode 100644
index 0000000..072f287
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetForPropertyLayoutXml.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.core.metamodel.facets.properties.propertylayout;
+
+import org.apache.isis.applib.layout.v1_0.PropertyLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.objectvalue.multiline.MultiLineFacet;
+import org.apache.isis.core.metamodel.facets.objectvalue.multiline.MultiLineFacetAbstract;
+
+public class MultiLineFacetForPropertyLayoutXml extends MultiLineFacetAbstract {
+
+ public static MultiLineFacet create(PropertyLayout propertyLayout, FacetHolder holder) {
+ if(propertyLayout == null) {
+ return null;
+ }
+ final Integer multiLine = propertyLayout.getMultiLine();
+ return multiLine != null && multiLine > 1 ? new MultiLineFacetForPropertyLayoutXml(multiLine, false, holder) : null;
+ }
+
+ private MultiLineFacetForPropertyLayoutXml(int numberOfLines, boolean preventWrapping, FacetHolder holder) {
+ super(numberOfLines, preventWrapping, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetForPropertyLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetForPropertyLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetForPropertyLayoutXml.java
new file mode 100644
index 0000000..0f0e9b7
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetForPropertyLayoutXml.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.properties.propertylayout;
+
+import com.google.common.base.Strings;
+
+import org.apache.isis.applib.layout.v1_0.PropertyLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacet;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacetAbstract;
+
+public class NamedFacetForPropertyLayoutXml extends NamedFacetAbstract {
+
+ public static NamedFacet create(PropertyLayout propertyLayout, FacetHolder holder) {
+ if(propertyLayout == null) {
+ return null;
+ }
+ final String named = Strings.emptyToNull(propertyLayout.getNamed());
+ final Boolean escaped = propertyLayout.getNamedEscaped();
+ return named != null ? new NamedFacetForPropertyLayoutXml(named, (escaped == null || escaped), holder) : null;
+ }
+
+ private NamedFacetForPropertyLayoutXml(
+ final String value,
+ final boolean escaped,
+ final FacetHolder holder) {
+
+ super(value, escaped, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetForPropertyLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetForPropertyLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetForPropertyLayoutXml.java
new file mode 100644
index 0000000..0ceab99
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetForPropertyLayoutXml.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.properties.propertylayout;
+
+import org.apache.isis.applib.layout.v1_0.PropertyLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.objectvalue.renderedadjusted.RenderedAdjustedFacet;
+import org.apache.isis.core.metamodel.facets.objectvalue.renderedadjusted.RenderedAdjustedFacetAbstract;
+
+public class RenderedAdjustedFacetForPropertyLayoutXml extends RenderedAdjustedFacetAbstract {
+
+ public static RenderedAdjustedFacet create(final PropertyLayout propertyLayout, FacetHolder holder) {
+ if(propertyLayout == null) {
+ return null;
+ }
+ final Boolean renderedAsDayBefore = propertyLayout.getRenderedAsDayBefore();
+ return renderedAsDayBefore != null && renderedAsDayBefore ? new RenderedAdjustedFacetForPropertyLayoutXml(holder) : null;
+ }
+
+ public static final int ADJUST_BY = -1;
+
+ private RenderedAdjustedFacetForPropertyLayoutXml(FacetHolder holder) {
+ super(ADJUST_BY, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/TypicalLengthFacetForPropertyLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/TypicalLengthFacetForPropertyLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/TypicalLengthFacetForPropertyLayoutXml.java
new file mode 100644
index 0000000..5d51ce9
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/TypicalLengthFacetForPropertyLayoutXml.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.properties.propertylayout;
+
+import org.apache.isis.applib.layout.v1_0.PropertyLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.objectvalue.typicallen.TypicalLengthFacet;
+import org.apache.isis.core.metamodel.facets.objectvalue.typicallen.TypicalLengthFacetAbstract;
+
+public class TypicalLengthFacetForPropertyLayoutXml extends TypicalLengthFacetAbstract {
+
+ public static TypicalLengthFacet create(PropertyLayout propertyLayout, FacetHolder holder) {
+ if(propertyLayout == null) {
+ return null;
+ }
+ final Integer typicalLength = propertyLayout.getTypicalLength();
+ return typicalLength != null && typicalLength != -1 ? new TypicalLengthFacetForPropertyLayoutXml(typicalLength, holder) : null;
+ }
+
+ private final int typicalLength;
+
+ private TypicalLengthFacetForPropertyLayoutXml(int typicalLength, FacetHolder holder) {
+ super(holder, Derivation.NOT_DERIVED);
+ this.typicalLength = typicalLength;
+ }
+
+ @Override
+ public int value() {
+ return typicalLength;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/layoutxml/LayoutXmlFacetDefaultTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/layoutxml/LayoutXmlFacetDefaultTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/layoutxml/LayoutXmlFacetDefaultTest.java
new file mode 100644
index 0000000..4a843bd
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/object/layoutxml/LayoutXmlFacetDefaultTest.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.core.metamodel.facets.object.layoutxml;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.junit.Test;
+
+import org.apache.isis.applib.layout.v1_0.PropertyGroup;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+public class LayoutXmlFacetDefaultTest {
+
+ @Test
+ public void xxx() throws Exception {
+
+ final AtomicReference<PropertyGroup> x = new AtomicReference<>();
+
+ PropertyGroup firstValue = new PropertyGroup();
+ PropertyGroup otherValue = new PropertyGroup();
+
+ assertThat(x.get(), is(nullValue()));
+
+ boolean b = x.compareAndSet(null, firstValue);
+ assertThat(b, is(true));
+ assertThat(x.get(), is(firstValue));
+
+ boolean b2 = x.compareAndSet(null, firstValue);
+ assertThat(b2, is(false));
+ assertThat(x.get(), is(firstValue));
+
+ boolean b3 = x.compareAndSet(null, otherValue);
+ assertThat(b3, is(false));
+ assertThat(x.get(), is(firstValue));
+
+ boolean b4 = x.compareAndSet(firstValue, otherValue);
+ assertThat(b4, is(true));
+ assertThat(x.get(), is(otherValue));
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.html
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.html b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.html
index add01ab..8165722 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.html
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.html
@@ -21,6 +21,8 @@
<body>
<wicket:panel>
<div class="entityTabbed">
+ <div wicket:id="entitySummary"></div>
+ <div wicket:id="entityPropertiesAndCollections"></div>
</div>
</wicket:panel>
</body>
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.java
index 0f23e3b..c1e37cd 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabbed/EntityTabbedPanel.java
@@ -19,9 +19,12 @@
package org.apache.isis.viewer.wicket.ui.components.entity.tabbed;
+import org.apache.isis.applib.layout.v1_0.DomainObject;
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.layoutxml.LayoutXmlFacet;
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;
@@ -50,9 +53,13 @@ public class EntityTabbedPanel extends PanelAbstract<EntityModel> {
CssClassAppender.appendCssClassTo(this, cssClass);
}
-// addOrReplace(ComponentType.ENTITY_SUMMARY, model);
-//
-// getComponentFactoryRegistry().addOrReplaceComponent(this, ID_ENTITY_PROPERTIES_AND_COLLECTIONS, ComponentType.ENTITY_PROPERTIES, model);
+ LayoutXmlFacet layoutXmlFacet = model.getTypeOfSpecification().getFacet(LayoutXmlFacet.class);
+ // force metadata to be derived && synced
+ DomainObject currentlyUnused = layoutXmlFacet.getLayoutMetadata();
+
+ 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/19b7e0eb/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 a78df60..b479d1c 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
@@ -11,8 +11,9 @@
<property id="name">
<actions>
<action id="updateName"/>
+ <action id="downloadJdoMetadata"/>
</actions>
- <layout/>
+ <layout labelPosition="TOP" multiLine="5" cssClass="abcde"/>
</property>
</propertyGroup>
</left>
[2/2] isis git commit: ISIS-993: pretty much there on deriving and
syncing the metamodel with the layout.xml info;
Posted by da...@apache.org.
ISIS-993: pretty much there on deriving and syncing the metamodel with the layout.xml info;
next step is to do the new Wicket views for the tabs themselves
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/19b7e0eb
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/19b7e0eb
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/19b7e0eb
Branch: refs/heads/ISIS-993
Commit: 19b7e0eb2cfbdee9e3a4b0e32442bef79bcfd766
Parents: c101628
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Jan 7 02:19:42 2016 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Jan 7 02:19:42 2016 +0000
----------------------------------------------------------------------
.../apache/isis/applib/layout/v1_0/Action.java | 5 +
.../isis/applib/layout/v1_0/Collection.java | 8 +
.../apache/isis/applib/layout/v1_0/Column.java | 8 +
.../isis/applib/layout/v1_0/DomainObject.java | 38 ++-
.../isis/applib/layout/v1_0/Property.java | 7 +
.../isis/applib/layout/v1_0/PropertyGroup.java | 7 +
.../ActionPositionFacetForActionLayoutXml.java | 41 +++
.../BookmarkPolicyFacetForActionLayoutXml.java | 42 +++
.../CssClassFaFacetForActionLayoutXml.java | 45 ++++
.../layout/CssClassFacetForActionLayoutXml.java | 43 +++
.../DescribedAsFacetForActionLayoutXml.java | 43 +++
.../layout/HiddenFacetForActionLayoutXml.java | 52 ++++
.../layout/NamedFacetForActionLayoutXml.java | 45 ++++
...tViewFacetForCollectionLayoutAnnotation.java | 41 ---
...ewFacetOnCollectionFromLayoutProperties.java | 46 ----
.../layout/CollectionLayoutFacetFactory.java | 2 -
.../CssClassFacetForCollectionLayoutXml.java | 43 +++
...tViewFacetForCollectionLayoutAnnotation.java | 43 +++
.../DefaultViewFacetForCollectionLayoutXml.java | 43 +++
...ewFacetOnCollectionFromLayoutProperties.java | 48 ++++
.../DescribedAsFacetForCollectionLayoutXml.java | 43 +++
.../HiddenFacetForCollectionLayoutXml.java | 52 ++++
.../NamedFacetForCollectionLayoutXml.java | 48 ++++
.../PagedFacetForCollectionLayoutXml.java | 41 +++
.../SortedByFacetForCollectionLayoutXml.java | 52 ++++
.../order/annotprop/MemberOrderFacetXml.java | 35 +++
.../object/layoutxml/LayoutXmlFacetDefault.java | 270 +++++++++++++++++--
.../object/layoutxml/LayoutXmlFacetFactory.java | 4 +-
.../CssClassFacetForPropertyLayoutXml.java | 43 +++
.../DescribedAsFacetForPropertyLayoutXml.java | 43 +++
.../HiddenFacetForPropertyLayoutXml.java | 52 ++++
.../LabelAtFacetForPropertyLayoutXml.java | 42 +++
.../MultiLineFacetForPropertyLayoutXml.java | 41 +++
.../NamedFacetForPropertyLayoutXml.java | 48 ++++
...nderedAdjustedFacetForPropertyLayoutXml.java | 43 +++
.../TypicalLengthFacetForPropertyLayoutXml.java | 49 ++++
.../layoutxml/LayoutXmlFacetDefaultTest.java | 60 +++++
.../entity/tabbed/EntityTabbedPanel.html | 2 +
.../entity/tabbed/EntityTabbedPanel.java | 13 +-
.../dom/simple/SimpleObject.layout.xml | 3 +-
40 files changed, 1503 insertions(+), 131 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Action.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Action.java b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Action.java
index d3ab3b3..05aa54f 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Action.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Action.java
@@ -31,6 +31,11 @@ import javax.xml.bind.annotation.XmlType;
)
public class Action {
+ public Action() {
+ }
+ public Action(final String id) {
+ setId(id);
+ }
private String id;
/**
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Collection.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Collection.java b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Collection.java
index 6439807..4c48c2a 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Collection.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Collection.java
@@ -36,6 +36,14 @@ import com.google.common.collect.Lists;
)
public class Collection implements ColumnContent, ActionHolder {
+
+ public Collection() {
+ }
+ public Collection(final String id) {
+ setId(id);
+ }
+
+
private String id;
/**
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Column.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Column.java b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Column.java
index e751c21..3ac724e 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Column.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Column.java
@@ -35,6 +35,14 @@ import com.google.common.collect.Lists;
)
public class Column {
+
+ public Column() {
+ }
+
+ public Column(final int span) {
+ setSpan(span);
+ }
+
private int span = 4;
@XmlAttribute(required = true)
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/DomainObject.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/DomainObject.java b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/DomainObject.java
index 836a732..c1868fc 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/DomainObject.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/DomainObject.java
@@ -36,8 +36,7 @@ import org.apache.isis.applib.services.dto.Dto;
@XmlRootElement
@XmlType(
- name="domain-object"
- , propOrder = {
+ propOrder = {
"actions"
, "tabGroups"
}
@@ -75,12 +74,16 @@ public class DomainObject implements Dto, ActionHolder {
public interface Visitor {
void visit(DomainObject domainObject);
- void visit(Property property);
- void visit(Collection collection);
- void visit(Action action);
void visit(TabGroup tabGroup);
void visit(Tab tab);
void visit(Column column);
+ void visit(PropertyGroup propertyGroup);
+ void visit(Property property);
+ void visit(@Nullable PropertyLayout propertyLayout, Property forProperty);
+ void visit(Collection collection);
+ void visit(@Nullable CollectionLayout collectionLayout, Collection forCollection);
+ void visit(Action action, ActionHolder holder);
+ void visit(@Nullable ActionLayout actionLayout, Action forAction);
}
public static class VisitorAdapter implements Visitor {
@@ -93,15 +96,23 @@ public class DomainObject implements Dto, ActionHolder {
@Override
public void visit(final Column column) { }
@Override
+ public void visit(PropertyGroup propertyGroup) {}
+ @Override
public void visit(Property property) {}
@Override
+ public void visit(@Nullable final PropertyLayout propertyLayout, final Property forProperty) { }
+ @Override
public void visit(Collection collection) {}
@Override
- public void visit(Action action) {}
+ public void visit(@Nullable final CollectionLayout collectionLayout, final Collection forCollection) { }
+ @Override
+ public void visit(final Action action, final ActionHolder actionHolder) { }
+ @Override
+ public void visit(@Nullable final ActionLayout actionLayout, final Action forAction) { }
}
- public void traverse(final Visitor visitor) {
+ public void visit(final Visitor visitor) {
visitor.visit(this);
traverseActions(this, visitor);
final List<TabGroup> tabGroups = getTabGroups();
@@ -118,20 +129,27 @@ public class DomainObject implements Dto, ActionHolder {
}
private void traverseColumn(final Column column, final Visitor visitor) {
+ if(column == null) {
+ return;
+ }
visitor.visit(column);
traversePropertyGroups(column, visitor);
traverseCollections(column, visitor);
}
private void traversePropertyGroups(final Column column, final Visitor visitor) {
+ List<ColumnContent> content = column.getContent();
final Iterable<PropertyGroup> propertyGroups =
Iterables.transform(
- Iterables.filter(column.getContent(), is(PropertyGroup.class)),
+ Iterables.filter(content, is(PropertyGroup.class)),
cast(PropertyGroup.class));
for (final PropertyGroup propertyGroup : propertyGroups) {
+ visitor.visit(propertyGroup);
+ traverseActions(propertyGroup, visitor);
final List<Property> properties = propertyGroup.getProperties();
for (final Property property : properties) {
visitor.visit(property);
+ visitor.visit(property.getLayout(), property);
traverseActions(property, visitor);
}
}
@@ -144,6 +162,7 @@ public class DomainObject implements Dto, ActionHolder {
cast(Collection.class));
for (final Collection collection : collections) {
visitor.visit(collection);
+ visitor.visit(collection.getLayout(), collection);
traverseActions(collection, visitor);
}
}
@@ -151,7 +170,8 @@ public class DomainObject implements Dto, ActionHolder {
private void traverseActions(final ActionHolder actionHolder, final Visitor visitor) {
final List<Action> actions = actionHolder.getActions();
for (final Action action : actions) {
- visitor.visit(action);
+ visitor.visit(action, actionHolder);
+ visitor.visit(action.getLayout(), action);
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Property.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Property.java b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Property.java
index 9e8136b..d3ee9b2 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Property.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/Property.java
@@ -36,6 +36,13 @@ import com.google.common.collect.Lists;
)
public class Property implements ActionHolder {
+ public Property() {
+ }
+
+ public Property(final String id) {
+ this.id = id;
+ }
+
private String id;
/**
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/PropertyGroup.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/PropertyGroup.java b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/PropertyGroup.java
index 0b9b632..9d883fa 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/PropertyGroup.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/layout/v1_0/PropertyGroup.java
@@ -39,6 +39,13 @@ import org.apache.isis.applib.annotation.MemberOrder;
)
public class PropertyGroup implements ColumnContent, ActionHolder {
+ public PropertyGroup() {
+ }
+
+ public PropertyGroup(final String name) {
+ setName(name);
+ }
+
private String name;
/**
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/ActionPositionFacetForActionLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/ActionPositionFacetForActionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/ActionPositionFacetForActionLayoutXml.java
new file mode 100644
index 0000000..c585b6b
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/ActionPositionFacetForActionLayoutXml.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.core.metamodel.facets.actions.layout;
+
+import org.apache.isis.applib.layout.v1_0.ActionLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.actions.position.ActionPositionFacet;
+import org.apache.isis.core.metamodel.facets.actions.position.ActionPositionFacetAbstract;
+
+public class ActionPositionFacetForActionLayoutXml extends ActionPositionFacetAbstract {
+
+ public static ActionPositionFacet create(ActionLayout actionLayout, FacetHolder holder) {
+ if(actionLayout == null) {
+ return null;
+ }
+ final org.apache.isis.applib.annotation.ActionLayout.Position position = actionLayout.getPosition();
+ return position != null ? new ActionPositionFacetForActionLayoutXml(position, holder) : null;
+ }
+
+ private ActionPositionFacetForActionLayoutXml(final org.apache.isis.applib.annotation.ActionLayout.Position position, final FacetHolder holder) {
+ super(position, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/BookmarkPolicyFacetForActionLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/BookmarkPolicyFacetForActionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/BookmarkPolicyFacetForActionLayoutXml.java
new file mode 100644
index 0000000..f273e9a
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/BookmarkPolicyFacetForActionLayoutXml.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.actions.layout;
+
+import org.apache.isis.applib.annotation.BookmarkPolicy;
+import org.apache.isis.applib.layout.v1_0.ActionLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.bookmarkpolicy.BookmarkPolicyFacet;
+import org.apache.isis.core.metamodel.facets.object.bookmarkpolicy.BookmarkPolicyFacetAbstract;
+
+public class BookmarkPolicyFacetForActionLayoutXml extends BookmarkPolicyFacetAbstract {
+
+ public static BookmarkPolicyFacet create(final ActionLayout actionLayout, final FacetHolder holder) {
+ if (actionLayout == null) {
+ return null;
+ }
+ final BookmarkPolicy bookmarkPolicy = actionLayout.getBookmarking();
+ return bookmarkPolicy != null && bookmarkPolicy != BookmarkPolicy.NEVER ? new BookmarkPolicyFacetForActionLayoutXml(bookmarkPolicy, holder) : null;
+ }
+
+ private BookmarkPolicyFacetForActionLayoutXml(final BookmarkPolicy bookmarkPolicy, final FacetHolder holder) {
+ super(bookmarkPolicy, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/CssClassFaFacetForActionLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/CssClassFaFacetForActionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/CssClassFaFacetForActionLayoutXml.java
new file mode 100644
index 0000000..285d705
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/CssClassFaFacetForActionLayoutXml.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.actions.layout;
+
+import com.google.common.base.Strings;
+
+import org.apache.isis.applib.layout.v1_0.ActionLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.members.cssclassfa.CssClassFaFacet;
+import org.apache.isis.core.metamodel.facets.members.cssclassfa.CssClassFaFacetAbstract;
+import org.apache.isis.core.metamodel.facets.members.cssclassfa.CssClassFaPosition;
+
+public class CssClassFaFacetForActionLayoutXml extends CssClassFaFacetAbstract {
+
+ public static CssClassFaFacet create(final ActionLayout actionLayout, final FacetHolder holder) {
+ if(actionLayout == null) {
+ return null;
+ }
+ final String cssClassFa = Strings.emptyToNull(actionLayout.getCssClassFa());
+ CssClassFaPosition cssClassFaPosition = CssClassFaPosition.from(actionLayout.getCssClassFaPosition());
+ return cssClassFa != null ? new CssClassFaFacetForActionLayoutXml(cssClassFa, cssClassFaPosition, holder) : null;
+ }
+
+ private CssClassFaFacetForActionLayoutXml(final String value, final CssClassFaPosition position, final FacetHolder holder) {
+ super(value, position, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/CssClassFacetForActionLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/CssClassFacetForActionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/CssClassFacetForActionLayoutXml.java
new file mode 100644
index 0000000..c242091
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/CssClassFacetForActionLayoutXml.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.actions.layout;
+
+import com.google.common.base.Strings;
+
+import org.apache.isis.applib.layout.v1_0.ActionLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacetAbstract;
+
+public class CssClassFacetForActionLayoutXml extends CssClassFacetAbstract {
+
+ public static CssClassFacet create(ActionLayout actionLayout, FacetHolder holder) {
+ if(actionLayout == null) {
+ return null;
+ }
+ final String cssClass = Strings.emptyToNull(actionLayout.getCssClass());
+ return cssClass != null ? new CssClassFacetForActionLayoutXml(cssClass, holder) : null;
+ }
+
+ private CssClassFacetForActionLayoutXml(String value, FacetHolder holder) {
+ super(value, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/DescribedAsFacetForActionLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/DescribedAsFacetForActionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/DescribedAsFacetForActionLayoutXml.java
new file mode 100644
index 0000000..493cd7f
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/DescribedAsFacetForActionLayoutXml.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.actions.layout;
+
+import com.google.common.base.Strings;
+
+import org.apache.isis.applib.layout.v1_0.ActionLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet;
+import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacetAbstract;
+
+public class DescribedAsFacetForActionLayoutXml extends DescribedAsFacetAbstract {
+
+ public static DescribedAsFacet create(ActionLayout actionLayout, FacetHolder holder) {
+ if(actionLayout == null) {
+ return null;
+ }
+ final String describedAs = Strings.emptyToNull(actionLayout.getDescribedAs());
+ return describedAs != null ? new DescribedAsFacetForActionLayoutXml(describedAs, holder) : null;
+ }
+
+ private DescribedAsFacetForActionLayoutXml(String value, FacetHolder holder) {
+ super(value, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/HiddenFacetForActionLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/HiddenFacetForActionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/HiddenFacetForActionLayoutXml.java
new file mode 100644
index 0000000..821083a
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/HiddenFacetForActionLayoutXml.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.actions.layout;
+
+import org.apache.isis.applib.annotation.When;
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.applib.layout.v1_0.ActionLayout;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet;
+import org.apache.isis.core.metamodel.facets.members.hidden.HiddenFacetAbstract;
+
+public class HiddenFacetForActionLayoutXml extends HiddenFacetAbstract {
+
+ public static HiddenFacet create(final ActionLayout actionLayout, final FacetHolder holder) {
+ if (actionLayout == null) {
+ return null;
+ }
+ final Where where = actionLayout.getHidden();
+ return where != null && where != Where.NOT_SPECIFIED ? new HiddenFacetForActionLayoutXml(where, holder) : null;
+ }
+
+ private HiddenFacetForActionLayoutXml(final Where where, final FacetHolder holder) {
+ super(When.ALWAYS, where, holder);
+ }
+
+ @Override
+ public String hiddenReason(final ObjectAdapter targetAdapter, final Where whereContext) {
+ if(!where().includes(whereContext)) {
+ return null;
+ }
+ return "Hidden on " + where().getFriendlyName();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/NamedFacetForActionLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/NamedFacetForActionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/NamedFacetForActionLayoutXml.java
new file mode 100644
index 0000000..a8917d6
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/layout/NamedFacetForActionLayoutXml.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.actions.layout;
+
+import com.google.common.base.Strings;
+
+import org.apache.isis.applib.layout.v1_0.ActionLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacet;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacetAbstract;
+
+public class NamedFacetForActionLayoutXml extends NamedFacetAbstract {
+
+ public static NamedFacet create(final ActionLayout actionLayout, final FacetHolder holder) {
+ if(actionLayout == null) {
+ return null;
+ }
+ final String named = Strings.emptyToNull(actionLayout.getNamed());
+ Boolean escaped = actionLayout.getNamedEscaped();
+ return named != null ? new NamedFacetForActionLayoutXml(named, (escaped == null || escaped), holder) : null;
+ }
+
+ private NamedFacetForActionLayoutXml(final String value, final boolean escaped, final FacetHolder holder) {
+
+ super(value, escaped, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/defaultview/DefaultViewFacetForCollectionLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/defaultview/DefaultViewFacetForCollectionLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/defaultview/DefaultViewFacetForCollectionLayoutAnnotation.java
deleted file mode 100644
index 437ab37..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/defaultview/DefaultViewFacetForCollectionLayoutAnnotation.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.metamodel.facets.collections.collection.defaultview;
-
-import com.google.common.base.Strings;
-
-import org.apache.isis.applib.annotation.CollectionLayout;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-
-public class DefaultViewFacetForCollectionLayoutAnnotation extends DefaultViewFacetAbstract {
-
- private DefaultViewFacetForCollectionLayoutAnnotation(String value, FacetHolder holder) {
- super(value, holder);
- }
-
- public static DefaultViewFacet create(CollectionLayout collectionLayout, FacetHolder holder) {
- if (collectionLayout == null) {
- return null;
- }
-
- final String defaultView = Strings.emptyToNull(collectionLayout.defaultView());
- return defaultView != null ? new DefaultViewFacetForCollectionLayoutAnnotation(defaultView, holder) : null;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/defaultview/DefaultViewFacetOnCollectionFromLayoutProperties.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/defaultview/DefaultViewFacetOnCollectionFromLayoutProperties.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/defaultview/DefaultViewFacetOnCollectionFromLayoutProperties.java
deleted file mode 100644
index 2926798..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/collection/defaultview/DefaultViewFacetOnCollectionFromLayoutProperties.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.metamodel.facets.collections.collection.defaultview;
-
-import java.util.Properties;
-
-import com.google.common.base.Strings;
-
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-
-public class DefaultViewFacetOnCollectionFromLayoutProperties extends DefaultViewFacetAbstract {
-
- private DefaultViewFacetOnCollectionFromLayoutProperties(String defaultView, FacetHolder holder) {
- super(defaultView, holder);
- }
-
- public static DefaultViewFacet create(Properties properties, FacetHolder holder) {
- final String defaultView = defaultView(properties);
- return defaultView != null ? new DefaultViewFacetOnCollectionFromLayoutProperties(defaultView, holder) : null;
- }
-
- public static String defaultView(Properties properties) {
- if (properties == null) {
- return null;
- }
-
- return Strings.emptyToNull(properties.getProperty("defaultView"));
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/CollectionLayoutFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/CollectionLayoutFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/CollectionLayoutFacetFactory.java
index 7367664..2d7d8d2 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/CollectionLayoutFacetFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/CollectionLayoutFacetFactory.java
@@ -31,8 +31,6 @@ import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet;
import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet;
import org.apache.isis.core.metamodel.facets.all.named.NamedFacet;
import org.apache.isis.core.metamodel.facets.collections.collection.defaultview.DefaultViewFacet;
-import org.apache.isis.core.metamodel.facets.collections.collection.defaultview.DefaultViewFacetForCollectionLayoutAnnotation;
-import org.apache.isis.core.metamodel.facets.collections.collection.defaultview.DefaultViewFacetOnCollectionFromLayoutProperties;
import org.apache.isis.core.metamodel.facets.collections.sortedby.SortedByFacet;
import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
import org.apache.isis.core.metamodel.facets.members.render.RenderFacet;
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/CssClassFacetForCollectionLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/CssClassFacetForCollectionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/CssClassFacetForCollectionLayoutXml.java
new file mode 100644
index 0000000..80f6132
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/CssClassFacetForCollectionLayoutXml.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.collections.layout;
+
+import com.google.common.base.Strings;
+
+import org.apache.isis.applib.layout.v1_0.CollectionLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacetAbstract;
+
+public class CssClassFacetForCollectionLayoutXml extends CssClassFacetAbstract {
+
+ public static CssClassFacet create(CollectionLayout collectionLayout, FacetHolder holder) {
+ if(collectionLayout == null) {
+ return null;
+ }
+ final String cssClass = Strings.emptyToNull(collectionLayout.getCssClass());
+ return cssClass != null ? new CssClassFacetForCollectionLayoutXml(cssClass, holder) : null;
+ }
+
+ private CssClassFacetForCollectionLayoutXml(String value, FacetHolder holder) {
+ super(value, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DefaultViewFacetForCollectionLayoutAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DefaultViewFacetForCollectionLayoutAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DefaultViewFacetForCollectionLayoutAnnotation.java
new file mode 100644
index 0000000..63c55d1
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DefaultViewFacetForCollectionLayoutAnnotation.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.collections.layout;
+
+import com.google.common.base.Strings;
+
+import org.apache.isis.applib.annotation.CollectionLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.collections.collection.defaultview.DefaultViewFacet;
+import org.apache.isis.core.metamodel.facets.collections.collection.defaultview.DefaultViewFacetAbstract;
+
+public class DefaultViewFacetForCollectionLayoutAnnotation extends DefaultViewFacetAbstract {
+
+ private DefaultViewFacetForCollectionLayoutAnnotation(String value, FacetHolder holder) {
+ super(value, holder);
+ }
+
+ public static DefaultViewFacet create(CollectionLayout collectionLayout, FacetHolder holder) {
+ if (collectionLayout == null) {
+ return null;
+ }
+
+ final String defaultView = Strings.emptyToNull(collectionLayout.defaultView());
+ return defaultView != null ? new DefaultViewFacetForCollectionLayoutAnnotation(defaultView, holder) : null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DefaultViewFacetForCollectionLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DefaultViewFacetForCollectionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DefaultViewFacetForCollectionLayoutXml.java
new file mode 100644
index 0000000..b8d9056
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DefaultViewFacetForCollectionLayoutXml.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.collections.layout;
+
+import com.google.common.base.Strings;
+
+import org.apache.isis.applib.layout.v1_0.CollectionLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.collections.collection.defaultview.DefaultViewFacet;
+import org.apache.isis.core.metamodel.facets.collections.collection.defaultview.DefaultViewFacetAbstract;
+
+public class DefaultViewFacetForCollectionLayoutXml extends DefaultViewFacetAbstract {
+
+ private DefaultViewFacetForCollectionLayoutXml(String value, FacetHolder holder) {
+ super(value, holder);
+ }
+
+ public static DefaultViewFacet create(CollectionLayout collectionLayout, FacetHolder holder) {
+ if (collectionLayout == null) {
+ return null;
+ }
+
+ final String defaultView = Strings.emptyToNull(collectionLayout.getDefaultView());
+ return defaultView != null ? new DefaultViewFacetForCollectionLayoutXml(defaultView, holder) : null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DefaultViewFacetOnCollectionFromLayoutProperties.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DefaultViewFacetOnCollectionFromLayoutProperties.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DefaultViewFacetOnCollectionFromLayoutProperties.java
new file mode 100644
index 0000000..288f190
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DefaultViewFacetOnCollectionFromLayoutProperties.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.collections.layout;
+
+import java.util.Properties;
+
+import com.google.common.base.Strings;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.collections.collection.defaultview.DefaultViewFacet;
+import org.apache.isis.core.metamodel.facets.collections.collection.defaultview.DefaultViewFacetAbstract;
+
+public class DefaultViewFacetOnCollectionFromLayoutProperties extends DefaultViewFacetAbstract {
+
+ private DefaultViewFacetOnCollectionFromLayoutProperties(String defaultView, FacetHolder holder) {
+ super(defaultView, holder);
+ }
+
+ public static DefaultViewFacet create(Properties properties, FacetHolder holder) {
+ final String defaultView = defaultView(properties);
+ return defaultView != null ? new DefaultViewFacetOnCollectionFromLayoutProperties(defaultView, holder) : null;
+ }
+
+ public static String defaultView(Properties properties) {
+ if (properties == null) {
+ return null;
+ }
+
+ return Strings.emptyToNull(properties.getProperty("defaultView"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DescribedAsFacetForCollectionLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DescribedAsFacetForCollectionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DescribedAsFacetForCollectionLayoutXml.java
new file mode 100644
index 0000000..10241a1
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DescribedAsFacetForCollectionLayoutXml.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.collections.layout;
+
+import com.google.common.base.Strings;
+
+import org.apache.isis.applib.layout.v1_0.CollectionLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet;
+import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacetAbstract;
+
+public class DescribedAsFacetForCollectionLayoutXml extends DescribedAsFacetAbstract {
+
+ public static DescribedAsFacet create(CollectionLayout collectionLayout, FacetHolder holder) {
+ if(collectionLayout == null) {
+ return null;
+ }
+ final String describedAs = Strings.emptyToNull(collectionLayout.getDescribedAs());
+ return describedAs != null ? new DescribedAsFacetForCollectionLayoutXml(describedAs, holder) : null;
+ }
+
+ private DescribedAsFacetForCollectionLayoutXml(String value, FacetHolder holder) {
+ super(value, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/HiddenFacetForCollectionLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/HiddenFacetForCollectionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/HiddenFacetForCollectionLayoutXml.java
new file mode 100644
index 0000000..f362634
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/HiddenFacetForCollectionLayoutXml.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.collections.layout;
+
+import org.apache.isis.applib.annotation.When;
+import org.apache.isis.applib.annotation.Where;
+import org.apache.isis.applib.layout.v1_0.CollectionLayout;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet;
+import org.apache.isis.core.metamodel.facets.members.hidden.HiddenFacetAbstract;
+
+public class HiddenFacetForCollectionLayoutXml extends HiddenFacetAbstract {
+
+ public static HiddenFacet create(final CollectionLayout collectionLayout, final FacetHolder holder) {
+ if (collectionLayout == null) {
+ return null;
+ }
+ final Where where = collectionLayout.getHidden();
+ return where != null && where != Where.NOT_SPECIFIED ? new HiddenFacetForCollectionLayoutXml(where, holder) : null;
+ }
+
+ private HiddenFacetForCollectionLayoutXml(final Where where, final FacetHolder holder) {
+ super(When.ALWAYS, where, holder);
+ }
+
+ @Override
+ public String hiddenReason(final ObjectAdapter targetAdapter, final Where whereContext) {
+ if(!where().includes(whereContext)) {
+ return null;
+ }
+ return "Hidden on " + where().getFriendlyName();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/NamedFacetForCollectionLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/NamedFacetForCollectionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/NamedFacetForCollectionLayoutXml.java
new file mode 100644
index 0000000..e9828d7
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/NamedFacetForCollectionLayoutXml.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.collections.layout;
+
+import com.google.common.base.Strings;
+
+import org.apache.isis.applib.layout.v1_0.CollectionLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacet;
+import org.apache.isis.core.metamodel.facets.all.named.NamedFacetAbstract;
+
+public class NamedFacetForCollectionLayoutXml extends NamedFacetAbstract {
+
+ public static NamedFacet create(CollectionLayout collectionLayout, FacetHolder holder) {
+ if(collectionLayout == null) {
+ return null;
+ }
+ final String named = Strings.emptyToNull(collectionLayout.getNamed());
+ final Boolean escaped = collectionLayout.getNamedEscaped();
+ return named != null ? new NamedFacetForCollectionLayoutXml(named, escaped == null || escaped, holder) : null;
+ }
+
+ private NamedFacetForCollectionLayoutXml(
+ final String value,
+ final boolean escaped,
+ final FacetHolder holder) {
+
+ super(value, escaped, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/PagedFacetForCollectionLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/PagedFacetForCollectionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/PagedFacetForCollectionLayoutXml.java
new file mode 100644
index 0000000..f14abb1
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/PagedFacetForCollectionLayoutXml.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.core.metamodel.facets.collections.layout;
+
+import org.apache.isis.applib.layout.v1_0.CollectionLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.object.paged.PagedFacet;
+import org.apache.isis.core.metamodel.facets.object.paged.PagedFacetAbstract;
+
+public class PagedFacetForCollectionLayoutXml extends PagedFacetAbstract {
+
+ public static PagedFacet create(CollectionLayout collectionLayout, FacetHolder holder) {
+ if(collectionLayout == null) {
+ return null;
+ }
+ final Integer paged = collectionLayout.getPaged();
+ return paged != null && paged != -1 ? new PagedFacetForCollectionLayoutXml(paged, holder) : null;
+ }
+
+ private PagedFacetForCollectionLayoutXml(int paged, FacetHolder holder) {
+ super(paged, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/SortedByFacetForCollectionLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/SortedByFacetForCollectionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/SortedByFacetForCollectionLayoutXml.java
new file mode 100644
index 0000000..2030e45
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/SortedByFacetForCollectionLayoutXml.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.collections.layout;
+
+import java.util.Comparator;
+
+import org.apache.isis.applib.layout.v1_0.CollectionLayout;
+import org.apache.isis.core.commons.lang.ClassUtil;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.collections.sortedby.SortedByFacet;
+import org.apache.isis.core.metamodel.facets.collections.sortedby.SortedByFacetAbstract;
+
+public class SortedByFacetForCollectionLayoutXml extends SortedByFacetAbstract {
+
+ public static SortedByFacet create(CollectionLayout collectionLayout, FacetHolder holder) {
+ if(collectionLayout == null) {
+ return null;
+ }
+ final String sortedBy = collectionLayout.getSortedBy();
+ if (sortedBy == null) {
+ return null;
+ }
+ final Class sortedByClass = ClassUtil.forName(sortedBy);
+ if(sortedByClass == Comparator.class) {
+ return null;
+ }
+
+ return sortedByClass != null ? new SortedByFacetForCollectionLayoutXml(sortedByClass, holder) : null;
+ }
+
+ private SortedByFacetForCollectionLayoutXml(Class<? extends Comparator<?>> sortedBy, FacetHolder holder) {
+ super(sortedBy, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/order/annotprop/MemberOrderFacetXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/order/annotprop/MemberOrderFacetXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/order/annotprop/MemberOrderFacetXml.java
new file mode 100644
index 0000000..7830d32
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/members/order/annotprop/MemberOrderFacetXml.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.members.order.annotprop;
+
+import org.apache.isis.applib.services.i18n.TranslationService;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.members.order.MemberOrderFacetAbstract;
+
+public class MemberOrderFacetXml extends MemberOrderFacetAbstract {
+
+ public MemberOrderFacetXml(
+ final String name,
+ final String sequence,
+ final TranslationService translationService, final FacetHolder holder) {
+ super(name, sequence, translationService, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutxml/LayoutXmlFacetDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutxml/LayoutXmlFacetDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutxml/LayoutXmlFacetDefault.java
index bbd2281..e0b81d6 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutxml/LayoutXmlFacetDefault.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutxml/LayoutXmlFacetDefault.java
@@ -20,14 +20,52 @@ package org.apache.isis.core.metamodel.facets.object.layoutxml;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
import org.apache.isis.applib.layout.v1_0.Action;
+import org.apache.isis.applib.layout.v1_0.ActionHolder;
+import org.apache.isis.applib.layout.v1_0.ActionLayout;
import org.apache.isis.applib.layout.v1_0.Collection;
+import org.apache.isis.applib.layout.v1_0.CollectionLayout;
+import org.apache.isis.applib.layout.v1_0.Column;
import org.apache.isis.applib.layout.v1_0.DomainObject;
import org.apache.isis.applib.layout.v1_0.Property;
+import org.apache.isis.applib.layout.v1_0.PropertyGroup;
+import org.apache.isis.applib.layout.v1_0.PropertyLayout;
+import org.apache.isis.applib.layout.v1_0.Tab;
+import org.apache.isis.applib.layout.v1_0.TabGroup;
+import org.apache.isis.applib.services.i18n.TranslationService;
import org.apache.isis.core.metamodel.facetapi.Facet;
import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facets.actions.layout.ActionPositionFacetForActionLayoutXml;
+import org.apache.isis.core.metamodel.facets.actions.layout.BookmarkPolicyFacetForActionLayoutXml;
+import org.apache.isis.core.metamodel.facets.actions.layout.CssClassFaFacetForActionLayoutXml;
+import org.apache.isis.core.metamodel.facets.actions.layout.CssClassFacetForActionLayoutXml;
+import org.apache.isis.core.metamodel.facets.actions.layout.DescribedAsFacetForActionLayoutXml;
+import org.apache.isis.core.metamodel.facets.actions.layout.HiddenFacetForActionLayoutXml;
+import org.apache.isis.core.metamodel.facets.actions.layout.NamedFacetForActionLayoutXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.CssClassFacetForCollectionLayoutXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.DefaultViewFacetForCollectionLayoutXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.DescribedAsFacetForCollectionLayoutXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.HiddenFacetForCollectionLayoutXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.NamedFacetForCollectionLayoutXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.PagedFacetForCollectionLayoutXml;
+import org.apache.isis.core.metamodel.facets.collections.layout.SortedByFacetForCollectionLayoutXml;
+import org.apache.isis.core.metamodel.facets.members.order.annotprop.MemberOrderFacetXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.CssClassFacetForPropertyLayoutXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.DescribedAsFacetForPropertyLayoutXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.HiddenFacetForPropertyLayoutXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.LabelAtFacetForPropertyLayoutXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.MultiLineFacetForPropertyLayoutXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.NamedFacetForPropertyLayoutXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.RenderedAdjustedFacetForPropertyLayoutXml;
+import org.apache.isis.core.metamodel.facets.properties.propertylayout.TypicalLengthFacetForPropertyLayoutXml;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.metamodel.spec.feature.Contributed;
import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
@@ -41,6 +79,7 @@ public class LayoutXmlFacetDefault
implements LayoutXmlFacet {
private final DomainObject metadata;
+ private final TranslationService translationService;
public static Class<? extends Facet> type() {
return LayoutXmlFacet.class;
@@ -49,80 +88,255 @@ public class LayoutXmlFacetDefault
public static LayoutXmlFacet create(
final FacetHolder facetHolder,
- final DomainObject domainObject) {
+ final DomainObject domainObject,
+ final TranslationService translationService) {
if(domainObject == null) {
return null;
}
- return new LayoutXmlFacetDefault(facetHolder, domainObject);
+ return new LayoutXmlFacetDefault(facetHolder, domainObject, translationService);
}
private LayoutXmlFacetDefault(
final FacetHolder facetHolder,
- final DomainObject metadata) {
+ final DomainObject metadata,
+ final TranslationService translationService) {
super(LayoutXmlFacetDefault.type(), facetHolder, Derivation.NOT_DERIVED);
this.metadata = metadata;
+ this.translationService = translationService;
}
- private boolean fleshedOut;
+ private boolean derivedAndSynced;
public DomainObject getLayoutMetadata() {
- return fleshedOut? metadata : fleshOut(metadata);
+ //return derivedAndSynced ? metadata : deriveAndSync(metadata);
+ return deriveAndSync(metadata);
}
- private DomainObject fleshOut(final DomainObject metadata) {
+ private DomainObject deriveAndSync(final DomainObject metadata) {
synchronized (metadata) {
- doFleshOut(metadata);
- fleshedOut = true;
+ doDeriveAndSync(metadata);
+ derivedAndSynced = true;
}
return metadata;
}
- private void doFleshOut(final DomainObject metadata) {
- ObjectSpecification objectSpec = (ObjectSpecification) getFacetHolder();
+ private void doDeriveAndSync(final DomainObject metadata) {
+
+ final ObjectSpecification objectSpec = (ObjectSpecification) getFacetHolder();
+ final Map<String, OneToOneAssociation> oneToOneAssociationById =
+ ObjectMember.Util.mapById(getOneToOneAssociations(objectSpec));
+ final Map<String, OneToManyAssociation> oneToManyAssociationById =
+ ObjectMember.Util.mapById(getOneToManyAssociations(objectSpec));
+ final Map<String, ObjectAction> objectActionById =
+ ObjectMember.Util.mapById(objectSpec.getObjectActions(Contributed.INCLUDED));
- final List<OneToOneAssociation> oneToOneAssociations = getOneToOneAssociations(objectSpec);
- final Map<String, OneToOneAssociation> oneToOneAssociationById = ObjectMember.Util.mapById(oneToOneAssociations);
+ derive(metadata, oneToOneAssociationById, oneToManyAssociationById, objectActionById);
- final List<OneToManyAssociation> oneToManyAssociations = getOneToManyAssociations(objectSpec);
- final Map<String, OneToManyAssociation> oneToManyAssociationById = ObjectMember.Util.mapById(oneToManyAssociations);
+ sync(metadata, oneToOneAssociationById, oneToManyAssociationById, objectActionById);
+ }
- final List<ObjectAction> objectActions = objectSpec.getObjectActions(Contributed.INCLUDED);
- final Map<String, ObjectAction> objectActionById = ObjectMember.Util.mapById(objectActions);
+ private void derive(
+ final DomainObject metadata,
+ final Map<String, OneToOneAssociation> oneToOneAssociationById,
+ final Map<String, OneToManyAssociation> oneToManyAssociationById,
+ final Map<String, ObjectAction> objectActionById) {
+ final List<String> propertyIds = Lists.newArrayList();
+ final List<String> collectionIds = Lists.newArrayList();
+ final List<String> actionIds = Lists.newArrayList();
+ final AtomicReference<PropertyGroup> generalPropertyGroupRef = new AtomicReference<>();
+ final AtomicReference<Column> firstColumnRef = new AtomicReference<>();
+ final AtomicReference<TabGroup> lastTabGroupRef = new AtomicReference<>();
- metadata.traverse(new DomainObject.VisitorAdapter() {
+ metadata.visit(new DomainObject.VisitorAdapter() {
@Override
public void visit(final Property property) {
- oneToOneAssociationById.remove(property.getId());
+ propertyIds.add(property.getId());
}
@Override
public void visit(final Collection collection) {
- oneToManyAssociationById.remove(collection.getId());
+ collectionIds.add(collection.getId());
+ }
+ @Override
+ public void visit(final Action action, final ActionHolder holder) {
+ actionIds.add(action.getId());
+ }
+ @Override
+ public void visit(final Column column) {
+ firstColumnRef.compareAndSet(null, column);
}
@Override
- public void visit(final Action action) {
- objectActionById.remove(action.getId());
+ public void visit(final PropertyGroup propertyGroup) {
+ if(propertyGroup.getName().equals("General")) {
+ generalPropertyGroupRef.compareAndSet(null, propertyGroup);
+ }
+ }
+ @Override
+ public void visit(final TabGroup tabGroup) {
+ lastTabGroupRef.set(tabGroup);
}
});
- if(!oneToOneAssociationById.isEmpty()) {
+ // any missing properties will be added to the (first) 'General' property group found
+ // if there is no 'General' property group then one will be added to the first Column of the first Tab.
+ final List<String> missingPropertyIds = Lists.newArrayList(oneToOneAssociationById.keySet());
+ missingPropertyIds.removeAll(propertyIds);
+ if(!missingPropertyIds.isEmpty()) {
+ // ensure that there is a property group to use
+ boolean wasSet = generalPropertyGroupRef.compareAndSet(null, new PropertyGroup("General"));
+ final PropertyGroup generalPropertyGroup = generalPropertyGroupRef.get();
+ if(wasSet) {
+ firstColumnRef.get().getContent().add(generalPropertyGroup);
+ }
+ Iterables.removeAll(propertyIds, oneToOneAssociationById.keySet());
+ for (final String propertyId : missingPropertyIds) {
+ generalPropertyGroup.getProperties().add(new Property(propertyId));
+ }
}
- if(!oneToManyAssociationById.isEmpty()) {
+ // any missing collections will be added as tabs to the last TabGroup.
+ // If there is only a single tab group then a new TabGroup will be added first
+ final List<String> missingCollectionIds = Lists.newArrayList(oneToManyAssociationById.keySet());
+ missingCollectionIds.removeAll(collectionIds);
+
+ if(!missingCollectionIds.isEmpty()) {
+ while(metadata.getTabGroups().size() < 2) {
+ final TabGroup tabGroup = new TabGroup();
+ metadata.getTabGroups().add(tabGroup);
+ lastTabGroupRef.set(tabGroup);
+ }
+ final TabGroup lastTabGroup = lastTabGroupRef.get();
+ for (final String collectionId : missingCollectionIds) {
+ final Tab tab = new Tab();
+ lastTabGroup.getTabs().add(tab);
+ Column left = new Column(12);
+ tab.setLeft(left);
+ left.getContent().add(new Collection(collectionId));
+ }
}
- if(!objectActionById.isEmpty()) {
+ // any missing actions will be added as domain object actions (in the header)
+ final List<String> missingActionIds = Lists.newArrayList(objectActionById.keySet());
+ missingActionIds.removeAll(actionIds);
+
+ if(!missingActionIds.isEmpty()) {
+ for (String actionId : missingActionIds) {
+ metadata.getActions().add(new Action(actionId));
+ }
}
}
+ private void sync(
+ final DomainObject metadata,
+ final Map<String, OneToOneAssociation> oneToOneAssociationById,
+ final Map<String, OneToManyAssociation> oneToManyAssociationById,
+ final Map<String, ObjectAction> objectActionById) {
+
+ metadata.visit(new DomainObject.VisitorAdapter() {
+ private int domainObjectSequence = 1;
+ private int propertyGroupSequence = 1;
+ private int propertySequence = 1;
+ private int collectionSequence = 1;
+ private Map<Action, ActionHolder> actionHolderByAction = Maps.newHashMap();
+ @Override
+ public void visit(final Action action, final ActionHolder actionHolder) {
+ actionHolderByAction.put(action, actionHolder);
+ final ObjectAction objectAction = objectActionById.get(action.getId());
+ final String memberOrderName;
+ final int memberOrderSequence;
+ if(actionHolder instanceof PropertyGroup) {
+ final PropertyGroup propertyGroup = (PropertyGroup) actionHolder;
+ final List<Property> properties = propertyGroup.getProperties();
+ final Property property = properties.get(0); // any will do
+ memberOrderName = property.getId();
+ memberOrderSequence = propertyGroupSequence++;
+ } else if(actionHolder instanceof Property) {
+ final Property property = (Property) actionHolder;
+ memberOrderName = property.getId();
+ memberOrderSequence = propertySequence++;
+ } else if(actionHolder instanceof Collection) {
+ final Collection collection = (Collection) actionHolder;
+ memberOrderName = collection.getId();
+ memberOrderSequence = collectionSequence++;
+ } else {
+ // DomainObject
+ memberOrderName = null;
+ memberOrderSequence = domainObjectSequence++;
+ }
+ FacetUtil.addFacet(
+ new MemberOrderFacetXml(memberOrderName, ""+memberOrderSequence, translationService, objectAction));
+ }
+ @Override
+ public void visit(final ActionLayout actionLayout, final Action action) {
+ final ObjectAction objectAction = objectActionById.get(action.getId());
+ final ActionHolder actionHolder = actionHolderByAction.get(action);
+
+ final ActionLayout actionLayoutForPosition;
+ if(actionHolder instanceof PropertyGroup) {
+ // ensure that there is a non-null valid ActionLayout#position()
+ actionLayoutForPosition = actionLayout != null ? actionLayout : new ActionLayout();
+ if( actionLayoutForPosition.getPosition() == null ||
+ actionLayoutForPosition.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.BELOW ||
+ actionLayoutForPosition.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.RIGHT) {
+ actionLayoutForPosition.setPosition(org.apache.isis.applib.annotation.ActionLayout.Position.PANEL);
+ }
+ } else if(actionHolder instanceof Property) {
+ // ensure that there is a non-null valid ActionLayout#position()
+ actionLayoutForPosition = actionLayout != null ? actionLayout : new ActionLayout();
+ if( actionLayoutForPosition.getPosition() == null ||
+ actionLayoutForPosition.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.PANEL_DROPDOWN ||
+ actionLayoutForPosition.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.PANEL) {
+ actionLayoutForPosition.setPosition(org.apache.isis.applib.annotation.ActionLayout.Position.BELOW);
+ }
+ } else {
+ // doesn't do anything for DomainObject or Collection
+ actionLayoutForPosition = null;
+ }
+ FacetUtil.addFacet(ActionPositionFacetForActionLayoutXml.create(actionLayoutForPosition, objectAction));
+
+ FacetUtil.addFacet(BookmarkPolicyFacetForActionLayoutXml.create(actionLayout, objectAction));
+ FacetUtil.addFacet(CssClassFacetForActionLayoutXml.create(actionLayout, objectAction));
+ FacetUtil.addFacet(CssClassFaFacetForActionLayoutXml.create(actionLayout, objectAction));
+ FacetUtil.addFacet(DescribedAsFacetForActionLayoutXml.create(actionLayout, objectAction));
+ FacetUtil.addFacet(HiddenFacetForActionLayoutXml.create(actionLayout, objectAction));
+ FacetUtil.addFacet(NamedFacetForActionLayoutXml.create(actionLayout, objectAction));
+ }
+ @Override
+ public void visit(final PropertyLayout propertyLayout, final Property property) {
+ final OneToOneAssociation oneToOneAssociation = oneToOneAssociationById.get(property.getId());
+ FacetUtil.addFacet(CssClassFacetForPropertyLayoutXml.create(propertyLayout, oneToOneAssociation));
+ FacetUtil.addFacet(DescribedAsFacetForPropertyLayoutXml.create(propertyLayout, oneToOneAssociation));
+ FacetUtil.addFacet(HiddenFacetForPropertyLayoutXml.create(propertyLayout, oneToOneAssociation));
+ FacetUtil.addFacet(LabelAtFacetForPropertyLayoutXml.create(propertyLayout, oneToOneAssociation));
+ FacetUtil.addFacet(MultiLineFacetForPropertyLayoutXml.create(propertyLayout, oneToOneAssociation));
+ FacetUtil.addFacet(NamedFacetForPropertyLayoutXml.create(propertyLayout, oneToOneAssociation));
+ FacetUtil.addFacet(RenderedAdjustedFacetForPropertyLayoutXml.create(propertyLayout, oneToOneAssociation));
+ FacetUtil.addFacet(TypicalLengthFacetForPropertyLayoutXml.create(propertyLayout, oneToOneAssociation));
+ }
+ @Override
+ public void visit(final CollectionLayout collectionLayout, final Collection collection) {
+ final OneToManyAssociation oneToManyAssociation = oneToManyAssociationById.get(collection.getId());
+ FacetUtil.addFacet(CssClassFacetForCollectionLayoutXml.create(collectionLayout, oneToManyAssociation));
+ FacetUtil.addFacet(DefaultViewFacetForCollectionLayoutXml.create(collectionLayout, oneToManyAssociation));
+ FacetUtil.addFacet(DescribedAsFacetForCollectionLayoutXml.create(collectionLayout, oneToManyAssociation));
+ FacetUtil.addFacet(HiddenFacetForCollectionLayoutXml.create(collectionLayout, oneToManyAssociation));
+ FacetUtil.addFacet(NamedFacetForCollectionLayoutXml.create(collectionLayout, oneToManyAssociation));
+ FacetUtil.addFacet(PagedFacetForCollectionLayoutXml.create(collectionLayout, oneToManyAssociation));
+ FacetUtil.addFacet(SortedByFacetForCollectionLayoutXml.create(collectionLayout, oneToManyAssociation));
+ }
+ });
+
+ }
- private List getOneToOneAssociations(final ObjectSpecification objectSpec) {
- return objectSpec
+ private List<OneToOneAssociation> getOneToOneAssociations(final ObjectSpecification objectSpec) {
+ List associations = objectSpec
.getAssociations(Contributed.INCLUDED, ObjectAssociation.Filters.PROPERTIES);
+ return associations;
}
- private List getOneToManyAssociations(final ObjectSpecification objectSpec) {
- return objectSpec
+ private List<OneToManyAssociation> getOneToManyAssociations(final ObjectSpecification objectSpec) {
+ List associations = objectSpec
.getAssociations(Contributed.INCLUDED, ObjectAssociation.Filters.COLLECTIONS);
+ return associations;
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutxml/LayoutXmlFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutxml/LayoutXmlFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutxml/LayoutXmlFacetFactory.java
index 17d4063..606f34a 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutxml/LayoutXmlFacetFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutxml/LayoutXmlFacetFactory.java
@@ -24,6 +24,7 @@ import com.google.common.collect.Sets;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.isis.applib.services.i18n.TranslationService;
import org.apache.isis.applib.services.jaxb.JaxbService;
import org.apache.isis.core.commons.lang.ClassExtensions;
import org.apache.isis.core.metamodel.facetapi.FacetHolder;
@@ -47,7 +48,8 @@ public class LayoutXmlFacetFactory extends FacetFactoryAbstract implements Servi
final Class<?> cls = processClassContext.getCls();
final FacetHolder facetHolder = processClassContext.getFacetHolder();
- FacetUtil.addFacet(LayoutXmlFacetDefault.create(facetHolder, readMetadata(cls)));
+ final TranslationService translationService = servicesInjector.lookupService(TranslationService.class);
+ FacetUtil.addFacet(LayoutXmlFacetDefault.create(facetHolder, readMetadata(cls), translationService));
}
private final Set<Class<?>> blacklisted = Sets.newConcurrentHashSet();
http://git-wip-us.apache.org/repos/asf/isis/blob/19b7e0eb/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetForPropertyLayoutXml.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetForPropertyLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetForPropertyLayoutXml.java
new file mode 100644
index 0000000..fb9bdb8
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetForPropertyLayoutXml.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.properties.propertylayout;
+
+import com.google.common.base.Strings;
+
+import org.apache.isis.applib.layout.v1_0.PropertyLayout;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacetAbstract;
+
+public class CssClassFacetForPropertyLayoutXml extends CssClassFacetAbstract {
+
+ public static CssClassFacet create(PropertyLayout propertyLayout, FacetHolder holder) {
+ if(propertyLayout == null) {
+ return null;
+ }
+ final String cssClass = Strings.emptyToNull(propertyLayout.getCssClass());
+ return cssClass != null ? new CssClassFacetForPropertyLayoutXml(cssClass, holder) : null;
+ }
+
+ private CssClassFacetForPropertyLayoutXml(String value, FacetHolder holder) {
+ super(value, holder);
+ }
+
+}