SmallSense__AbstractDIalog.st
changeset 332 1ea99b9d1a1e
parent 330 055633bb5ceb
child 334 43dba1c14293
child 337 5f39eba6a1e3
--- a/SmallSense__AbstractDIalog.st	Wed Apr 30 11:59:10 2014 +0100
+++ b/SmallSense__AbstractDIalog.st	Fri May 02 10:07:13 2014 +0100
@@ -3,7 +3,8 @@
 "{ NameSpace: SmallSense }"
 
 SimpleDialog subclass:#AbstractDIalog
-	instanceVariableNames:'buttons buttonsPanelView acceptEnabledHolder'
+	instanceVariableNames:'buttons buttonsPanelView acceptEnabledHolder
+		optionsVisibleLabelHolder optionsVisibleHolder'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'SmallSense-Core-Interface-Search'
@@ -11,6 +12,69 @@
 
 !AbstractDIalog class methodsFor:'interface specs'!
 
+dialogSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:SmallSense::AbstractDIalog andSelector:#dialogSpec
+     SmallSense::AbstractDIalog new openInterface:#dialogSpec
+    "
+
+    <resource: #canvas>
+
+    ^ 
+    #(FullSpec
+       name: dialogSpec
+       window: 
+      (WindowSpec
+         label: 'Search...'
+         name: 'Search...'
+         min: (Point 10 10)
+         bounds: (Rectangle 0 0 708 404)
+         menu: mainMenuSpec
+       )
+       component: 
+      (SpecCollection
+         collection: (
+          (VerticalPanelViewSpec
+             name: 'ContentAndOptionsPanel'
+             layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+             horizontalLayout: fit
+             verticalLayout: topSpaceFit
+             horizontalSpace: 3
+             verticalSpace: 3
+             elementsChangeSize: true
+             component: 
+            (SpecCollection
+               collection: (
+                (UISubSpecification
+                   name: 'Content'
+                   minorKey: contentPaneSpec
+                   extent: (Point 708 350)
+                 )
+                (UISubSpecification
+                   name: 'Options'
+                   initiallyInvisible: true
+                   visibilityChannel: optionsVisibleHolder
+                   minorKey: optionsSpec
+                   extent: (Point 708 40)
+                 )
+                )
+              
+             )
+           )
+          )
+        
+       )
+     )
+
+    "Modified: / 02-05-2014 / 00:40:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 windowSpec
     "This resource specification was automatically generated
      by the UIPainter of ST/X."
@@ -86,9 +150,14 @@
        component: 
       (SpecCollection
          collection: (
+          (UISubSpecification
+             name: 'ButtonOptionsShowOrHide'
+             layout: (LayoutFrame 0 0 0 0 100 0 0 1)
+             minorKey: optionsShowHideLeftAlignedPaneSpec
+           )
           (HorizontalPanelViewSpec
              name: 'Buttons'
-             layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+             layout: (LayoutFrame 100 0 0 0 0 1 0 1)
              horizontalLayout: right
              verticalLayout: center
              horizontalSpace: 3
@@ -100,6 +169,128 @@
         
        )
      )
+!
+
+contentPaneSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:SmallSense::AbstractSearchDialog andSelector:#optionsPaneSpec
+     SmallSense::AbstractSearchDialog new openInterface:#optionsPaneSpec
+    "
+
+    <resource: #canvas>
+
+    ^ 
+    #(FullSpec
+       name: contentPaneSpec
+       window: 
+      (WindowSpec
+         label: 'Search ...'
+         name: 'Search Options...'
+         min: (Point 10 10)
+         bounds: (Rectangle 0 0 634 40)
+       )
+       component: 
+      (SpecCollection
+         collection: (
+          (LabelSpec
+             label: 'No content (override #contentPaneSpec)'
+             name: 'NoOptionsLabel'
+             layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+             translateLabel: true
+           )
+          )
+        
+       )
+     )
+
+    "Created: / 02-05-2014 / 00:17:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+optionsPaneSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:SmallSense::AbstractSearchDialog andSelector:#optionsPaneSpec
+     SmallSense::AbstractSearchDialog new openInterface:#optionsPaneSpec
+    "
+
+    <resource: #canvas>
+
+    ^ 
+    #(FullSpec
+       name: optionsPaneSpec
+       window: 
+      (WindowSpec
+         label: 'Search Options...'
+         name: 'Search Options...'
+         min: (Point 10 10)
+         bounds: (Rectangle 0 0 634 40)
+       )
+       component: 
+      (SpecCollection
+         collection: (
+          (LabelSpec
+             label: 'No options (override #optionsPaneSpec)'
+             name: 'NoOptionsLabel'
+             layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+             translateLabel: true
+           )
+          )
+        
+       )
+     )
+!
+
+optionsShowHideLeftAlignedPaneSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:SmallSense::AbstractDIalog andSelector:#optionsShowHideLeftAlignedPaneSpec
+     SmallSense::AbstractDIalog new openInterface:#optionsShowHideLeftAlignedPaneSpec
+    "
+
+    <resource: #canvas>
+
+    ^ 
+    #(FullSpec
+       name: optionsShowHideLeftAlignedPaneSpec
+       window: 
+      (WindowSpec
+         label: 'Show / Hide options'
+         name: 'Show / Hide options'
+         min: (Point 10 10)
+         bounds: (Rectangle 0 0 452 20)
+       )
+       component: 
+      (SpecCollection
+         collection: (
+          (LinkButtonSpec
+             label: 'Options'
+             name: 'ShowHideOptions'
+             layout: (LayoutFrame 0 0 0 0 0 1 0 1)
+             translateLabel: true
+             labelChannel: optionsVisibleLabelHolder
+             adjust: left
+             model: doOptionsShowOrHide
+           )
+          )
+        
+       )
+     )
 ! !
 
 !AbstractDIalog class methodsFor:'testing'!
