3,8 KiB
3,8 KiB
Window-Architektur Cheat Sheet
Klassenhierarchie
wBaseWindow (Wurzel - keine Superklasse)
+-- wMainWindow (eigenstaendige Fenster: wOrders, wParts...)
+-- wSubWindow (eingebettete Panels: wOrder, wOrderItems...)
Wichtigste Instanzvariablen
Auf ALLEN Fenstern (von wBaseWindow):
| Variable | Zweck |
|---|---|
ioCode |
Business-Logik-Objekt |
iiRef2SubWindow |
Referenz auf aktives SubWindow |
ibControl2SubWindow |
kTrue = Commands gehen an SubWindow |
ilList |
Haupt-Datenliste |
irRow |
Aktuelle Datenzeile |
inEDMode |
Bearbeitungsmodus |
icCurrTabPane |
Aktiver Tab-Reiter |
Nur auf wSubWindow:
| Variable | Zweck |
|---|---|
iiRef2Parent |
Referenz ZURUECK zum Elter |
icFormWindow |
Name fuer Rechte-Check |
icSubWindow |
SubWindow-Feldname |
DAS zentrale Pattern: Command-Delegation
## Auf jedem Fenster identisch:
If $cinst.ibControl2SubWindow
Do iiRef2SubWindow.$cXxx() ## -> Weiter ans SubWindow
Else
Do $cinst.ioCode.$cXxx() ## -> Business-Logik
End If
Lebenszyklus
$construct (SubWindow meldet sich an):
Do inherited
Set reference iiRef2SubWindow to $cinst.$objs.wSubWindow.$ref
Set reference iiRef2Parent to pRef2Parent
Do iiRef2Parent.$setControl2SubWindow(kTrue) ## KONTROLLE UEBERNEHMEN
$destruct (SubWindow meldet sich ab):
If iiRef2Parent
Do iiRef2Parent.$setControl2SubWindow(kFalse) ## KONTROLLE ZURUECKGEBEN
End If
Do ilList.$define()
Do irRow.$define()
$closeWindow (delegiert nach oben):
Do iiRef2Parent.$closeWindow() ## Parent schliesst das Fenster
$EnableTabPane (sperrt Tabs nach oben):
Do iiRef2Parent.$EnableTabPane($cinst.inEDMode) ## Parent sperrt seine Tabs
Command-Fluss Beispiel (Sales/wOrders)
User klickt [Edit]
-> wOrders.$cEdit (wMainWindow)
-> $closeRelatedWindow()
-> ibControl2SubWindow = kTrue
-> wOrder.$cEdit (wSubWindow Ebene 1)
-> ibControl2SubWindow = kTrue
-> wOrderItems.$cEdit (wSubWindow Ebene 2)
-> ibControl2SubWindow = kFalse
-> ioCode.$cEdit() == oOrderItems.$cEdit()
-> HIER passiert die Aktion!
Alle delegierten Commands
wMainWindow (mit $closeRelatedWindow):
$cEdit, $cCancel, $cAudit, $cNextVersion
wSubWindow (ohne $closeRelatedWindow):
$cEdit, $cCancel, $cInsert, $cDelete, $cSave, $cPrint, $cAudit, $cNextVersion, $cFirst, $cLast
Referenz-Kette
iiRef2SubWindow iiRef2SubWindow
MainWindow ----------> SubWindow ----------> SubSubWindow
<---------- <----------
iiRef2Parent iiRef2Parent
Cross-Library Vererbung
# Innerhalb solution2-Library:
wMeinFenster extends wSubWindow
# Aus anderer Library (Sales, Manufacturing...):
wMeinFenster extends solution2.wSubWindow ## Library-Prefix noetig!
TabPane-Konvention
TabPane-Objekt heisst IMMER: TP
Zugriff: $cwind.$objs.TP.$enableTabPanes(pEDMode)
7 Goldene Regeln
1. ibControl2SubWindow bestimmt ALLES
2. $construct: inherited aufrufen = Kette aufbauen
3. $destruct: Kontrolle zurueckgeben
4. Commands fliessen ABWAERTS (Main -> Sub -> SubSub)
5. TabPane-Sperren fliessen AUFWAERTS (Sub -> Parent)
6. $closeWindow delegiert AUFWAERTS
7. ioCode ist der letzte Stopp (kein SubWindow aktiv)
Debugging Quick-Check
# 1. Wer hat die Kontrolle?
Calculate lDebug as $cinst.ibControl2SubWindow
# 2. Ist SubWindow-Referenz gueltig?
If iiRef2SubWindow
# Referenz existiert
End If
# 3. Welches SubWindow ist aktiv?
Calculate lClass as iiRef2SubWindow.$classname
# 4. Hat $construct inherited aufgerufen?
# -> Breakpoint in wSubWindow.$construct setzen
# 5. Ist Superklasse korrekt?
# -> Class Inspector -> Superclass pruefen