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 2013/11/22 16:46:26 UTC
[1/2] ISIS-604, ISIS-605, ISIS-606, ISIS-607: dynamic layouts
Updated Branches:
refs/heads/master 2dee08b44 -> 4a6938fdc
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/propparam/multiline/MultiLineAnnotationFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/propparam/multiline/MultiLineAnnotationFacetFactoryTest.java b/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/propparam/multiline/MultiLineAnnotationFacetFactoryTest.java
index 9892c4b..65e3eae 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/propparam/multiline/MultiLineAnnotationFacetFactoryTest.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/propparam/multiline/MultiLineAnnotationFacetFactoryTest.java
@@ -32,8 +32,8 @@ import org.apache.isis.core.progmodel.facets.object.multiline.annotation.MultiLi
import org.apache.isis.core.progmodel.facets.object.multiline.annotation.MultiLineFacetAnnotationOnType;
import org.apache.isis.core.progmodel.facets.param.multiline.annotation.MultiLineAnnotationOnParameterFacetFactory;
import org.apache.isis.core.progmodel.facets.param.multiline.annotation.MultiLineFacetAnnotationOnParameter;
-import org.apache.isis.core.progmodel.facets.properties.multiline.annotation.MultiLineAnnotationOnPropertyFacetFactory;
-import org.apache.isis.core.progmodel.facets.properties.multiline.annotation.MultiLineFacetAnnotationOnProperty;
+import org.apache.isis.core.progmodel.facets.properties.multiline.annotation.MultiLineOnPropertyFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.multiline.annotation.MultiLineFacetOnPropertyAnnotation;
public class MultiLineAnnotationFacetFactoryTest extends AbstractFacetFactoryTest {
@@ -55,7 +55,7 @@ public class MultiLineAnnotationFacetFactoryTest extends AbstractFacetFactoryTes
}
public void testMultiLineAnnotationPickedUpOnProperty() {
- final MultiLineAnnotationOnPropertyFacetFactory facetFactory = new MultiLineAnnotationOnPropertyFacetFactory();
+ final MultiLineOnPropertyFacetFactory facetFactory = new MultiLineOnPropertyFacetFactory();
class Customer {
@SuppressWarnings("unused")
@@ -70,8 +70,8 @@ public class MultiLineAnnotationFacetFactoryTest extends AbstractFacetFactoryTes
final Facet facet = facetedMethod.getFacet(MultiLineFacet.class);
assertNotNull(facet);
- assertTrue(facet instanceof MultiLineFacetAnnotationOnProperty);
- final MultiLineFacetAnnotationOnProperty multiLineFacetAnnotation = (MultiLineFacetAnnotationOnProperty) facet;
+ assertTrue(facet instanceof MultiLineFacetOnPropertyAnnotation);
+ final MultiLineFacetOnPropertyAnnotation multiLineFacetAnnotation = (MultiLineFacetOnPropertyAnnotation) facet;
assertEquals(12, multiLineFacetAnnotation.numberOfLines());
assertEquals(true, multiLineFacetAnnotation.preventWrapping());
}
@@ -112,7 +112,7 @@ public class MultiLineAnnotationFacetFactoryTest extends AbstractFacetFactoryTes
}
public void testMultiLineAnnotationIgnoredForNonStringProperties() {
- final MultiLineAnnotationOnPropertyFacetFactory facetFactory = new MultiLineAnnotationOnPropertyFacetFactory();
+ final MultiLineOnPropertyFacetFactory facetFactory = new MultiLineOnPropertyFacetFactory();
class Customer {
@SuppressWarnings("unused")
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/propparam/typicallength/TypicalLengthAnnotationFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/propparam/typicallength/TypicalLengthAnnotationFacetFactoryTest.java b/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/propparam/typicallength/TypicalLengthAnnotationFacetFactoryTest.java
index ee21baf..ef36d4b 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/propparam/typicallength/TypicalLengthAnnotationFacetFactoryTest.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/propparam/typicallength/TypicalLengthAnnotationFacetFactoryTest.java
@@ -29,13 +29,13 @@ import org.apache.isis.core.metamodel.facets.typicallen.TypicalLengthFacet;
import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
import org.apache.isis.core.progmodel.facets.param.typicallen.annotation.TypicalLengthAnnotationOnParameterFacetFactory;
import org.apache.isis.core.progmodel.facets.param.typicallen.annotation.TypicalLengthFacetAnnotationOnParameter;
-import org.apache.isis.core.progmodel.facets.properties.typicallen.annotation.TypicalLengthAnnotationOnPropertyFacetFactory;
-import org.apache.isis.core.progmodel.facets.properties.typicallen.annotation.TypicalLengthFacetAnnotationOnProperty;
+import org.apache.isis.core.progmodel.facets.properties.typicallen.annotation.TypicalLengthOnPropertyFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.typicallen.annotation.TypicalLengthFacetOnPropertyAnnotation;
public class TypicalLengthAnnotationFacetFactoryTest extends AbstractFacetFactoryTest {
public void testTypicalLengthAnnotationPickedUpOnProperty() {
- final TypicalLengthAnnotationOnPropertyFacetFactory facetFactory = new TypicalLengthAnnotationOnPropertyFacetFactory();
+ final TypicalLengthOnPropertyFacetFactory facetFactory = new TypicalLengthOnPropertyFacetFactory();
class Customer {
@SuppressWarnings("unused")
@@ -50,8 +50,8 @@ public class TypicalLengthAnnotationFacetFactoryTest extends AbstractFacetFactor
final Facet facet = facetedMethod.getFacet(TypicalLengthFacet.class);
assertNotNull(facet);
- assertTrue(facet instanceof TypicalLengthFacetAnnotationOnProperty);
- final TypicalLengthFacetAnnotationOnProperty typicalLengthFacetAnnotation = (TypicalLengthFacetAnnotationOnProperty) facet;
+ assertTrue(facet instanceof TypicalLengthFacetOnPropertyAnnotation);
+ final TypicalLengthFacetOnPropertyAnnotation typicalLengthFacetAnnotation = (TypicalLengthFacetOnPropertyAnnotation) facet;
assertEquals(30, typicalLengthFacetAnnotation.value());
}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/test/resources/org/apache/isis/core/metamodel/layoutmetadata/json/ExampleDomainObject.layout.json
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/resources/org/apache/isis/core/metamodel/layoutmetadata/json/ExampleDomainObject.layout.json b/core/metamodel/src/test/resources/org/apache/isis/core/metamodel/layoutmetadata/json/ExampleDomainObject.layout.json
index 9bf292e..b108397 100644
--- a/core/metamodel/src/test/resources/org/apache/isis/core/metamodel/layoutmetadata/json/ExampleDomainObject.layout.json
+++ b/core/metamodel/src/test/resources/org/apache/isis/core/metamodel/layoutmetadata/json/ExampleDomainObject.layout.json
@@ -21,17 +21,27 @@
memberGroups: {
General: {
members: {
- description: {},
+ description: {
+ typicalLength: {
+ value: 50
+ }
+ },
category: {},
complete: {
actions: {
completed: {
- named: {
- value: Done
+ named: { value: "Done" },
+ describedAs: {
+ value: "Mark this todo item as having been completed"
}
},
notYetCompleted: {}
- }
+ },
+ named: { value: "Done" },
+ describedAs: {
+ value: "Whether this todo item has been completed"
+ },
+ cssClass: { value: "x-highlight" }
}
}
},
@@ -49,15 +59,22 @@
members: {
dueBy: {
actions: {
- dueBy: {}
- }
+ dueBy: {
+ cssClass: { value: "x-key2" }
+ }
+ },
+ cssClass: { value: "x-key" }
},
cost: {
actions: {
updateCost:{}
}
},
- notes: {},
+ notes: {
+ multiLine: {
+ numberOfLines: 5
+ }
+ },
attachment: {}
}
}
@@ -72,7 +89,9 @@
dependencies: {
actions: {
add:{},
- remove: {}
+ remove: {
+ cssClass: { value: "x-caution" }
+ }
},
paged: {
value: 5
@@ -88,10 +107,15 @@
}
],
actions: {
- delete: {},
+ delete: {
+ cssClass: { value: "x-caution" }
+ },
duplicate: {
- named: {
- value: Clone
+ named: {
+ value: "Clone"
+ },
+ describedAs: {
+ value: "Create a new todo item from this one"
}
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/test/resources/org/apache/isis/core/metamodel/layoutmetadata/json/ExampleDomainObject.layout.properties
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/resources/org/apache/isis/core/metamodel/layoutmetadata/json/ExampleDomainObject.layout.properties b/core/metamodel/src/test/resources/org/apache/isis/core/metamodel/layoutmetadata/json/ExampleDomainObject.layout.properties
index 8499c31..03393b7 100644
--- a/core/metamodel/src/test/resources/org/apache/isis/core/metamodel/layoutmetadata/json/ExampleDomainObject.layout.properties
+++ b/core/metamodel/src/test/resources/org/apache/isis/core/metamodel/layoutmetadata/json/ExampleDomainObject.layout.properties
@@ -31,8 +31,12 @@ class.memberGroupLayout.right=
# Properties (General)
member.description.memberOrder.name=General
+member.description.typicalLength.value=50
member.category.memberOrder.name=General
member.complete.memberOrder.name=General
+member.complete.named.value=Done
+member.complete.cssClass.value=x-highlight
+member.complete.describedAs.value=Whether this todo item has been completed
member.description.memberOrder.sequence=1
member.category.memberOrder.sequence=2
@@ -47,9 +51,11 @@ member.versionSequence.memberOrder.sequence=4
member.dueBy.memberOrder.name=Detail
member.cost.memberOrder.name=Detail
member.notes.memberOrder.name=Detail
+member.notes.multiLine.numberOfLines=5
member.attachment.memberOrder.name=Detail
member.dueBy.memberOrder.sequence=5
+member.dueBy.cssClass.value=x-key
member.cost.memberOrder.sequence=6
member.notes.memberOrder.sequence=7
member.attachment.memberOrder.sequence=8
@@ -65,14 +71,17 @@ member.similarItems.render.value=LAZILY
#Actions (freestanding)
-member.delete.memberOrder.sequence=1
-member.duplicate.memberOrder.sequence=2
-member.duplicate.named.value=Clone
+member.delete().memberOrder.sequence=1
+member.delete().cssClass.value=x-caution
+member.duplicate().memberOrder.sequence=2
+member.duplicate().named.value=Clone
+member.duplicate().describedAs.value=Create a new todo item from this one
#Actions (associated with properties)
action.completed.memberOrder.name=complete
action.completed.named.value=Done
+action.completed.describedAs.value=Mark this todo item as having been completed
action.notYetCompleted.memberOrder.name=complete
action.completed.memberOrder.sequence=1
@@ -83,8 +92,11 @@ action.updateCost.memberOrder.sequence=1
action.dueBy.memberOrder.name=dueBy
action.dueBy.memberOrder.sequence=1
+action.dueBy.cssClass.value=x-key2
#Actions (associated with collections)
action.add.memberOrder.name=dependencies
action.remove.memberOrder.name=dependencies
+action.remove.cssClass.value=x-caution
+
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
index 12b7d36..e0290d7 100644
--- a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
+++ b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
@@ -44,11 +44,9 @@ import org.apache.isis.applib.annotation.AutoComplete;
import org.apache.isis.applib.annotation.Bookmarkable;
import org.apache.isis.applib.annotation.Bulk;
import org.apache.isis.applib.annotation.Bulk.InteractionContext;
-import org.apache.isis.applib.annotation.CssClass;
import org.apache.isis.applib.annotation.Disabled;
import org.apache.isis.applib.annotation.Hidden;
import org.apache.isis.applib.annotation.MinLength;
-import org.apache.isis.applib.annotation.MultiLine;
import org.apache.isis.applib.annotation.Named;
import org.apache.isis.applib.annotation.ObjectType;
import org.apache.isis.applib.annotation.Optional;
@@ -56,8 +54,6 @@ import org.apache.isis.applib.annotation.Programmatic;
import org.apache.isis.applib.annotation.PublishedAction;
import org.apache.isis.applib.annotation.PublishedObject;
import org.apache.isis.applib.annotation.RegEx;
-import org.apache.isis.applib.annotation.Render;
-import org.apache.isis.applib.annotation.Render.Type;
import org.apache.isis.applib.annotation.SortedBy;
import org.apache.isis.applib.annotation.TypicalLength;
import org.apache.isis.applib.annotation.Where;
@@ -171,7 +167,6 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
private LocalDate dueBy;
@javax.jdo.annotations.Column(allowsNull="true")
- @CssClass("x-key")
public LocalDate getDueBy() {
return dueBy;
}
@@ -311,7 +306,6 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
@PublishedAction
@Bulk
- @CssClass("x-highlight")
public ToDoItem completed() {
setComplete(true);
@@ -386,7 +380,6 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
@javax.jdo.annotations.Column(allowsNull="true", length=400)
@Hidden(where=Where.ALL_TABLES)
- @MultiLine(numberOfLines=5)
public String getNotes() {
return notes;
}
@@ -418,7 +411,6 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
@Hidden(where=Where.ALL_TABLES)
@Disabled
- @Named("Version")
public Long getVersionSequence() {
if(!(this instanceof PersistenceCapable)) {
return null;
@@ -498,7 +490,6 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
return null;
}
- @CssClass("x-caution")
public ToDoItem remove(final ToDoItem toDoItem) {
getDependencies().remove(toDoItem);
return this;
@@ -564,7 +555,6 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
// //////////////////////////////////////
@Bulk
- @CssClass("x-caution")
public List<ToDoItem> delete() {
container.removeIfNotAlready(this);
container.informUser("Deleted " + container.titleOf(this));
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.layout.json
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.layout.json b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.layout.json
index 779f20c..00d8b48 100644
--- a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.layout.json
+++ b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.layout.json
@@ -21,9 +21,10 @@
memberGroups: {
General: {
members: {
- description: {},
- category: {
+ description: {
+ typicalLength: { value: 50 }
},
+ category: {},
subcategory: {
actions: {
updateCategory: {
@@ -37,22 +38,27 @@
complete: {
actions: {
completed: {
- named: {
- value: "Done"
- }
+ named: { value: "Done" },
+ describedAs: {
+ value: "Mark this todo item as having been completed"
+ },
+ cssClass: { value: "x-highlight" }
},
notYetCompleted: {
- named: {
- value: "Not done"
- }
+ named: { value: "Not done" }
}
+ },
+ describedAs: {
+ value: "Whether this todo item has been completed"
}
}
}
},
Misc: {
members: {
- versionSequence: {}
+ versionSequence: {
+ named: { value: "Version" }
+ }
}
}
}
@@ -68,7 +74,9 @@
next: {}
}
},
- dueBy: {},
+ dueBy: {
+ cssClass: { value: "x-key" }
+ },
cost: {
actions: {
updateCost:{
@@ -78,7 +86,11 @@
}
}
},
- notes: {},
+ notes: {
+ multiLine: {
+ numberOfLines: 5
+ }
+ },
attachment: {}
}
}
@@ -93,7 +105,9 @@
dependencies: {
actions: {
add:{},
- remove: {}
+ remove: {
+ cssClass: { value: "x-caution" }
+ }
},
paged: {
value: 5
@@ -114,12 +128,16 @@
}
],
actions: {
+ delete: {
+ cssClass: { value: "x-caution" }
+ },
duplicate: {
named: {
value: "Clone"
- }
- },
- delete: {}
+ },
+ describedAs: {
+ value: "Create a new todo item from this one"
+ }
+ }
}
}
-
\ No newline at end of file
[2/2] git commit: ISIS-604, ISIS-605, ISIS-606,
ISIS-607: dynamic layouts
Posted by da...@apache.org.
ISIS-604, ISIS-605, ISIS-606, ISIS-607: dynamic layouts
for typicalLength, multiLine, cssClass and describedAs
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/4a6938fd
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/4a6938fd
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/4a6938fd
Branch: refs/heads/master
Commit: 4a6938fdc97ebeadb20127ea6642c5e1a4cba62b
Parents: 2dee08b
Author: Dan Haywood <da...@apache.org>
Authored: Fri Nov 22 15:36:54 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Fri Nov 22 15:36:54 2013 +0000
----------------------------------------------------------------------
.../metamodel/layoutmetadata/ActionRepr.java | 8 ++
.../layoutmetadata/CssClassFacetRepr.java | 22 +++++
.../layoutmetadata/DescribedAsFacetRepr.java | 22 +++++
.../metamodel/layoutmetadata/MemberRepr.java | 10 +++
.../layoutmetadata/MultiLineFacetRepr.java | 22 +++++
.../layoutmetadata/TypicalLengthFacetRepr.java | 23 +++++
.../json/LayoutMetadataReaderFromJson.java | 33 +++++++-
.../CssClassAnnotationOnMemberFacetFactory.java | 47 -----------
.../CssClassFacetAnnotationOnMember.java | 30 -------
.../CssClassFacetOnMemberAnnotation.java | 30 +++++++
.../CssClassFacetOnMemberFromProperties.java | 36 ++++++++
.../cssclass/CssClassOnMemberFacetFactory.java | 73 ++++++++++++++++
...scribedAsAnnotationOnMemberFacetFactory.java | 66 ---------------
.../DescribedAsFacetAnnotationOnMember.java | 31 -------
.../DescribedAsFacetOnMemberAnnotation.java | 31 +++++++
.../DescribedAsFacetOnMemberFromProperties.java | 37 ++++++++
.../DescribedAsOnMemberFacetFactory.java | 88 ++++++++++++++++++++
.../annotation/NamedOnMemberFacetFactory.java | 10 +--
...ltiLineAnnotationOnPropertyFacetFactory.java | 50 -----------
.../MultiLineFacetAnnotationOnProperty.java | 31 -------
.../MultiLineFacetOnPropertyAnnotation.java | 31 +++++++
.../MultiLineFacetOnPropertyFromProperties.java | 43 ++++++++++
.../MultiLineOnPropertyFacetFactory.java | 74 ++++++++++++++++
...lLengthAnnotationOnPropertyFacetFactory.java | 48 -----------
.../TypicalLengthFacetAnnotationOnProperty.java | 39 ---------
.../TypicalLengthFacetOnPropertyAnnotation.java | 39 +++++++++
...icalLengthFacetOnPropertyFromProperties.java | 41 +++++++++
.../TypicalLengthOnPropertyFacetFactory.java | 76 +++++++++++++++++
.../dflt/ProgrammingModelFacetsJava5.java | 16 ++--
.../LayoutMetadataReaderFromJsonTest_read.java | 38 +++++++--
...ClassAnnotationOnMemberFacetFactoryTest.java | 2 +-
.../DescribedAsAnnotationFacetFactoryTest.java | 8 +-
.../MultiLineAnnotationFacetFactoryTest.java | 12 +--
...TypicalLengthAnnotationFacetFactoryTest.java | 10 +--
.../json/ExampleDomainObject.layout.json | 46 +++++++---
.../json/ExampleDomainObject.layout.properties | 18 +++-
.../dom/src/main/java/dom/todo/ToDoItem.java | 10 ---
.../src/main/java/dom/todo/ToDoItem.layout.json | 50 +++++++----
38 files changed, 880 insertions(+), 421 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/ActionRepr.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/ActionRepr.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/ActionRepr.java
index d4bb5fa..10adb26 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/ActionRepr.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/ActionRepr.java
@@ -16,6 +16,14 @@
*/
package org.apache.isis.core.metamodel.layoutmetadata;
+/**
+ * Representation of actions associated with members (properties or collections).
+ *
+ * <p>
+ * Free-standing (non-associated) actions are represented simly by {@link MemberRepr}.
+ */
public class ActionRepr {
public NamedFacetRepr named;
+ public DescribedAsFacetRepr describedAs;
+ public CssClassFacetRepr cssClass;
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/CssClassFacetRepr.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/CssClassFacetRepr.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/CssClassFacetRepr.java
new file mode 100644
index 0000000..b7871bb
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/CssClassFacetRepr.java
@@ -0,0 +1,22 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.isis.core.metamodel.layoutmetadata;
+
+
+public class CssClassFacetRepr {
+ public String value;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/DescribedAsFacetRepr.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/DescribedAsFacetRepr.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/DescribedAsFacetRepr.java
new file mode 100644
index 0000000..2a18657
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/DescribedAsFacetRepr.java
@@ -0,0 +1,22 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.isis.core.metamodel.layoutmetadata;
+
+
+public class DescribedAsFacetRepr {
+ public String value;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/MemberRepr.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/MemberRepr.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/MemberRepr.java
index 767a411..857d778 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/MemberRepr.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/MemberRepr.java
@@ -18,10 +18,20 @@ package org.apache.isis.core.metamodel.layoutmetadata;
import java.util.Map;
+/**
+ * Representation of properties, collections or free-standing actions.
+ *
+ * <p>
+ * Actions associated with members are represented by {@link ActionRepr}.
+ */
public class MemberRepr {
public Map<String,ActionRepr> actions;
public PagedFacetRepr paged;
public RenderFacetRepr render;
public NamedFacetRepr named;
+ public DescribedAsFacetRepr describedAs;
+ public CssClassFacetRepr cssClass;
+ public TypicalLengthFacetRepr typicalLength;
+ public MultiLineFacetRepr multiLine;
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/MultiLineFacetRepr.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/MultiLineFacetRepr.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/MultiLineFacetRepr.java
new file mode 100644
index 0000000..7db9c41
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/MultiLineFacetRepr.java
@@ -0,0 +1,22 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.isis.core.metamodel.layoutmetadata;
+
+
+public class MultiLineFacetRepr {
+ public int numberOfLines;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/TypicalLengthFacetRepr.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/TypicalLengthFacetRepr.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/TypicalLengthFacetRepr.java
new file mode 100644
index 0000000..a7d0fa0
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/TypicalLengthFacetRepr.java
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.isis.core.metamodel.layoutmetadata;
+
+import java.util.Map;
+
+public class TypicalLengthFacetRepr {
+ public int value;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java
index 870e84d..30bde7a 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJson.java
@@ -44,13 +44,17 @@ import org.apache.isis.core.metamodel.facets.object.membergroups.MemberGroupLayo
import org.apache.isis.core.metamodel.layout.memberorderfacet.MemberOrderFacetComparator;
import org.apache.isis.core.metamodel.layoutmetadata.ActionRepr;
import org.apache.isis.core.metamodel.layoutmetadata.ColumnRepr;
+import org.apache.isis.core.metamodel.layoutmetadata.CssClassFacetRepr;
+import org.apache.isis.core.metamodel.layoutmetadata.DescribedAsFacetRepr;
import org.apache.isis.core.metamodel.layoutmetadata.LayoutMetadata;
import org.apache.isis.core.metamodel.layoutmetadata.LayoutMetadataReader;
import org.apache.isis.core.metamodel.layoutmetadata.MemberGroupRepr;
import org.apache.isis.core.metamodel.layoutmetadata.MemberRepr;
+import org.apache.isis.core.metamodel.layoutmetadata.MultiLineFacetRepr;
import org.apache.isis.core.metamodel.layoutmetadata.NamedFacetRepr;
import org.apache.isis.core.metamodel.layoutmetadata.PagedFacetRepr;
import org.apache.isis.core.metamodel.layoutmetadata.RenderFacetRepr;
+import org.apache.isis.core.metamodel.layoutmetadata.TypicalLengthFacetRepr;
import org.apache.isis.core.metamodel.spec.ActionType;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.metamodel.spec.ObjectSpecifications;
@@ -145,12 +149,26 @@ public class LayoutMetadataReaderFromJson implements LayoutMetadataReader {
if(named != null) {
props.setProperty("member." + memberName + ".named.value", named.value);
}
-
+ final DescribedAsFacetRepr describedAs = memberRepr.describedAs;
+ if(describedAs!= null) {
+ props.setProperty("member." + memberName + ".describedAs.value", describedAs.value);
+ }
+ final CssClassFacetRepr cssClass = memberRepr.cssClass;
+ if(cssClass!= null) {
+ props.setProperty("member." + memberName + ".cssClass.value", cssClass.value);
+ }
+ final TypicalLengthFacetRepr typicalLength = memberRepr.typicalLength;
+ if(typicalLength!= null) {
+ props.setProperty("member." + memberName + ".typicalLength.value", ""+typicalLength.value);
+ }
+ final MultiLineFacetRepr multiLine = memberRepr.multiLine;
+ if(multiLine!= null) {
+ props.setProperty("member." + memberName + ".multiLine.numberOfLines", ""+multiLine.numberOfLines);
+ }
final PagedFacetRepr paged = memberRepr.paged;
if(paged != null) {
props.setProperty("member." + memberName + ".paged.value", ""+paged.value);
}
-
final RenderFacetRepr render = memberRepr.render;
if(render != null) {
// same default as in Render.Type.value()
@@ -183,13 +201,22 @@ public class LayoutMetadataReaderFromJson implements LayoutMetadataReader {
}
}
- private static void setRemainingActionProperties(Properties props, String prefix, final String actionName, final ActionRepr actionRepr, final int seq) {
+ private static void setRemainingActionProperties(Properties props, String prefix, final String actionNameOrig, final ActionRepr actionRepr, final int seq) {
+ final String actionName = actionNameOrig + ("action".equals(prefix)?"":"()");
props.setProperty(prefix + "." + actionName + ".memberOrder.sequence", ""+ seq);
final NamedFacetRepr actionNamed = actionRepr.named;
if(actionNamed != null) {
props.setProperty(prefix +"." + actionName + ".named.value", actionNamed.value);
}
+ final DescribedAsFacetRepr describedAs = actionRepr.describedAs;
+ if(describedAs!= null) {
+ props.setProperty(prefix +"." + actionName + ".describedAs.value", describedAs.value);
+ }
+ final CssClassFacetRepr cssClass = actionRepr.cssClass;
+ if(cssClass!= null) {
+ props.setProperty(prefix +"." + actionName + ".cssClass.value", cssClass.value);
+ }
}
public LayoutMetadata asLayoutMetadata(Class<?> domainClass) throws ReaderException {
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassAnnotationOnMemberFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassAnnotationOnMemberFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassAnnotationOnMemberFacetFactory.java
deleted file mode 100644
index 7e20e37..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassAnnotationOnMemberFacetFactory.java
+++ /dev/null
@@ -1,47 +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.progmodel.facets.members.cssclass;
-
-import org.apache.isis.applib.annotation.CssClass;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facetapi.FacetUtil;
-import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facets.Annotations;
-import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
-import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
-
-public class CssClassAnnotationOnMemberFacetFactory extends FacetFactoryAbstract {
-
- public CssClassAnnotationOnMemberFacetFactory() {
- super(FeatureType.MEMBERS);
- }
-
- @Override
- public void process(final ProcessMethodContext processMethodContext) {
- final CssClass annotation = Annotations.getAnnotation(processMethodContext.getMethod(), CssClass.class);
- FacetUtil.addFacet(create(annotation, processMethodContext.getFacetHolder()));
- }
-
- private CssClassFacet create(final CssClass annotation, final FacetHolder holder) {
- return annotation != null ? new CssClassFacetAnnotationOnMember(annotation.value(), holder) : null;
- }
-
-}
-
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassFacetAnnotationOnMember.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassFacetAnnotationOnMember.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassFacetAnnotationOnMember.java
deleted file mode 100644
index 26d0c29..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassFacetAnnotationOnMember.java
+++ /dev/null
@@ -1,30 +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.progmodel.facets.members.cssclass;
-
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacetAbstract;
-
-public class CssClassFacetAnnotationOnMember extends CssClassFacetAbstract {
-
- public CssClassFacetAnnotationOnMember(final String value, final FacetHolder holder) {
- super(value, holder);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassFacetOnMemberAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassFacetOnMemberAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassFacetOnMemberAnnotation.java
new file mode 100644
index 0000000..40d506c
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassFacetOnMemberAnnotation.java
@@ -0,0 +1,30 @@
+/*
+ * 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.progmodel.facets.members.cssclass;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacetAbstract;
+
+public class CssClassFacetOnMemberAnnotation extends CssClassFacetAbstract {
+
+ public CssClassFacetOnMemberAnnotation(final String value, final FacetHolder holder) {
+ super(value, holder);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassFacetOnMemberFromProperties.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassFacetOnMemberFromProperties.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassFacetOnMemberFromProperties.java
new file mode 100644
index 0000000..f491bf3
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassFacetOnMemberFromProperties.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets.members.cssclass;
+
+import java.util.Properties;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacetAbstract;
+
+public class CssClassFacetOnMemberFromProperties extends CssClassFacetAbstract {
+
+ public CssClassFacetOnMemberFromProperties(final Properties properties, final FacetHolder holder) {
+ super(valueFrom(properties), holder);
+ }
+
+ private static String valueFrom(Properties properties) {
+ return properties.getProperty("value");
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassOnMemberFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassOnMemberFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassOnMemberFacetFactory.java
new file mode 100644
index 0000000..ef292fb
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassOnMemberFacetFactory.java
@@ -0,0 +1,73 @@
+/*
+ * 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.progmodel.facets.members.cssclass;
+
+import java.util.Properties;
+
+import org.apache.isis.applib.annotation.CssClass;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.Annotations;
+import org.apache.isis.core.metamodel.facets.ContributeeMemberFacetFactory;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet;
+
+public class CssClassOnMemberFacetFactory extends FacetFactoryAbstract implements ContributeeMemberFacetFactory {
+
+ public CssClassOnMemberFacetFactory() {
+ super(FeatureType.MEMBERS);
+ }
+
+ @Override
+ public void process(final ProcessMethodContext processMethodContext) {
+ CssClassFacet cssClassFacet = createFromMetadataPropertiesIfPossible(processMethodContext);
+ if(cssClassFacet == null) {
+ cssClassFacet = createFromAnnotationIfPossible(processMethodContext);
+ }
+
+ // no-op if null
+ FacetUtil.addFacet(cssClassFacet);
+ }
+
+
+ @Override
+ public void process(ProcessContributeeMemberContext processMemberContext) {
+ CssClassFacet cssClassFacet = createFromMetadataPropertiesIfPossible(processMemberContext);
+ // no-op if null
+ FacetUtil.addFacet(cssClassFacet);
+ }
+
+ private static CssClassFacet createFromMetadataPropertiesIfPossible(
+ final ProcessContextWithMetadataProperties<? extends FacetHolder> pcwmp) {
+
+ final FacetHolder holder = pcwmp.getFacetHolder();
+
+ final Properties properties = pcwmp.metadataProperties("cssClass");
+ return properties != null ? new CssClassFacetOnMemberFromProperties(properties, holder) : null;
+ }
+
+ private CssClassFacet createFromAnnotationIfPossible(final ProcessMethodContext processMethodContext) {
+ final CssClass annotation = Annotations.getAnnotation(processMethodContext.getMethod(), CssClass.class);
+ return annotation != null ? new CssClassFacetOnMemberAnnotation(annotation.value(), processMethodContext.getFacetHolder()) : null;
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsAnnotationOnMemberFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsAnnotationOnMemberFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsAnnotationOnMemberFacetFactory.java
deleted file mode 100644
index 3c46bbf..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsAnnotationOnMemberFacetFactory.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.progmodel.facets.members.describedas.annotation;
-
-import org.apache.isis.applib.annotation.DescribedAs;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facetapi.FacetUtil;
-import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facets.Annotations;
-import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
-import org.apache.isis.core.metamodel.facets.describedas.DescribedAsFacet;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-
-public class DescribedAsAnnotationOnMemberFacetFactory extends FacetFactoryAbstract {
-
- public DescribedAsAnnotationOnMemberFacetFactory() {
- super(FeatureType.MEMBERS);
- }
-
- @Override
- public void process(final ProcessMethodContext processMethodContext) {
-
- // look for annotation on the property
- final DescribedAs annotation = Annotations.getAnnotation(processMethodContext.getMethod(), DescribedAs.class);
- DescribedAsFacet facet = create(annotation, processMethodContext.getFacetHolder());
- if (facet != null) {
- FacetUtil.addFacet(facet);
- return;
- }
-
- // otherwise, look for annotation on the type
- final Class<?> returnType = processMethodContext.getMethod().getReturnType();
- final DescribedAsFacet returnTypeDescribedAsFacet = getDescribedAsFacet(returnType);
- if (returnTypeDescribedAsFacet != null) {
- facet = new DescribedAsFacetForMemberDerivedFromType(returnTypeDescribedAsFacet, processMethodContext.getFacetHolder());
- FacetUtil.addFacet(facet);
- }
- }
-
- private DescribedAsFacet create(final DescribedAs annotation, final FacetHolder holder) {
- return annotation == null ? null : new DescribedAsFacetAnnotationOnMember(annotation.value(), holder);
- }
-
- private DescribedAsFacet getDescribedAsFacet(final Class<?> type) {
- final ObjectSpecification paramTypeSpec = getSpecificationLoader().loadSpecification(type);
- return paramTypeSpec.getFacet(DescribedAsFacet.class);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsFacetAnnotationOnMember.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsFacetAnnotationOnMember.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsFacetAnnotationOnMember.java
deleted file mode 100644
index 9b0ec77..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsFacetAnnotationOnMember.java
+++ /dev/null
@@ -1,31 +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.progmodel.facets.members.describedas.annotation;
-
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.describedas.DescribedAsFacetAbstract;
-
-public class DescribedAsFacetAnnotationOnMember extends DescribedAsFacetAbstract {
-
- public DescribedAsFacetAnnotationOnMember(final String value, final FacetHolder holder) {
- super(value, holder);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsFacetOnMemberAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsFacetOnMemberAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsFacetOnMemberAnnotation.java
new file mode 100644
index 0000000..0da41f6
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsFacetOnMemberAnnotation.java
@@ -0,0 +1,31 @@
+/*
+ * 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.progmodel.facets.members.describedas.annotation;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.describedas.DescribedAsFacetAbstract;
+
+public class DescribedAsFacetOnMemberAnnotation extends DescribedAsFacetAbstract {
+
+ public DescribedAsFacetOnMemberAnnotation(final String value, final FacetHolder holder) {
+ super(value, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsFacetOnMemberFromProperties.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsFacetOnMemberFromProperties.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsFacetOnMemberFromProperties.java
new file mode 100644
index 0000000..bb163b2
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsFacetOnMemberFromProperties.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets.members.describedas.annotation;
+
+import java.util.Properties;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.describedas.DescribedAsFacetAbstract;
+
+public class DescribedAsFacetOnMemberFromProperties extends DescribedAsFacetAbstract {
+
+ public DescribedAsFacetOnMemberFromProperties(final Properties properties, final FacetHolder holder) {
+ super(valueFrom(properties), holder);
+ }
+
+ private static String valueFrom(final Properties properties) {
+ return properties.getProperty("value");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsOnMemberFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsOnMemberFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsOnMemberFacetFactory.java
new file mode 100644
index 0000000..b4a6ff3
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/describedas/annotation/DescribedAsOnMemberFacetFactory.java
@@ -0,0 +1,88 @@
+/*
+ * 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.progmodel.facets.members.describedas.annotation;
+
+import java.util.Properties;
+
+import org.apache.isis.applib.annotation.DescribedAs;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.Annotations;
+import org.apache.isis.core.metamodel.facets.ContributeeMemberFacetFactory;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.describedas.DescribedAsFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+
+public class DescribedAsOnMemberFacetFactory extends FacetFactoryAbstract implements ContributeeMemberFacetFactory {
+
+ public DescribedAsOnMemberFacetFactory() {
+ super(FeatureType.MEMBERS);
+ }
+
+ @Override
+ public void process(final ProcessMethodContext processMethodContext) {
+
+ DescribedAsFacet facet = createFromMetadataPropertiesIfPossible(processMethodContext);
+
+ if(facet == null) {
+ facet = createFromAnnotationIfPossible(processMethodContext);
+ }
+ if (facet == null) {
+ facet = createFromAnnotationOnReturnTypeIfPossible(processMethodContext);
+ }
+
+ // no-op if null
+ FacetUtil.addFacet(facet);
+ }
+
+ @Override
+ public void process(ProcessContributeeMemberContext processMemberContext) {
+ DescribedAsFacet facet = createFromMetadataPropertiesIfPossible(processMemberContext);
+ // no-op if null
+ FacetUtil.addFacet(facet);
+ }
+
+ private static DescribedAsFacet createFromMetadataPropertiesIfPossible(
+ final ProcessContextWithMetadataProperties<? extends FacetHolder> pcwmp) {
+
+ final FacetHolder holder = pcwmp.getFacetHolder();
+
+ final Properties properties = pcwmp.metadataProperties("describedAs");
+ return properties != null ? new DescribedAsFacetOnMemberFromProperties(properties, holder) : null;
+ }
+
+ private static DescribedAsFacet createFromAnnotationIfPossible(final ProcessMethodContext processMethodContext) {
+ // look for annotation on the property
+ final DescribedAs annotation = Annotations.getAnnotation(processMethodContext.getMethod(), DescribedAs.class);
+ return annotation == null ? null : new DescribedAsFacetOnMemberAnnotation(annotation.value(), processMethodContext.getFacetHolder());
+ }
+
+ private DescribedAsFacet createFromAnnotationOnReturnTypeIfPossible(final ProcessMethodContext processMethodContext) {
+ final Class<?> returnType = processMethodContext.getMethod().getReturnType();
+ final DescribedAsFacet returnTypeDescribedAsFacet = getDescribedAsFacet(returnType);
+ return returnTypeDescribedAsFacet != null ? new DescribedAsFacetForMemberDerivedFromType(returnTypeDescribedAsFacet, processMethodContext.getFacetHolder()) : null;
+ }
+
+ private DescribedAsFacet getDescribedAsFacet(final Class<?> type) {
+ final ObjectSpecification paramTypeSpec = getSpecificationLoader().loadSpecification(type);
+ return paramTypeSpec.getFacet(DescribedAsFacet.class);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/named/annotation/NamedOnMemberFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/named/annotation/NamedOnMemberFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/named/annotation/NamedOnMemberFacetFactory.java
index 78dd13e..391156c 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/named/annotation/NamedOnMemberFacetFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/members/named/annotation/NamedOnMemberFacetFactory.java
@@ -52,11 +52,6 @@ public class NamedOnMemberFacetFactory extends FacetFactoryAbstract implements C
// no-op if null
FacetUtil.addFacet(namedFacet);
}
-
- private static NamedFacet createFromAnnotationIfPossible(final ProcessMethodContext processMethodContext) {
- final Named annotation = Annotations.getAnnotation(processMethodContext.getMethod(), Named.class);
- return annotation != null ? new NamedFacetOnMemberAnnotation(annotation.value(), processMethodContext.getFacetHolder()) : null;
- }
private static NamedFacet createFromMetadataPropertiesIfPossible(
final ProcessContextWithMetadataProperties<? extends FacetHolder> pcwmp) {
@@ -66,4 +61,9 @@ public class NamedOnMemberFacetFactory extends FacetFactoryAbstract implements C
final Properties properties = pcwmp.metadataProperties("named");
return properties != null ? new NamedFacetOnMemberFromProperties(properties, holder) : null;
}
+
+ private static NamedFacet createFromAnnotationIfPossible(final ProcessMethodContext processMethodContext) {
+ final Named annotation = Annotations.getAnnotation(processMethodContext.getMethod(), Named.class);
+ return annotation != null ? new NamedFacetOnMemberAnnotation(annotation.value(), processMethodContext.getFacetHolder()) : null;
+ }
}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineAnnotationOnPropertyFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineAnnotationOnPropertyFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineAnnotationOnPropertyFacetFactory.java
deleted file mode 100644
index a9ac8f0..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineAnnotationOnPropertyFacetFactory.java
+++ /dev/null
@@ -1,50 +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.progmodel.facets.properties.multiline.annotation;
-
-import org.apache.isis.applib.annotation.MultiLine;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facetapi.FacetUtil;
-import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facets.Annotations;
-import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
-import org.apache.isis.core.metamodel.facets.multiline.MultiLineFacet;
-
-public class MultiLineAnnotationOnPropertyFacetFactory extends FacetFactoryAbstract {
-
- public MultiLineAnnotationOnPropertyFacetFactory() {
- super(FeatureType.PROPERTIES_ONLY);
- }
-
- @Override
- public void process(final ProcessMethodContext processMethodContext) {
- final Class<?> returnType = processMethodContext.getMethod().getReturnType();
- if (!Annotations.isString(returnType)) {
- return;
- }
- final MultiLine annotation = Annotations.getAnnotation(processMethodContext.getMethod(), MultiLine.class);
- FacetUtil.addFacet(create(annotation, processMethodContext.getFacetHolder()));
- }
-
- private MultiLineFacet create(final MultiLine annotation, final FacetHolder holder) {
- return (annotation != null) ? new MultiLineFacetAnnotationOnProperty(annotation.numberOfLines(), annotation.preventWrapping(), holder) : null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineFacetAnnotationOnProperty.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineFacetAnnotationOnProperty.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineFacetAnnotationOnProperty.java
deleted file mode 100644
index 712a35f..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineFacetAnnotationOnProperty.java
+++ /dev/null
@@ -1,31 +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.progmodel.facets.properties.multiline.annotation;
-
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.multiline.MultiLineFacetAbstract;
-
-public class MultiLineFacetAnnotationOnProperty extends MultiLineFacetAbstract {
-
- public MultiLineFacetAnnotationOnProperty(final int numberOfLines, final boolean preventWrapping, final FacetHolder holder) {
- super(numberOfLines, preventWrapping, holder);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineFacetOnPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineFacetOnPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineFacetOnPropertyAnnotation.java
new file mode 100644
index 0000000..bc39f2f
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineFacetOnPropertyAnnotation.java
@@ -0,0 +1,31 @@
+/*
+ * 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.progmodel.facets.properties.multiline.annotation;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.multiline.MultiLineFacetAbstract;
+
+public class MultiLineFacetOnPropertyAnnotation extends MultiLineFacetAbstract {
+
+ public MultiLineFacetOnPropertyAnnotation(final int numberOfLines, final boolean preventWrapping, final FacetHolder holder) {
+ super(numberOfLines, preventWrapping, holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineFacetOnPropertyFromProperties.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineFacetOnPropertyFromProperties.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineFacetOnPropertyFromProperties.java
new file mode 100644
index 0000000..5d757e3
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineFacetOnPropertyFromProperties.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.progmodel.facets.properties.multiline.annotation;
+
+import java.util.Properties;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.multiline.MultiLineFacetAbstract;
+
+public class MultiLineFacetOnPropertyFromProperties extends MultiLineFacetAbstract {
+
+ public MultiLineFacetOnPropertyFromProperties(Properties properties, FacetHolder holder) {
+ super(numberOfLinesFrom(properties), preventWrappingFrom(properties), holder);
+ }
+
+ private static int numberOfLinesFrom(Properties properties) {
+ return Integer.parseInt(properties.getProperty("numberOfLines"));
+ }
+
+ private static boolean preventWrappingFrom(Properties properties) {
+ final String property = properties.getProperty("preventWrapping");
+ // same defaults as @MultiLine annotation
+ return property == null || Boolean.parseBoolean(property);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineOnPropertyFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineOnPropertyFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineOnPropertyFacetFactory.java
new file mode 100644
index 0000000..db1459e
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/multiline/annotation/MultiLineOnPropertyFacetFactory.java
@@ -0,0 +1,74 @@
+/*
+ * 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.progmodel.facets.properties.multiline.annotation;
+
+import java.util.Properties;
+
+import org.apache.isis.applib.annotation.MultiLine;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.Annotations;
+import org.apache.isis.core.metamodel.facets.ContributeeMemberFacetFactory;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.multiline.MultiLineFacet;
+
+public class MultiLineOnPropertyFacetFactory extends FacetFactoryAbstract implements ContributeeMemberFacetFactory {
+
+ public MultiLineOnPropertyFacetFactory() {
+ super(FeatureType.PROPERTIES_ONLY);
+ }
+
+ @Override
+ public void process(final ProcessMethodContext processMethodContext) {
+ MultiLineFacet facet = createFromMetadataPropertiesIfPossible(processMethodContext);
+ if(facet == null) {
+ facet = createFromAnnotationIfPossible(processMethodContext);
+ }
+
+ // no-op if null
+ FacetUtil.addFacet(facet);
+ }
+
+ @Override
+ public void process(ProcessContributeeMemberContext processMemberContext) {
+
+ }
+
+ private static MultiLineFacet createFromMetadataPropertiesIfPossible(
+ final ProcessContextWithMetadataProperties<? extends FacetHolder> pcwmp) {
+
+ final FacetHolder holder = pcwmp.getFacetHolder();
+
+ final Properties properties = pcwmp.metadataProperties("multiLine");
+ return properties != null ? new MultiLineFacetOnPropertyFromProperties(properties, holder) : null;
+ }
+
+ private static MultiLineFacetOnPropertyAnnotation createFromAnnotationIfPossible(final ProcessMethodContext processMethodContext) {
+ final Class<?> returnType = processMethodContext.getMethod().getReturnType();
+ if (!Annotations.isString(returnType)) {
+ return null;
+ }
+ final MultiLine annotation = Annotations.getAnnotation(processMethodContext.getMethod(), MultiLine.class);
+ return (annotation != null) ? new MultiLineFacetOnPropertyAnnotation(annotation.numberOfLines(), annotation.preventWrapping(), processMethodContext.getFacetHolder()) : null;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthAnnotationOnPropertyFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthAnnotationOnPropertyFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthAnnotationOnPropertyFacetFactory.java
deleted file mode 100644
index 0b19793..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthAnnotationOnPropertyFacetFactory.java
+++ /dev/null
@@ -1,48 +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.progmodel.facets.properties.typicallen.annotation;
-
-import org.apache.isis.applib.annotation.TypicalLength;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facetapi.FacetUtil;
-import org.apache.isis.core.metamodel.facetapi.FeatureType;
-import org.apache.isis.core.metamodel.facets.Annotations;
-import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
-import org.apache.isis.core.metamodel.facets.typicallen.TypicalLengthFacet;
-
-public class TypicalLengthAnnotationOnPropertyFacetFactory extends FacetFactoryAbstract {
-
- public TypicalLengthAnnotationOnPropertyFacetFactory() {
- super(FeatureType.PROPERTIES_ONLY);
- }
-
- @Override
- public void process(final ProcessMethodContext processMethodContext) {
- final TypicalLength annotation = Annotations.getAnnotation(processMethodContext.getMethod(), TypicalLength.class);
- final TypicalLengthFacet facet = create(annotation, processMethodContext.getFacetHolder());
-
- FacetUtil.addFacet(facet);
- }
-
- private TypicalLengthFacet create(final TypicalLength annotation, final FacetHolder holder) {
- return annotation != null ? new TypicalLengthFacetAnnotationOnProperty(annotation.value(), holder) : null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthFacetAnnotationOnProperty.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthFacetAnnotationOnProperty.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthFacetAnnotationOnProperty.java
deleted file mode 100644
index 8b6930e..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthFacetAnnotationOnProperty.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.progmodel.facets.properties.typicallen.annotation;
-
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.typicallen.TypicalLengthFacetAbstract;
-
-public class TypicalLengthFacetAnnotationOnProperty extends TypicalLengthFacetAbstract {
-
- private final int value;
-
- public TypicalLengthFacetAnnotationOnProperty(final int value, final FacetHolder holder) {
- super(holder, false);
- this.value = value;
- }
-
- @Override
- public int value() {
- return value;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthFacetOnPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthFacetOnPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthFacetOnPropertyAnnotation.java
new file mode 100644
index 0000000..8f1f4d1
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthFacetOnPropertyAnnotation.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets.properties.typicallen.annotation;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.typicallen.TypicalLengthFacetAbstract;
+
+public class TypicalLengthFacetOnPropertyAnnotation extends TypicalLengthFacetAbstract {
+
+ private final int value;
+
+ public TypicalLengthFacetOnPropertyAnnotation(final int value, final FacetHolder holder) {
+ super(holder, false);
+ this.value = value;
+ }
+
+ @Override
+ public int value() {
+ return value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthFacetOnPropertyFromProperties.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthFacetOnPropertyFromProperties.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthFacetOnPropertyFromProperties.java
new file mode 100644
index 0000000..dc361dc
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthFacetOnPropertyFromProperties.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.progmodel.facets.properties.typicallen.annotation;
+
+import java.util.Properties;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.typicallen.TypicalLengthFacetAbstract;
+
+public class TypicalLengthFacetOnPropertyFromProperties extends TypicalLengthFacetAbstract {
+
+ private final int value;
+
+ public TypicalLengthFacetOnPropertyFromProperties(final Properties properties, final FacetHolder holder) {
+ super(holder, false);
+ this.value = Integer.parseInt(properties.getProperty("value"));
+ }
+
+ @Override
+ public int value() {
+ return value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthOnPropertyFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthOnPropertyFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthOnPropertyFacetFactory.java
new file mode 100644
index 0000000..7d52f56
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/properties/typicallen/annotation/TypicalLengthOnPropertyFacetFactory.java
@@ -0,0 +1,76 @@
+/*
+ * 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.progmodel.facets.properties.typicallen.annotation;
+
+import java.util.Properties;
+
+import org.apache.isis.applib.annotation.TypicalLength;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.Annotations;
+import org.apache.isis.core.metamodel.facets.ContributeeMemberFacetFactory;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.typicallen.TypicalLengthFacet;
+
+public class TypicalLengthOnPropertyFacetFactory extends FacetFactoryAbstract implements ContributeeMemberFacetFactory {
+
+ public TypicalLengthOnPropertyFacetFactory() {
+ super(FeatureType.PROPERTIES_ONLY);
+ }
+
+ @Override
+ public void process(final ProcessMethodContext processMethodContext) {
+ TypicalLengthFacet facet = createFromMetadataPropertiesIfPossible(processMethodContext);
+ if(facet == null) {
+ facet = createFromAnnotationIfPossible(processMethodContext);
+ }
+
+ // no-op if null
+ FacetUtil.addFacet(facet);
+ }
+
+ @Override
+ public void process(ProcessContributeeMemberContext processMemberContext) {
+ TypicalLengthFacet facet = createFromMetadataPropertiesIfPossible(processMemberContext);
+
+ // no-op if null
+ FacetUtil.addFacet(facet);
+ }
+
+ private static TypicalLengthFacet createFromMetadataPropertiesIfPossible(
+ final ProcessContextWithMetadataProperties<? extends FacetHolder> pcwmp) {
+
+ final FacetHolder holder = pcwmp.getFacetHolder();
+
+ final Properties properties = pcwmp.metadataProperties("typicalLength");
+ return properties != null ? new TypicalLengthFacetOnPropertyFromProperties(properties, holder) : null;
+ }
+
+ private static TypicalLengthFacet createFromAnnotationIfPossible(final ProcessMethodContext processMethodContext) {
+ final TypicalLength annotation =
+ Annotations.getAnnotation(processMethodContext.getMethod(), TypicalLength.class);
+ return annotation != null
+ ? new TypicalLengthFacetOnPropertyAnnotation(annotation.value(), processMethodContext.getFacetHolder())
+ : null;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java b/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
index c51834f..b830aca 100644
--- a/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
+++ b/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
@@ -49,8 +49,8 @@ import org.apache.isis.core.progmodel.facets.collections.notpersisted.annotation
import org.apache.isis.core.progmodel.facets.collections.sortedby.SortedByAnnotationFacetFactory;
import org.apache.isis.core.progmodel.facets.collections.typeof.TypeOfAnnotationForCollectionsFacetFactory;
import org.apache.isis.core.progmodel.facets.fallback.FallbackFacetFactory;
-import org.apache.isis.core.progmodel.facets.members.cssclass.CssClassAnnotationOnMemberFacetFactory;
-import org.apache.isis.core.progmodel.facets.members.describedas.annotation.DescribedAsAnnotationOnMemberFacetFactory;
+import org.apache.isis.core.progmodel.facets.members.cssclass.CssClassOnMemberFacetFactory;
+import org.apache.isis.core.progmodel.facets.members.describedas.annotation.DescribedAsOnMemberFacetFactory;
import org.apache.isis.core.progmodel.facets.members.describedas.staticmethod.DescribedAsFacetViaDescriptionMethodFacetFactory;
import org.apache.isis.core.progmodel.facets.members.disabled.annotation.DisabledAnnotationFacetFactory;
import org.apache.isis.core.progmodel.facets.members.disabled.forsession.DisabledFacetViaDisableForSessionMethodFacetFactory;
@@ -160,10 +160,10 @@ import org.apache.isis.core.progmodel.facets.properties.mandatory.dflt.Mandatory
import org.apache.isis.core.progmodel.facets.properties.mandatory.staticmethod.PropertyOptionalFacetFactory;
import org.apache.isis.core.progmodel.facets.properties.modify.PropertyModifyFacetFactory;
import org.apache.isis.core.progmodel.facets.properties.modify.PropertySetAndClearFacetFactory;
-import org.apache.isis.core.progmodel.facets.properties.multiline.annotation.MultiLineAnnotationOnPropertyFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.multiline.annotation.MultiLineOnPropertyFacetFactory;
import org.apache.isis.core.progmodel.facets.properties.notpersisted.annotation.NotPersistedAnnotationForPropertyFacetFactory;
import org.apache.isis.core.progmodel.facets.properties.renderedasdaybefore.annotation.RenderedAsDayBeforeAnnotationOnPropertyFacetFactory;
-import org.apache.isis.core.progmodel.facets.properties.typicallen.annotation.TypicalLengthAnnotationOnPropertyFacetFactory;
+import org.apache.isis.core.progmodel.facets.properties.typicallen.annotation.TypicalLengthOnPropertyFacetFactory;
import org.apache.isis.core.progmodel.facets.properties.typicallen.fromtype.TypicalLengthFacetForPropertyDerivedFromTypeFacetFactory;
import org.apache.isis.core.progmodel.facets.properties.validate.PropertyValidateDefaultFacetFactory;
import org.apache.isis.core.progmodel.facets.properties.validate.PropertyValidateFacetFactory;
@@ -327,7 +327,7 @@ public final class ProgrammingModelFacetsJava5 extends ProgrammingModelAbstract
addFactory(ParameterDefaultDerivedFromTypeFacetFactory.class);
addFactory(DescribedAsAnnotationOnTypeFacetFactory.class);
- addFactory(DescribedAsAnnotationOnMemberFacetFactory.class);
+ addFactory(DescribedAsOnMemberFacetFactory.class);
addFactory(DescribedAsAnnotationOnParameterFacetFactory.class);
addFactory(DisabledAnnotationFacetFactory.class);
@@ -343,7 +343,7 @@ public final class ProgrammingModelFacetsJava5 extends ProgrammingModelAbstract
// must come after the TitleAnnotationFacetFactory, because can act as an override
addFactory(HiddenAnnotationForMemberFacetFactory.class);
addFactory(CssClassAnnotationForTypeFacetFactory.class);
- addFactory(CssClassAnnotationOnMemberFacetFactory.class);
+ addFactory(CssClassOnMemberFacetFactory.class);
addFactory(HiddenObjectViaHiddenMethodFacetFactory.class);
addFactory(DisabledObjectViaDisabledMethodFacetFactory.class);
@@ -367,7 +367,7 @@ public final class ProgrammingModelFacetsJava5 extends ProgrammingModelAbstract
addFactory(MustSatisfySpecificationOnParameterFacetFactory.class);
addFactory(MultiLineAnnotationOnTypeFacetFactory.class);
- addFactory(MultiLineAnnotationOnPropertyFacetFactory.class);
+ addFactory(MultiLineOnPropertyFacetFactory.class);
addFactory(MultiLineAnnotationOnParameterFacetFactory.class);
addFactory(NamedAnnotationOnTypeFacetFactory.class);
@@ -409,7 +409,7 @@ public final class ProgrammingModelFacetsJava5 extends ProgrammingModelAbstract
addFactory(TypicalLengthFacetForParameterDerivedFromTypeFacetFactory.class);
addFactory(TypicalLengthAnnotationOnTypeFacetFactory.class);
- addFactory(TypicalLengthAnnotationOnPropertyFacetFactory.class);
+ addFactory(TypicalLengthOnPropertyFacetFactory.class);
addFactory(TypicalLengthAnnotationOnParameterFacetFactory.class);
addFactory(RenderedAsDayBeforeAnnotationOnPropertyFacetFactory.class);
addFactory(RenderedAsDayBeforeAnnotationOnParameterFacetFactory.class);
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJsonTest_read.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJsonTest_read.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJsonTest_read.java
index c37cb65..a84bc6f 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJsonTest_read.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layoutmetadata/json/LayoutMetadataReaderFromJsonTest_read.java
@@ -16,13 +16,17 @@
*/
package org.apache.isis.core.metamodel.layoutmetadata.json;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertThat;
import java.util.Properties;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import com.google.common.base.Objects;
+
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -43,14 +47,34 @@ public class LayoutMetadataReaderFromJsonTest_read {
assertThat(properties, is(not(nullValue())));
final Properties expectedProperties = ClassExtensions.resourceProperties(ExampleDomainObject.class, ".layout.properties");
- for (Object expectedKey : expectedProperties.keySet()) {
- final String key = (String) expectedKey;
+
+ final Set<Object> expectedSet = expectedProperties.keySet();
+ final Set<Object> actualSet = properties.keySet();
+ final SortedSet<Object> keys = new TreeSet<Object>();
+ keys.addAll(expectedSet);
+ keys.addAll(actualSet);
+
+ final StringBuilder buf = new StringBuilder("\n");
+ boolean fail = false;
+ for (Object keyObj : keys) {
+ final String key = (String) keyObj;
final String expectedValue = expectedProperties.getProperty(key);
-
final String actualValue = properties.getProperty(key);
- assertThat(key, actualValue, is(expectedValue.trim()));
+ final boolean expectedKey = expectedSet.contains(keyObj);
+ final boolean matches = Objects.equal(trimmed(expectedValue), trimmed(actualValue)) || !expectedKey;
+ final String result = matches? (expectedKey?"OK":"N/A"):"FAIL";
+ if(!result.equals("OK")) {
+ buf.append(String.format("%1$-40s %2$-5s %3$-40s %4$-40s\n", key, result, expectedValue, actualValue));
+ }
+ fail = fail || !matches;
+ }
+ if(fail) {
+ Assert.fail(buf.toString());
}
}
+ private String trimmed(String expectedValue) {
+ return expectedValue != null? expectedValue.trim(): expectedValue;
+ }
}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassAnnotationOnMemberFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassAnnotationOnMemberFacetFactoryTest.java b/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassAnnotationOnMemberFacetFactoryTest.java
index 8bc74f2..b921d3c 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassAnnotationOnMemberFacetFactoryTest.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/members/cssclass/CssClassAnnotationOnMemberFacetFactoryTest.java
@@ -39,7 +39,7 @@ public class CssClassAnnotationOnMemberFacetFactoryTest extends AbstractFacetFac
@Test
public void testCssClassAnnotationPickedUpOnClass() {
- final CssClassAnnotationOnMemberFacetFactory facetFactory = new CssClassAnnotationOnMemberFacetFactory();
+ final CssClassOnMemberFacetFactory facetFactory = new CssClassOnMemberFacetFactory();
facetFactory.setSpecificationLookup(mockSpecificationLoaderSpi);
class Customer {
http://git-wip-us.apache.org/repos/asf/isis/blob/4a6938fd/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsAnnotationFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsAnnotationFacetFactoryTest.java b/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsAnnotationFacetFactoryTest.java
index 427425b..cea37f8 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsAnnotationFacetFactoryTest.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/naming/describedas/DescribedAsAnnotationFacetFactoryTest.java
@@ -30,7 +30,7 @@ import org.apache.isis.core.metamodel.facets.FacetFactory.ProcessParameterContex
import org.apache.isis.core.metamodel.facets.describedas.DescribedAsFacet;
import org.apache.isis.core.metamodel.facets.describedas.DescribedAsFacetAbstract;
import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
-import org.apache.isis.core.progmodel.facets.members.describedas.annotation.DescribedAsAnnotationOnMemberFacetFactory;
+import org.apache.isis.core.progmodel.facets.members.describedas.annotation.DescribedAsOnMemberFacetFactory;
import org.apache.isis.core.progmodel.facets.object.describedas.annotation.DescribedAsAnnotationOnTypeFacetFactory;
import org.apache.isis.core.progmodel.facets.param.describedas.annotation.DescribedAsAnnotationOnParameterFacetFactory;
@@ -55,7 +55,7 @@ public class DescribedAsAnnotationFacetFactoryTest extends AbstractFacetFactoryT
}
public void testDescribedAsAnnotationPickedUpOnProperty() {
- final DescribedAsAnnotationOnMemberFacetFactory facetFactory = new DescribedAsAnnotationOnMemberFacetFactory();
+ final DescribedAsOnMemberFacetFactory facetFactory = new DescribedAsOnMemberFacetFactory();
class Customer {
@SuppressWarnings("unused")
@@ -78,7 +78,7 @@ public class DescribedAsAnnotationFacetFactoryTest extends AbstractFacetFactoryT
}
public void testDescribedAsAnnotationPickedUpOnCollection() {
- final DescribedAsAnnotationOnMemberFacetFactory facetFactory = new DescribedAsAnnotationOnMemberFacetFactory();
+ final DescribedAsOnMemberFacetFactory facetFactory = new DescribedAsOnMemberFacetFactory();
class Customer {
@SuppressWarnings("unused")
@@ -101,7 +101,7 @@ public class DescribedAsAnnotationFacetFactoryTest extends AbstractFacetFactoryT
}
public void testDescribedAsAnnotationPickedUpOnAction() {
- final DescribedAsAnnotationOnMemberFacetFactory facetFactory = new DescribedAsAnnotationOnMemberFacetFactory();
+ final DescribedAsOnMemberFacetFactory facetFactory = new DescribedAsOnMemberFacetFactory();
class Customer {
@SuppressWarnings("unused")