http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DescribedAsFacetForCollectionLayoutXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DescribedAsFacetForCollectionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DescribedAsFacetForCollectionLayoutXml.java deleted file mode 100644 index 10241a1..0000000 --- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DescribedAsFacetForCollectionLayoutXml.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.core.metamodel.facets.collections.layout; - -import com.google.common.base.Strings; - -import org.apache.isis.applib.layout.v1_0.CollectionLayout; -import org.apache.isis.core.metamodel.facetapi.FacetHolder; -import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet; -import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacetAbstract; - -public class DescribedAsFacetForCollectionLayoutXml extends DescribedAsFacetAbstract { - - public static DescribedAsFacet create(CollectionLayout collectionLayout, FacetHolder holder) { - if(collectionLayout == null) { - return null; - } - final String describedAs = Strings.emptyToNull(collectionLayout.getDescribedAs()); - return describedAs != null ? new DescribedAsFacetForCollectionLayoutXml(describedAs, holder) : null; - } - - private DescribedAsFacetForCollectionLayoutXml(String value, FacetHolder holder) { - super(value, holder); - } - -}
http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DescribedAsFacetForCollectionXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DescribedAsFacetForCollectionXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DescribedAsFacetForCollectionXml.java new file mode 100644 index 0000000..a159fc2 --- /dev/null +++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/DescribedAsFacetForCollectionXml.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.isis.core.metamodel.facets.collections.layout; + +import com.google.common.base.Strings; + +import org.apache.isis.applib.layout.v1_0.Collection; +import org.apache.isis.core.metamodel.facetapi.FacetHolder; +import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet; +import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacetAbstract; + +public class DescribedAsFacetForCollectionXml extends DescribedAsFacetAbstract { + + public static DescribedAsFacet create(Collection collectionLayout, FacetHolder holder) { + if(collectionLayout == null) { + return null; + } + final String describedAs = Strings.emptyToNull(collectionLayout.getDescribedAs()); + return describedAs != null ? new DescribedAsFacetForCollectionXml(describedAs, holder) : null; + } + + private DescribedAsFacetForCollectionXml(String value, FacetHolder holder) { + super(value, holder); + } + +} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/HiddenFacetForCollectionLayoutXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/HiddenFacetForCollectionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/HiddenFacetForCollectionLayoutXml.java deleted file mode 100644 index f362634..0000000 --- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/HiddenFacetForCollectionLayoutXml.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.core.metamodel.facets.collections.layout; - -import org.apache.isis.applib.annotation.When; -import org.apache.isis.applib.annotation.Where; -import org.apache.isis.applib.layout.v1_0.CollectionLayout; -import org.apache.isis.core.metamodel.adapter.ObjectAdapter; -import org.apache.isis.core.metamodel.facetapi.FacetHolder; -import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet; -import org.apache.isis.core.metamodel.facets.members.hidden.HiddenFacetAbstract; - -public class HiddenFacetForCollectionLayoutXml extends HiddenFacetAbstract { - - public static HiddenFacet create(final CollectionLayout collectionLayout, final FacetHolder holder) { - if (collectionLayout == null) { - return null; - } - final Where where = collectionLayout.getHidden(); - return where != null && where != Where.NOT_SPECIFIED ? new HiddenFacetForCollectionLayoutXml(where, holder) : null; - } - - private HiddenFacetForCollectionLayoutXml(final Where where, final FacetHolder holder) { - super(When.ALWAYS, where, holder); - } - - @Override - public String hiddenReason(final ObjectAdapter targetAdapter, final Where whereContext) { - if(!where().includes(whereContext)) { - return null; - } - return "Hidden on " + where().getFriendlyName(); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/HiddenFacetForCollectionXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/HiddenFacetForCollectionXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/HiddenFacetForCollectionXml.java new file mode 100644 index 0000000..8a52c8e --- /dev/null +++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/HiddenFacetForCollectionXml.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.isis.core.metamodel.facets.collections.layout; + +import org.apache.isis.applib.annotation.When; +import org.apache.isis.applib.annotation.Where; +import org.apache.isis.applib.layout.v1_0.Collection; +import org.apache.isis.core.metamodel.adapter.ObjectAdapter; +import org.apache.isis.core.metamodel.facetapi.FacetHolder; +import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet; +import org.apache.isis.core.metamodel.facets.members.hidden.HiddenFacetAbstract; + +public class HiddenFacetForCollectionXml extends HiddenFacetAbstract { + + public static HiddenFacet create(final Collection collectionLayout, final FacetHolder holder) { + if (collectionLayout == null) { + return null; + } + final Where where = collectionLayout.getHidden(); + return where != null && where != Where.NOT_SPECIFIED ? new HiddenFacetForCollectionXml(where, holder) : null; + } + + private HiddenFacetForCollectionXml(final Where where, final FacetHolder holder) { + super(When.ALWAYS, where, holder); + } + + @Override + public String hiddenReason(final ObjectAdapter targetAdapter, final Where whereContext) { + if(!where().includes(whereContext)) { + return null; + } + return "Hidden on " + where().getFriendlyName(); + } + +} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/NamedFacetForCollectionLayoutXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/NamedFacetForCollectionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/NamedFacetForCollectionLayoutXml.java deleted file mode 100644 index e9828d7..0000000 --- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/NamedFacetForCollectionLayoutXml.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.metamodel.facets.collections.layout; - -import com.google.common.base.Strings; - -import org.apache.isis.applib.layout.v1_0.CollectionLayout; -import org.apache.isis.core.metamodel.facetapi.FacetHolder; -import org.apache.isis.core.metamodel.facets.all.named.NamedFacet; -import org.apache.isis.core.metamodel.facets.all.named.NamedFacetAbstract; - -public class NamedFacetForCollectionLayoutXml extends NamedFacetAbstract { - - public static NamedFacet create(CollectionLayout collectionLayout, FacetHolder holder) { - if(collectionLayout == null) { - return null; - } - final String named = Strings.emptyToNull(collectionLayout.getNamed()); - final Boolean escaped = collectionLayout.getNamedEscaped(); - return named != null ? new NamedFacetForCollectionLayoutXml(named, escaped == null || escaped, holder) : null; - } - - private NamedFacetForCollectionLayoutXml( - final String value, - final boolean escaped, - final FacetHolder holder) { - - super(value, escaped, holder); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/NamedFacetForCollectionXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/NamedFacetForCollectionXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/NamedFacetForCollectionXml.java new file mode 100644 index 0000000..295cbc9 --- /dev/null +++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/NamedFacetForCollectionXml.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.isis.core.metamodel.facets.collections.layout; + +import com.google.common.base.Strings; + +import org.apache.isis.applib.layout.v1_0.Collection; +import org.apache.isis.core.metamodel.facetapi.FacetHolder; +import org.apache.isis.core.metamodel.facets.all.named.NamedFacet; +import org.apache.isis.core.metamodel.facets.all.named.NamedFacetAbstract; + +public class NamedFacetForCollectionXml extends NamedFacetAbstract { + + public static NamedFacet create(Collection collectionLayout, FacetHolder holder) { + if(collectionLayout == null) { + return null; + } + final String named = Strings.emptyToNull(collectionLayout.getNamed()); + final Boolean escaped = collectionLayout.getNamedEscaped(); + return named != null ? new NamedFacetForCollectionXml(named, escaped == null || escaped, holder) : null; + } + + private NamedFacetForCollectionXml( + final String value, + final boolean escaped, + final FacetHolder holder) { + + super(value, escaped, holder); + } + +} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/PagedFacetForCollectionLayoutXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/PagedFacetForCollectionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/PagedFacetForCollectionLayoutXml.java deleted file mode 100644 index f14abb1..0000000 --- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/PagedFacetForCollectionLayoutXml.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.core.metamodel.facets.collections.layout; - -import org.apache.isis.applib.layout.v1_0.CollectionLayout; -import org.apache.isis.core.metamodel.facetapi.FacetHolder; -import org.apache.isis.core.metamodel.facets.object.paged.PagedFacet; -import org.apache.isis.core.metamodel.facets.object.paged.PagedFacetAbstract; - -public class PagedFacetForCollectionLayoutXml extends PagedFacetAbstract { - - public static PagedFacet create(CollectionLayout collectionLayout, FacetHolder holder) { - if(collectionLayout == null) { - return null; - } - final Integer paged = collectionLayout.getPaged(); - return paged != null && paged != -1 ? new PagedFacetForCollectionLayoutXml(paged, holder) : null; - } - - private PagedFacetForCollectionLayoutXml(int paged, FacetHolder holder) { - super(paged, holder); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/PagedFacetForCollectionXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/PagedFacetForCollectionXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/PagedFacetForCollectionXml.java new file mode 100644 index 0000000..eee8838 --- /dev/null +++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/PagedFacetForCollectionXml.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.isis.core.metamodel.facets.collections.layout; + +import org.apache.isis.applib.layout.v1_0.Collection; +import org.apache.isis.core.metamodel.facetapi.FacetHolder; +import org.apache.isis.core.metamodel.facets.object.paged.PagedFacet; +import org.apache.isis.core.metamodel.facets.object.paged.PagedFacetAbstract; + +public class PagedFacetForCollectionXml extends PagedFacetAbstract { + + public static PagedFacet create(Collection collectionLayout, FacetHolder holder) { + if(collectionLayout == null) { + return null; + } + final Integer paged = collectionLayout.getPaged(); + return paged != null && paged != -1 ? new PagedFacetForCollectionXml(paged, holder) : null; + } + + private PagedFacetForCollectionXml(int paged, FacetHolder holder) { + super(paged, holder); + } + +} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/SortedByFacetForCollectionLayoutXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/SortedByFacetForCollectionLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/SortedByFacetForCollectionLayoutXml.java deleted file mode 100644 index 2030e45..0000000 --- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/SortedByFacetForCollectionLayoutXml.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.core.metamodel.facets.collections.layout; - -import java.util.Comparator; - -import org.apache.isis.applib.layout.v1_0.CollectionLayout; -import org.apache.isis.core.commons.lang.ClassUtil; -import org.apache.isis.core.metamodel.facetapi.FacetHolder; -import org.apache.isis.core.metamodel.facets.collections.sortedby.SortedByFacet; -import org.apache.isis.core.metamodel.facets.collections.sortedby.SortedByFacetAbstract; - -public class SortedByFacetForCollectionLayoutXml extends SortedByFacetAbstract { - - public static SortedByFacet create(CollectionLayout collectionLayout, FacetHolder holder) { - if(collectionLayout == null) { - return null; - } - final String sortedBy = collectionLayout.getSortedBy(); - if (sortedBy == null) { - return null; - } - final Class sortedByClass = ClassUtil.forName(sortedBy); - if(sortedByClass == Comparator.class) { - return null; - } - - return sortedByClass != null ? new SortedByFacetForCollectionLayoutXml(sortedByClass, holder) : null; - } - - private SortedByFacetForCollectionLayoutXml(Class<? extends Comparator<?>> sortedBy, FacetHolder holder) { - super(sortedBy, holder); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/SortedByFacetForCollectionXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/SortedByFacetForCollectionXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/SortedByFacetForCollectionXml.java new file mode 100644 index 0000000..dbba9dd --- /dev/null +++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/layout/SortedByFacetForCollectionXml.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.isis.core.metamodel.facets.collections.layout; + +import java.util.Comparator; + +import org.apache.isis.applib.layout.v1_0.Collection; +import org.apache.isis.core.commons.lang.ClassUtil; +import org.apache.isis.core.metamodel.facetapi.FacetHolder; +import org.apache.isis.core.metamodel.facets.collections.sortedby.SortedByFacet; +import org.apache.isis.core.metamodel.facets.collections.sortedby.SortedByFacetAbstract; + +public class SortedByFacetForCollectionXml extends SortedByFacetAbstract { + + public static SortedByFacet create(Collection collectionLayout, FacetHolder holder) { + if(collectionLayout == null) { + return null; + } + final String sortedBy = collectionLayout.getSortedBy(); + if (sortedBy == null) { + return null; + } + final Class sortedByClass = ClassUtil.forName(sortedBy); + if(sortedByClass == Comparator.class) { + return null; + } + + return sortedByClass != null ? new SortedByFacetForCollectionXml(sortedByClass, holder) : null; + } + + private SortedByFacetForCollectionXml(Class<? extends Comparator<?>> sortedBy, FacetHolder holder) { + super(sortedBy, holder); + } + +} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutxml/LayoutXmlFacetDefault.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutxml/LayoutXmlFacetDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutxml/LayoutXmlFacetDefault.java index ad617e8..ca42fa6 100644 --- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutxml/LayoutXmlFacetDefault.java +++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/layoutxml/LayoutXmlFacetDefault.java @@ -28,14 +28,11 @@ import com.google.common.collect.Maps; import org.apache.isis.applib.layout.v1_0.Action; import org.apache.isis.applib.layout.v1_0.ActionHolder; -import org.apache.isis.applib.layout.v1_0.ActionLayout; import org.apache.isis.applib.layout.v1_0.Collection; -import org.apache.isis.applib.layout.v1_0.CollectionLayout; import org.apache.isis.applib.layout.v1_0.Column; import org.apache.isis.applib.layout.v1_0.DomainObject; import org.apache.isis.applib.layout.v1_0.Property; import org.apache.isis.applib.layout.v1_0.PropertyGroup; -import org.apache.isis.applib.layout.v1_0.PropertyLayout; import org.apache.isis.applib.layout.v1_0.Tab; import org.apache.isis.applib.layout.v1_0.TabGroup; import org.apache.isis.applib.services.i18n.TranslationService; @@ -43,30 +40,30 @@ import org.apache.isis.core.metamodel.facetapi.Facet; import org.apache.isis.core.metamodel.facetapi.FacetAbstract; import org.apache.isis.core.metamodel.facetapi.FacetHolder; import org.apache.isis.core.metamodel.facetapi.FacetUtil; -import org.apache.isis.core.metamodel.facets.actions.layout.ActionPositionFacetForActionLayoutXml; -import org.apache.isis.core.metamodel.facets.actions.layout.BookmarkPolicyFacetForActionLayoutXml; -import org.apache.isis.core.metamodel.facets.actions.layout.CssClassFaFacetForActionLayoutXml; -import org.apache.isis.core.metamodel.facets.actions.layout.CssClassFacetForActionLayoutXml; -import org.apache.isis.core.metamodel.facets.actions.layout.DescribedAsFacetForActionLayoutXml; +import org.apache.isis.core.metamodel.facets.actions.layout.ActionPositionFacetForActionXml; +import org.apache.isis.core.metamodel.facets.actions.layout.BookmarkPolicyFacetForActionXml; +import org.apache.isis.core.metamodel.facets.actions.layout.CssClassFaFacetForActionXml; +import org.apache.isis.core.metamodel.facets.actions.layout.CssClassFacetForActionXml; +import org.apache.isis.core.metamodel.facets.actions.layout.DescribedAsFacetForActionXml; import org.apache.isis.core.metamodel.facets.actions.layout.HiddenFacetForActionLayoutXml; -import org.apache.isis.core.metamodel.facets.actions.layout.NamedFacetForActionLayoutXml; -import org.apache.isis.core.metamodel.facets.collections.layout.CssClassFacetForCollectionLayoutXml; -import org.apache.isis.core.metamodel.facets.collections.layout.DefaultViewFacetForCollectionLayoutXml; -import org.apache.isis.core.metamodel.facets.collections.layout.DescribedAsFacetForCollectionLayoutXml; -import org.apache.isis.core.metamodel.facets.collections.layout.HiddenFacetForCollectionLayoutXml; -import org.apache.isis.core.metamodel.facets.collections.layout.NamedFacetForCollectionLayoutXml; -import org.apache.isis.core.metamodel.facets.collections.layout.PagedFacetForCollectionLayoutXml; -import org.apache.isis.core.metamodel.facets.collections.layout.SortedByFacetForCollectionLayoutXml; +import org.apache.isis.core.metamodel.facets.actions.layout.NamedFacetForActionXml; +import org.apache.isis.core.metamodel.facets.collections.layout.CssClassFacetForCollectionXml; +import org.apache.isis.core.metamodel.facets.collections.layout.DefaultViewFacetForCollectionXml; +import org.apache.isis.core.metamodel.facets.collections.layout.DescribedAsFacetForCollectionXml; +import org.apache.isis.core.metamodel.facets.collections.layout.HiddenFacetForCollectionXml; +import org.apache.isis.core.metamodel.facets.collections.layout.NamedFacetForCollectionXml; +import org.apache.isis.core.metamodel.facets.collections.layout.PagedFacetForCollectionXml; +import org.apache.isis.core.metamodel.facets.collections.layout.SortedByFacetForCollectionXml; import org.apache.isis.core.metamodel.facets.members.order.annotprop.MemberOrderFacetXml; import org.apache.isis.core.metamodel.facets.object.membergroups.MemberGroupLayoutFacet; -import org.apache.isis.core.metamodel.facets.properties.propertylayout.CssClassFacetForPropertyLayoutXml; -import org.apache.isis.core.metamodel.facets.properties.propertylayout.DescribedAsFacetForPropertyLayoutXml; -import org.apache.isis.core.metamodel.facets.properties.propertylayout.HiddenFacetForPropertyLayoutXml; -import org.apache.isis.core.metamodel.facets.properties.propertylayout.LabelAtFacetForPropertyLayoutXml; -import org.apache.isis.core.metamodel.facets.properties.propertylayout.MultiLineFacetForPropertyLayoutXml; -import org.apache.isis.core.metamodel.facets.properties.propertylayout.NamedFacetForPropertyLayoutXml; -import org.apache.isis.core.metamodel.facets.properties.propertylayout.RenderedAdjustedFacetForPropertyLayoutXml; -import org.apache.isis.core.metamodel.facets.properties.propertylayout.TypicalLengthFacetForPropertyLayoutXml; +import org.apache.isis.core.metamodel.facets.properties.propertylayout.CssClassFacetForPropertyXml; +import org.apache.isis.core.metamodel.facets.properties.propertylayout.DescribedAsFacetForPropertyXml; +import org.apache.isis.core.metamodel.facets.properties.propertylayout.HiddenFacetForPropertyXml; +import org.apache.isis.core.metamodel.facets.properties.propertylayout.LabelAtFacetForPropertyXml; +import org.apache.isis.core.metamodel.facets.properties.propertylayout.MultiLineFacetForPropertyXml; +import org.apache.isis.core.metamodel.facets.properties.propertylayout.NamedFacetForPropertyXml; +import org.apache.isis.core.metamodel.facets.properties.propertylayout.RenderedAdjustedFacetForPropertyXml; +import org.apache.isis.core.metamodel.facets.properties.propertylayout.TypicalLengthFacetForPropertyXml; import org.apache.isis.core.metamodel.spec.ObjectSpecification; import org.apache.isis.core.metamodel.spec.feature.Contributed; import org.apache.isis.core.metamodel.spec.feature.ObjectAction; @@ -281,53 +278,46 @@ public class LayoutXmlFacetDefault } FacetUtil.addFacet( new MemberOrderFacetXml(memberOrderName, ""+memberOrderSequence, translationService, objectAction)); - } - @Override - public void visit(final ActionLayout actionLayout) { - final Action action = actionLayout.getOwner(); - final ActionHolder actionHolder = action.getOwner(); if(actionHolder instanceof PropertyGroup) { - if(actionLayout.getPosition() == null || - actionLayout.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.BELOW || - actionLayout.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.RIGHT) { - actionLayout.setPosition(org.apache.isis.applib.annotation.ActionLayout.Position.PANEL); + if(action.getPosition() == null || + action.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.BELOW || + action.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.RIGHT) { + action.setPosition(org.apache.isis.applib.annotation.ActionLayout.Position.PANEL); } } else if(actionHolder instanceof Property) { - if(actionLayout.getPosition() == null || - actionLayout.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.PANEL_DROPDOWN || - actionLayout.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.PANEL) { - actionLayout.setPosition(org.apache.isis.applib.annotation.ActionLayout.Position.BELOW); + if(action.getPosition() == null || + action.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.PANEL_DROPDOWN || + action.getPosition() == org.apache.isis.applib.annotation.ActionLayout.Position.PANEL) { + action.setPosition(org.apache.isis.applib.annotation.ActionLayout.Position.BELOW); } } else { // doesn't do anything for DomainObject or Collection - actionLayout.setPosition(null); + action.setPosition(null); } - final ObjectAction objectAction = objectActionById.get(action.getId()); - FacetUtil.addFacet(ActionPositionFacetForActionLayoutXml.create(actionLayout, objectAction)); - FacetUtil.addFacet(BookmarkPolicyFacetForActionLayoutXml.create(actionLayout, objectAction)); - FacetUtil.addFacet(CssClassFacetForActionLayoutXml.create(actionLayout, objectAction)); - FacetUtil.addFacet(CssClassFaFacetForActionLayoutXml.create(actionLayout, objectAction)); - FacetUtil.addFacet(DescribedAsFacetForActionLayoutXml.create(actionLayout, objectAction)); - FacetUtil.addFacet(HiddenFacetForActionLayoutXml.create(actionLayout, objectAction)); - FacetUtil.addFacet(NamedFacetForActionLayoutXml.create(actionLayout, objectAction)); + FacetUtil.addFacet(ActionPositionFacetForActionXml.create(action, objectAction)); + FacetUtil.addFacet(BookmarkPolicyFacetForActionXml.create(action, objectAction)); + FacetUtil.addFacet(CssClassFacetForActionXml.create(action, objectAction)); + FacetUtil.addFacet(CssClassFaFacetForActionXml.create(action, objectAction)); + FacetUtil.addFacet(DescribedAsFacetForActionXml.create(action, objectAction)); + FacetUtil.addFacet(HiddenFacetForActionLayoutXml.create(action, objectAction)); + FacetUtil.addFacet(NamedFacetForActionXml.create(action, objectAction)); } @Override - public void visit(final PropertyLayout propertyLayout) { - final Property property = propertyLayout.getOwner(); + public void visit(final Property property) { final OneToOneAssociation oneToOneAssociation = oneToOneAssociationById.get(property.getId()); - FacetUtil.addFacet(CssClassFacetForPropertyLayoutXml.create(propertyLayout, oneToOneAssociation)); - FacetUtil.addFacet(DescribedAsFacetForPropertyLayoutXml.create(propertyLayout, oneToOneAssociation)); - FacetUtil.addFacet(HiddenFacetForPropertyLayoutXml.create(propertyLayout, oneToOneAssociation)); - FacetUtil.addFacet(LabelAtFacetForPropertyLayoutXml.create(propertyLayout, oneToOneAssociation)); - FacetUtil.addFacet(MultiLineFacetForPropertyLayoutXml.create(propertyLayout, oneToOneAssociation)); - FacetUtil.addFacet(NamedFacetForPropertyLayoutXml.create(propertyLayout, oneToOneAssociation)); - FacetUtil.addFacet(RenderedAdjustedFacetForPropertyLayoutXml.create(propertyLayout, oneToOneAssociation)); - FacetUtil.addFacet(TypicalLengthFacetForPropertyLayoutXml.create(propertyLayout, oneToOneAssociation)); + FacetUtil.addFacet(CssClassFacetForPropertyXml.create(property, oneToOneAssociation)); + FacetUtil.addFacet(DescribedAsFacetForPropertyXml.create(property, oneToOneAssociation)); + FacetUtil.addFacet(HiddenFacetForPropertyXml.create(property, oneToOneAssociation)); + FacetUtil.addFacet(LabelAtFacetForPropertyXml.create(property, oneToOneAssociation)); + FacetUtil.addFacet(MultiLineFacetForPropertyXml.create(property, oneToOneAssociation)); + FacetUtil.addFacet(NamedFacetForPropertyXml.create(property, oneToOneAssociation)); + FacetUtil.addFacet(RenderedAdjustedFacetForPropertyXml.create(property, oneToOneAssociation)); + FacetUtil.addFacet(TypicalLengthFacetForPropertyXml.create(property, oneToOneAssociation)); // @MemberOrder#name based on owning property group, @MemberOrder#sequence monotonically increasing final PropertyGroup propertyGroup = property.getOwner(); @@ -338,17 +328,16 @@ public class LayoutXmlFacetDefault } @Override - public void visit(final CollectionLayout collectionLayout) { - final Collection collection = collectionLayout.getOwner(); + public void visit(final Collection collection) { final OneToManyAssociation oneToManyAssociation = oneToManyAssociationById.get(collection.getId()); - FacetUtil.addFacet(CssClassFacetForCollectionLayoutXml.create(collectionLayout, oneToManyAssociation)); - FacetUtil.addFacet(DefaultViewFacetForCollectionLayoutXml.create(collectionLayout, oneToManyAssociation)); - FacetUtil.addFacet(DescribedAsFacetForCollectionLayoutXml.create(collectionLayout, oneToManyAssociation)); - FacetUtil.addFacet(HiddenFacetForCollectionLayoutXml.create(collectionLayout, oneToManyAssociation)); - FacetUtil.addFacet(NamedFacetForCollectionLayoutXml.create(collectionLayout, oneToManyAssociation)); - FacetUtil.addFacet(PagedFacetForCollectionLayoutXml.create(collectionLayout, oneToManyAssociation)); - FacetUtil.addFacet(SortedByFacetForCollectionLayoutXml.create(collectionLayout, oneToManyAssociation)); + FacetUtil.addFacet(CssClassFacetForCollectionXml.create(collection, oneToManyAssociation)); + FacetUtil.addFacet(DefaultViewFacetForCollectionXml.create(collection, oneToManyAssociation)); + FacetUtil.addFacet(DescribedAsFacetForCollectionXml.create(collection, oneToManyAssociation)); + FacetUtil.addFacet(HiddenFacetForCollectionXml.create(collection, oneToManyAssociation)); + FacetUtil.addFacet(NamedFacetForCollectionXml.create(collection, oneToManyAssociation)); + FacetUtil.addFacet(PagedFacetForCollectionXml.create(collection, oneToManyAssociation)); + FacetUtil.addFacet(SortedByFacetForCollectionXml.create(collection, oneToManyAssociation)); // copy the collection name onto the tab final Column column = collection.getOwner(); http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetForPropertyLayoutXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetForPropertyLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetForPropertyLayoutXml.java deleted file mode 100644 index fb9bdb8..0000000 --- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetForPropertyLayoutXml.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.core.metamodel.facets.properties.propertylayout; - -import com.google.common.base.Strings; - -import org.apache.isis.applib.layout.v1_0.PropertyLayout; -import org.apache.isis.core.metamodel.facetapi.FacetHolder; -import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet; -import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacetAbstract; - -public class CssClassFacetForPropertyLayoutXml extends CssClassFacetAbstract { - - public static CssClassFacet create(PropertyLayout propertyLayout, FacetHolder holder) { - if(propertyLayout == null) { - return null; - } - final String cssClass = Strings.emptyToNull(propertyLayout.getCssClass()); - return cssClass != null ? new CssClassFacetForPropertyLayoutXml(cssClass, holder) : null; - } - - private CssClassFacetForPropertyLayoutXml(String value, FacetHolder holder) { - super(value, holder); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetForPropertyXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetForPropertyXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetForPropertyXml.java new file mode 100644 index 0000000..065e80c --- /dev/null +++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/CssClassFacetForPropertyXml.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.isis.core.metamodel.facets.properties.propertylayout; + +import com.google.common.base.Strings; + +import org.apache.isis.applib.layout.v1_0.Property; +import org.apache.isis.core.metamodel.facetapi.FacetHolder; +import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet; +import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacetAbstract; + +public class CssClassFacetForPropertyXml extends CssClassFacetAbstract { + + public static CssClassFacet create(Property propertyLayout, FacetHolder holder) { + if(propertyLayout == null) { + return null; + } + final String cssClass = Strings.emptyToNull(propertyLayout.getCssClass()); + return cssClass != null ? new CssClassFacetForPropertyXml(cssClass, holder) : null; + } + + private CssClassFacetForPropertyXml(String value, FacetHolder holder) { + super(value, holder); + } + +} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetForPropertyLayoutXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetForPropertyLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetForPropertyLayoutXml.java deleted file mode 100644 index d36dfa9..0000000 --- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetForPropertyLayoutXml.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.core.metamodel.facets.properties.propertylayout; - -import com.google.common.base.Strings; - -import org.apache.isis.applib.layout.v1_0.PropertyLayout; -import org.apache.isis.core.metamodel.facetapi.FacetHolder; -import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet; -import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacetAbstract; - -public class DescribedAsFacetForPropertyLayoutXml extends DescribedAsFacetAbstract { - - public static DescribedAsFacet create(PropertyLayout propertyLayout, FacetHolder holder) { - if(propertyLayout == null) { - return null; - } - final String describedAs = Strings.emptyToNull(propertyLayout.getDescribedAs()); - return describedAs != null ? new DescribedAsFacetForPropertyLayoutXml(describedAs, holder) : null; - } - - private DescribedAsFacetForPropertyLayoutXml(String value, FacetHolder holder) { - super(value, holder); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetForPropertyXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetForPropertyXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetForPropertyXml.java new file mode 100644 index 0000000..2c9f6f6 --- /dev/null +++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/DescribedAsFacetForPropertyXml.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.isis.core.metamodel.facets.properties.propertylayout; + +import com.google.common.base.Strings; + +import org.apache.isis.applib.layout.v1_0.Property; +import org.apache.isis.core.metamodel.facetapi.FacetHolder; +import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacet; +import org.apache.isis.core.metamodel.facets.all.describedas.DescribedAsFacetAbstract; + +public class DescribedAsFacetForPropertyXml extends DescribedAsFacetAbstract { + + public static DescribedAsFacet create(Property propertyLayout, FacetHolder holder) { + if(propertyLayout == null) { + return null; + } + final String describedAs = Strings.emptyToNull(propertyLayout.getDescribedAs()); + return describedAs != null ? new DescribedAsFacetForPropertyXml(describedAs, holder) : null; + } + + private DescribedAsFacetForPropertyXml(String value, FacetHolder holder) { + super(value, holder); + } + +} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyLayoutXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyLayoutXml.java deleted file mode 100644 index 7a93898..0000000 --- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyLayoutXml.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.core.metamodel.facets.properties.propertylayout; - -import org.apache.isis.applib.annotation.When; -import org.apache.isis.applib.annotation.Where; -import org.apache.isis.applib.layout.v1_0.PropertyLayout; -import org.apache.isis.core.metamodel.adapter.ObjectAdapter; -import org.apache.isis.core.metamodel.facetapi.FacetHolder; -import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet; -import org.apache.isis.core.metamodel.facets.members.hidden.HiddenFacetAbstract; - -public class HiddenFacetForPropertyLayoutXml extends HiddenFacetAbstract { - - public static HiddenFacet create(final PropertyLayout propertyLayout, final FacetHolder holder) { - if (propertyLayout == null) { - return null; - } - final Where where = propertyLayout.getHidden(); - return where != null && where != Where.NOT_SPECIFIED ? new HiddenFacetForPropertyLayoutXml(where, holder) : null; - } - - private HiddenFacetForPropertyLayoutXml(final Where where, final FacetHolder holder) { - super(HiddenFacetForPropertyLayoutXml.class, When.ALWAYS, where, holder); - } - - @Override - public String hiddenReason(final ObjectAdapter targetAdapter, final Where whereContext) { - if(!where().includes(whereContext)) { - return null; - } - return "Hidden on " + where().getFriendlyName(); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyXml.java new file mode 100644 index 0000000..4ee7f1d --- /dev/null +++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/HiddenFacetForPropertyXml.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.isis.core.metamodel.facets.properties.propertylayout; + +import org.apache.isis.applib.annotation.When; +import org.apache.isis.applib.annotation.Where; +import org.apache.isis.applib.layout.v1_0.Property; +import org.apache.isis.core.metamodel.adapter.ObjectAdapter; +import org.apache.isis.core.metamodel.facetapi.FacetHolder; +import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet; +import org.apache.isis.core.metamodel.facets.members.hidden.HiddenFacetAbstract; + +public class HiddenFacetForPropertyXml extends HiddenFacetAbstract { + + public static HiddenFacet create(final Property propertyLayout, final FacetHolder holder) { + if (propertyLayout == null) { + return null; + } + final Where where = propertyLayout.getHidden(); + return where != null && where != Where.NOT_SPECIFIED ? new HiddenFacetForPropertyXml(where, holder) : null; + } + + private HiddenFacetForPropertyXml(final Where where, final FacetHolder holder) { + super(HiddenFacetForPropertyXml.class, When.ALWAYS, where, holder); + } + + @Override + public String hiddenReason(final ObjectAdapter targetAdapter, final Where whereContext) { + if(!where().includes(whereContext)) { + return null; + } + return "Hidden on " + where().getFriendlyName(); + } + +} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetForPropertyLayoutXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetForPropertyLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetForPropertyLayoutXml.java deleted file mode 100644 index c8a84d0..0000000 --- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetForPropertyLayoutXml.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.core.metamodel.facets.properties.propertylayout; - -import org.apache.isis.applib.annotation.LabelPosition; -import org.apache.isis.applib.layout.v1_0.PropertyLayout; -import org.apache.isis.core.metamodel.facetapi.FacetHolder; -import org.apache.isis.core.metamodel.facets.objectvalue.labelat.LabelAtFacet; -import org.apache.isis.core.metamodel.facets.objectvalue.labelat.LabelAtFacetAbstract; - -public class LabelAtFacetForPropertyLayoutXml extends LabelAtFacetAbstract { - - public static LabelAtFacet create(final PropertyLayout propertyLayout, FacetHolder holder) { - if (propertyLayout == null) { - return null; - } - final LabelPosition labelPosition = propertyLayout.getLabelPosition(); - return labelPosition != null ? new LabelAtFacetForPropertyLayoutXml(labelPosition, holder) : null; - } - - private LabelAtFacetForPropertyLayoutXml(final LabelPosition value, final FacetHolder holder) { - super(value, holder); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetForPropertyXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetForPropertyXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetForPropertyXml.java new file mode 100644 index 0000000..ba512a9 --- /dev/null +++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/LabelAtFacetForPropertyXml.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.isis.core.metamodel.facets.properties.propertylayout; + +import org.apache.isis.applib.annotation.LabelPosition; +import org.apache.isis.applib.layout.v1_0.Property; +import org.apache.isis.core.metamodel.facetapi.FacetHolder; +import org.apache.isis.core.metamodel.facets.objectvalue.labelat.LabelAtFacet; +import org.apache.isis.core.metamodel.facets.objectvalue.labelat.LabelAtFacetAbstract; + +public class LabelAtFacetForPropertyXml extends LabelAtFacetAbstract { + + public static LabelAtFacet create(final Property propertyLayout, FacetHolder holder) { + if (propertyLayout == null) { + return null; + } + final LabelPosition labelPosition = propertyLayout.getLabelPosition(); + return labelPosition != null ? new LabelAtFacetForPropertyXml(labelPosition, holder) : null; + } + + private LabelAtFacetForPropertyXml(final LabelPosition value, final FacetHolder holder) { + super(value, holder); + } + +} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetForPropertyLayoutXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetForPropertyLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetForPropertyLayoutXml.java deleted file mode 100644 index 072f287..0000000 --- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetForPropertyLayoutXml.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.core.metamodel.facets.properties.propertylayout; - -import org.apache.isis.applib.layout.v1_0.PropertyLayout; -import org.apache.isis.core.metamodel.facetapi.FacetHolder; -import org.apache.isis.core.metamodel.facets.objectvalue.multiline.MultiLineFacet; -import org.apache.isis.core.metamodel.facets.objectvalue.multiline.MultiLineFacetAbstract; - -public class MultiLineFacetForPropertyLayoutXml extends MultiLineFacetAbstract { - - public static MultiLineFacet create(PropertyLayout propertyLayout, FacetHolder holder) { - if(propertyLayout == null) { - return null; - } - final Integer multiLine = propertyLayout.getMultiLine(); - return multiLine != null && multiLine > 1 ? new MultiLineFacetForPropertyLayoutXml(multiLine, false, holder) : null; - } - - private MultiLineFacetForPropertyLayoutXml(int numberOfLines, boolean preventWrapping, FacetHolder holder) { - super(numberOfLines, preventWrapping, holder); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetForPropertyXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetForPropertyXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetForPropertyXml.java new file mode 100644 index 0000000..9a48271 --- /dev/null +++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/MultiLineFacetForPropertyXml.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.isis.core.metamodel.facets.properties.propertylayout; + +import org.apache.isis.applib.layout.v1_0.Property; +import org.apache.isis.core.metamodel.facetapi.FacetHolder; +import org.apache.isis.core.metamodel.facets.objectvalue.multiline.MultiLineFacet; +import org.apache.isis.core.metamodel.facets.objectvalue.multiline.MultiLineFacetAbstract; + +public class MultiLineFacetForPropertyXml extends MultiLineFacetAbstract { + + public static MultiLineFacet create(Property propertyLayout, FacetHolder holder) { + if(propertyLayout == null) { + return null; + } + final Integer multiLine = propertyLayout.getMultiLine(); + return multiLine != null && multiLine > 1 ? new MultiLineFacetForPropertyXml(multiLine, false, holder) : null; + } + + private MultiLineFacetForPropertyXml(int numberOfLines, boolean preventWrapping, FacetHolder holder) { + super(numberOfLines, preventWrapping, holder); + } + +} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetForPropertyLayoutXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetForPropertyLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetForPropertyLayoutXml.java deleted file mode 100644 index 0f0e9b7..0000000 --- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetForPropertyLayoutXml.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.metamodel.facets.properties.propertylayout; - -import com.google.common.base.Strings; - -import org.apache.isis.applib.layout.v1_0.PropertyLayout; -import org.apache.isis.core.metamodel.facetapi.FacetHolder; -import org.apache.isis.core.metamodel.facets.all.named.NamedFacet; -import org.apache.isis.core.metamodel.facets.all.named.NamedFacetAbstract; - -public class NamedFacetForPropertyLayoutXml extends NamedFacetAbstract { - - public static NamedFacet create(PropertyLayout propertyLayout, FacetHolder holder) { - if(propertyLayout == null) { - return null; - } - final String named = Strings.emptyToNull(propertyLayout.getNamed()); - final Boolean escaped = propertyLayout.getNamedEscaped(); - return named != null ? new NamedFacetForPropertyLayoutXml(named, (escaped == null || escaped), holder) : null; - } - - private NamedFacetForPropertyLayoutXml( - final String value, - final boolean escaped, - final FacetHolder holder) { - - super(value, escaped, holder); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetForPropertyXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetForPropertyXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetForPropertyXml.java new file mode 100644 index 0000000..392a152 --- /dev/null +++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/NamedFacetForPropertyXml.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.isis.core.metamodel.facets.properties.propertylayout; + +import com.google.common.base.Strings; + +import org.apache.isis.applib.layout.v1_0.Property; +import org.apache.isis.core.metamodel.facetapi.FacetHolder; +import org.apache.isis.core.metamodel.facets.all.named.NamedFacet; +import org.apache.isis.core.metamodel.facets.all.named.NamedFacetAbstract; + +public class NamedFacetForPropertyXml extends NamedFacetAbstract { + + public static NamedFacet create(Property propertyLayout, FacetHolder holder) { + if(propertyLayout == null) { + return null; + } + final String named = Strings.emptyToNull(propertyLayout.getNamed()); + final Boolean escaped = propertyLayout.getNamedEscaped(); + return named != null ? new NamedFacetForPropertyXml(named, (escaped == null || escaped), holder) : null; + } + + private NamedFacetForPropertyXml( + final String value, + final boolean escaped, + final FacetHolder holder) { + + super(value, escaped, holder); + } + +} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetForPropertyLayoutXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetForPropertyLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetForPropertyLayoutXml.java deleted file mode 100644 index 0ceab99..0000000 --- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetForPropertyLayoutXml.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.core.metamodel.facets.properties.propertylayout; - -import org.apache.isis.applib.layout.v1_0.PropertyLayout; -import org.apache.isis.core.metamodel.facetapi.FacetHolder; -import org.apache.isis.core.metamodel.facets.objectvalue.renderedadjusted.RenderedAdjustedFacet; -import org.apache.isis.core.metamodel.facets.objectvalue.renderedadjusted.RenderedAdjustedFacetAbstract; - -public class RenderedAdjustedFacetForPropertyLayoutXml extends RenderedAdjustedFacetAbstract { - - public static RenderedAdjustedFacet create(final PropertyLayout propertyLayout, FacetHolder holder) { - if(propertyLayout == null) { - return null; - } - final Boolean renderedAsDayBefore = propertyLayout.getRenderedAsDayBefore(); - return renderedAsDayBefore != null && renderedAsDayBefore ? new RenderedAdjustedFacetForPropertyLayoutXml(holder) : null; - } - - public static final int ADJUST_BY = -1; - - private RenderedAdjustedFacetForPropertyLayoutXml(FacetHolder holder) { - super(ADJUST_BY, holder); - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetForPropertyXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetForPropertyXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetForPropertyXml.java new file mode 100644 index 0000000..63a3e4a --- /dev/null +++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/RenderedAdjustedFacetForPropertyXml.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.isis.core.metamodel.facets.properties.propertylayout; + +import org.apache.isis.applib.layout.v1_0.Property; +import org.apache.isis.core.metamodel.facetapi.FacetHolder; +import org.apache.isis.core.metamodel.facets.objectvalue.renderedadjusted.RenderedAdjustedFacet; +import org.apache.isis.core.metamodel.facets.objectvalue.renderedadjusted.RenderedAdjustedFacetAbstract; + +public class RenderedAdjustedFacetForPropertyXml extends RenderedAdjustedFacetAbstract { + + public static RenderedAdjustedFacet create(final Property propertyLayout, FacetHolder holder) { + if(propertyLayout == null) { + return null; + } + final Boolean renderedAsDayBefore = propertyLayout.getRenderedAsDayBefore(); + return renderedAsDayBefore != null && renderedAsDayBefore ? new RenderedAdjustedFacetForPropertyXml(holder) : null; + } + + public static final int ADJUST_BY = -1; + + private RenderedAdjustedFacetForPropertyXml(FacetHolder holder) { + super(ADJUST_BY, holder); + } + +} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/TypicalLengthFacetForPropertyLayoutXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/TypicalLengthFacetForPropertyLayoutXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/TypicalLengthFacetForPropertyLayoutXml.java deleted file mode 100644 index 5d51ce9..0000000 --- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/TypicalLengthFacetForPropertyLayoutXml.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.isis.core.metamodel.facets.properties.propertylayout; - -import org.apache.isis.applib.layout.v1_0.PropertyLayout; -import org.apache.isis.core.metamodel.facetapi.FacetHolder; -import org.apache.isis.core.metamodel.facets.objectvalue.typicallen.TypicalLengthFacet; -import org.apache.isis.core.metamodel.facets.objectvalue.typicallen.TypicalLengthFacetAbstract; - -public class TypicalLengthFacetForPropertyLayoutXml extends TypicalLengthFacetAbstract { - - public static TypicalLengthFacet create(PropertyLayout propertyLayout, FacetHolder holder) { - if(propertyLayout == null) { - return null; - } - final Integer typicalLength = propertyLayout.getTypicalLength(); - return typicalLength != null && typicalLength != -1 ? new TypicalLengthFacetForPropertyLayoutXml(typicalLength, holder) : null; - } - - private final int typicalLength; - - private TypicalLengthFacetForPropertyLayoutXml(int typicalLength, FacetHolder holder) { - super(holder, Derivation.NOT_DERIVED); - this.typicalLength = typicalLength; - } - - @Override - public int value() { - return typicalLength; - } - -} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/TypicalLengthFacetForPropertyXml.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/TypicalLengthFacetForPropertyXml.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/TypicalLengthFacetForPropertyXml.java new file mode 100644 index 0000000..1a193e5 --- /dev/null +++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/propertylayout/TypicalLengthFacetForPropertyXml.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.isis.core.metamodel.facets.properties.propertylayout; + +import org.apache.isis.applib.layout.v1_0.Property; +import org.apache.isis.core.metamodel.facetapi.FacetHolder; +import org.apache.isis.core.metamodel.facets.objectvalue.typicallen.TypicalLengthFacet; +import org.apache.isis.core.metamodel.facets.objectvalue.typicallen.TypicalLengthFacetAbstract; + +public class TypicalLengthFacetForPropertyXml extends TypicalLengthFacetAbstract { + + public static TypicalLengthFacet create(Property propertyLayout, FacetHolder holder) { + if(propertyLayout == null) { + return null; + } + final Integer typicalLength = propertyLayout.getTypicalLength(); + return typicalLength != null && typicalLength != -1 ? new TypicalLengthFacetForPropertyXml(typicalLength, holder) : null; + } + + private final int typicalLength; + + private TypicalLengthFacetForPropertyXml(int typicalLength, FacetHolder holder) { + super(holder, Derivation.NOT_DERIVED); + this.typicalLength = typicalLength; + } + + @Override + public int value() { + return typicalLength; + } + +} http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layoutxml/v1_0/DomainObjectTest.java ---------------------------------------------------------------------- diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layoutxml/v1_0/DomainObjectTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layoutxml/v1_0/DomainObjectTest.java index 51269c5..437783a 100644 --- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layoutxml/v1_0/DomainObjectTest.java +++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/layoutxml/v1_0/DomainObjectTest.java @@ -18,11 +18,13 @@ */ package org.apache.isis.core.metamodel.layoutxml.v1_0; +import java.util.List; import java.util.Map; import javax.xml.bind.Marshaller; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; import org.junit.After; import org.junit.Before; @@ -79,10 +81,14 @@ public class DomainObjectTest { Action updateNameAction = new Action(); updateNameAction.setId("updateName"); + final List<Action> propertyActions = Lists.newArrayList(); + nameProperty.setActions(propertyActions); nameProperty.getActions().add(updateNameAction); Action deleteAction = new Action(); deleteAction.setId("delete"); + final List<Action> domainObjectActions = Lists.newArrayList(); + domainObject.setActions(domainObjectActions); domainObject.getActions().add(deleteAction); String xml = jaxbService.toXml(domainObject, http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabGroupsPanel.java ---------------------------------------------------------------------- diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabGroupsPanel.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabGroupsPanel.java index 3f9b76f..1ab845e 100644 --- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabGroupsPanel.java +++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/entity/tabgroups/EntityTabGroupsPanel.java @@ -33,6 +33,7 @@ import org.apache.wicket.model.Model; import org.apache.isis.applib.layout.v1_0.DomainObject; import org.apache.isis.applib.layout.v1_0.Tab; import org.apache.isis.applib.layout.v1_0.TabGroup; +import org.apache.isis.applib.services.jaxb.JaxbService; import org.apache.isis.core.metamodel.adapter.ObjectAdapter; import org.apache.isis.core.metamodel.facets.members.cssclass.CssClassFacet; import org.apache.isis.core.metamodel.facets.object.layoutxml.LayoutXmlFacet; @@ -73,6 +74,10 @@ public class EntityTabGroupsPanel extends PanelAbstract<EntityModel> { final LayoutXmlFacet layoutXmlFacet = model.getTypeOfSpecification().getFacet(LayoutXmlFacet.class); final DomainObject domainObject = layoutXmlFacet.getLayoutMetadata(); + // TODO: debugging, remove + final String xml = getServicesInjector().lookupService(JaxbService.class).toXml(domainObject); + System.out.println(xml); + addOrReplace(ComponentType.ENTITY_SUMMARY, model); final List<TabGroup> tabGroups = domainObject.getTabGroups(); http://git-wip-us.apache.org/repos/asf/isis/blob/79248dc5/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java ---------------------------------------------------------------------- diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java index 2c0bc1f..dad55cf 100644 --- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java +++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java @@ -18,6 +18,9 @@ */ package domainapp.dom.simple; +import java.util.List; + +import javax.inject.Inject; import javax.jdo.JDOHelper; import javax.jdo.annotations.IdentityType; import javax.jdo.annotations.VersionStrategy; @@ -143,6 +146,18 @@ public class SimpleObject implements Comparable<SimpleObject> { @javax.inject.Inject @SuppressWarnings("unused") - private DomainObjectContainer container; + DomainObjectContainer container; + + + public List<SimpleObject> getSimilarTo() { + return simpleObjects.findByName(getName().substring(0,1)); + } + + public List<SimpleObject> getOthers() { + return simpleObjects.listAll(); + } + + @Inject + SimpleObjects simpleObjects; }