The SquidKit Windowing Architecture. Ronald J. Mann Sr. Staff Engineer Sun Microsystems Inc.

Similar documents
Graphical User Interface (GUI)

Creating Rich GUIs in Java. Amy Fowler Staff Engineer JavaSoft

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours

Graphical User Interface (GUI)

Sri Vidya College of Engineering & Technology

CS 4300 Computer Graphics

Course Structure. COMP434/534B Software Design Component-based software architectures. Components. First term. Components.

Widget. Widget is a generic name for parts of an interface that have their own behaviour. e.g., buttons, progress bars, sliders, drop-down

Creational Patterns. Factory Method (FM) Abstract Factory (AF) Singleton (SI) Prototype (PR) Builder (BU)

UI Software Organization

where are we? ICS 105: Project in HCI ui toolkits what does the toolkit do? model-view-controller model-view-controller lectures

A Performance Tale. The evolution of binding in JavaFX. Robert Field Brian Goetz Sun Microsystems, Inc.

DESIGN PATTERN - INTERVIEW QUESTIONS

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7

Windows and Events. created originally by Brian Bailey

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview

Type of Classes Nested Classes Inner Classes Local and Anonymous Inner Classes

Socket attaches to a Ratchet. 2) Bridge Decouple an abstraction from its implementation so that the two can vary independently.

Chapter 4 Defining Classes I

[Course Overview] After completing this module you are ready to: Develop Desktop applications, Networking & Multi-threaded programs in java.

Lecture 1: Overview of Java

Internet Application Developer

Widgets. Overview. Widget. Widgets Widget toolkits Lightweight vs. heavyweight widgets Swing Widget Demo

Core Java Syllabus. Pre-requisite / Target Audience: C language skills (Good to Have)

SELF-STUDY. Glossary

What's Coming in IBM WebSphere Portlet Factory 7.0

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance

15CS45 : OBJECT ORIENTED CONCEPTS

CONTENTS. Chapter 1 Getting Started with Java SE 6 1. Chapter 2 Exploring Variables, Data Types, Operators and Arrays 13

Widget Toolkits CS MVC

Appendix A - Glossary(of OO software term s)

Widgets. Widgets Widget Toolkits. 2.3 Widgets 1

Graphical User Interfaces (GUIs)

S U N M I C R O SYS T E M S B R O C H U R E P E R S O N A L J AVA

Creational Design Patterns

Block I Unit 2. Basic Constructs in Java. AOU Beirut Computer Science M301 Block I, unit 2 1

Contents. iii Copyright 1998 Sun Microsystems, Inc. All Rights Reserved. Enterprise Services August 1998, Revision B

Data Mappings in the Model-View-Controller Pattern 1

Input: Interaction Techniques

Event Dispatch. Interactor Tree Lightweight vs. Heavyweight Positional Dispatch Focus Dispatch. Event Architecture. A pipeline: Event Capture

Object-Oriented Programming Design. Topic : Graphics Programming GUI Part I

Class, Variable, Constructor, Object, Method Questions

Event Dispatch. Interactor Tree Lightweight vs. Heavyweight Positional Dispatch Focus Dispatch. 2.4 Event Dispatch 1

Widgets. Widgets Widget Toolkits. User Interface Widget

GUI s and Keyboards. Larry Rudolph March 13, Pervasive Computing MIT SMA 5508 Spring 2006 Larry Rudolph

This page intentionally left blank

CS2113 Lab: Collections 10/29/2018

ProvideX. NOMADS Enhancements

Design Patterns. SE3A04 Tutorial. Jason Jaskolka

Flash Domain 4: Building Rich Media Elements Using Flash CS5

Core Java SYLLABUS COVERAGE SYLLABUS IN DETAILS

Advanced Java 2014

CSC207 Week 4. Larry Zhang

Introduction to Programming Using Java (98-388)

Model-view-controller View hierarchy Observer

Software Design Patterns. Background 1. Background 2. Jonathan I. Maletic, Ph.D.

Tool Kits, Swing. Overview. SMD158 Interactive Systems Spring Tool Kits in the Abstract. An overview of Swing/AWT

Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1

GUI Implementation Support

Software Architecture

Chapter 18. Advanced graphics programming

Interactive Programming In Java

Inheritance. Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L

Framework. Set of cooperating classes/interfaces. Example: Swing package is framework for problem domain of GUI programming

