This file is indexed.

/usr/share/mozart/doc/browser/node5.html is in mozart-doc 1.4.0-8ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

1
2
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>4 Using Browser Objects</TITLE><LINK href="ozdoc.css" rel="stylesheet" type="text/css"></HEAD><BODY><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node4.html#sec.browser.browsercommandsandoptions">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="idx.html#label287">Next &gt;&gt;</A></TD></TR></TABLE><DIV id="sec.browser.applicationbrowsers"><H1><A name="sec.browser.applicationbrowsers">4 Using Browser Objects</A></H1><P>All Browsers in the Oz system are Oz objects. The <CODE>BrowserClass</CODE> is the class definition of these objects. In this section the usage of these objects is described. </P><H2><A name="label233">4.1 Creating A Browser Object</A></H2><P><A name="label235"></A> One can create Browser objects similarly to the pre-defined <CODE>Browser</CODE> one: </P><BLOCKQUOTE class="code"><CODE>BrowserObject&nbsp;=&nbsp;{New&nbsp;Browser<SPAN class="keyword">.</SPAN><SPAN class="string">'class'</SPAN>&nbsp;init}</CODE></BLOCKQUOTE><P></P><P>The plain <CODE>init</CODE> method makes a newly created Browser placed on its own toplevel widget. One can tell a Browser object to use a Tk frame (see for details) as its toplevel frame: <A name="label237"></A> <A name="label239"></A> <A name="label241"></A> </P><BLOCKQUOTE class="code"><CODE><SPAN class="keyword">declare</SPAN>&nbsp;W&nbsp;F&nbsp;BrowserObject&nbsp;<SPAN class="keyword">in</SPAN>&nbsp;<BR>%%<SPAN class="comment">&nbsp;<BR></SPAN>W&nbsp;=&nbsp;{New&nbsp;Tk<SPAN class="keyword">.</SPAN>toplevel&nbsp;tkInit(bg:ivory)}<BR>{Tk<SPAN class="keyword">.</SPAN>send&nbsp;wm(geometry&nbsp;W&nbsp;<SPAN class="string">&quot;500x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&nbsp;250)}<BR>{Tk<SPAN class="keyword">.</SPAN>send&nbsp;pack(F&nbsp;fill:both&nbsp;padx:10&nbsp;pady:10&nbsp;expand:<SPAN class="keyword">true</SPAN>)}<BR>%%<SPAN class="comment">&nbsp;<BR></SPAN>BrowserObject&nbsp;=&nbsp;{New&nbsp;Browser<SPAN class="keyword">.</SPAN><SPAN class="string">'class'</SPAN>&nbsp;init(origWindow:&nbsp;F)}<BR>{BrowserObject&nbsp;createWindow}<BR>%%<SPAN class="comment">&nbsp;<BR></SPAN>{BrowserObject<BR>&nbsp;browse(<BR>&nbsp;&nbsp;&nbsp;&nbsp;record(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;atom:&nbsp;bonjour<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;quotedAtom:&nbsp;<SPAN class="string">'hello&nbsp;world'</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list:&nbsp;[one&nbsp;two&nbsp;three&nbsp;four&nbsp;five&nbsp;six&nbsp;seven&nbsp;nine]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;integer:&nbsp;57<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;float:&nbsp;34<SPAN class="keyword">.</SPAN>56e<SPAN class="keyword">~</SPAN>76<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;string:<SPAN class="string">&quot;adieu,&nbsp;monde&nbsp;cruel!&quot;</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;byteString:{ByteString<SPAN class="keyword">.</SPAN>make&nbsp;<SPAN class="string">&quot;squeeze&nbsp;me&quot;</SPAN>}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tuple:&nbsp;foo(one(1)&nbsp;two(1&nbsp;2)&nbsp;three(1&nbsp;2&nbsp;3))))}</CODE></BLOCKQUOTE><P></P><P>The window produced that way is shown on <A href="node5.html#fig.browser.oz-em-browser">Figure&nbsp;4.1</A>. Such a browser is called an <A name="label242"></A><EM>embedded</EM> Browser, compared to a <A name="label243"></A><EM>stand-alone</EM> Browser using its own toplevel widget. </P><DIV id="fig.browser.oz-em-browser"><HR><P><A name="fig.browser.oz-em-browser"></A></P><DIV align="center"><IMG alt="" src="emb_nicebrowser.gif"></DIV><P class="caption"><STRONG>Figure&nbsp;4.1:</STRONG> An Embedded Application Browser</P><HR></DIV><P> <A name="label245"></A> <A name="label247"></A> Note that when a Browser object is created, either stand-alone or embedded, its window does not appear immediately. This happens when either <CODE>createWindow</CODE> or <CODE>browse</CODE> methods are applied.</P><P><A name="label249"></A> <A name="label251"></A> A Browser window can be closed by means of the <CODE>closeWindow</CODE> method. Each time a Browser window is closed its buffer is flushed. A Browser object itself can be closed by means of the <CODE>close</CODE> method, which deletes its window and frees used by the object memory. A subsequent application of a Browser object closed this way proceeds as it were just created\footnote{This feature is used in the pre-defined <CODE>Browser</CODE>, which can be closed many times but never dies. Note that this behavior <EM>is not</EM> ``re-creating'' since no new Browser object is created immediately.}.</P><P><A name="label253"></A> Note that the <CODE>closeWindow</CODE> method has no effect for embedded application browsers.</P><P><A name="label255"></A> An embedded browser and its frame should be closed by sending the <CODE>close</CODE> messages on the Browser object and on the frame object in that sequence. For instance, in our example it would be </P><BLOCKQUOTE class="code"><CODE>&nbsp;&nbsp;&nbsp;{BO&nbsp;close}<BR>&nbsp;&nbsp;&nbsp;{F&nbsp;close}</CODE></BLOCKQUOTE><P></P><H2><A name="label256">4.2 Browser Object Methods</A></H2><P><A name="label257"></A> <A name="label258"></A> Browser objects are controlled by user through the Browser GUI, and by means of application of them to the <CODE>BrowserClass</CODE> methods. At the glance, there are the following public methods of a Browser object, where <CODE>X</CODE> and <CODE>Y</CODE> are certain internal default values: <A name="label260"></A> <A name="label262"></A> <A name="label264"></A> <A name="label266"></A> <A name="label268"></A> <A name="label270"></A> <A name="label272"></A> <A name="label274"></A> <A name="label276"></A> <A name="label278"></A> <A name="label280"></A> <A name="label282"></A> <A name="label284"></A> <A name="label286"></A> </P><BLOCKQUOTE class="code"><CODE>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">meth</SPAN>&nbsp;<SPAN class="functionname">init</SPAN>(origWindow:&nbsp;OrigWindow&nbsp;<SPAN class="keyword">&lt;=</SPAN>&nbsp;X)<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">meth</SPAN>&nbsp;<SPAN class="functionname">createWindow</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">meth</SPAN>&nbsp;<SPAN class="functionname">closeWindow</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">meth</SPAN>&nbsp;<SPAN class="functionname">close</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">meth</SPAN>&nbsp;<SPAN class="functionname">browse</SPAN>(Term)<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">meth</SPAN>&nbsp;<SPAN class="functionname">break</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">meth</SPAN>&nbsp;<SPAN class="functionname">clear</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">meth</SPAN>&nbsp;<SPAN class="functionname">clearAllButLast</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">meth</SPAN>&nbsp;<SPAN class="functionname">rebrowse</SPAN>&nbsp;<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">meth</SPAN>&nbsp;<SPAN class="functionname">option</SPAN>(<SPAN class="keyword">...</SPAN>)<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">meth</SPAN>&nbsp;<SPAN class="functionname">add</SPAN>(Action&nbsp;label:Label&nbsp;<SPAN class="keyword">&lt;=</SPAN>&nbsp;Y)<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">meth</SPAN>&nbsp;<SPAN class="functionname">set</SPAN>(Action)<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">meth</SPAN>&nbsp;<SPAN class="functionname">delete</SPAN>(Action)<BR>&nbsp;&nbsp;&nbsp;<SPAN class="keyword">meth</SPAN>&nbsp;<SPAN class="functionname">refineLayout</SPAN></CODE></BLOCKQUOTE><P></P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node4.html#sec.browser.browsercommandsandoptions">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="idx.html#label287">Next &gt;&gt;</A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.sics.se/~kost/">Konstantin&nbsp;Popov</A><BR><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>