View this PageEdit this Page (locked)Attachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

The Source code



Object subclass: #Converter
instanceVariableNames: 'urlString '
classVariableNames: ''
poolDictionaries: ''
category: 'Project-Newspaper'!

Converter commentStamp: '' prior: 0!

Provides functionality to convert a Set or equivalent to a String or File for the Project-Newspaper. DEJ 2/15/00



Converter methodsFor: 'converers' stamp: 'DEj 2/13/2000 03:07'!

setToFile: mySet
"Given a set of strings, returns 1 string which contains all entries."

|myArray myString mySpace myIO|

myIO _ IO new.
myString _ String new.
mySpace _ String new.
mySpace _ ' '.
myArray _ mySet asArray. "convert to an array for utility."
1 to: myArray size do:

"Make a string out of all elements"
[:index| myString _ myString, (myArray at: index), mySpace].

myIO writeToFile: myString.! !

Converter methodsFor: 'converers' stamp: 'DEj 2/13/2000 02:32'!

setToString: mySet
"Given a set of strings, returns 1 string which contains all entries."

|myArray myString mySpace|

myString _ String new.
mySpace _ String new.
mySpace _ ' '.
myArray _ mySet asArray. "convert to an array for utility."
1 to: myArray size do:

"Make a string out of all elements"
[:index| myString _ myString, (myArray at: index), mySpace].

^myString.! !


Converter methodsFor: 'access/modify' stamp: 'DEj 2/15/2000 00:05'!

urlString
"returns the value of urlString"
^ urlString.! !

Converter methodsFor: 'access/modify' stamp: 'DEj 2/15/2000 00:05'!

urlString: aString
"sets the urlString – to be used later in the project"
urlString _ aString.! !



Object subclass: #IO
instanceVariableNames: 'defaultSites '
classVariableNames: ''
poolDictionaries: ''
category: 'Project-Newspaper'!

IO commentStamp: '' prior: 0!

This class provides easy methods to read a string from a file and write to a file fort Project-Newspaper. DEJ 2/15/00!


IO methodsFor: 'read/write' stamp: 'DEj 2/15/2000 00:34'!

readFile
"returns a fileStream for use in the project."

| file fileName |

fileName _ 'newssources.txt'.
(file := ReadWriteStream openEmpty: fileName) isError
"if there is an error opening file..."
ifTrue: [ ^self error: file message ].


file close.! !

IO methodsFor: 'read/write' stamp: 'DEj 2/13/2000 15:44'!

readFileForProcessing
"Will see if there is a file to open. If not, will create a default"

| tempFile myFileName|

myFileName := 'newssources.txt'.
(StandardFileStream isAFileNamed: myFileName) ifFalse:
[tempFile _ StandardFileStream newFileNamed: myFileName.
tempFile nextPutAll: '1 http://www.cnn.com http://www.slashdot.org'].

"opens up the file and sets tempFile to the Filestream."
tempFile := StandardFileStream readOnlyFileNamed: myFileName.

"do stuff here to process"

tempFile close. ! !

IO methodsFor: 'read/write' stamp: 'bs 2/13/2000 16:43'!

writeToFile: aString
"Will open a file and write to it"

"Will see if there is a file to open. If not, will create a default"

| tempFile myFileName|

myFileName := 'newssources.txt'.

tempFile _ IOsubsystem newFileNamed: myFileName.
" tempFile := IOsubsystem fileNamed: myFileName."

"write stuff here"
tempFile nextPutAll: aString.
tempFile close.! !


IO methodsFor: 'accessors/modifiers' stamp: 'DEj 2/15/2000 00:05'!

defaultSites
"returns the value of defaultSites"
^ defaultSites.! !

IO methodsFor: 'accessors/modifiers' stamp: 'DEj 2/15/2000 00:33'!

defaultSites: aString
"Set the default sites"

defaultSites := aString.! !

"– – – – – – – – – – – – – – – – – – "!

IO class
instanceVariableNames: ''!

IO class methodsFor: 'as yet unclassified' stamp: 'DEj 2/13/2000 16:02'!

