/usr/share/mozart/doc/demo/node31.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>User dialog widgets: Dialogs.oz</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="node30.html#code.transportation.configure"><< Prev</A></TD><TD><A href="transportation.html">- Up -</A></TD><TD><A href="node32.html#code.transportation.germany">Next >></A></TD></TR></TABLE><DIV class="unnumbered" id="code.transportation.dialogs"><H3><A name="code.transportation.dialogs">User dialog widgets: <CODE>Dialogs.oz</CODE></A></H3><P class="margin"><A href="Transport/Dialogs.oz">Source File</A></P><P> </P><BLOCKQUOTE><PRE><SPAN class="keyword">functor</SPAN> <BR> <BR><SPAN class="keyword">import</SPAN> <BR> Tk TkTools<BR> <BR> Widgets(entryChooser)<BR> Country(isCity cities)<BR> Configure(title colors fonts)<BR> <BR><SPAN class="keyword">export</SPAN> <BR> About<BR> AddCompany<BR> RemCompany<BR> AddDriver<BR> RemDriver<BR> <BR><SPAN class="keyword">prepare</SPAN> <BR> Pad = 2<BR> BigPad = 4<BR> BigTextWidth = 17<BR> <BR><SPAN class="keyword">define</SPAN> <BR> <BR> TextBg = Configure<SPAN class="keyword">.</SPAN>colors<SPAN class="keyword">.</SPAN>textBg<BR> AboutFont = Configure<SPAN class="keyword">.</SPAN>fonts<SPAN class="keyword">.</SPAN>about<BR> <BR> <SPAN class="keyword">class</SPAN> <SPAN class="type">About</SPAN> <BR> <SPAN class="keyword">from</SPAN><SPAN class="type"> TkTools.dialog</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">init</SPAN>(master:Master)<BR> TkTools<SPAN class="keyword">.</SPAN>dialog<SPAN class="keyword">,</SPAN>tkInit(master: Master<BR> title: Configure<SPAN class="keyword">.</SPAN>title<SPAN class="keyword">#</SPAN><SPAN class="string">': About'</SPAN> <BR> buttons: [<SPAN class="string">'Okay'</SPAN><SPAN class="keyword">#</SPAN>tkClose]<BR> focus: 1<BR> pack: <SPAN class="keyword">false</SPAN> <BR> default: 1)<BR> Title = {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent: <SPAN class="keyword">self</SPAN> <BR> font: AboutFont<BR> text: Configure<SPAN class="keyword">.</SPAN>title<BR> foreground: blue)}<BR> <BR> Author = {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent: <SPAN class="keyword">self</SPAN> <BR> text: (<SPAN class="string">'Christian Schulte\n'</SPAN> <SPAN class="keyword">#</SPAN> <BR> <SPAN class="string">'<schulte@ps.uni-sb.de>\n'</SPAN>))}<BR> <SPAN class="keyword">in</SPAN> <BR> {Tk<SPAN class="keyword">.</SPAN>send pack(Title Author side:top expand:1 padx:BigPad pady:BigPad)}<BR> About<SPAN class="keyword">,</SPAN>tkPack<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <BR> <SPAN class="keyword">class</SPAN> <SPAN class="type">OkayDialog</SPAN> <BR> <SPAN class="keyword">from</SPAN><SPAN class="type"> TkTools.dialog</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">init</SPAN>(master:M title:T okay:O)<BR> TkTools<SPAN class="keyword">.</SPAN>dialog<SPAN class="keyword">,</SPAN>tkInit(master: M<BR> title: Configure<SPAN class="keyword">.</SPAN>title<SPAN class="keyword">#</SPAN><SPAN class="string">': '</SPAN><SPAN class="keyword">#</SPAN>T<BR> buttons: [<SPAN class="string">'Okay'</SPAN><SPAN class="keyword">#</SPAN>O <SPAN class="string">'Cancel'</SPAN><SPAN class="keyword">#</SPAN>tkClose]<BR> pack: <SPAN class="keyword">false</SPAN> <BR> default: 1)<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">Error</SPAN> M T}<BR> {Wait {New TkTools<SPAN class="keyword">.</SPAN>error tkInit(master:M text:T)}<SPAN class="keyword">.</SPAN>tkClosed}<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">class</SPAN> <SPAN class="type">AddCompany</SPAN> <BR> <SPAN class="keyword">from</SPAN><SPAN class="type"> OkayDialog</SPAN> <BR> <SPAN class="keyword">prop</SPAN> final<BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">init</SPAN>(master:M agents:AS company:C)<BR> <BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">Okay</SPAN>}<BR> AddC={Entry tkReturnAtom(get $)}<BR> <SPAN class="keyword">in</SPAN> <BR> <SPAN class="keyword">if</SPAN> {Dictionary<SPAN class="keyword">.</SPAN>member AS AddC} <SPAN class="keyword">then</SPAN> <BR> {Error <SPAN class="keyword">self</SPAN> <SPAN class="string">'Company '</SPAN><SPAN class="keyword">#</SPAN>AddC<SPAN class="keyword">#</SPAN><SPAN class="string">' already exists.'</SPAN>}<BR> <SPAN class="keyword">else</SPAN> C=AddC {<SPAN class="keyword">self</SPAN> tkClose}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> OkayDialog<SPAN class="keyword">,</SPAN>init(master:M title:<SPAN class="string">'Add Company'</SPAN> okay:Okay)<BR> Frame = {New TkTools<SPAN class="keyword">.</SPAN>textframe tkInit(parent:<SPAN class="keyword">self</SPAN> text:<SPAN class="string">'Add Company'</SPAN>)}<BR> Name = {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent:Frame<SPAN class="keyword">.</SPAN>inner text:<SPAN class="string">'Company:'</SPAN>)}<BR> Entry = {New Tk<SPAN class="keyword">.</SPAN>entry tkInit(parent:Frame<SPAN class="keyword">.</SPAN>inner bg:TextBg<BR> width:BigTextWidth)}<BR> <SPAN class="keyword">in</SPAN> <BR> {Tk<SPAN class="keyword">.</SPAN>batch [pack(Name Entry side:left padx:Pad pady:Pad)<BR> pack(Frame) focus(Entry)]}<BR> AddCompany<SPAN class="keyword">,</SPAN>tkPack<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <BR> <SPAN class="keyword">class</SPAN> <SPAN class="type">RemCompany</SPAN> <BR> <SPAN class="keyword">from</SPAN><SPAN class="type"> OkayDialog</SPAN> <BR> <SPAN class="keyword">prop</SPAN> final<BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">init</SPAN>(master:M agents:AS company:C)<BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">Okay</SPAN>}<BR> RemC={Entry<SPAN class="keyword">.</SPAN>entry tkReturnAtom(get $)}<BR> <SPAN class="keyword">in</SPAN> <BR> <SPAN class="keyword">if</SPAN> {Dictionary<SPAN class="keyword">.</SPAN>member AS RemC} <SPAN class="keyword">then</SPAN> C=RemC {<SPAN class="keyword">self</SPAN> tkClose}<BR> <SPAN class="keyword">else</SPAN> {Error <SPAN class="keyword">self</SPAN> <SPAN class="string">'There is no company with name: '</SPAN><SPAN class="keyword">#</SPAN>RemC<SPAN class="keyword">#</SPAN><SPAN class="string">'.'</SPAN>}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> OkayDialog<SPAN class="keyword">,</SPAN> init(master:M title:<SPAN class="string">'Remove Company'</SPAN> okay:Okay)<BR> Frame = {New TkTools<SPAN class="keyword">.</SPAN>textframe tkInit(parent:<SPAN class="keyword">self</SPAN> <BR> text:<SPAN class="string">'Remove Company'</SPAN>)}<BR> Name = {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent:Frame<SPAN class="keyword">.</SPAN>inner text:<SPAN class="string">'Company:'</SPAN>)}<BR> Entry = {New Widgets<SPAN class="keyword">.</SPAN>entryChooser<BR> tkInit(parent:Frame<SPAN class="keyword">.</SPAN>inner<BR> toplevel:<SPAN class="keyword">self.</SPAN>toplevel<BR> entries:{Dictionary<SPAN class="keyword">.</SPAN>keys AS})}<BR> <SPAN class="keyword">in</SPAN> <BR> {Tk<SPAN class="keyword">.</SPAN>batch [pack(Name Entry side:left padx:Pad pady:Pad)<BR> pack(Frame) focus(Entry<SPAN class="keyword">.</SPAN>entry)]}<BR> RemCompany<SPAN class="keyword">,</SPAN>tkPack<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <BR> <SPAN class="keyword">class</SPAN> <SPAN class="type">AddDriver</SPAN> <BR> <SPAN class="keyword">from</SPAN><SPAN class="type"> OkayDialog</SPAN> <BR> <SPAN class="keyword">prop</SPAN> final<BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">init</SPAN>(master:M agents:AS company:C driver:D city:Y)<BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">Okay</SPAN>}<BR> AddC={EntryC<SPAN class="keyword">.</SPAN>entry tkReturnAtom(get $)}<BR> AddD={EntryD tkReturnAtom(get $)}<BR> AddY={EntryY<SPAN class="keyword">.</SPAN>entry tkReturnAtom(get $)}<BR> <SPAN class="keyword">in</SPAN> <BR> <SPAN class="keyword">if</SPAN> {Dictionary<SPAN class="keyword">.</SPAN>member AS AddC} <SPAN class="keyword">then</SPAN> <BR> <SPAN class="keyword">if</SPAN> {Member AddD {Dictionary<SPAN class="keyword">.</SPAN>get AS AddC}} <SPAN class="keyword">then</SPAN> <BR> {Error <SPAN class="keyword">self</SPAN> <SPAN class="string">'Driver '</SPAN><SPAN class="keyword">#</SPAN>AddD<SPAN class="keyword">#</SPAN><SPAN class="string">' already exists for company '</SPAN><SPAN class="keyword">#</SPAN> <BR> AddC<SPAN class="keyword">#</SPAN><SPAN class="string">'.'</SPAN>}<BR> <SPAN class="keyword">elseif</SPAN> {Country<SPAN class="keyword">.</SPAN>isCity AddY} <SPAN class="keyword">then</SPAN> <BR> C=AddC D=AddD Y=AddY {<SPAN class="keyword">self</SPAN> tkClose}<BR> <SPAN class="keyword">else</SPAN> <BR> {Error <SPAN class="keyword">self</SPAN> <SPAN class="string">'There is no city '</SPAN><SPAN class="keyword">#</SPAN>AddY<SPAN class="keyword">#</SPAN><SPAN class="string">'.'</SPAN>}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">else</SPAN> {Error <SPAN class="keyword">self</SPAN> <SPAN class="string">'There is no company '</SPAN><SPAN class="keyword">#</SPAN>AddC<SPAN class="keyword">#</SPAN><SPAN class="string">'.'</SPAN>}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> OkayDialog<SPAN class="keyword">,</SPAN> init(master:M title:<SPAN class="string">'Add Driver'</SPAN> okay:Okay)<BR> Frame = {New TkTools<SPAN class="keyword">.</SPAN>textframe tkInit(parent:<SPAN class="keyword">self</SPAN> text:<SPAN class="string">'Add Driver'</SPAN>)}<BR> NameC = {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent:Frame<SPAN class="keyword">.</SPAN>inner text:<SPAN class="string">'Company:'</SPAN>)}<BR> EntryC = {New Widgets<SPAN class="keyword">.</SPAN>entryChooser<BR> tkInit(parent: Frame<SPAN class="keyword">.</SPAN>inner<BR> toplevel: <SPAN class="keyword">self.</SPAN>toplevel<BR> entries: {Dictionary<SPAN class="keyword">.</SPAN>keys AS})}<BR> NameD = {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent:Frame<SPAN class="keyword">.</SPAN>inner text:<SPAN class="string">'Driver:'</SPAN>)}<BR> EntryD = {New Tk<SPAN class="keyword">.</SPAN>entry tkInit(parent:Frame<SPAN class="keyword">.</SPAN>inner bg:TextBg)}<BR> NameY = {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent:Frame<SPAN class="keyword">.</SPAN>inner text:<SPAN class="string">'City:'</SPAN>)}<BR> EntryY = {New Widgets<SPAN class="keyword">.</SPAN>entryChooser<BR> tkInit(parent: Frame<SPAN class="keyword">.</SPAN>inner<BR> toplevel: <SPAN class="keyword">self.</SPAN>toplevel<BR> entries: Country<SPAN class="keyword">.</SPAN>cities)}<BR> <SPAN class="keyword">in</SPAN> <BR> {Tk<SPAN class="keyword">.</SPAN>batch [grid(NameC row:0 column:0 sticky:w)<BR> grid(NameD row:1 column:0 sticky:w)<BR> grid(NameY row:2 column:0 sticky:w)<BR> grid(EntryC row:0 column:1 sticky:we)<BR> grid(EntryD row:1 column:1 sticky:we)<BR> grid(EntryY row:2 column:1 sticky:we)<BR> pack(Frame)]}<BR> AddDriver<SPAN class="keyword">,</SPAN>tkPack<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <BR> <SPAN class="keyword">class</SPAN> <SPAN class="type">RemDriver</SPAN> <BR> <SPAN class="keyword">from</SPAN><SPAN class="type"> OkayDialog</SPAN> <BR> <SPAN class="keyword">prop</SPAN> final<BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">init</SPAN>(master:M agents:AS company:C driver:D)<BR> Companies = {Filter {Dictionary<SPAN class="keyword">.</SPAN>keys AS}<BR> <SPAN class="keyword">fun</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> C}<BR> {Dictionary<SPAN class="keyword">.</SPAN>get AS C}<SPAN class="keyword">\=</SPAN>nil<BR> <SPAN class="keyword">end</SPAN>}<BR> <BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">Okay</SPAN>}<BR> RemC={EntryC<SPAN class="keyword">.</SPAN>entry tkReturnAtom(get $)}<BR> RemD={EntryD<SPAN class="keyword">.</SPAN>entry tkReturnAtom(get $)}<BR> <SPAN class="keyword">in</SPAN> <BR> <SPAN class="keyword">if</SPAN> {Dictionary<SPAN class="keyword">.</SPAN>member AS RemC} <SPAN class="keyword">then</SPAN> <BR> <SPAN class="keyword">if</SPAN> {Member RemD {Dictionary<SPAN class="keyword">.</SPAN>get AS RemC}} <SPAN class="keyword">then</SPAN> <BR> C=RemC D=RemD {<SPAN class="keyword">self</SPAN> tkClose}<BR> <SPAN class="keyword">else</SPAN> <BR> {Error <SPAN class="keyword">self</SPAN> <SPAN class="string">'No driver '</SPAN><SPAN class="keyword">#</SPAN>RemD<SPAN class="keyword">#</SPAN><SPAN class="string">' for company '</SPAN><SPAN class="keyword">#</SPAN>RemC<SPAN class="keyword">#</SPAN><SPAN class="string">'.'</SPAN>}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">else</SPAN> {Error <SPAN class="keyword">self</SPAN> <SPAN class="string">'There is no company '</SPAN><SPAN class="keyword">#</SPAN>RemC<SPAN class="keyword">#</SPAN><SPAN class="string">'.'</SPAN>}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> OkayDialog<SPAN class="keyword">,</SPAN> init(master:M title:<SPAN class="string">'Remove Driver'</SPAN> okay:Okay)<BR> Frame = {New TkTools<SPAN class="keyword">.</SPAN>textframe tkInit(parent:<SPAN class="keyword">self</SPAN> text:<SPAN class="string">'Remove Driver'</SPAN>)}<BR> NameC = {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent:Frame<SPAN class="keyword">.</SPAN>inner text:<SPAN class="string">'Company:'</SPAN>)}<BR> EntryC = {New Widgets<SPAN class="keyword">.</SPAN>entryChooser<BR> tkInit(parent: Frame<SPAN class="keyword">.</SPAN>inner<BR> toplevel: <SPAN class="keyword">self.</SPAN>toplevel<BR> entries: Companies<BR> action: <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> A}<BR> {EntryD entries({Dictionary<SPAN class="keyword">.</SPAN>get AS A})}<BR> <SPAN class="keyword">end</SPAN>)}<BR> NameD = {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent:Frame<SPAN class="keyword">.</SPAN>inner text:<SPAN class="string">'Driver:'</SPAN>)}<BR> EntryD = {New Widgets<SPAN class="keyword">.</SPAN>entryChooser<BR> tkInit(parent: Frame<SPAN class="keyword">.</SPAN>inner<BR> toplevel: <SPAN class="keyword">self.</SPAN>toplevel<BR> entries: {Dictionary<SPAN class="keyword">.</SPAN>get AS Companies<SPAN class="keyword">.</SPAN>1})}<BR> <SPAN class="keyword">in</SPAN> <BR> {Tk<SPAN class="keyword">.</SPAN>batch [grid(NameC row:0 column:0 sticky:w)<BR> grid(NameD row:1 column:0 sticky:w)<BR> grid(EntryC row:0 column:1 sticky:we)<BR> grid(EntryD row:1 column:1 sticky:we)<BR> pack(Frame)]}<BR> RemDriver<SPAN class="keyword">,</SPAN>tkPack<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR><SPAN class="keyword">end</SPAN> <BR> <BR> <BR> <BR> <BR> <BR> <BR> <BR></PRE></BLOCKQUOTE><P></P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node30.html#code.transportation.configure"><< Prev</A></TD><TD><A href="transportation.html">- Up -</A></TD><TD><A href="node32.html#code.transportation.germany">Next >></A></TD></TR></TABLE><HR><ADDRESS><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>
|