IT101. Graphical User Interface

B2.52-R3: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING THROUGH JAVA

Introduction to the JAVA UI classes Advanced HCI IAT351

GUI framework communication via the WWW

CSE 70 Final Exam Fall 2009

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Fall UI Design and Implementation 1

CS-140 Fall 2017 Test 1 Version Practice Practice for Nov. 20, Name:

CS 349 / SE 382 Custom Components. Professor Michael Terry February 6, 2009

COMP 401 Fall Recitation 6: Inheritance

Swing Based Remote GUI Emulation

The Sun s Java Certification and its Possible Role in the Joint Teaching Material

Towards a Repository of Common Programming Technologies Knowledge

Principles of Programming Languages, 2

CS 251 Intermediate Programming GUIs: Components and Layout

Concurrency in Object Oriented Programs 1. Object-Oriented Software Development COMP4001 CSE UNSW Sydney Lecturer: John Potter

Creating an object Instance variables

Lecture 9: UI Software Architecture. Fall UI Design and Implementation 1

Software Development & Education Center. Java Platform, Standard Edition 7 (JSE 7)

Object Oriented Programming with Java. Unit-1

SNS COLLEGE OF ENGINEERING, Coimbatore

Chapter 6 Enterprise Java Beans

UI Elements. If you are not working in 2D mode, you need to change the texture type to Sprite (2D and UI)

Radical GUI Makeover with Ajax Mashup

Swing from A to Z Using Focus in Swing, Part 2. Preface

DS 2009: middleware. David Evans

Mobile MOUSe JAVA2 FOR PROGRAMMERS ONLINE COURSE OUTLINE

M301: Software Systems & their Development. Unit 4: Inheritance, Composition and Polymorphism

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

TYPES OF INTERACTORS Prasun Dewan Department of Computer Science University of North Carolina at Chapel Hill

PESIT Bangalore South Campus

CIS3023: Programming Fundamentals for CIS Majors II Summer 2010

Java Swing Introduction

Syllabus & Curriculum for Certificate Course in Java. CALL: , for Queries

Remote Invocation. Today. Next time. l Overlay networks and P2P. l Request-reply, RPC, RMI

7. Program Frameworks

Transcription:

The SquidKit Windowing Architecture Ronald J. Mann Sr. Staff Engineer Sun Microsystems Inc. ron@east.sun.com

Window Woes The WORA promise Human Interface Design View drives architecture (Policy vs. Mechanism) Developers are people too! A single framework would ease use, maintenance Is a single GUI paradigm for Java Possible? AWT: Too dependant on native functionality Swing: Lots of Features, too big Profiles: Just give up on WORA Html/WAP/Etc: Not feature rich Toolkit Model: Procedural, fixed, largely static New devices + Internet = Need for new Paradigm

SquidKit Scalable Customizable GUI Development Kit Portability WORA Flexibility Eliminate the procedural remnants of the past; Provide a true OO model Window DNA Scalability Fixed collections of objects can t so the job Kill the Toolkit!

Premise Most visual interactive devices are created equal (kind of) Provide for Events Are Pixel Addressable Have at least one user-accessible clipped Rectangle Exploit Commonality, Stop dwelling on individuality HI should not drive infrastructure design Toolkit model is inflexible; Mechanism, Not Policy!

OTOH Targeted Toolkits can compete with native facilities Performance can be higher Footprint (in the ME space) can be lower We need both, at least until resources are limitless

Squid Architecture SquidKit est omnis divisa in partes tres Core Layer (Portability) Native Bridge Interface BasicWindow Abstraction Event Model Window Construction Kit (Flexibility) Windowing DNA Octopus (Scalability) IDE Interface Layer

History A Mistake Repeated Expedience forces reliance on high-level constructs WABI AWT Mann s Law ;-) The level of cross platform compatibility achievable by any application is inversely proportional to its reliance on native functionality.

Core Layer Abstracts Fundamental Types Eliminates reliance on Native State Standardizes a common Native Interface Standardizes Events Delivery Order Hide events necessary to platform

Core Layer: Native Bridge Event Abstraction Window Abstraction Screen Abstraction Prototype has 16 Entry Points! Init GetEvent, DispatchEvent, Event Masking Window Manipulation (Create, Destroy, Geometry) Need to add D&D, Font