@@ -108,6 +299,14 @@
     ^ self == SmallSense::AbstractDIalog
 ! !
 
+!AbstractDIalog methodsFor:'actions'!
+
+doOptionsShowOrHide
+    self optionsVisibleHolder value: self optionsVisibleHolder value not.
+
+    "Modified: / 02-05-2014 / 00:27:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !AbstractDIalog methodsFor:'adding & removing components'!
 
 addButton: aButton
@@ -170,6 +369,82 @@
 "/       acceptEnabledHolder onChangeSend:#acceptEnabledHolderChanged to:self.
     ].
     ^ acceptEnabledHolder.
+!
+
+optionsVisibleHolder
+    "return/create the 'optionsVisibleHolder' value holder (automatically generated)"
+
+    optionsVisibleHolder isNil ifTrue:[
+        optionsVisibleHolder := false asValue.
+        optionsVisibleHolder addDependent:self.
+    ].
+    ^ optionsVisibleHolder
+
+    "Modified: / 02-05-2014 / 00:26:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+optionsVisibleHolder:something
+    "set the 'optionsVisibleHolder' value holder (automatically generated)"
+
+    |oldValue newValue|
+
+    optionsVisibleHolder notNil ifTrue:[
+        oldValue := optionsVisibleHolder value.
+        optionsVisibleHolder removeDependent:self.
+    ].
+    optionsVisibleHolder := something.
+    optionsVisibleHolder notNil ifTrue:[
+        optionsVisibleHolder addDependent:self.
+    ].
+    newValue := optionsVisibleHolder value.
+    oldValue ~~ newValue ifTrue:[
+        self update:#value with:newValue from:optionsVisibleHolder.
+    ].
+!
+
+optionsVisibleLabelHolder
+    <resource: #uiAspect>
+
+    "automatically generated by UIPainter ..."
+
+    "*** the code below creates a default model when invoked."
+    "*** (which may not be the one you wanted)"
+    "*** Please change as required and accept it in the browser."
+    "*** (and replace this comment by something more useful ;-)"
+
+    optionsVisibleLabelHolder isNil ifTrue:[
+        optionsVisibleLabelHolder := (resources string: 'Options') asValue.
+"/ if your app needs to be notified of changes, uncomment one of the lines below:
+"/       optionsVisibleLabelHolder addDependent:self.
+"/       optionsVisibleLabelHolder onChangeSend:#optionsVisibleLabelHolderChanged to:self.
+    ].
+    ^ optionsVisibleLabelHolder.
+
+    "Modified: / 02-05-2014 / 00:25:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!AbstractDIalog methodsFor:'change & update'!
+
+update:something with:aParameter from:changedObject
+    changedObject == optionsVisibleHolder ifTrue:[
+        self updateOptionsVisibleLabel.
+        ^ self.
+    ].     
+    ^ super update:something with:aParameter from:changedObject
+
+    "Created: / 02-05-2014 / 00:29:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+updateOptionsVisibleLabel
+    | label |
+
+    label := 
+        self optionsVisibleHolder value 
+            ifTrue:[ resources string: 'Hide options']
+            ifFalse:[ resources string: 'Options'].
+    self optionsVisibleLabelHolder value: label.
+
+    "Created: / 02-05-2014 / 00:29:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !AbstractDIalog methodsFor:'hooks'!