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/isis.git
commit 46a4c888c2d37ff9b643d0cf4c941ee991026718 Author: Jörg Rade <joerg.r...@kuehne-nagel.com> AuthorDate: Tue Aug 30 15:51:16 2022 +0200 ISIS-3171 xml layout files moved(bs), cleaned, toString() added. Collection amended by linkList. Aggregators amended by handleGrid. --- .../kroviz/core/aggregator/AggregatorWithLayout.kt | 13 ++++- .../kroviz/core/aggregator/CollectionAggregator.kt | 10 +--- .../kroviz/core/aggregator/ObjectAggregator.kt | 22 +------- .../isis/client/kroviz/core/event/LogEntry.kt | 4 +- .../kroviz/core/model/DisplayModelWithLayout.kt | 2 +- .../isis/client/kroviz/handler/LayoutXmlHandler.kt | 2 +- .../isis/client/kroviz/to/{bs3 => bs}/Action.kt | 33 ++++++----- .../isis/client/kroviz/to/{bs3 => bs}/Col.kt | 36 ++++++++---- .../client/kroviz/to/{bs3 => bs}/Collection.kt | 49 +++++++++++----- .../client/kroviz/to/{bs3 => bs}/DomainObject.kt | 2 +- .../isis/client/kroviz/to/{bs3 => bs}/FieldSet.kt | 12 ++-- .../isis/client/kroviz/to/{bs3 => bs}/Grid.kt | 14 ++++- .../isis/client/kroviz/to/{bs3 => bs}/Link.kt | 21 +++++-- .../isis/client/kroviz/to/{bs3 => bs}/Property.kt | 18 +++--- .../isis/client/kroviz/to/{bs3 => bs}/Row.kt | 8 +-- .../isis/client/kroviz/to/{bs3 => bs}/Tab.kt | 6 +- .../isis/client/kroviz/to/{bs3 => bs}/TabGroup.kt | 8 +-- .../LayoutBuilder.kt => to/bs/XmlLayout.kt} | 25 +++------ .../isis/client/kroviz/ui/builder/ColBuilder.kt | 2 +- .../client/kroviz/ui/builder/FieldSetBuilder.kt | 2 +- .../isis/client/kroviz/ui/builder/LayoutBuilder.kt | 2 +- .../isis/client/kroviz/ui/builder/RowBuilder.kt | 2 +- .../isis/client/kroviz/ui/builder/TabBuilder.kt | 2 +- .../client/kroviz/ui/builder/TabGroupBuilder.kt | 2 +- .../isis/client/kroviz/ui/diagram/LayoutDiagram.kt | 6 +- .../isis/client/kroviz/ui/dialog/EventLogDetail.kt | 2 +- .../isis/client/kroviz/ui/dialog/LoginPrompt.kt | 2 +- .../isis/client/kroviz/layout/LayoutXmlTest.kt | 49 ---------------- .../snapshots/demo2_0_0/OBJECT_COLLECTION2.kt | 53 ++++++++++++++++++ .../apache/isis/client/kroviz/to/CollectionTest.kt | 20 +++++++ .../client/kroviz/to/{bs3 => bs}/LayoutXmlTest.kt | 65 +++++++++++++++++----- 31 files changed, 297 insertions(+), 197 deletions(-) diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/AggregatorWithLayout.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/AggregatorWithLayout.kt index 72fd2fd291..da4f7b5ea9 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/AggregatorWithLayout.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/AggregatorWithLayout.kt @@ -19,10 +19,13 @@ package org.apache.isis.client.kroviz.core.aggregator import org.apache.isis.client.kroviz.core.event.LogEntry +import org.apache.isis.client.kroviz.core.event.ResourceProxy import org.apache.isis.client.kroviz.core.model.DisplayModelWithLayout +import org.apache.isis.client.kroviz.core.model.ObjectDM import org.apache.isis.client.kroviz.layout.Layout import org.apache.isis.client.kroviz.to.Represention import org.apache.isis.client.kroviz.to.TObject +import org.apache.isis.client.kroviz.to.bs.Grid import org.apache.isis.client.kroviz.ui.core.Constants import org.apache.isis.client.kroviz.ui.diagram.Tree @@ -57,10 +60,18 @@ abstract class AggregatorWithLayout : BaseAggregator() { } } + protected fun handleGrid(grid: Grid, dm: DisplayModelWithLayout, referrer: String) { + (dpm as ObjectDM).grid = grid + grid.getPropertyList().forEach { + val link = it.link!! + ResourceProxy().fetch(link, this, subType = Constants.subTypeJson, referrer = referrer) + } + } + protected fun invokeLayoutLink(obj: TObject, aggregator: AggregatorWithLayout, referrer: String) { val l = obj.getLayoutLink() if (l.representation() == Represention.OBJECT_LAYOUT_BS) { - invoke(l, aggregator, Constants.subTypeXml, referrer) + invoke(l, aggregator, Constants.subTypeXml, referrer = referrer) } else { invoke(l, aggregator, referrer = referrer) } diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/CollectionAggregator.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/CollectionAggregator.kt index 61dbe02382..b7b2a037e9 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/CollectionAggregator.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/CollectionAggregator.kt @@ -25,7 +25,7 @@ import org.apache.isis.client.kroviz.core.event.ResourceSpecification import org.apache.isis.client.kroviz.core.model.CollectionDM import org.apache.isis.client.kroviz.layout.Layout import org.apache.isis.client.kroviz.to.* -import org.apache.isis.client.kroviz.to.bs3.Grid +import org.apache.isis.client.kroviz.to.bs.Grid import org.apache.isis.client.kroviz.ui.core.ViewManager /** sequence of operations: @@ -54,7 +54,7 @@ class CollectionAggregator(actionTitle: String, val parent: ObjectAggregator? = is TObject -> handleObject(obj, referrer) is DomainType -> handleDomainType(obj, referrer) is Layout -> handleLayout(obj, dpm as CollectionDM, referrer) - is Grid -> handleGrid(obj) + is Grid -> handleGrid(obj, dpm as CollectionDM, referrer) is Property -> handleProperty(obj, referrer) is Collection -> handleCollection(obj, referrer) is Icon -> handleIcon(obj) @@ -105,10 +105,6 @@ class CollectionAggregator(actionTitle: String, val parent: ObjectAggregator? = } } - private fun handleGrid(grid: Grid) { - (dpm as CollectionDM).grid = grid - } - private fun handleProperty(p: Property, referrer: String) { val dm = dpm as CollectionDM if (p.isPropertyDescription()) { @@ -128,7 +124,7 @@ class CollectionAggregator(actionTitle: String, val parent: ObjectAggregator? = ResourceProxy().fetch(it, this, referrer = referrer) } } - collection.value.forEach { + collection.value!!.forEach { ResourceProxy().fetch(it, this, referrer = referrer) } } diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/ObjectAggregator.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/ObjectAggregator.kt index c5d7a13d5b..0a6f82e0a2 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/ObjectAggregator.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/aggregator/ObjectAggregator.kt @@ -21,11 +21,10 @@ package org.apache.isis.client.kroviz.core.aggregator import org.apache.isis.client.kroviz.core.event.LogEntry import org.apache.isis.client.kroviz.core.event.ResourceProxy import org.apache.isis.client.kroviz.core.model.CollectionDM -import org.apache.isis.client.kroviz.core.model.DisplayModelWithLayout import org.apache.isis.client.kroviz.core.model.ObjectDM import org.apache.isis.client.kroviz.layout.Layout import org.apache.isis.client.kroviz.to.* -import org.apache.isis.client.kroviz.to.bs3.Grid +import org.apache.isis.client.kroviz.to.bs.Grid import org.apache.isis.client.kroviz.ui.core.ViewManager import org.apache.isis.client.kroviz.ui.dialog.ErrorDialog @@ -44,11 +43,6 @@ class ObjectAggregator(val actionTitle: String) : AggregatorWithLayout() { } override fun update(logEntry: LogEntry, subType: String?) { - if (logEntry.url.contains("object-layout")) { - console.log("[OA.update]") - console.log(logEntry) - console.log(subType) - } super.update(logEntry, subType) if (!logEntry.isUpdatedFromParentedCollection()) { val referrer = logEntry.url @@ -80,7 +74,7 @@ class ObjectAggregator(val actionTitle: String) : AggregatorWithLayout() { } } - fun handleObject(obj: TObject, referrer : String) { + fun handleObject(obj: TObject, referrer: String) { // After ~/action/invoke is called, the actual object instance (containing properties) needs to be invoked as well. // Note that rel.self/href is identical and both are of type TObject. logEntry.url is different, though. if (obj.getProperties().size == 0) { @@ -121,10 +115,6 @@ class ObjectAggregator(val actionTitle: String) : AggregatorWithLayout() { val aggregator = CollectionAggregator(key, this) collectionMap.put(key, aggregator) val link = it.links.first() - console.log("[OA.handleCollections]") - console.log(link) - console.log(aggregator) - console.log(referrer) ResourceProxy().fetch(link, aggregator, referrer = referrer) } } @@ -135,14 +125,6 @@ class ObjectAggregator(val actionTitle: String) : AggregatorWithLayout() { // throw Throwable("[ObjectAggregator.handleProperty] not implemented yet") } - private fun handleGrid(grid: Grid, dm: DisplayModelWithLayout, referrer: String) { - console.log("[AWL.handleGrid]") - console.log(grid) - console.log(dm) - console.log(referrer) - (dpm as ObjectDM).grid = grid - } - override fun reset(): ObjectAggregator { dpm.isRendered = false return this diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/LogEntry.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/LogEntry.kt index 2c36f441f4..8e1801d4ca 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/LogEntry.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/LogEntry.kt @@ -25,7 +25,7 @@ import kotlinx.serialization.Serializable import org.apache.isis.client.kroviz.core.aggregator.ActionDispatcher import org.apache.isis.client.kroviz.core.aggregator.BaseAggregator import org.apache.isis.client.kroviz.to.* -import org.apache.isis.client.kroviz.to.bs3.Grid +import org.apache.isis.client.kroviz.to.bs.Grid import org.apache.isis.client.kroviz.to.mb.Menubars import org.apache.isis.client.kroviz.ui.core.Constants import org.apache.isis.client.kroviz.ui.core.ViewManager @@ -186,8 +186,6 @@ data class LogEntry( this.type = extractType(to) } is Grid -> { - console.log("[LE.setTransferObject]Layout/Grid") - console.log(response) this.type = Relation.LAYOUT.type } is Icon -> { diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/model/DisplayModelWithLayout.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/model/DisplayModelWithLayout.kt index 3dede81daf..e0087b8117 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/model/DisplayModelWithLayout.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/model/DisplayModelWithLayout.kt @@ -23,7 +23,7 @@ import org.apache.isis.client.kroviz.layout.RowLt import org.apache.isis.client.kroviz.to.Icon import org.apache.isis.client.kroviz.to.Property import org.apache.isis.client.kroviz.to.TransferObject -import org.apache.isis.client.kroviz.to.bs3.Grid +import org.apache.isis.client.kroviz.to.bs.Grid abstract class DisplayModelWithLayout : BaseDisplayModel() { diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/handler/LayoutXmlHandler.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/handler/LayoutXmlHandler.kt index 12012f417c..b8b37f7e82 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/handler/LayoutXmlHandler.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/handler/LayoutXmlHandler.kt @@ -19,7 +19,7 @@ package org.apache.isis.client.kroviz.handler import org.apache.isis.client.kroviz.to.TransferObject -import org.apache.isis.client.kroviz.to.bs3.Grid +import org.apache.isis.client.kroviz.to.bs.Grid import org.apache.isis.client.kroviz.utils.UrlUtils import org.apache.isis.client.kroviz.utils.XmlHelper diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Action.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Action.kt similarity index 63% rename from incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Action.kt rename to incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Action.kt index a1fd9a999f..f8936117b4 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Action.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Action.kt @@ -16,12 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.isis.client.kroviz.to.bs3 +package org.apache.isis.client.kroviz.to.bs import org.w3c.dom.Node import org.w3c.dom.asList -class Action(node: Node) { +class Action(node: Node) : XmlLayout() { var bookmarking: String //BookmarkPolicy? = null use ENUM var cssClass: String var cssClassFa: String @@ -31,29 +31,36 @@ class Action(node: Node) { var position: String //USE ENUM Position? = null var named = "" var describedAs = "" + var linkList = mutableListOf<Link>() init { val dyNode = node.asDynamic() - bookmarking = dyNode.getAttribute("bookmarking") - cssClass = dyNode.getAttribute("cssClass") - cssClassFa = dyNode.getAttribute("cssClassFa") - cssClassFaPosition = dyNode.getAttribute("cssClassFaPosition") - hidden = dyNode.getAttribute("hidden") - id = dyNode.getAttribute("id") - position = dyNode.getAttribute("position") - named = dyNode.getAttribute("named") - describedAs = dyNode.getAttribute("describedAs") + bookmarking = dyNode.getAttribute("bookmarking") as String + cssClass = dyNode.getAttribute("cssClass") as String + cssClassFa = dyNode.getAttribute("cssClassFa") as String + cssClassFaPosition = dyNode.getAttribute("cssClassFaPosition") as String + hidden = dyNode.getAttribute("hidden") as String + id = dyNode.getAttribute("id") as String + position = dyNode.getAttribute("position") as String + named = dyNode.getAttribute("named") as String + describedAs = dyNode.getAttribute("describedAs") as String val nodeList = node.childNodes.asList() - val namedList = nodeList.filter { it.nodeName.equals("cpt:named") } + val namedList = nodeList.filter { it.nodeName == "$nsCpt:named" } if (namedList.isNotEmpty()) { val n = namedList.first() named = n.textContent as String } - val describedAsList = nodeList.filter { it.nodeName.equals("cpt:describedAs") } + val describedAsList = nodeList.filter { it.nodeName == "$nsCpt:describedAs" } if (describedAsList.isNotEmpty()) { val n = describedAsList.first() describedAs = n.textContent as String } + val lList = nodeList.filter { it.nodeName == "$nsCpt:link" } + for (n: Node in lList) { + val link = Link(n) + linkList.add(link) + } } + } diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Col.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Col.kt similarity index 64% rename from incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Col.kt rename to incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Col.kt index 8c6d84a749..bae7402449 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Col.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Col.kt @@ -16,12 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.isis.client.kroviz.to.bs3 +package org.apache.isis.client.kroviz.to.bs import org.w3c.dom.Node import org.w3c.dom.asList -class Col(node: Node) { +class Col(node: Node) : XmlLayout() { val rowList = mutableListOf<Row>() var domainObject: DomainObject? = null var actionList = mutableListOf<Action>() @@ -32,40 +32,40 @@ class Col(node: Node) { init { val dyNode = node.asDynamic() - span = dyNode.getAttribute("span") + span = dyNode.getAttribute("span") as Int val nl = node.childNodes.asList() - val rl = nl.filter { it.nodeName.equals("bs3row") } + val rl = nl.filter { it.nodeName == "$nsBs:row" } for (n: Node in rl) { val row = Row(n) rowList.add(row) } - val doNodes = nl.filter { it.nodeName.equals("cpt:domainObject") } - if (!doNodes.isEmpty()) { + val doNodes = nl.filter { it.nodeName == "$nsCpt:domainObject" } + if (doNodes.isNotEmpty()) { domainObject = DomainObject(doNodes.first()) } - val actNodes = nl.filter { it.nodeName.equals("cpt:action") } + val actNodes = nl.filter { it.nodeName == "$nsCpt:action" } for (n: Node in actNodes) { val act = Action(n) actionList.add(act) } - val tgNodes = nl.filter { it.nodeName.equals("bs:tabGroup") } + val tgNodes = nl.filter { it.nodeName == "$nsBs:tabGroup" } for (n: Node in tgNodes) { val tg = TabGroup(n) tabGroupList.add(tg) } - val fsNodes = nl.filter { it.nodeName.equals("cpt:fieldSet") } + val fsNodes = nl.filter { it.nodeName == "$nsCpt:fieldSet" } for (n: Node in fsNodes) { val fs = FieldSet(n) fieldSetList.add(fs) } - val collNodes = nl.filter { it.nodeName.equals("cpt:collection") } + val collNodes = nl.filter { it.nodeName == "$nsCpt:collection" } for (n: Node in collNodes) { val c = Collection(n) collectionList.add(c) @@ -74,14 +74,28 @@ class Col(node: Node) { fun getPropertyList(): List<Property> { val list = mutableListOf<Property>() + rowList.forEach { r -> + list.addAll(r.getPropertyList()) + } fieldSetList.forEach { fs -> list.addAll(fs.propertyList) } tabGroupList.forEach { tg -> list.addAll(tg.getPropertyList()) } - console.log("[CB.getPropertyList]") return list } + override fun toString(): String { + val c = this::class.simpleName!! + return c + "\n" + + "rowList: " + rowList.size + "\n" + + "domainObject: " + domainObject.toString() + "\n" + + "actionList: " + actionList.size + "\n" + + "tabGroupList: " + tabGroupList.size + "\n" + + "fieldSetList: " + fieldSetList.size + "\n" + + "collectionList: " + collectionList.size + "\n" + + "span: " + span + "\n" + } + } diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Collection.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Collection.kt similarity index 50% rename from incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Collection.kt rename to incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Collection.kt index f66a1a45dc..370b8bcb10 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Collection.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Collection.kt @@ -16,12 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.isis.client.kroviz.to.bs3 +package org.apache.isis.client.kroviz.to.bs import org.w3c.dom.Node import org.w3c.dom.asList -class Collection(node: Node) { +class Collection(node: Node) : XmlLayout() { var bookmarking: String //BookmarkPolicy? = null use ENUM var cssClass: String var cssClassFa: String @@ -31,29 +31,52 @@ class Collection(node: Node) { var position: String //USE ENUM Position? = null var named = "" var describedAs = "" + var linkList = mutableListOf<Link>() init { val dyNode = node.asDynamic() - bookmarking = dyNode.getAttribute("bookmarking") - cssClass = dyNode.getAttribute("cssClass") - cssClassFa = dyNode.getAttribute("cssClassFa") - cssClassFaPosition = dyNode.getAttribute("cssClassFaPosition") - hidden = dyNode.getAttribute("hidden") - id = dyNode.getAttribute("id") - position = dyNode.getAttribute("position") - named = dyNode.getAttribute("named") - describedAs = dyNode.getAttribute("describedAs") + bookmarking = dyNode.getAttribute("bookmarking") as String + cssClass = dyNode.getAttribute("cssClass") as String + cssClassFa = dyNode.getAttribute("cssClassFa") as String + cssClassFaPosition = dyNode.getAttribute("cssClassFaPosition") as String + hidden = dyNode.getAttribute("hidden") as String + id = dyNode.getAttribute("id") as String + position = dyNode.getAttribute("position") as String + named = dyNode.getAttribute("named") as String + describedAs = dyNode.getAttribute("describedAs") as String val nodeList = node.childNodes.asList() - val namedList = nodeList.filter { it.nodeName.equals("cpt:named") } + + val namedList = nodeList.filter { it.nodeName == "$nsCpt:named" } if (namedList.isNotEmpty()) { val n = namedList.first() named = n.textContent as String } - val describedAsList = nodeList.filter { it.nodeName.equals("cpt:describedAs") } + val describedAsList = nodeList.filter { it.nodeName == "$nsCpt:describedAs" } if (describedAsList.isNotEmpty()) { val n = describedAsList.first() describedAs = n.textContent as String } + val lList = nodeList.filter { it.nodeName == "$nsCpt:link" } + for (n: Node in lList) { + val link = Link(n) + linkList.add(link) + } } + + override fun toString(): String { + val c = this::class.simpleName!! + return c + "\n" + + "bookmarking: " + bookmarking + "\n" + + "cssClass: " + cssClass + "\n" + + "cssClassFa: " + cssClassFa + "\n" + + "cssClassFaPosition: " + cssClassFaPosition + "\n" + + "hidden: " + hidden + "\n" + + "id: " + id + "\n" + + "position: " + position + "\n" + + "named: " + named + "\n" + + "describedAs: " + describedAs + "\n" + + "linkList: " + linkList.size + "\n" + } + } diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/DomainObject.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/DomainObject.kt similarity index 97% rename from incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/DomainObject.kt rename to incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/DomainObject.kt index 729fc32d7f..bdcceed822 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/DomainObject.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/DomainObject.kt @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.isis.client.kroviz.to.bs3 +package org.apache.isis.client.kroviz.to.bs import org.apache.isis.client.kroviz.utils.XmlHelper import org.w3c.dom.Node diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/FieldSet.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/FieldSet.kt similarity index 82% rename from incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/FieldSet.kt rename to incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/FieldSet.kt index 6c02044f79..eea5ce0832 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/FieldSet.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/FieldSet.kt @@ -16,12 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.isis.client.kroviz.to.bs3 +package org.apache.isis.client.kroviz.to.bs import org.w3c.dom.Node import org.w3c.dom.asList -class FieldSet(node: Node) { +class FieldSet(node: Node) : XmlLayout() { var actionList = mutableListOf<Action>() var propertyList = mutableListOf<Property>() var name: String = "" @@ -29,20 +29,20 @@ class FieldSet(node: Node) { init { val dyNode = node.asDynamic() - if (dyNode.hasOwnProperty("name")) { + if (dyNode.hasOwnProperty("name") as Boolean) { name = dyNode.getAttribute("name") as String } - if (dyNode.hasOwnProperty("id")) { + if (dyNode.hasOwnProperty("id") as Boolean) { id = dyNode.getAttribute("id") as String } val nl = node.childNodes.asList() - val actList = nl.filter { it.nodeName.equals("cpt:action") } + val actList = nl.filter { it.nodeName == "$nsCpt:action" } for (n: Node in actList) { val act = Action(n) actionList.add(act) } - val pNl = nl.filter { it.nodeName.equals("cpt:property") } + val pNl = nl.filter { it.nodeName == "$nsCpt:property" } for (n: Node in pNl) { val p = Property(n) if (p.hidden != "") { diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Grid.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Grid.kt similarity index 80% rename from incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Grid.kt rename to incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Grid.kt index 19214540b6..71ee0e1256 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Grid.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Grid.kt @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.isis.client.kroviz.to.bs3 +package org.apache.isis.client.kroviz.to.bs import org.apache.isis.client.kroviz.to.TransferObject import org.w3c.dom.Document @@ -30,18 +30,26 @@ import org.w3c.dom.asList * * there may be N other rows as well * Please note, that rows may be children of Tab as well (recursive) */ -class Grid(document: Document) : TransferObject { +class Grid(document: Document) : XmlLayout(), TransferObject { var rows = ArrayList<Row>() init { val root = document.firstChild!! val kids = root.childNodes val rowNodes = kids.asList() - val rowList = rowNodes.filter { it.nodeName.equals("bs:row") } + val rowList = rowNodes.filter { it.nodeName == "$nsBs:row" } for (n: Node in rowList) { val row = Row(n) rows.add(row) } } + fun getPropertyList(): List<Property> { + val list = mutableListOf<Property>() + rows.forEach { r -> + list.addAll(r.getPropertyList()) + } + return list + } + } diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Link.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Link.kt similarity index 70% rename from incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Link.kt rename to incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Link.kt index c4923a0ddc..848ae9f21a 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Link.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Link.kt @@ -16,12 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.isis.client.kroviz.to.bs3 +package org.apache.isis.client.kroviz.to.bs import org.w3c.dom.Node import org.w3c.dom.asList -class Link(node: Node) { +class Link(node: Node) : XmlLayout() { lateinit var rel: String lateinit var method: String lateinit var href: String @@ -30,29 +30,38 @@ class Link(node: Node) { init { val nodeList = node.childNodes.asList() - val relList = nodeList.filter { it.nodeName.equals("lnk:rel") } + val relList = nodeList.filter { it.nodeName == "$nsLnk:rel" } if (relList.isNotEmpty()) { val n = relList.first() rel = n.textContent as String } - val methodList = nodeList.filter { it.nodeName.equals("lnk:method") } + val methodList = nodeList.filter { it.nodeName == "$nsLnk:method" } if (methodList.isNotEmpty()) { val n = methodList.first() method = n.textContent as String } - val hrefList = nodeList.filter { it.nodeName.equals("lnk:href") } + val hrefList = nodeList.filter { it.nodeName == "$nsLnk:href" } if (hrefList.isNotEmpty()) { val n = hrefList.first() href = n.textContent as String } - val typeList = nodeList.filter { it.nodeName.equals("lnk:type") } + val typeList = nodeList.filter { it.nodeName == "$nsLnk:type" } if (typeList.isNotEmpty()) { val n = typeList.first() type = n.textContent as String } } + override fun toString(): String { + val c = this::class.simpleName!! + return c + "\n" + + "rel: " + rel + "\n" + + "method: " + method + "\n" + + "href: " + href + "\n" + + "type: " + type + "\n" + } + } diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Property.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Property.kt similarity index 77% rename from incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Property.kt rename to incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Property.kt index d1683b2718..c57185c277 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Property.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Property.kt @@ -16,14 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.isis.client.kroviz.to.bs3 +package org.apache.isis.client.kroviz.to.bs import org.apache.isis.client.kroviz.to.Link import org.w3c.dom.Node import org.w3c.dom.asList //IMPROVE class differs in many aspects from org.ro.to.Property - to be refactored? -class Property(node: Node) { +class Property(node: Node) : XmlLayout() { var id: String var named = "" var link: Link? = null @@ -35,26 +35,26 @@ class Property(node: Node) { init { val dn = node.asDynamic() - hidden = dn.getAttribute("hidden") + hidden = dn.getAttribute("hidden") as String id = dn.getAttribute("id") as String - typicalLength = dn.getAttribute("typicalLength") - multiLine = dn.getAttribute("multiLine") - describedAs = dn.getAttribute("describedAs") + typicalLength = dn.getAttribute("typicalLength") as Int + multiLine = dn.getAttribute("multiLine") as Int + describedAs = dn.getAttribute("describedAs") as String val nodeList = node.childNodes.asList() - val namedList = nodeList.filter { it.nodeName.equals("cpt:named") } + val namedList = nodeList.filter { it.nodeName == "$nsCpt:named" } if (namedList.isNotEmpty()) { val n = namedList.first() named = n.textContent as String } - val actList = nodeList.filter { it.nodeName.equals("cpt:action") } + val actList = nodeList.filter { it.nodeName == "$nsCpt:action" } if (actList.isNotEmpty()) { val n = actList.first() action = Action(n) } - val linkList = nodeList.filter { it.nodeName.equals("cpt:link") } + val linkList = nodeList.filter { it.nodeName == "$nsCpt:link" } if (linkList.isNotEmpty()) { val n = linkList.first() val bs3l = Link(n) diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Row.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Row.kt similarity index 87% rename from incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Row.kt rename to incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Row.kt index f473d9a5df..5986cbd80b 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Row.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Row.kt @@ -16,23 +16,23 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.isis.client.kroviz.to.bs3 +package org.apache.isis.client.kroviz.to.bs import org.apache.isis.client.kroviz.utils.XmlHelper import org.w3c.dom.Node -class Row(node: Node) { +class Row(node: Node) : XmlLayout() { val colList = mutableListOf<Col>() var id: String = "" init { val dyNode = node.asDynamic() - if (dyNode.hasOwnProperty("id")) { + if (dyNode.hasOwnProperty("id") as Boolean) { id = dyNode.getAttribute("id") as String } val nodeList = XmlHelper.nonTextChildren(node) - val cl = nodeList.filter { it.nodeName.equals("bs:col") } + val cl = nodeList.filter { it.nodeName == "$nsBs:col" } for (n: Node in cl) { val col = Col(n) colList.add(col) diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Tab.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Tab.kt similarity index 90% rename from incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Tab.kt rename to incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Tab.kt index f675597c62..ab05af3e0e 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/Tab.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/Tab.kt @@ -16,12 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.isis.client.kroviz.to.bs3 +package org.apache.isis.client.kroviz.to.bs import org.w3c.dom.Node import org.w3c.dom.asList -class Tab(node: Node) { +class Tab(node: Node) : XmlLayout() { val rowList = mutableListOf<Row>() var name: String @@ -31,7 +31,7 @@ class Tab(node: Node) { val nl = node.childNodes.asList() - val rNodes = nl.filter { it.nodeName.equals("bs:row") } + val rNodes = nl.filter { it.nodeName == "$nsBs:row" } for (n: Node in rNodes) { val row = Row(n) rowList.add(row) diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/TabGroup.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/TabGroup.kt similarity index 87% rename from incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/TabGroup.kt rename to incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/TabGroup.kt index f4bd26ca0f..240d6b45ad 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs3/TabGroup.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/TabGroup.kt @@ -16,12 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.isis.client.kroviz.to.bs3 +package org.apache.isis.client.kroviz.to.bs import org.w3c.dom.Node import org.w3c.dom.asList -class TabGroup(node: Node) { +class TabGroup(node: Node) : XmlLayout() { var tabList = mutableListOf<Tab>() lateinit var metadataError: String lateinit var cssClass: String @@ -29,9 +29,9 @@ class TabGroup(node: Node) { init { val nodeList = node.childNodes.asList() - val tnList = nodeList.filter { it.nodeName.equals("bs:tab") } + val tnList = nodeList.filter { it.nodeName == "$nsBs:tab" } for (n: Node in tnList) { - val tab =Tab(n) + val tab = Tab(n) tabList.add(tab) } } diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/LayoutBuilder.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/XmlLayout.kt similarity index 64% copy from incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/LayoutBuilder.kt copy to incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/XmlLayout.kt index 1bc51fc14d..600262bda8 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/LayoutBuilder.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/to/bs/XmlLayout.kt @@ -16,22 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.isis.client.kroviz.ui.builder - -import io.kvision.panel.VPanel -import org.apache.isis.client.kroviz.to.TObject -import org.apache.isis.client.kroviz.to.bs3.Grid - -class LayoutBuilder { - - fun create(grid: Grid, tObject: TObject, dsp: RoDisplay): VPanel { - val panel = VPanel() - for (rl in grid.rows) { - val cpt = RowBuilder().create(rl, tObject, dsp) - panel.add(cpt) - } - return panel - } - -} +package org.apache.isis.client.kroviz.to.bs +abstract class XmlLayout { + // nameSpaces + val nsBs = "bs" + val nsCpt = "cpt" + val nsLnk = "lnk" +} \ No newline at end of file diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/ColBuilder.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/ColBuilder.kt index b6766528d6..16f5713d85 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/ColBuilder.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/ColBuilder.kt @@ -24,7 +24,7 @@ import io.kvision.panel.FlexPanel import io.kvision.panel.HPanel import io.kvision.panel.SimplePanel import org.apache.isis.client.kroviz.to.TObject -import org.apache.isis.client.kroviz.to.bs3.Col +import org.apache.isis.client.kroviz.to.bs.Col import org.apache.isis.client.kroviz.ui.core.Constants import org.apache.isis.client.kroviz.ui.core.RoTable import org.apache.isis.client.kroviz.ui.menu.DropDownMenuBuilder diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/FieldSetBuilder.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/FieldSetBuilder.kt index 744af773f8..0e538794c0 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/FieldSetBuilder.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/FieldSetBuilder.kt @@ -21,7 +21,7 @@ package org.apache.isis.client.kroviz.ui.builder import io.kvision.form.FormPanel import org.apache.isis.client.kroviz.to.TObject import org.apache.isis.client.kroviz.to.TypeMapper -import org.apache.isis.client.kroviz.to.bs3.FieldSet +import org.apache.isis.client.kroviz.to.bs.FieldSet import org.apache.isis.client.kroviz.ui.core.FormItem import org.apache.isis.client.kroviz.ui.core.FormPanelFactory diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/LayoutBuilder.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/LayoutBuilder.kt index 1bc51fc14d..1e930ecf83 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/LayoutBuilder.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/LayoutBuilder.kt @@ -20,7 +20,7 @@ package org.apache.isis.client.kroviz.ui.builder import io.kvision.panel.VPanel import org.apache.isis.client.kroviz.to.TObject -import org.apache.isis.client.kroviz.to.bs3.Grid +import org.apache.isis.client.kroviz.to.bs.Grid class LayoutBuilder { diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/RowBuilder.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/RowBuilder.kt index c537eb6938..28e798d253 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/RowBuilder.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/RowBuilder.kt @@ -22,7 +22,7 @@ import io.kvision.core.* import io.kvision.panel.FlexPanel import io.kvision.panel.SimplePanel import org.apache.isis.client.kroviz.to.TObject -import org.apache.isis.client.kroviz.to.bs3.Row +import org.apache.isis.client.kroviz.to.bs.Row import org.apache.isis.client.kroviz.ui.core.Constants class RowBuilder : UiBuilder() { diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/TabBuilder.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/TabBuilder.kt index 30aab37410..b97a65dd72 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/TabBuilder.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/TabBuilder.kt @@ -19,7 +19,7 @@ package org.apache.isis.client.kroviz.ui.builder import org.apache.isis.client.kroviz.to.TObject -import org.apache.isis.client.kroviz.to.bs3.Tab +import org.apache.isis.client.kroviz.to.bs.Tab import io.kvision.core.Component import io.kvision.panel.SimplePanel diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/TabGroupBuilder.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/TabGroupBuilder.kt index 02aca31299..18d5f02ee4 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/TabGroupBuilder.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/builder/TabGroupBuilder.kt @@ -19,7 +19,7 @@ package org.apache.isis.client.kroviz.ui.builder import org.apache.isis.client.kroviz.to.TObject -import org.apache.isis.client.kroviz.to.bs3.TabGroup +import org.apache.isis.client.kroviz.to.bs.TabGroup import io.kvision.core.Component import io.kvision.panel.TabPanel diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/diagram/LayoutDiagram.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/diagram/LayoutDiagram.kt index 6654da6743..1a9920395d 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/diagram/LayoutDiagram.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/diagram/LayoutDiagram.kt @@ -18,9 +18,9 @@ */ package org.apache.isis.client.kroviz.ui.diagram -import org.apache.isis.client.kroviz.to.bs3.Col -import org.apache.isis.client.kroviz.to.bs3.Grid -import org.apache.isis.client.kroviz.to.bs3.Row +import org.apache.isis.client.kroviz.to.bs.Col +import org.apache.isis.client.kroviz.to.bs.Grid +import org.apache.isis.client.kroviz.to.bs.Row object LayoutDiagram { diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/EventLogDetail.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/EventLogDetail.kt index 112b137760..9b6d93bb62 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/EventLogDetail.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/EventLogDetail.kt @@ -21,7 +21,7 @@ package org.apache.isis.client.kroviz.ui.dialog import org.apache.isis.client.kroviz.core.event.LogEntry import org.apache.isis.client.kroviz.core.event.ResourceSpecification import org.apache.isis.client.kroviz.to.ValueType -import org.apache.isis.client.kroviz.to.bs3.Grid +import org.apache.isis.client.kroviz.to.bs.Grid import org.apache.isis.client.kroviz.ui.core.Constants import org.apache.isis.client.kroviz.ui.core.FormItem import org.apache.isis.client.kroviz.ui.core.RoDialog diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/LoginPrompt.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/LoginPrompt.kt index 6841e4a4bb..b6ed5cdf3c 100644 --- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/LoginPrompt.kt +++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/LoginPrompt.kt @@ -37,8 +37,8 @@ class LoginPrompt(val nextController: Controller? = null) : Controller() { override fun open() { val formItems = mutableListOf<FormItem>() val urlList = mutableListOf<StringPair>() - urlList.add(StringPair(Constants.demoUrl8, Constants.demoUrl8)) urlList.add(StringPair(Constants.demoUrl9, Constants.demoUrl9)) + urlList.add(StringPair(Constants.demoUrl8, Constants.demoUrl8)) urlList.add(StringPair(Constants.demoUrlRemote, Constants.demoUrlRemote)) urlList.add(StringPair(Constants.domoxUrl, Constants.domoxUrl)) formItems.add(FormItem("Url", ValueType.SIMPLE_SELECT, urlList)) diff --git a/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/layout/LayoutXmlTest.kt b/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/layout/LayoutXmlTest.kt deleted file mode 100644 index 930677f203..0000000000 --- a/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/layout/LayoutXmlTest.kt +++ /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.client.kroviz.layout - -import org.apache.isis.client.kroviz.IntegrationTest -import org.apache.isis.client.kroviz.handler.LayoutXmlHandler -import org.apache.isis.client.kroviz.snapshots.demo2_0_0.STRINGS_LAYOUT_XML_BS3 -import org.apache.isis.client.kroviz.snapshots.demo2_0_0.STRINGS_LAYOUT_XML_BS -import org.apache.isis.client.kroviz.to.bs3.Grid -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertNotNull -import kotlin.test.assertTrue - -class LayoutXmlTest : IntegrationTest() { - - @Test - fun testStringsLayout_BS() { - //given - val xmlStr = STRINGS_LAYOUT_XML_BS.str - //when - val layout = LayoutXmlHandler().parse(xmlStr) as Grid - // then - assertNotNull(layout) // - assertEquals(2, layout.rows.size) - - val r1 = layout.rows[0] - assertEquals(1, r1.colList.size) - - val r2 = layout.rows[1] - } - -} diff --git a/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/snapshots/demo2_0_0/OBJECT_COLLECTION2.kt b/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/snapshots/demo2_0_0/OBJECT_COLLECTION2.kt new file mode 100644 index 0000000000..4da3735434 --- /dev/null +++ b/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/snapshots/demo2_0_0/OBJECT_COLLECTION2.kt @@ -0,0 +1,53 @@ +/* + * 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.client.kroviz.snapshots.demo2_0_0 + +import org.apache.isis.client.kroviz.snapshots.Response + +object OBJECT_COLLECTION2: Response(){ + override val url = "http://localhost:8080/restful/objects/demo.JavaLangStrings/PADw_eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04IiBzdGFuZGFsb25lPSJ5ZXMiPz4KPERlbW8vPgo=/collections/entities" + override val str = """ +{ + "id" : "objects", + "memberType" : "collection", + "links" : [ { + "rel" : "self", + "href" : "http://localhost:9090/restful/objects/isis.applib.DomainObjectList/PAR-LCAAAAAAAAACFkMFOwzAMhu99iih3knFDU5uJy6QhEIeNBwip1WVKnFJ7g709jspgggM5Ob9_f7_ldvWRkzrBRLFgp2_NQivAUPqIQ6dfduubO62IPfY-FYROn4H0yjVtisRKZpGWoeRO75nHpbWRIhk_-rAHU6bBkhTZW7Hkgto1Sl7LkRO4hXrwJ68ePQ5qy5MEElBr5-Zs9IFlred3lOb6LaDrIRc_jqYv2fB5BDIHYSRBmAqrrF2VnwCPrf0zfk3d9I7m1ItRlGvD_TQcMyCTuxh-lNkHCeq3Jv633VfU95bbS_RvxkwurwcITFYObeulXfMJyMCkw6kBAAA=/collections/objects", + "method" : "GET", + "type" : "application/json;profile=\"urn:org.restfulobjects:repr-types/object-collection\"" + }, { + "rel" : "up", + "href" : "http://localhost:9090/restful/objects/isis.applib.DomainObjectList/PAR-LCAAAAAAAAACFkMFOwzAMhu99iih3knFDU5uJy6QhEIeNBwip1WVKnFJ7g709jspgggM5Ob9_f7_ldvWRkzrBRLFgp2_NQivAUPqIQ6dfduubO62IPfY-FYROn4H0yjVtisRKZpGWoeRO75nHpbWRIhk_-rAHU6bBkhTZW7Hkgto1Sl7LkRO4hXrwJ68ePQ5qy5MEElBr5-Zs9IFlred3lOb6LaDrIRc_jqYv2fB5BDIHYSRBmAqrrF2VnwCPrf0zfk3d9I7m1ItRlGvD_TQcMyCTuxh-lNkHCeq3Jv633VfU95bbS_RvxkwurwcITFYObeulXfMJyMCkw6kBAAA=", + "method" : "GET", + "type" : "application/json;profile=\"urn:org.restfulobjects:repr-types/object\"", + "title" : "Domain Object List" + }, { + "rel" : "describedby", + "href" : "http://localhost:9090/restful/domain-types/isis.applib.DomainObjectList/collections/objects", + "method" : "GET", + "type" : "application/json;profile=\"urn:org.restfulobjects:repr-types/collection-description\"" + } ], + "extensions" : { + "collectionSemantics" : "list" + }, + "value" : [ ] +} +""" +} diff --git a/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/to/CollectionTest.kt b/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/to/CollectionTest.kt index 12c01f7732..af4074b75a 100644 --- a/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/to/CollectionTest.kt +++ b/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/to/CollectionTest.kt @@ -21,11 +21,31 @@ package org.apache.isis.client.kroviz.to import org.apache.isis.client.kroviz.IntegrationTest import org.apache.isis.client.kroviz.handler.CollectionHandler import org.apache.isis.client.kroviz.snapshots.demo2_0_0.OBJECT_COLLECTION +import org.apache.isis.client.kroviz.snapshots.demo2_0_0.OBJECT_COLLECTION2 import kotlin.test.Test import kotlin.test.assertEquals class CollectionTest : IntegrationTest() { + @Test + fun testParse2() { + //given + val jsonStr = OBJECT_COLLECTION2.str + //when + val collection = CollectionHandler().parse(jsonStr) as Collection + //then + assertEquals("objects", collection.id) + assertEquals("collection", collection.memberType) + + val linkList = collection.links + assertEquals(3, linkList.size) + + assertEquals("list", collection.extensions.collectionSemantics) + + val valueList = collection.value + assertEquals(0, valueList.size) + } + @Test fun testParse() { //given diff --git a/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/to/bs3/LayoutXmlTest.kt b/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/to/bs/LayoutXmlTest.kt similarity index 56% rename from incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/to/bs3/LayoutXmlTest.kt rename to incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/to/bs/LayoutXmlTest.kt index 041f3e317b..114d637cb5 100644 --- a/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/to/bs3/LayoutXmlTest.kt +++ b/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/to/bs/LayoutXmlTest.kt @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.isis.client.kroviz.to.bs3 +package org.apache.isis.client.kroviz.to.bs import org.apache.isis.client.kroviz.handler.LayoutXmlHandler import org.apache.isis.client.kroviz.snapshots.demo2_0_0.STRINGS_LAYOUT_XML @@ -24,6 +24,7 @@ import org.apache.isis.client.kroviz.snapshots.demo2_0_0.TAB_LAYOUT_XML import org.apache.isis.client.kroviz.snapshots.simpleapp1_16_0.SO_LAYOUT_XML import kotlin.test.Test import kotlin.test.assertEquals +import kotlin.test.assertTrue class LayoutXmlTest { @@ -34,25 +35,63 @@ class LayoutXmlTest { //when val grid = LayoutXmlHandler().parse(xmlStr) as Grid // then - assertEquals(3, grid.rows.size, message = "grid.rows.size") //1 + assertEquals(2, grid.rows.size, message = "grid.rows.size") //1 - val primaryRow = grid.rows[1] - assertEquals(2, primaryRow.colList.size, message = "primaryRow.colList.size") //2 + val r2 = grid.rows[1] + assertEquals(2, r2.colList.size, message = "r2.colList.size") //2 - val primaryCol = primaryRow.colList[0] - assertEquals(1, primaryCol.rowList.size, message = "primaryCol.rowList.size") //3 + val r2c1 = r2.colList[0] + assertEquals("4", r2c1.span.toString(), message = "r2c1.span") //3a + assertEquals(2, r2c1.rowList.size, message = "r2c1.rowList.size") //3b - val secondaryRow = primaryCol.rowList[0] - assertEquals(2, secondaryRow.colList.size, message = "secondaryRow.colList.size") //4 + val r2c1r1 = r2c1.rowList[0] + assertEquals(1, r2c1r1.colList.size, message = "r2c1r1.colList.size") //4 - val secondaryCol = secondaryRow.colList[0] - assertEquals("12", secondaryCol.span.toString(), message = "secondaryCol.span") //5 + val r2c1r1c1 = r2c1r1.colList[0] + assertEquals("12", r2c1r1c1.span.toString(), message = "r2c1r1c1.span") //5 - val collectionList = secondaryCol.collectionList + val tabGroupList = r2c1r1c1.tabGroupList + assertEquals(1, tabGroupList.size, message = "tabGroupList.size") //5b + + val tabList = tabGroupList[0].tabList + assertEquals(3, tabList.size, message = "tabList.size") //5c + + val tab3 = tabList[2] + assertEquals("Metadata", tab3.name, message = "tab3.name") //5d + + val tab3r = tab3.rowList + assertEquals(1, tab3r.size, message = "tab3r.size") //5e + + val tab3_r1 = tab3.rowList[0] + assertEquals(1, tab3_r1.colList.size, message = "tab3_r1.colList.size") //5f + + val tab3_r1c1 = tab3_r1.colList[0] + assertEquals("12", tab3_r1c1.span.toString(), message = "tab3_r1c1.span") //5g + + val tab3_r1c1fs1 = tab3_r1c1.fieldSetList[0] + assertEquals(10, tab3_r1c1fs1.actionList.size, message = "tab3_r1c1fs1.actionList.size") //5h + assertEquals(2, tab3_r1c1fs1.propertyList.size, message = "tab3_r1c1fs1.propertyList.size") //5h + + val tab3_r1c1fs1_a10 = tab3_r1c1fs1.actionList[9] + assertEquals("recentAuditTrailEntries", tab3_r1c1fs1_a10.id, message = "tab3_r1c1fs1_a10.id") //5h + assertEquals(1, tab3_r1c1fs1_a10.linkList.size, message = "tab3_r1c1fs1_a10.linkList") //5i + + val tab3_r1c1fs1_a10l1 = tab3_r1c1fs1_a10.linkList[0] + assertTrue(tab3_r1c1fs1_a10l1.type.contains("object-action"), message = "tab3_r1c1fs1_a10l1.type") //5j + + val r2c2 = r2.colList[1] + val r2c2tg1 = r2c2.tabGroupList[0] + val r2c2tg1_tab1 = r2c2tg1.tabList[0] + val r2c2tg1_tab1r1 = r2c2tg1_tab1.rowList[0] + val r2c2tg1_tab1r1c1 = r2c2tg1_tab1r1.colList[0] + val collectionList = r2c2tg1_tab1r1c1.collectionList assertEquals(1, collectionList.size, message = "collectionList.size") //6 val collection = collectionList[0] - assertEquals("entities", collection.id, message = "collection.id") + assertEquals("objects", collection.id, message = "collection.id") //7 + + val collection_l1 = collection.linkList[0] + assertTrue(collection_l1.type.contains("object-collection"), message = "tab3_r1c1fs1_a10l1.type") //8 } @Test @@ -67,7 +106,7 @@ class LayoutXmlTest { // assertEquals(2, grid.rows.size) //1 } - @Test + // @Test nameSpace was renamed from bs3 to bs, SO_LAYOUT_XML needs to be updated fun testParseXmlLayout() { //given val xmlStr = SO_LAYOUT_XML.str