Core Layer: Proto Entry Points boolean initializenative(); boolean geteventnative( CoreEvent e ); void dispatcheventnative( CoreEvent e ); void seteventmasknative ( long mask ); long geteventmasknative(); long createwindownative( WindowAttributes wa ); void destroywindownative( long window ); public void minimizewindownative( long window ); public void showwindownative( long window ); void setgeometrynative( long winhandle, int x, int y, int w, int h); void setstackingordernative( long win, long winstack, int flag ); void setvisiblenative( WindowAttributes wa ); void setcursornative( Cursor c ); boolean opendisplaynative( ScreenAttributes sa ); boolean opendisplaynative( ScreenAttributes sa, String s ); void getdesktoprectnative ( Rect r );

Core Layer: Windows BasicWindow (Abstract Class) CoreWindow Screen (Device) Parenting Default Event Handling Region, Geometry Manipulation Thread Issues WindowAttributes Encapsulates Persistent State Geometry, Visibility, State (Enabled, modality) etc. Listeners Décor (Decorations)

Core Layer: Events CoreEvent Class System, Info, Action, User, Native System contains abstracted native info Data retrieved on message receipt Traditional Get/Dispatch Methodology Eliminate Async delivery on random threads Events delivered ONLY to Window s owner thread (can migrate)

Core Layer: Event Queues System Event Queue Repository for Events Guarantee Delivery Order Preprocess Event for Delivery Application Event Queue One per thread SquidKit Instance Each Window has an owner thread Get/Peek/Dispatch/Send constructs Pre/Post Event Listeners

Core Layer: Graphics Graphics Interface Bridge to graphics services Minimalist approach Java vs. Native implementation Tiered Model Renderers 1, 2 & 3 Multiple versions, capabilities

Core Layer: Example Code import squidkit.core.*; import squidkit.util.color; public class Sample { public static void main( String[] args ) { SquidKit s = new SquidKit(); CoreWindowAttributes wa = new CoreWindowAttributes(); wa.setx( 100 ); wa.sety( 200 ); wa.setwidth( 300 ); wa.setheight( 400 ); wa.setvisible( true ); wa.setbackgroundcolor( Color.yellow ); wa.settitle( Hello World ); wa.parent = s.getdefaultscreen(); CoreWindow cw = new CoreWindow( wa ) ; } } while (true ) { CoreEvent e = s.getevent(); if ( e!= null ) s.dispatchevent( e ); }

Window Result

Core Layer: Summary Builds on common native constructions Provides base windowing environment Ensures portability Enables the heart of Squidy: The WCK

The Window Construction Kit WCK est omnis divisa in partes quattour Singular State Change Object (Buttons) Data Manipulation Object ( Edits ) Singular Value Out of Many Object ( Dials ) Manager Object ( Containers ) Music Composition: Motif & Development Customization via Configurable Personalities Customization via Event Handling Customization via Painting

WCK Features Complex constructions are derived Build on the Fly Use only what you need Total transformation of stock objects Customization Model, Controller determine behavior View is arbitrary Intercept Events Override Painting Install new personalities

Dial Personality Transforms File Edit Open Close Update Close File Open Edit Dial Object: Conventional Horizontal Slider Dial object: Slider becomes pulldown menu, Draw background, render text on thumb. Dial Object: Simple Knob becomes Pie Menu.

Complex Object Transforms Conventional Horizontal Scrollbar Scrollbar with Modified Layout. 0.7983 File Edit Open Close Update Same Scrollbar, new L&F through personality transforms Vertical Scrollbar converted to Scrollable Menu.

WCK Objects Buttons Label, Push, Radio, Arrows, CheckBox, Briefcase, Tree, Lock Proto Class size: 17K Dials Slider, Scroll, Progress, Knob Box, Triangular, Round Thumbs Proto Class size: 20K

WCK Objects Edit Event Framework (6K) Editable Container Event Framework (1K) LayoutManager

Button Object Types

Dial Object Types

WCK Summary New Perspectives on Common Constructs Small Footprint True Reuse Flexible Runtime generation of Objects Easily manipulated, Customizable Not A Toolkit!!!!

Builders Eliminate the Toolkit Scalability lost on traditional Toolkit designs Reduce programmer error IDEs Enables Just in Time Windowing But WAIT! How do we develop a protocol when objects can be customized?

Octopus: Object Conversion TO Protocol for Use by SquidKit Java is XML friendly Reflection Invocation WCK Factory Layer XML Input for Window Construction XML Serialization for On the Fly Protocol generation

