Wiki source code of Panels
Last modified by Eleni Cojocariu on 2026/08/28 09:53
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
![]() |
2.1 | 1 | The [[Panels Application>>doc:extensions:Extension.Panels Application]] turns a wiki page carrying a ##Panels.PanelClass## xobject into a UI extension, and the skin templates ask for those extensions when they draw the columns beside the content. Nothing about a Panel is hard-coded: a Panel is a document, and its position is a preference. |
| 2 | |||
| 3 | {{plantuml}} | ||
| 4 | @startuml | ||
| 5 | !theme bluegray | ||
| 6 | skinparam componentStyle rectangle | ||
| 7 | |||
| 8 | component "Panel page\nPanels.PanelClass xobject" as PAGE | ||
| 9 | component "PanelWikiUIExtensionComponentBuilder\nhint = Panels.PanelClass" as BUILDER | ||
| 10 | component "PanelWikiUIExtension\nUIExtension, scope GLOBAL\nextension point platform.panels" as UIX | ||
| 11 | component "LeftPanelsUIExtensionManager\nRightPanelsUIExtensionManager" as MGR | ||
| 12 | component "XWiki.XWikiPreferences\nor Space.WebPreferences" as PREFS | ||
| 13 | component "leftpanels.vm\nrightpanels.vm" as VM | ||
| 14 | |||
| 15 | PAGE --> BUILDER : observed as a wiki component | ||
| 16 | BUILDER --> UIX : builds one per xobject | ||
| 17 | MGR --> UIX : collects every instance | ||
| 18 | PREFS --> MGR : leftPanels, rightPanels | ||
| 19 | VM --> MGR : services.uix.getExtensions | ||
| 20 | @enduml | ||
| 21 | {{/plantuml}} | ||
| 22 | |||
| 23 | The manager is what makes the order predictable: it collects **every** ##UIExtension## registered on ##platform.panels##, keeps those whose document is named in the preference, and then sorts them back into the order the preference lists them in. So a Panel's position comes from the configuration string and never from the order the components happened to register in. | ||
| 24 | |||
| 25 | While a Panel renders, the Panel's own document is bound to ##$paneldoc## and ##$doc## still refers to the page the Panel is displayed on. This is deliberate, and it is what lets a Panel test where it is being shown. The values a Panel's content may rely on are listed in [[Panel Content Macros and Variables>>doc:documentation.xs.dev.panels.content-macros.WebHome]]. | ||
| 26 | |||
| 27 | A Panel is rendered through the asynchronous renderer, so the "Asynchronous rendering", "Cached" and "Context elements" properties of ##Panels.PanelClass## are the ones inherited from the async class rather than anything specific to Panels. The cache key is built from the context elements the Panel declares. |
