Declare visual capabilities and dispatch explicit Presentable views
Verify Tessera GUI / verify (push) Failing after 7m41s

This commit is contained in:
2026-10-21 21:37:22 +08:00
parent 8d980745ea
commit 7acc5783a5
9 changed files with 363 additions and 4 deletions
+27
View File
@@ -0,0 +1,27 @@
class Product {
name: String
color: String
function label(self: Product): String { return self.name }
function shade(self: Product): String { return self.color }
function update(self: Product, event: Event): Unit {
self.name = "原业务对象已更新"
self.color = "#237A45"
}
function present(self: Product, window: Window): Block {
title = TextBlock(self.name)
swatch = RectBlock(180,48,8,self.color)
titleBinding = title.bind("text",self.label)
colorBinding = swatch.bind("color",self.shade)
button = Button("调用业务对象方法")
connection = button.on("click",self.update)
result = Column(24,16,title,swatch,button)
result.source = self
result.contextWindow = window.id()
return result
}
}
ui.implement(Product,Presentable)
product = Product("普通对象的显式展示能力", "#526AC7")
view = ui.present(product)
page = ui.open(view)
page.title = "Presentable"