VDBAbstractContainer.st
changeset 5 fac6e83fd5c0
parent 2 9741a7683808
child 13 d06924d8ca0a
--- a/VDBAbstractContainer.st	Tue Jun 10 01:38:50 2014 +0100
+++ b/VDBAbstractContainer.st	Tue Jun 10 17:46:14 2014 +0100
@@ -1,13 +1,93 @@
 "{ Package: 'jv:vdb' }"
 
 VDBAbstractApplication subclass:#VDBAbstractContainer
-	instanceVariableNames:''
+	instanceVariableNames:'components labels'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'VDB-UI-Abstract'
 !
 
 
+!VDBAbstractContainer class methodsFor:'queries'!
+
+isAbstract
+    "Return if this class is an abstract class.
+     True is returned here for myself only; false for subclasses.
+     Abstract subclasses must redefine again."
+
+    ^ self == VDBAbstractContainer.
+! !
+
+!VDBAbstractContainer methodsFor:'adding & removing components'!
+
+addApplication: anApplicationModel
+    | label |
+
+    label := anApplicationModel perform: #title ifNotUnderstood:[ anApplicationModel class name ].
+    ^ self addApplication: anApplicationModel labeled: label
+
+    "Created: / 10-06-2014 / 14:23:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 10-06-2014 / 16:59:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addApplication: anApplicationModel labeled: aString
+    ^ self addApplication: anApplicationModel labeled: aString beforeIndex: components size + 1
+
+    "Created: / 10-06-2014 / 16:59:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addApplication: anApplicationModel labeled: aString beforeIndex: anInteger
+    | component |
+
+    component := ApplicationSubView new.
+    anApplicationModel createBuilder.
+    anApplicationModel window: component.
+    component client: anApplicationModel.
+    ^ self addComponent: component labeled: aString beforeIndex: anInteger
+
+    "Created: / 10-06-2014 / 16:58:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addComponent: aView labeled: aString 
+    self addComponent: aView labeled: aString beforeIndex: labels size + 1.
+
+    "Created: / 10-06-2014 / 16:39:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addComponent: aView labeled: aString beforeIndex: anInteger
+    labels add: aString beforeIndex: anInteger.
+    components add: aView beforeIndex: anInteger.
+    aView isApplicationSubView ifTrue:[ 
+        aView application debuggerHolder: self debuggerHolder.
+    ].    
+    self assert: labels size == components size.
+
+    "Created: / 10-06-2014 / 16:37:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBAbstractContainer methodsFor:'aspects'!
+
+debuggerHolder:aValueModel
+    super debuggerHolder:aValueModel.
+    components do:[:each | 
+        each isApplicationSubView ifTrue:[ 
+            each application debuggerHolder: aValueModel
+        ].
+    ].
+
+    "Created: / 10-06-2014 / 17:27:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!VDBAbstractContainer methodsFor:'initialization & release'!
+
+initialize
+    labels := List new.
+    components := List new.
+
+    "Created: / 10-06-2014 / 14:24:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 10-06-2014 / 16:37:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !VDBAbstractContainer class methodsFor:'documentation'!
 
 version_HG