Octopus: Rules/Assumptions All Objects ultimately decompose to Primitives Objects Elements Primitives Attributes Persistence Achievable via Set/Get Methods Object must supply null Constructor Naming Limitations XML limits Element naming

XMLSerialization Seven Methods xmlattributemethods(); xmlattributereturns(); xmlattributedefaults(); xmlelementmethods(); xmlelementreturns(); Static construction of lists Default Array built in constructor Values retrieved via reflection at runtime Object Repository

XML Commands Currently <Clone> <Update> <Remove> <Multi> A few to follow for Event Handling

Sample Static Initialization: static{ Method[] m; attributemethods = new ArrayList(); m = WindowAttributes.class.getDeclaredMethods(); for ( int i = 0; i < m.length; i++ ) { name = m[i].getname(); if ( name.startswith("get") == false ) { //check for get/set methods continue; } argclass[0] = m[i].getreturntype(); rettype = argclass[0].getname(); WindowAttributes.class.getMethod(testname.toString(), argclass); if ( retclass.isprimitive() ) { attributemethods.add( m[i] ); attributereturns.add( new StringBuffer( rettype )); } else if ( retclass.isassignablefrom( String.class ) ) { attributemethods.add( m[i] ); attributereturns.add( new StringBuffer( rettype )); } else { elementmethods.add( m[i] ); elementreturns.add( new String( rettype )); } } }

Sample XML Output for Clone Operation: <Clone> <squidkit.core.screen elementid="1" > </squidkit.core.screen> <squidkit.core.corewindow elementid="2" > <squidkit.core.corewindowattributes elementid="3" parentaccessor="setwindowattributes" parenttype="squidkit.core.windowattributes" parentid="2" settitle="(java.lang.string)<"&testxmldials">" setx="(int)100" sety="(int)200" setwidth="(int)700" setheight="(int)400" > <squidkit.core.screen elementid="1" parentaccessor="setparent" parenttype="squidkit.core.basicwindow" parentid="3" /> <squidkit.util.color elementid="4" parentaccessor="setforegroundcolor" parenttype="squidkit.util.color" parentid="3" setrgb="(int)-16777216" > </squidkit.util.color> <squidkit.util.color elementid="5" parentaccessor="setbackgroundcolor" parenttype="squidkit.util.color" parentid="3" setrgb="(int)-1" > </squidkit.util.color> <squidkit.util.rect elementid="6" parentaccessor="setmargins" parenttype="squidkit.util.rect" parentid="3" > <_5BI elementid="7" parentaccessor="setrect" parenttype="[i" parentid="6" dim="4" value="0,0,0,0" /> </squidkit.util.rect> <squidkit.core.defaultdecor elementid="8" parentaccessor="setdecor" parenttype="squidkit.core.decor" parentid="3" setstyle="(int)447" > </squidkit.core.defaultdecor> </squidkit.core.corewindowattributes> </squidkit.core.corewindow> </Clone>

Sample XML Update <Multi> <Clone> <squidkit.util.rect elementid="95" > <_5BI elementid="96" parentaccessor="setrect" parenttype="[i" parentid="95" dim="4" value="100,200,800,600" /> </squidkit.util.rect> </Clone> <Update> <squidkit.core.corewindow elementid="2" setgeometry="(squidkit.util.rect)95" /> </Update> <Remove> <squidkit.util.rect elementid="95" /> </Remove> </Multi>

Distributed Execution Issues Updating via Get/Set Pairs Invoke of non-get/set pairs? Object Removal Object Reference Problem (Ref Counts?) Repository serves as placeholder Arrays argh Just remove from Object Repository Event handling (All events vs. some) Synchronization

Key Points Layered Architecture A more OO-centric model Less specialization in Objects means they are easier to understand A reasonable shot at allowing developers to ignore most toolkit issues via IDE/builders Universality over Feature set

Summary SquidKit: More Portable More Dynamically customizable Layered Eliminates the toolkit concept Simpler IDE to Windowing Model Smaller footprint Further needs Graphics, Font Solutions Core personality definitions Protocol Work

Can We At Least Agree? Java should provide: Mechanism Vs. Policy Build Infrastructure Attempt to achieve a single framework Aid developer understanding Reduce industry level of effort Provide targeted solutions where ugui can t go

Testimonials