'From VisualWorks(R) Release 2.0 of 4 August 1994 on 27 June 1995 at 11:02:52 pm'! !HyperComposite methodsFor: 'streams'! nextPut: aHyperComponent self add: aHyperComponent. self changed: #add with: aHyperComponent.! ! Object subclass: #RenderPolicy instanceVariableNames: 'maxWidth leftOffset maxWidthFlag component infoString renderer ' classVariableNames: '' poolDictionaries: '' category: 'HyperTalk-Rendering Policies'! RenderPolicy comment: 'I am responsibile for how a HyperComponent looks like on the screen. I assume that I will have certain types of object as my component. In other words, different kinds of component may have different format managers. For example, ListPolicy is used to format HyperComponent with type #UL. Instance Variables: maxWidth The maximum width for displaying a hypertextComponent. leftOffset indent width. maxWidthFlag Should I display the hypertextComponent with width = maxWidth? component that I am going to format. infoString misc. information that links the a hypertextComponent with its visual appearance. presentationMgr '! !RenderPolicy methodsFor: 'accessing'! formatInto: aContainer "Format component and put its visual representations (VisualLink) into aContainer. Return the last visualComponent put by me into aContainer." ^nil! ! Model subclass: #HyperRenderer instanceVariableNames: 'model view styleMgr pageFullFlag buffer inputStream ' classVariableNames: '' poolDictionaries: '' category: 'HyperTalk-Rendering'! !HyperRenderer methodsFor: 'private'! defaultCompositeComponent | c | c := LazyComposite new type: #text. self initFormatPolicy: CompositePolicy new for: c. ^c! ! !HyperRenderer methodsFor: 'accessing'! inputStream: aStream inputStream notNil ifTrue: [ inputStream release]. inputStream := aStream. aStream addDependent: self! ! !HyperRenderer methodsFor: 'initialize-release'! initFormatPolicy: aHypertextComponent "Initialize FormatManagers for aHypertextComponent and its descendants." aHypertextComponent preorderDo: [:each | | fm | fm := self policyFor: each type. "fm addDependent: self." each formatPolicy: fm. self getEmbeddedNode: fm. fm maxWidthFlag: true; presentationMgr: self; maxWidth: view bounds width]! release super release. inputStream release! ! !HyperView methodsFor: 'accessing'! flush self layoutComponentsForBounds: self bounds. self repairDamage! ! Model subclass: #TestModel instanceVariableNames: 'resolver ' classVariableNames: '' poolDictionaries: '' category: 'NetFish-Model'! Object subclass: #WebCache instanceVariableNames: 'cacheItems maxItems maxVisuals totalVisuals ' classVariableNames: '' poolDictionaries: '' category: 'NetFish-Model'! !WebCache methodsFor: 'accessing'! clear cacheItems do: [:each | | file | file := each filename. file notNil ifTrue: [file delete]]. cacheItems removeAllSuchThat:[:each | true]. self initialize! ! CompositePolicy comment: 'I render HyperComposites. instance variables: flattenFlag true -> format each child individually. false -> format all the children together.'! !CompositePolicy methodsFor: 'private'! formatCollection: aCollection into: aContainer width: anInteger "Format each element in a collection of HypertextComponents. #isHText checks if the representations of consecutive HyperComponents may be combined into one paragraph. " | iString textWidth vComp | iString := self defaultTaggedString new. textWidth := anInteger. aCollection do: [:each | | fm | fm := each formatPolicy. (fm isHText and: [fm isText]) ifTrue: [iString := iString , fm makeTaggedString] ifFalse: [iString size > 0 ifTrue: [self composeTaggedString: iString into: aContainer width: textWidth]. textWidth := anInteger. fm maxWidth: textWidth; maxWidthFlag: false. vComp := fm formatInto: aContainer. vComp notNil ifTrue: [textWidth := textWidth - vComp preferredBounds width. textWidth < 1 ifTrue: [textWidth := anInteger]]. iString := self defaultTaggedString new]]. iString size > 0 ifTrue: [vComp := self composeTaggedString: iString into: aContainer width: textWidth]. ^vComp! ! HyperComponent subclass: #WebComponent instanceVariableNames: 'hTextFlag container ' classVariableNames: '' poolDictionaries: '' category: 'Hypertext-Storage Layer'! Model subclass: #Viewer instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'HyperTalk-Framework'! Model subclass: #LinkHistorian instanceVariableNames: 'historyList currentPos aspect ' classVariableNames: '' poolDictionaries: '' category: 'NetFish-Model'! !LinkHistorian methodsFor: 'accessing'! add: anObject [currentPos < historyList size] whileTrue: [historyList removeLast]. historyList add: anObject. currentPos := historyList size! ! Model subclass: #StreamManager instanceVariableNames: 'outputStream model link tmpFilename spawnFlag cache ' classVariableNames: '' poolDictionaries: '' category: 'HyperTalk-Framework'! !HtmlDtd class methodsFor: 'class initialization'! initElements "Each entry contains (name, content, attributes, parents, mappedObjectClass hTextFlag). self initElements. 'Name', 'content', 'attributes' are defined by the dtd at http://www11.w3.org/hypertext/WWW/MarkUp/HTML.dtd.html. 'Parents' is the set of possible tags that can be the parent of name. MappedObjectClass is the class created for mapping 'name'. also see http://www.w3.org/hypertext/WWW/MarkUp/html-spec/L2Pindex.html" | t | Elements := Dictionary new. t := #( #(#a #mixed #(#HREF #NAME #REL #REV #TITLE #URN #METHODS) #(#address #b #cite #code #dd #dt #em #h1 #h2 #h3 #h4 #h5 #h6 #i #kbd #li #p #pre #samp #strong #tt #var) #WebComposite true) #(#address #mixed #() #(#blockquote #body #form) #WebComposite false) #(#b #mixed #() #(#a #address #b #cite #code #dd #dt #em #h1 #h2 #h3 #h4 #h5 #h6 #i #kbd #li #p #pre #samp #strong #tt #var) #WebComposite true) #(#base #mixed #(#HREF) #(#head) #WebComposite false) #(#blockquote #mixed #() #(#blockquote #body #dd #form #li) #WebComposite false) #(#body #mixed #() #(#html) #WebComposite false) #(#br #empty #() #(a #address #b #cite #code #dd #dt #em #h1 #h2 #h3 #h4 #h5 #h6 #i #kbd #li #p #pre #samp #strong #tt #var) #WebComponent false) #(#cite #mixed #() #(a #address #b #cite #code #dd #dt #em #h1 #h2 #h3 #h4 #h5 #h6 #i #kbd #li #p #pre #samp #strong #tt #var) #WebComposite true) #(#code #mixed #() #(a #address #b #cite #code #dd #dt #em #h1 #h2 #h3 #h4 #h5 #h6 #i #kbd #li #p #pre #samp #strong #tt #var) #WebComposite true) #(#comment #mixed #() #() #WebComposite false) #(#dd #empty #() #(#dl) #WebComposite false) #(#dfn #mixed #() #() #WebComposite true) #(#dir #mixed #(#COMPACT) #(#blockquote #body #dd #form #li) #WebComposite false) #(#dl #mixed #(#COMPACT) #(#blockquote #body #dd #form #li) #WebComposite false) #(#dlc #mixed #(#COMPACT) #() #WebComposite false) #(#dt #empty #() #(#dl) #WebComposite false) #(#em #mixed #() #(#a #address #b #cite #code #dd #dt #em #h1 #h2 #h3 #h4 #h5 #h6 #i #kbd #li #p #pre #samp #strong #tt #var) #WebComposite true) #(#form #mixed #(#ACTION #METHOD #ENCTYPE) #(#blockquote #body #form) #WebComposite false) #(#head #mixed #() #(#html) #WebComposite false) #(#h1 #mixed #() #(#blockquote #body #form) #WebComposite false) #(#h2 #mixed #() #(#blockquote #body #form) #WebComposite false) #(#h3 #mixed #() #(#blockquote #body #form) #WebComposite false) #(#h4 #mixed #() #(#blockquote #body #form) #WebComposite false) #(#h5 #mixed #() #(#blockquote #body #form) #WebComposite false) #(#h6 #mixed #() #(#blockquote #body #form) #WebComposite false) #(#h7 #mixed #() #(#blockquote #body #form) #WebComposite false) #(#hr #empty #() #(#blockquote #body #form #pre) #WebComponent false) #(#html #mixed #() #() #WebComposite false) #(#i #mixed #() #(#a #address #b #cite #code #dd #dt #em #h1 #h2 #h3 #h4 #h5 #h6 #i #kbd #li #p #pre #samp #strong #tt #var) #WebComposite true) #(#img #empty #(#ALT #SRC #ALIGN #ISMAP) #(#a #address #b #cite #code #dd #dt #em #h1 #h2 #h3 #h4 #h5 #h6 #i #kbd #li #p #samp #strong #tt #var) #WebComponent true) #(#input #empty #(#ALIGN #CHECKED #MAXLENGTH #NAME #SIZE #TYPE #VALUE #SRC) #(#form) #WebComponent false) #(#isindex #empty #() #(#blockquote #body #dd #form #head #li) #WebComponent false) #(#kbd #mixed #() #(#a #address #b #cite #code #dd #dt #em #h1 #h2 #h3 #h4 #h5 #h6 #i #li #p #pre #samp #strong #tt #var) #WebComposite true) #(#key #mixed #() #() #WebComposite true) #(#li #empty #(#COMPACT) #(#ul #ol #menu #dir) #WebComposite false) #(#link #empty #(#HREF #REL #REV #URL #TITLE #METHODS) #(#head) #WebComponent false) #(#listing #cdata #() #() #WebComposite false) #(#menu #mixed #(#COMPACT) #(#blockquote #body #dd #form #li) #WebComposite false) #(#meta #mixed #(#HTTP-EQUIV #NAME #CONTENT) #(#head) #WebComposite false) #(#nextid #empty #(#N) #(#head) #WebComponent false) #(#ol #mixed #(#COMPACT) #(#blockquote #body #dd #form #li) #WebComposite false) #(#option #empty #(#SELECTED) #(#select) #WebComponent false) #(#p #empty #() #(#address #blockquote #body #dd #form #li) #WebComponent false) #(#plaintext #cdata #() #() #WebComposite false) #(#pre #rcdata #(#WIDTH) #(#blockquote #body #dd #form #li) #WebComposite false) #(#samp #mixed #() #(#a #address #b #cite #code #dd #dt #em #h1 #h2 #h3 #h4 #h5 #h6 #i #kbd #li #p #pre #samp #strong #tt #var) #WebComposite true) #(#select #mixed #(#MULTIPLE #NAME) #(#form) #WebComposite false) #(#strong #mixed #() #(#a #address #b #cite #code #dd #dt #em #h1 #h2 #h3 #h4 #h5 #h6 #i #kbd #li #p #pre #samp #strong #tt #var) #WebComposite true) #(#textarea #mixed #(#COLS #NAME #ROWS) #() #WebComposite false) #(#title #rcdata #() #(#head) #WebComposite false) #(#tt #mixed #() #(#a #address #b #cite #code #dd #dt #em #h1 #h2 #h3 #h4 #h5 #h6 #i #kbd #li #p #pre #samp #strong #tt #var) #WebComposite true) #(#u #mixed #() #() #WebComposite true) #(#ul #mixed #(#COMPACT) #(#blockquote #body #dd #form #li) #WebComposite false) #(#var #mixed #() #(#a #address #b #cite #code #dd #dt #em #h1 #h2 #h3 #h4 #h5 #h6 #i #kbd #li #p #pre #samp #strong #tt #var) #WebComposite true) #(#xmp #cdata #() #() #WebComposite false)). t do: [:each | self addElement: (HtmlElement name: (each at: 1) attributes: (each at: 3) content: (each at: 2) parents: (each at: 4) mappedClassName: (each at: 5) hTextFlag: (each at: 6))]. t do: [:item | (item at: 4) do: [:each | self elements at: each ]]! initialize "HtmlDtd initialize" self initElements. self initEntities! ! !WebClient methodsFor: 'initialize-release'! release self clearCache. renderer release. super release! ! !ImagePolicy methodsFor: 'accessing'! formatInto: aContainer | vLink anImage vComponent | anImage := self getImage. vLink := (self defaultVisualLink) structuralComponent: self component; visualComponent: (CachedImage on: anImage). vComponent := self wrapperClass on: vLink. aContainer addWrapper: vComponent. ^vComponent! ! WebComposite subclass: #LazyComposite instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Hypertext-Storage Layer'! LazyComposite comment: 'I am similar to WebComposite except when I add a new child, I don''t modify its container to me. Also, when I am used to generate HTML document, I won''t generate my type. '! !LazyComposite methodsFor: 'accessing'! add: aHyperComponent content add: aHyperComponent. self container: aHyperComponent container.! ! !SMWeb methodsFor: 'initialize-release'! initViewer: aResponseHeader | viewer | viewer := self getViewerFrom: aResponseHeader. viewer notNil ifTrue: [self tmpFilename: (model randomFile nextWithSuffix: '.' , aResponseHeader mimeSubType). "viewer addDependent: self"]. ^viewer! ! ApplicationModel subclass: #NetFish instanceVariableNames: 'url model hyperView homepage historian ' classVariableNames: 'DefaultTmpDir DefaultURL ' poolDictionaries: '' category: 'NetFish-Model'! !NetFish methodsFor: 'actions'! exit self closeRequest. model release.! ! !NetFish methodsFor: 'private'! defaultUrl ^self class defaultURL! ! !NetFish class methodsFor: 'examples'! example1 "You need to modify the tmp directory. Temporary files will be written in the temp directory you supply. These files are deleted when you exit Netfish through the File|exit menu. You may also want to use another homepage of your preference." "Other url you may want to try are file://.../somelocalfilename http://st-www.cs.uiuc.edu/users/mchung/mcheung05.gif http://st-www.cs.uiuc.edu/users/mchung/test.mchung" "NetFish example1" NetFish defaultURL: 'http://st-www.cs.uiuc.edu/users/chai/research/netfish/'; defaultTmpDir: '/tmp/'. NetFish openOn: (NetFish new)! ! !NetFish class methodsFor: 'class initialization'! initialize " NetFish initialize " self defaultURL:'http://st-www.cs.uiuc.edu'. self defaultTmpDir: '/tmp/'! ! !NetFish class methodsFor: 'accessing'! defaultTmpDir ^DefaultTmpDir! defaultTmpDir: aString DefaultTmpDir := aString! defaultURL ^DefaultURL! defaultURL: aURL DefaultURL := aURL! ! Model subclass: #StreamFilter instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'HyperTalk-Framework'! NetFish initialize! HtmlDtd initialize!