Title: Views an XMLbased independent GUI system
1Views 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
2Motivation
- 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
3Where 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
4Rotor 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
5GUI building today
6A GUI using XML
7Example in Views
XML
C
Views.Form f new Views.Form(_at_"ltFormgt
ltverticalgt lthorizontalgt ltButton
NameShow/gt ltButton NameHide/gt
lt/horizontalgt ltPictureBox Namepic
Image'Jacarandas.jpg' Height175/gt
lt/verticalgt lt/Formgt" )
string c for () c f.GetControl() if
(cnull) 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
8The Views Notation
form ltformgt controlGroup lt/formgt controlGroup lt
verticalgt controlList lt/verticalgt
lthorizontalgt controlList lt/horizontalgt controlList
control textItemList ltitemgt text lt/itemgt
control controlGroup ltButton/gt
ltCheckBox/gt ltCheckedListBoxgt textItemList
lt/CheckedListBoxgt ltDomainUpDowngt textItemList
lt/DomainUpDowngt ltGroupBoxgt radioButtonList
lt/GroupBoxgt ltLabel/gt ltListBox/gt
ltOpenFileDialog/gt ltSaveFileDialog/gt
ltPictureBox/gt ltTextBox/gt ltProgressBar/gt
ltTrackBar/gt radioButtonList ltRadioButton/gt
9The Eight Handler methods
Essentially five kinds of methods construct clo
se 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
10Views1 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 users 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"
11Views2 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( "ltTagName A1V1 A2V2 A3V2 ..
/gt" ) - so we can introduce new tags without
preprogramming Views for all controls - Views2 can handle asynchronous events
- ltButton Name"Show" Click"ButtonClick"/gt
- c.f. show.Click new EventHandler(ActionPerforme
d)
12Future 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
13References 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.