This is an automated email from the ASF dual-hosted git repository. joergrade pushed a commit to branch ISIS-3171 in repository https://gitbox.apache.org/repos/asf/causeway.git
commit 55f7e1397cef92728ce4ff5913ded14dacabe66a Author: Jörg Rade <[email protected]> AuthorDate: Thu Feb 16 18:47:13 2023 +0100 ISIS-3171 'sources' explicitly hidden --- .../kroviz/core/aggregator/AggregatorWithLayout.kt | 18 ------------------ .../kroviz/core/aggregator/CollectionAggregator.kt | 22 +++++++++++++++++++++- .../kroviz/core/aggregator/ObjectAggregator.kt | 2 +- .../client/kroviz/core/model/CollectionLayout.kt | 15 +++++++++++---- .../kroviz/core/model/PropertySpecification.kt | 18 +++++++++++++++++- .../causeway/client/kroviz/to/bs/PropertyBs.kt | 1 + 6 files changed, 51 insertions(+), 25 deletions(-) diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/aggregator/AggregatorWithLayout.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/aggregator/AggregatorWithLayout.kt index b114488c4f..66bcd434e3 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/aggregator/AggregatorWithLayout.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/aggregator/AggregatorWithLayout.kt @@ -51,22 +51,4 @@ abstract class AggregatorWithLayout : BaseAggregator() { invoke(l, aggregator, referrer = referrer) } - protected fun handleProperty(property: Property, referrer: String, layout: BaseLayout) { - when { - property.isObjectProperty() -> { - val op = ObjectProperty(property) - val pdLink = op.getDescriptionLink()!! - ResourceProxy().fetch(pdLink, this, referrer = referrer) - } - - property.isPropertyDescription() -> { - console.log("[AWL_handleProperty] PropertyDescription obsolete?") - } - - else -> { - TODO("handle 3rd type of property") - } - } - } - } diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/aggregator/CollectionAggregator.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/aggregator/CollectionAggregator.kt index 07ea8ebc5f..3a36d46fd1 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/aggregator/CollectionAggregator.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/aggregator/CollectionAggregator.kt @@ -22,11 +22,11 @@ import org.apache.causeway.client.kroviz.core.event.EventState import org.apache.causeway.client.kroviz.core.event.LogEntry import org.apache.causeway.client.kroviz.core.event.ResourceProxy import org.apache.causeway.client.kroviz.core.event.ResourceSpecification +import org.apache.causeway.client.kroviz.core.model.BaseLayout import org.apache.causeway.client.kroviz.core.model.CollectionDM import org.apache.causeway.client.kroviz.core.model.CollectionLayout import org.apache.causeway.client.kroviz.to.* import org.apache.causeway.client.kroviz.to.bs.GridBs -import org.apache.causeway.client.kroviz.ui.core.Constants import org.apache.causeway.client.kroviz.ui.core.ViewManager /** sequence of operations: @@ -148,6 +148,26 @@ class CollectionAggregator(actionTitle: String, private val parent: ObjectAggreg handleProperty(property, referrer, getLayout()) } + protected fun handleProperty(property: Property, referrer: String, layout: BaseLayout) { + when { + property.isObjectProperty() -> { + val op = ObjectProperty(property) + val pdLink = op.getDescriptionLink()!! + ResourceProxy().fetch(pdLink, this, referrer = referrer) + } + + property.isPropertyDescription() -> { + val pd = PropertyDescription(property) + getLayout().addPropertyDescription(pd, this, referrer) + } + + else -> { + TODO("handle 3rd type of property") + } + } + } + + private fun handleCollection(collection: Collection) { if (isParentedCollection()) { //TODO is _id_ required in both CollectionDM and CollectionLayout? diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/aggregator/ObjectAggregator.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/aggregator/ObjectAggregator.kt index 7f85e6f74a..17b85d0581 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/aggregator/ObjectAggregator.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/aggregator/ObjectAggregator.kt @@ -103,7 +103,7 @@ class ObjectAggregator(val actionTitle: String) : AggregatorWithLayout() { } private fun handleProperty(property: Property, referrer: String) { - handleProperty(property, referrer, getLayout()) //FIXME + handleProperty(property, referrer) //FIXME } private fun handleGrid(grid: GridBs, referrer: String) { diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/model/CollectionLayout.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/model/CollectionLayout.kt index 92f1a48ef1..71b97e68ed 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/model/CollectionLayout.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/model/CollectionLayout.kt @@ -18,8 +18,10 @@ */ package org.apache.causeway.client.kroviz.core.model +import org.apache.causeway.client.kroviz.core.aggregator.AggregatorWithLayout import org.apache.causeway.client.kroviz.core.aggregator.CollectionAggregator import org.apache.causeway.client.kroviz.core.event.ResourceProxy +import org.apache.causeway.client.kroviz.to.PropertyDescription import org.apache.causeway.client.kroviz.to.TObject import org.apache.causeway.client.kroviz.to.bs.PropertyBs @@ -75,9 +77,14 @@ class CollectionLayout : BaseLayout() { ps.amendWith(propertyBs) } - // FIXME NPE -> ISIS-2846 ? - //FIXME hidden etc is not contained in ObjectProperty, see GidBs for the collection.protoType - // e.g. http://localhost:9090/restful/objects/demo.JavaLangStringEntity/356/object-layout - // furthermore, the column header can be taken from there as well + fun addPropertyDescription( + propertyDescription: PropertyDescription, + aggregator: AggregatorWithLayout, + referrer: String + ) { + val id = propertyDescription.id + val ps: PropertySpecification = propertySpecificationList.firstOrNull { it.id == id }!! + ps.amendWith(propertyDescription) + } } \ No newline at end of file diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/model/PropertySpecification.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/model/PropertySpecification.kt index 187d464294..d70a72b0f3 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/model/PropertySpecification.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/core/model/PropertySpecification.kt @@ -19,6 +19,7 @@ package org.apache.causeway.client.kroviz.core.model import org.apache.causeway.client.kroviz.to.Member +import org.apache.causeway.client.kroviz.to.PropertyDescription import org.apache.causeway.client.kroviz.to.bs.PropertyBs /** @@ -37,13 +38,19 @@ class PropertySpecification(member: Member) { var hidden = true var disabled = member.disabledReason.isNotEmpty() var isAmendedFromBs = false + var isAmendedFromPropertyDescription = false var typicalLength: Int = 10 fun amendWith(pbs: PropertyBs) { console.log("[PS_amendWith] PropertyBs") + console.log(pbs) name = pbs.named hidden = !(pbs.hidden != null && pbs.hidden.isNotEmpty()) + //This is hacky + if (id == "sources") { + hidden = true + } if (pbs.typicalLength != null && pbs.typicalLength > 0) { typicalLength = pbs.typicalLength.toInt() } @@ -51,11 +58,20 @@ class PropertySpecification(member: Member) { console.log(this) } + fun amendWith(pd: PropertyDescription) { + val ex = pd.extensions!! + val fn = ex.getFriendlyName() + if (fn.isNotEmpty()) { + name = fn + } + isAmendedFromPropertyDescription = true + } + fun readyToRender(): Boolean { return when (id) { "logicalTypeName" -> true "objectIdentifier" -> true - else -> isAmendedFromBs + else -> isAmendedFromBs && isAmendedFromPropertyDescription } } diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/to/bs/PropertyBs.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/to/bs/PropertyBs.kt index 7e76306754..4c93d3e460 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/to/bs/PropertyBs.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/causeway/client/kroviz/to/bs/PropertyBs.kt @@ -34,6 +34,7 @@ class PropertyBs(node: Node) : XmlLayout() { lateinit var action: ActionBs init { + // TODO improve casting val dn = node.asDynamic() hidden = dn.getAttribute("hidden") //as String id = dn.getAttribute("id") //as String
