AbstractSettingsApplication.st
changeset 4825 97ccd5a946f4
parent 4813 b394e24fa72f
child 4830 40c63445c248
--- a/AbstractSettingsApplication.st	Tue Apr 15 16:54:43 2003 +0200
+++ b/AbstractSettingsApplication.st	Thu Apr 17 13:52:32 2003 +0200
@@ -70,7 +70,8 @@
 
 AbstractSettingsApplication subclass:#HTTPStartServerSettingsApplication
 	instanceVariableNames:'portNumberChannel informationLabel hasNoCreatedServerChannel
-		hasCreatedServerChannel'
+		hasCreatedServerChannel readSettingsFromFile
+		enableReadSettingsFromSettingsFile'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:AbstractSettingsApplication
@@ -267,8 +268,12 @@
     |result|
 
     (self hasUnsavedChanges) ifTrue:[
-        result := self confirmWithCancel:(resources 
-                            string:'Save changed ' , settingsString , ' ?').
+        self askForChangeOnRealease ifTrue:[
+            result := self confirmWithCancel:(resources 
+                                string:'Save changed ' , settingsString , ' ?').
+        ] ifFalse:[
+            result := true.
+        ].
         result isNil ifTrue:[
             ^ false
         ].
@@ -310,6 +315,10 @@
 
 !AbstractSettingsApplication methodsFor:'protocol'!
 
+askForChangeOnRealease
+    ^ true
+!
+
 basicSaveSettings
 
     self subclassResponsibility.
@@ -3008,7 +3017,7 @@
 !AbstractSettingsApplication::HTTPStartServerSettingsApplication class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractSettingsApplication.st,v 1.50 2003-04-10 16:09:56 penk Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractSettingsApplication.st,v 1.51 2003-04-17 11:52:32 penk Exp $'
 ! !
 
 !AbstractSettingsApplication::HTTPStartServerSettingsApplication class methodsFor:'image specs'!
@@ -3106,7 +3115,7 @@
                              )
                            
                           )
-                          #extent: #(#Point 539 95)
+                          #extent: #(#Point 539 200)
                         )
                        #(#ViewSpec
                           #name: 'Box18'
@@ -3129,6 +3138,7 @@
                                 #layout: #(#LayoutFrame 40 0 20 0 100 0 42 0)
                                 #model: #portNumberChannel
                                 #type: #number
+                                #immediateAccept: true
                                 #acceptOnReturn: true
                                 #acceptOnTab: true
                                 #acceptOnLostFocus: true
@@ -3154,6 +3164,24 @@
                           )
                           #extent: #(#Point 539 90)
                         )
+                       #(#ViewSpec
+                          #name: 'Box20'
+                          #component: 
+                         #(#SpecCollection
+                            #collection: #(
+                             #(#CheckBoxSpec
+                                #label: 'Read Server Settings from Settings File'
+                                #name: 'CheckBox1'
+                                #layout: #(#LayoutFrame 40 0 0 0 -5 1 22 0)
+                                #enableChannel: #enableReadSettingsFromSettingsFile
+                                #model: #readSettingsFromFile
+                                #translateLabel: true
+                              )
+                             )
+                           
+                          )
+                          #extent: #(#Point 539 24)
+                        )
                        )
                      
                     )
@@ -3295,6 +3323,23 @@
 
 !AbstractSettingsApplication::HTTPStartServerSettingsApplication methodsFor:'aspects'!
 
+enableReadSettingsFromSettingsFile
+    "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 ;-)"
+
+    enableReadSettingsFromSettingsFile isNil ifTrue:[
+        enableReadSettingsFromSettingsFile := true asValue.
+"/ if your app needs to be notified of changes, uncomment one of the lines below:
+"/       enableReadSettingsFromSettingsFile addDependent:self.
+"/       enableReadSettingsFromSettingsFile onChangeSend:#enableReadSettingsFromSettingsFileChanged to:self.
+    ].
+    ^ enableReadSettingsFromSettingsFile.
+!
+
 hasCreatedServerChannel
     "automatically generated by UIPainter ..."
 
@@ -3321,15 +3366,33 @@
 2. control individual running servers (if you want to handle 
    multiple servers on multiple ports).
 The default servers settings are specified in the 
-"HTTPServer Default Settings" entry.'
+"HTTPServer Default Settings" entry.
+The settings for for sa new created server are taken from
+the default server or if taken from file is true from the settings 
+file'
 !
 
 portNumberChannel
 
     portNumberChannel isNil ifTrue:[
         portNumberChannel := ValueHolder new.
+        portNumberChannel onChangeSend:#portNumberChannelChanged to:self.
     ].
     ^ portNumberChannel.
+!
+
+readSettingsFromFile
+    "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 ;-)"
+
+    readSettingsFromFile isNil ifTrue:[
+        readSettingsFromFile := false asValue.
+    ].
+    ^ readSettingsFromFile.
 ! !
 
 !AbstractSettingsApplication::HTTPStartServerSettingsApplication methodsFor:'change & update'!
@@ -3340,6 +3403,14 @@
     self setPortOnFreePort.
 !
 
+portNumberChannelChanged
+
+    | hasSettingsFileForPort |
+
+    hasSettingsFileForPort := HTTPServer hasSettingsFileForPort:self portNumberChannel value.
+    self enableReadSettingsFromSettingsFile value:hasSettingsFileForPort.
+!
+
 runningServersChanged
 
     |runningServers|
@@ -3359,12 +3430,6 @@
 
 !AbstractSettingsApplication::HTTPStartServerSettingsApplication methodsFor:'initialization & release'!
 
-basicInitialize
-
-"/    self createServerSubApplicationsForRunningServer.
-    super basicInitialize
-!
-
 release
 
     HTTPServer runningServers removeDependent:self.
@@ -10874,5 +10939,5 @@
 !AbstractSettingsApplication class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractSettingsApplication.st,v 1.50 2003-04-10 16:09:56 penk Exp $'
-! !
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractSettingsApplication.st,v 1.51 2003-04-17 11:52:32 penk Exp $'
+! !