newFileNamed: fileName
"Create a new file with the given name, and answer a stream opened for writing on that file. If the file already exists, ask the user what to do.
Note: Overwritten by DEJ from StandardFileStream
"

| dir localName choice newName fullName |
fullName _ StandardFileStream fullName: fileName.
( StandardFileStream isAFileNamed: fullName)
ifFalse: [^ StandardFileStream new open: fullName forWrite: true].

"file already exists:"
dir _ FileDirectory forFileName: fullName.
localName _ FileDirectory localNameFor: fullName.
choice _ (PopUpMenu
labels:
'overwrite that file
cancel')
startUpWithCaption: localName, '
already exists.'.

choice = 1 ifTrue: [
dir deleteFileNamed: localName
ifAbsent: [self error: 'Could not delete the old version of that file'].
^ self new open: fullName forWrite: true].

self error: 'Please close this to abort file opening'.

!




StandardFileStream subclass: #IOsubsystem
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Project-Newspaper'!

IOsubsystem commentStamp: '' prior: 0!

This class was subclassed from StandardFileStream to allow us to override the menu option that the standard call forced. We want to automatically overwrite the 'newssources.txt' file every time that the settings are saved.!


"– – – – – – – – – – – – – – – – – – "!

IOsubsystem class
instanceVariableNames: ''!

IOsubsystem class methodsFor: 'overloadedMethod' stamp: 'bs 2/13/2000 16:46'!

newFileNamed: fileName
"This section was subclassed to remove the prompting of what to do with a file that already exists."

| fullName dir|
fullName _ self fullName: fileName.
dir _ FileDirectory forFileName: fullName.
dir deleteFileNamed: fullName.
^ self new open: fullName forWrite: true.

! !



AlignmentMorph subclass: #NewsPage
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Project-Newspaper'!

NewsPage commentStamp: '' prior: 0!

The main page class. This will be used to display the contents of the generated paper. !


NewsPage methodsFor: 'mouseStuff' stamp: 'bs 2/11/2000 04:09'!

handlesMouseDown: aMorphicEvent
^true.! !

NewsPage methodsFor: 'mouseStuff' stamp: 'bs 2/11/2000 18:01'!

mouseDown: aMorphicEvent

| menu |

menu _ CustomMenu new.
menu add: 'Generate Paper...' action: #generate.
menu addLine.
menu add: 'Modify News Settings' action: #modifySettings.


menu invokeOn:self defaultSelection:nil.



!



NewsPage methodsFor: 'buttonMethods' stamp: 'bs 2/11/2000 13:02'!

generate
"Displays a pop-up menu stating that this functionality is not yet implemented"

PopUpMenu notify: 'Generate Paper is not currently implemented'! !

NewsPage methodsFor: 'buttonMethods' stamp: 'ajg 2/12/2000 06:42'!

modifySettings
"Opens the modify settings window"

| openSettings |

openSettings _ SettingsWindow new.
openSettings openAsMorph.! !



Object subclass: #Newspaper
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Project-Newspaper'!

Newspaper commentStamp: '' prior: 0!

The main project class so that we could run the program with 'Newspaper start.'!


Newspaper methodsFor: 'init' stamp: 'DEj 2/10/2000 21:33'!

openAsMorph
"open our browser as a morphic"

| win |

"Create a window to display in"
win:= SystemWindow labelled: 'WebBrowser'.
win model: self.! !

"– – – – – – – – – – – – – – – – – – "!

Newspaper class
instanceVariableNames: ''!

Newspaper class methodsFor: 'startUp' stamp: 'bs 2/11/2000 02:59'!

start
"init stuff"

| aPaper |
aPaper _ NewspaperWindow new.
aPaper openAsMorph.! !



Object subclass: #NewspaperWindow
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Project-Newspaper'!

NewspaperWindow commentStamp: 'bs 2/15/2000 01:05' prior: 0!

The main window that sets up the initial NewsPage. !


NewspaperWindow methodsFor: 'init' stamp: 'bs 2/11/2000 17:57'!

openAsMorph
| win component page |

"Create the page"
page _ NewsPage new.


"Create a window for it"
win := SystemWindow labelled: 'The E-Herald – ', Date today printString.
win model: self.


component := PluggableButtonMorph new
model: page;
action:#generate;
label: 'Generate Paper';
borderWidth: 1.
win addMorph: component frame: (0@0 extent: 0.5@0.2).

component := PluggableButtonMorph new
model: page;
action: #modifySettings;
label: 'Modify News Settings';
borderWidth: 1.
win addMorph: component frame: (0.5@0 extent: 0.5@0.2).

page _ NewsPage newRow.
page centering: #bottomRight.
win addMorph: page frame: (0@0.2 extent: 1@0.8).


win openInWorld.
^win! !



AlignmentMorph subclass: #SettingsPage
instanceVariableNames: 'settingString '
classVariableNames: ''
poolDictionaries: ''
category: 'Project-Newspaper'!

SettingsPage commentStamp: 'bs 2/15/2000 01:07' prior: 0!

Currently this is the backend workhorse of the group. It handles all the menu interface issues and the button functionality for all of the settings information.!


SettingsPage methodsFor: 'mouse' stamp: 'ajg 2/12/2000 06:20'!

handlesMouseDown: aMorphicEvent
^true.

!


SettingsPage methodsFor: 'mouse' stamp: 'ajg 2/14/2000 22:47'!

mouseDown: aMorphicEvent

"Brings up the main menu for the Settings Window when the mouse
is clicked."

| menu |
menu _ CustomMenu new.

"Passes to the set Primary menu when selected."
menu add: 'Set Primary News Catagory' action: #setPrimary.
menu addLine.

"Passes to the add news sources menu when selected."
menu add: 'Edit News Sources' action: #addNewsSources.

"Saves the Users selected sources when selected."
menu add: 'Save News Sources' action: #saveSettings.
menu invokeOn:self defaultSelection:nil.! !


SettingsPage methodsFor: 'accessing' stamp: 'ajg 2/14/2000 23:00'!

addItemToSet: aString
"Helper method calls the that adds an item (aString) to the set (settingString)."

self settingString add: aString.! !

SettingsPage methodsFor: 'accessing' stamp: 'ajg 2/14/2000 23:01'!

saveSettings
"creates an instance of converter and passes it the set that will be converted then saved to a file."

| aConverter |
aConverter := Converter new.
aConverter setToFile: self settingString.! !

SettingsPage methodsFor: 'accessing' stamp: 'ajg 2/14/2000 22:50'!

settingString
"returns settingString"

^settingString.! !


SettingsPage methodsFor: 'initialization' stamp: 'ajg 2/14/2000 22:51'!

initSettingString
"initalizes the set (settingString) used to hold the user's prefrences before they are written to a file."

settingString := Set new.! !


SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:52'!

addAtlantaLocal
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'AccessAtlanta-Local'.
PopUpMenu notify: 'Access Atlanta has been set in your prefrences for Local news'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:52'!

addAtlantaTraffic
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'AccessAtlanta-Traffic'.
PopUpMenu notify: 'Access Atlanta has been set in your prefrences for Traffic news'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:53'!

addAtlantaWeather
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'AccessAtlanta-Weather'.
PopUpMenu notify: 'Access Atlanta has been set in your prefrences for Weather news'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:53'!

addBbcEducation
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'BBC-Education'.
PopUpMenu notify: 'BBC has been set in your prefrences for Education'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:53'!

addBbcEntertainment
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'BBC-Entertainment'.
PopUpMenu notify: 'BBC has been set in your prefrences for Entertainment'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:53'!

addBbcHealth
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'BBC-Health'.
PopUpMenu notify: 'BBC has been set in your prefrences for Health'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:53'!

addBbcHistory
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'BBC-History'.
PopUpMenu notify: 'BBC has been set in your prefrences for History news'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:53'!

addBbcHomeAndGarden
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'BBC-HomeAndGarden'.
PopUpMenu notify: 'BBC has been set in your prefrences for Home & Garden news'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:54'!

addBbcNews
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'BBC-News'.
PopUpMenu notify: 'BBC has been set in your prefrences for News'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:54'!

addBbcScience
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'Bbc-Science'.
PopUpMenu notify: 'BBC has been set in your prefrences for Science news'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:54'!

addBbcWorld
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'BBC-World'.
PopUpMenu notify: 'BBC has been set in your prefrences for World news'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:54'!

addCnnBooks
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'CNN-Books'.
PopUpMenu notify: 'CNN has been set in your prefrences for Book news'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:54'!

addCnnBusiness
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'CNN-Business'.
PopUpMenu notify: 'CNN has been set in your prefrences for Business news'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:54'!

addCnnEntertainment
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'CNN-Entertainment'.
PopUpMenu notify: 'CNN has been set in your prefrences for Entertainment news'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:54'!

addCnnFood
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'CNN-Food'.
PopUpMenu notify: 'CNN has been set in your prefrences for Food news'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:54'!

addCnnHealth
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."


self addItemToSet: 'CNN-Health'.
PopUpMenu notify: 'CNN has been set in your prefrences for Health news'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/13/2000 03:31'!

addCnnScience

self addItemToSet: 'CNN-Science'.
PopUpMenu notify: 'CNN has been set in your prefrences for Science news'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:55'!

addCnnSpace
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'CNN-Space'.
PopUpMenu notify: 'CNN has been set in your prefrences for Space news'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:55'!

addCnnTravel
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'CNN-Travel'.
PopUpMenu notify: 'CNN has been set in your prefrences for Travel news'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:55'!

addCnnUs
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'CNN-Us'.
PopUpMenu notify: 'CNN has been set in your prefrences for US news'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:55'!

addCnnWorld
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'CNN-World'.
PopUpMenu notify: 'CNN has been set in your prefrences for World news'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:55'!

addEspnSports
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'ESPN-Sports'.
PopUpMenu notify: 'ESPN has been set in your prefrences for Sports News'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:55'!

addEspnTv
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'ESPN-Tv'.
PopUpMenu notify: 'ESPN has been set in your prefrences for TV listings'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:56'!

addGaNavTraffic
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'GeorgiaNavigator-Traffic'.
PopUpMenu notify: 'Georgia Navagator has been set in your prefrences for Traffic news'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:56'!

addSlashdotTech
"Calls the method to add the site information to the set containing User prefrences. then notifies the user that this site has been added to their prefrences."

self addItemToSet: 'Slashdot-Technology'.
PopUpMenu notify: 'Slashdot has been set in your prefrences for Technology News'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:57'!

setLocalAsPrimary
"Adds the info for the Primary news catagory to the set then notifies the user that that catagory has been set to a primary."

self addItemToSet: 'Primary-Local'.
PopUpMenu notify: 'You have set "Local News" as your primary news catagory.'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:57'!

setSportsAsPrimary
"Adds the info for the Primary news catagory to the set then notifies the user that that catagory has been set to a primary."

self addItemToSet: 'Primary-Sports'.
PopUpMenu notify: 'You have set "Sports News" as your primary news catagory.'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:57'!

setWeatherAsPrimary
"Adds the info for the Primary news catagory to the set then notifies the user that that catagory has been set to a primary."

self addItemToSet: 'Primary-Weather'.
PopUpMenu notify: 'You have set "Weather News" as your primary news catagory.'.! !

SettingsPage methodsFor: 'menu/buttonHelpers' stamp: 'ajg 2/14/2000 22:57'!

setWorldAsPrimary
"Adds the info for the Primary news catagory to the set then notifies the user that that catagory has been set to a primary."

self addItemToSet: 'Primary-World'.
PopUpMenu notify: 'You have set "World News" as your primary news catagory.'.! !


SettingsPage methodsFor: 'mainMenuStuff' stamp: 'ajg 2/14/2000 23:07'!

addNewsSources
" Creates a menu for the Add News Sources selection from the main menu. When a selection is made the method will call that selections
corrisponding function to add it to the set to be saved to file."

| menu |
menu _ CustomMenu new.

"Area handling www.slashdot.org menu selections."
menu add: 'Slashdot-Technology' action: #addSlashdotTech.
menu addLine.

"Area handling www.espn.go.com menu selections."
menu add: 'ESPN-Sports' action: #addEspnSports.
menu add: 'ESPN-Tv' action: #addEspnTv.
menu addLine.

"Area handling www.accessatlanta.com menu selecions"
menu add: 'Access Atlanta-Local' action: #addAtlantaLocal.
menu add: 'Access Atlanta-Weather' action: #addAtlantaWeather. menu add: 'Access Atlanta-Traffic' action: #addAtlantaTraffic.
menu addLine.

"Area Handling www.georgianavigator menu selections."
menu add: 'Georgia Navigator-Traffic' action:#addGaNavTraffic.
menu addLine.

"Area handling www.cnn.com menu selections."
menu add: 'CNN-Space' action: #addCnnSpace.
menu add: 'CNN-World' action: #addCnnWorld.
menu add: 'CNN-US' action: #addCnnUs.
menu add: 'CNN-Business' action: #addCnnBusiness.
menu add: 'CNN-Health' action: #addCnnHealth.
menu add: 'CNN-Entertainment' action: #addCnnEntertainment.
menu add: 'CNN-Books' action: #addCnnBooks.
menu add: 'CNN-Travel' action: #addCnnTravel.
menu add: 'CNN-Food' action: #addCnnFood.
menu addLine.

"Area handling www.bbc.co.uk/home/today menu selections."
menu add: 'BBC-World' action: #addBbcWorld.
menu add: 'BBC-News' action: #addBbcNews.
menu add: 'BBC-Education' action: #addBbcEducation.
menu add: 'BBC-Health' action: #addBbcHealth.
menu add: 'BBC-Entertainment' action: #addBbcEntertainment.
menu add: 'BBC-History' action: #addBbcHistory.
menu add: 'BBC-Home&Garden' action: #addBbcHomeAndGarden.
menu add: 'BBC-Science' action: #addBbcScience.

menu invokeOn:self defaultSelection:nil.! !

SettingsPage methodsFor: 'mainMenuStuff' stamp: 'ajg 2/14/2000 23:09'!

setPrimary
" Creates a menu for the Set Primary Sources selection from the main menu. When a selection is made the method will call that selections
corrisponding function to add it to the set to be saved to file."

| menu |
menu _ CustomMenu new.
"Handles selectionof World News."
menu add: 'World News' action: #setWorldAsPrimary.

"Handles selection of Local News."
menu add: 'Local News' action: #setLocalAsPrimary.

"Handles selection of Sports News."
menu add: 'Sports' action: #setSportsAsPrimary.

"Handles selection of Weather News."
menu add: 'Weather' action: #setWeatherAsPrimary.

menu invokeOn:self defaultSelection:nil.! !



Object subclass: #SettingsWindow
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Project-Newspaper'!

SettingsWindow commentStamp: 'bs 2/15/2000 01:08' prior: 0!

This class is used to initialize all of the page formatting and all the buttons that are used to display any newspaper settings. !


SettingsWindow methodsFor: 'init' stamp: 'ajg 2/14/2000 23:17'!

openAsMorph
"Initalizes an instance of Settings page, as well as initializing the set (settingString) that will contain the users selections that will be saved to file. A window containing the appropriate buttons for the setting menu is correctly formated and then opened."

| win page component |

"Create the page"
page _ SettingsPage newRow.

"Create the set for user prefrences"
page initSettingString.

"Create a window for it"
win := SystemWindow labelled: 'The E-Herald – Settings – ', Date today printString.
win model: self.
page centering: #bottomRight.
win addMorph: page frame: (0@0 extent: 1.1@1.1).


"BUTTON SECTION"

"sets up the format and actions for the Select Primary News Catagory button."
component := PluggableButtonMorph new
model: page;
action:#setPrimary;
label: 'Select Primary News Catagory';
borderWidth: 1.
win addMorph: component frame: ( 0.25@0.1 extent: 0.5@0.1).



"sets up the format and actions for the Add new sources button. Which will open a menu list of sources for the user to select."

component := PluggableButtonMorph new
model: page;
action:#addNewsSources;
label: 'Click here or on any of the choices below to add news sources';
borderWidth: 1.
win addMorph: component frame: ( 0.05@0.3 extent: 0.9@0.05).



"Adds the first of 3 columns of buttons containing the format and actions to add 1 source individual at a time when clicked."

component := PluggableButtonMorph new
model: page;
action:#addSlashdotTech;
label: 'SlashDot - Technology';
borderWidth: 1.
win addMorph: component frame: ( 0.05@0.4 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addEspnSports;
label: 'ESPN - Sports';
borderWidth: 1.
win addMorph: component frame: ( 0.05@0.45 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addEspnTv;
label: 'ESPN - TV Listings';
borderWidth: 1.
win addMorph: component frame: ( 0.05@0.5 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addAtlantaLocal;
label: 'Access Atl. - Local';
borderWidth: 1.
win addMorph: component frame: ( 0.05@0.55 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addAtlantaWeather;
label: 'Access Atl. - Weather';
borderWidth: 1.
win addMorph: component frame: ( 0.05@0.6 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addAtlantaTraffic;
label: 'Access Atl. - Traffic';
borderWidth: 1.
win addMorph: component frame: ( 0.05@0.65 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addGaNavTraffic;
label: 'Georgia Nav - Traffic';
borderWidth: 1.
win addMorph: component frame: ( 0.05@0.7 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addCnnSpace;
label: 'CNN - Space';
borderWidth: 1.
win addMorph: component frame: ( 0.05@0.75 extent: 0.3@0.05).


"Adds the second of 3 columns of buttons containing the format and actions to add 1 source individual at a time when clicked."

component := PluggableButtonMorph new
model: page;
action:#addCnnWorld;
label: 'CNN - World';
borderWidth: 1.
win addMorph: component frame: ( 0.35@0.4 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addCnnUs;
label: 'CNN - US';
borderWidth: 1.
win addMorph: component frame: ( 0.35@0.45 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addCnnBusiness;
label: 'CNN - Business';
borderWidth: 1.
win addMorph: component frame: ( 0.35@0.5 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addCnnHealth;
label: 'CNN - Health';
borderWidth: 1.
win addMorph: component frame: ( 0.35@0.55 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addCnnEntertainment;
label: 'CNN - Entertainment';
borderWidth: 1.
win addMorph: component frame: ( 0.35@0.6 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addCnnBooks;
label: 'CNN - Books';
borderWidth: 1.
win addMorph: component frame: ( 0.35@0.65 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addCnnTravel;
label: 'CNN - Travel';
borderWidth: 1.
win addMorph: component frame: ( 0.35@0.7 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addCnnFood;
label: 'CNN - Food';
borderWidth: 1.
win addMorph: component frame: ( 0.35@0.75 extent: 0.3@0.05).


"Adds the third of 3 columns of buttons containing the format and actions to add 1 source individual at a time when clicked."

component := PluggableButtonMorph new
model: page;
action:#addBbcWorld;
label: 'BBC - World';
borderWidth: 1.
win addMorph: component frame: ( 0.65@0.4 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addBbcNews;
label: 'BBC - News';
borderWidth: 1.
win addMorph: component frame: ( 0.65@0.45 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addBbcEducation;
label: 'BBC - Education';
borderWidth: 1.
win addMorph: component frame: ( 0.65@0.5 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addBbcHealth;
label: 'BBC - Health';
borderWidth: 1.
win addMorph: component frame: ( 0.65@0.55 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addBbcEntertainment;
label: 'BBC - Entertainment';
borderWidth: 1.
win addMorph: component frame: ( 0.65@0.6 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addBbcHistory;
label: 'BBC - History';
borderWidth: 1.
win addMorph: component frame: ( 0.65@0.65 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addBbcHomeAndGarden;
label: 'BBC - Home&Garden';
borderWidth: 1.
win addMorph: component frame: ( 0.65@0.7 extent: 0.3@0.05).

component := PluggableButtonMorph new
model: page;
action:#addBbcScience;
label: 'BBC - Science';
borderWidth: 1.
win addMorph: component frame: ( 0.65@0.75 extent: 0.3@0.05).


"Adds the button containing the format and actions to save the users prefrences to file when clicked."

component := PluggableButtonMorph new
model: page;
action:#saveSettings;
label: 'Save Your Personalized Settings';
borderWidth: 1.
win addMorph: component frame: ( 0.25@0.85 extent: 0.5@0.1).

"open the window."
win openInWorld.
^win! !

Link to this Page