1 / 13

Views – an XML-based independent GUI system

Views – an XML-based independent GUI system. Judith Bishop University of Pretoria, South Africa Nigel Horspool University of Victoria, Canada http://www.cs.up.ac.za/rotor. Motivation. Forward looking Move to platform independent GUI systems Integration of XML into languages (cf XEN)

Télécharger la présentation

Views – an XML-based independent GUI system

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Views – an XML-based independent GUI system Judith Bishop University of Pretoria, South Africa Nigel Horspool University of Victoria, Canada http://www.cs.up.ac.za/rotor 2nd Rotor Workshop 2003

  2. Motivation • Forward looking • Move to platform independent GUI systems • Integration of XML into languages (cf XEN) • Technical • Rotor does not have a GUI capability • Interesting challenges in Reflection, RegEx etc • Educational • Dissatisfaction with method-oriented or drag and drop GUIs • Separation of concerns 2nd Rotor Workshop 2003

  3. Where GUIs are going The reality of a single cross-language, cross-platform GUI interface programming model is in sight, based on an XML description language supported by fast native runtimes. [Russel Jones, DevX, Nov 2002] Supporting many GUIs isn't just a simple process of including one set of libraries or another; it's often a frustrating and error-prone exercise in writing GUI-specific code. [Russel Jones, DevX, Aug 2003] 2nd Rotor Workshop 2003

  4. JScript Rotor CLI Implementation VS.NET System.Web (ASP.NET) System.WinForms System.WinForms C# System.Drawing System.Data (ADO.NET) System.Xml SDK Tools System Common Language Runtime Platform Abstraction 2nd Rotor Workshop 2003

  5. widget rendering in the OS widget calls in a language Windows GUI Builder Application Add Listeners Handlers Visual Studio C# GUI building today 2nd Rotor Workshop 2003

  6. widget rendering in the OS GUI XML Spec Application Control Engine Handlers Add Listeners A GUI using XML 2nd Rotor Workshop 2003

  7. Example in Views XML C# Views.Form f = new Views.Form(@"<Form> <vertical> <horizontal> <Button Name=Show/> <Button Name=Hide/> </horizontal> <PictureBox Name=pic Image='Jacarandas.jpg' Height=175/> </vertical> </Form>" ); string c; for (;;) { c = f.GetControl(); if (c==null) break; PictureBox pb = f["pic"]; switch (c) { case ”Show" : pb.Show(); break; } case ”Hide" : pb.Hide(); break; } } } • No pixel positioning • No generated code • Separation of concerns 2nd Rotor Workshop 2003

  8. The Views Notation form: <form>controlGroup</form> controlGroup: <vertical>controlList</vertical> | <horizontal>controlList</horizontal> controlList: { control } textItemList: { <item> text </item> } control: controlGroup | <Button/>| <CheckBox/> | <CheckedListBox> textItemList </CheckedListBox> | <DomainUpDown> textItemList </DomainUpDown> | <GroupBox>radioButtonList</GroupBox> | <Label/>| <ListBox/> | <OpenFileDialog/> | <SaveFileDialog/> | <PictureBox/> | <TextBox/> | <ProgressBar/> | <TrackBar/> radioButtonList: { <RadioButton/> } 2nd Rotor Workshop 2003

  9. The Eight Handler methods Essentially five kinds of methods: construct close getControl get put PLUS … direct access Form(string spec,params) The constructor. void CloseGUI( ) Terminates the execution thread string GetControl( ) Waits for the user to perform an action string GetText(string name) Returns the value of the Text attribute int GetValue(string name) Returns the Value attribute from TrackBar, ProgressBar and CheckBox int GetValue(string name, int index) Returns the status of CheckBox at position index void PutText(string name, string s) Displays the string in a TextBox or ListBox control. void PutValue(string name, int v) Sets an integer value associated with a ProgressBar or CheckBox 2nd Rotor Workshop 2003

  10. Views1 implementation • RegEx API would be nice for normalising XML • If REs fail to match, hard to create a use friendly error message • did not use the RE package. • XML API produces poor error messages when reading XML • implemented our own lexical analyzer for the XML specifications • preprocess the user’s XML then use the XML package, • Views inverts the interaction logic of controls • normally events cause invocation of handling routines asynchronously • our simple interface has the user invoke Views to wait for an event to happen ... s = form.GetControl(); switch(s) { ... case "Push Me": 2nd Rotor Workshop 2003

  11. Views2 implementation • Views2 is a general-purpose tool for creating sophisticated graph structures whose nodes are arbitrary class instances and where the structure layout is defined by a simple XML notation • Correspondence can be made to work with reflection: Views2.Create( "<TagName A1=V1 A2=V2 A3=V2 .. />" ) so we can introduce new tags without preprogramming Views for all controls • Views2 can handle asynchronous events <Button Name="Show" Click="ButtonClick"/> c.f. show.Click += new EventHandler(ActionPerformed); 2nd Rotor Workshop 2003

  12. Future Work • Completing Views2 and writing it up • Completing the TCL/Tk version and looking at alternative GUI tools • Completing a drag and drop stand-alone tool to emit Views XML • Further investigating the pedagogy • Thinking of asking MS to make Regex available in all operating systems • e.g. “PDA .NET environment we've seen doesn'tinclude the regexp library, threading, reflection or a full version of collections.” • Long term – XML checking in the language 2nd Rotor Workshop 2003

  13. References on www.cs.up.ac.za/rotor • Horspool R N and Bishop J M, Views - and independent GUI development tool for Rotor, 1st Rotor Workshop, Cambridge July 2002. • Bishop J M and Horspool R N, Views - a Vendor Independent Extensible Windowing System, presented at IFIP WG2.4 meeting, Dagstuhl, Germany, November 2002 • Bishop J M, Horspool R N and Worrall B G, Experience with integrating Java with C# and .NET, JavaGrande, Seattle, November 2002, and Concurrency and Computation - Practice and Experience, to be published, January 2004 • Bishop J M, Tutorial at RISE, University of Linkoping, Sweden, December 2002 • Bishop J M and Horspool R N, Views report to Microsoft, January 2003 • Bishop J M and Horspool R N, C# - the modular language for the 2000s. Tutorial at JMLC, Klagenfurt, August 2003 • Bishop J M and Horspool R N, C# Concisely, Addison Wesley, appear October 2003. • Bishop J M and Horspool, Towards principles of GUI programming using Views, paper submitted to SIGCSE 2004. 2nd Rotor Workshop 2003

More Related