Distributed Collaboration - Assignment 1: Multi-View 1-User IM

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

Distributed Collaboration - Assignment 3: Replicated N-User IM

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

Graphical User Interfaces (GUIs)

Comp Assignment 4: Commands and Graphics

CSC207 Week 4. Larry Zhang

Course Status Networking GUI Wrap-up. CS Java. Introduction to Java. Andy Mroczkowski

CS Exam 1 Review Suggestions

Table of Contents. Chapter 1 Getting Started with Java SE 7 1. Chapter 2 Exploring Class Members in Java 15. iii. Introduction of Java SE 7...

St. Louis JUG Trivia Night. January 2010

CSE 331 Software Design & Implementation

Lab 4. D0010E Object-Oriented Programming and Design. Today s lecture. GUI programming in

Introduction to Graphical Interface Programming in Java. Introduction to AWT and Swing

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

Lab 5 TOC to Me. IM Client Implementation --- Part 2

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

COMP 346 Winter 2019 Programming Assignment 2

The DSL created in Scala was accomplished using the Implicit conversion (Views) feature of Scala.

Chat Channels Via Kafka (with Grading Notes)

Introduction. Assessment Test. Part I The Programmer s Exam 1

CSE 331 Software Design & Implementation

This page intentionally left blank

Event Dispatch. Dispatching events to windows and widgets.

All the Swing components start with J. The hierarchy diagram is shown below. JComponent is the base class.

COMP 401 FACTORIES. Instructor: Prasun Dewan

Phase 2: Due 11/28/18: Additional code to add, move and remove vertices in response to user mouse clicks on the screen.

Java Swing Introduction

Handouts. 1 Handout for today! Recap. Homework #2 feedback. Last Time. What did you think? HW3a: ThreadBank. Today. Small assignment.

Prelim 2. CS 2110, 5:30 PM, November 17, 2016

Tips from the experts: How to waste a lot of time on this assignment

Window Interfaces Using Swing Objects

Design Patterns. it s about the Observer pattern, the Command pattern, MVC, and some GUI. some more

CS108, Stanford Handout #22. Thread 3 GUI

CS 455/655 Computer Networks Fall Programming Assignment 1: Implementing a Social Media App Due: Thursday, October 5 th, 2017 (1pm)

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

Lecture 18 Java Graphics and GUIs

Frames, GUI and events. Introduction to Swing Structure of Frame based applications Graphical User Interface (GUI) Events and event handling

Java Swing. based on slides by: Walter Milner. Java Swing Walter Milner 2005: Slide 1

Window Interfaces Using Swing Objects

Event-driven Programming, Separation of Concerns, the Observer pattern and the JavaFX Event Infrastructure

Phase 2: Due 05/02/18 The Gui now stores and displays a graph in response to user mouse clicks on the screen.

DHANALAKSHMI SRINIVASAN COLLEGE OF ENGINEERING AND TECHNOLOGY ACADEMIC YEAR (ODD SEM)

CHAPTER 1: A GENERAL INTRODUCTION TO PROGRAMMING 1

P2: Collaborations. CSE 335, Spring 2009

Contents Introduction 1

ACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1

Comp Assignment 2: Object-Oriented Scanning for Numbers, Words, and Quoted Strings

Page 1. Human-computer interaction. Lecture 2: Design & Implementation. Building user interfaces. Users and limitations

SELF-STUDY. Glossary

Introduction to GUIs. Principles of Software Construction: Objects, Design, and Concurrency. Jonathan Aldrich and Charlie Garrod Fall 2014

MOODLE MANUAL TABLE OF CONTENTS

Swing from A to Z Some Simple Components. Preface

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7

Project #3. Computer Science 2334 Fall Create a Graphical User Interface and import/export software for a Hurricane Database.

JAVA. A. Zakiuddin Ahmed. M.Sc.,M.Phil M.S.(Edn), PGDCSM, Professor in Computer Science, P. Rizwan Ahmed. MCA., M.Sc.,M.A., M.Phil.

Java Application Development

Concurrency User Guide

Java Concurrency in practice Chapter 9 GUI Applications

Widgets. Widgets Widget Toolkits. User Interface Widget

An Introduction to Blackboard

SINGLE EVENT HANDLING

Project 2: Part 1: RPC and Locks

Our second exam is Thursday, November 10. Note that it will not be possible to get all the homework submissions graded before the exam.

Synchronization in Concurrent Programming. Amit Gupta

Cheng, CSE870. More Frameworks. Overview. Recap on OOP. Acknowledgements:

Lecture 19 GUI Events

San José State University Department of Computer Science CS151, Section 04 Object Oriented Design Spring 2018

G51PGP Programming Paradigms. Lecture 009 Concurrency, exceptions

CST242 Concurrency Page 1

EPITA Première Année Cycle Ingénieur. Atelier Java - J5

CSE 143. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT

Graphical User Interface (GUI)

CSE 331 Software Design & Implementation

Example Programs. COSC 3461 User Interfaces. GUI Program Organization. Outline. DemoHelloWorld.java DemoHelloWorld2.java DemoSwing.

THE MYSTERY OF THE 20GB LOG FILE. Instructor: Prasun Dewan (FB 150,

CSE Theory of Computing Spring 2018 Project 2-Finite Automata

CSE 331 Software Design and Implementation. Lecture 19 GUI Events

COMP 250 Winter 2011 Reading: Java background January 5, 2011

Homework 6 part 2: Turtle Etch-A-Sketch (40pts)

Distributed Systems Project 4 Assigned: Friday March 20 Due: Friday April 3, 11:59pm

Swing: Building GUIs in Java

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

LIGHTWEIGHT UI TOOLKIT MAKING COMPELLING JAVA ME APPLICATIONS EASY

Java Programming Lecture 6

Part 1. Audio Controls and Indicators. When I first thought about writing a book on the processing of sound, I concluded INTRODUCTION...

Widget Toolkits CS MVC

Graphical User Interfaces. Comp 152

Part I: Learn Common Graphics Components

Swing: Building GUIs in Java

Event Driven Programming

Casting -Allows a narrowing assignment by asking the Java compiler to "trust us"

(Incomplete) History of GUIs

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

Java Programming Fundamentals

Java Programming. Price $ (inc GST)

Widgets. Widgets Widget Toolkits. 2.3 Widgets 1

Java: Graphical User Interfaces (GUI)

Copyright and Trademark Information Trademarks Disclaimer; No Warranty

Java Threads. COMP 585 Noteset #2 1

CS 209 Spring, 2006 Lab 11: Files & Streams Instructor: J.G. Neal

Transcription:

Distributed Collaboration - Assignment 1: Multi-View 1-User IM Date Assigned:??? 1-View Target Date:??? Multi-View Submission Date:??? Objectives: Understand the use of observer pattern in user -interface toolkits Understand separation of UI and computation code Understand threads and synchronization (extra credit) In this assignment you will implement the 1-User version of the IM/Editor project. The assignment is broken into two parts to allow you to incrementally build it. To make sure you do not procrastinate there are two completion dates. The first one is a target date to help you pace yourself. The other one is the actual submission date. The assignment involves the use of the Java Swing/AWT toolkit. Use the web to find tutorials on how to use Swing and AWT most books on introductory programming have sections on the toolkit. I have listed below some keywords to use in your searches. Of course, use Piazza for clarifications and other assignment discussion. All assignments will most probably be changed after they are posted to clarify them or change constraints, and features. The changes will be highlighted using track changes, Single View GUI Implement a single-user IM tool, along the lines shown in the first demo. You do not and should not slavishly follow the layout and user-interface shown in the demo. However, there are certain constraints. 1. The data or model displayed should contain the following (and possibly additional) components: a. an editable single-line topic text string. The string should be modelled as a list of characters rather than an atomic string. The reason is that we want to track the individual inserts and deletes into it, so that we can these incremental operations to other users rather than the whole string, which in turn allows

users to concurrently edit different portions of the string as you see in the operation transformation demos. b. an editable single-line unaware-message text string. c. an editable single-line aware-message text string (extra credit) d. a non-editable multi-line string history storing in each element a message line a message entered by the user. The message lines should be stored in the order in which they are entered. e. an uneditable status object (enum/string/int ) showing whether the user has entered but not committed an aware message, is currently entering such a message, or has not entered an uncommitted message. The user is currently entering a message if the time that has elapsed since the last character insertion is less than some threshold time (I used 3 seconds). This status object perhaps makes little sense in the single-user case, as users know their status. It is intended to be transmitted to other users in the next assignment. 2. All of the data should be displayed in a single window or frame and the frame should be a Swing JFrame (and not an AWT Frame) object. The reason is that it is not possible/easy to draw a telepointer in an AWT classes such as Frame. 3. The unaware message should be displayed in an AWT TextField object (rather than a Swing JTextField) object. The reason is that it is not possible/easy to send JTextField text cursor positions correctly when you implement the shared window system, as you saw in the demo. 4. The topic and aware message should be displayed in a Swing JTextField object (rather than an AWT TextField) object. The reason is that it is not possible/easy to get information about character-level changes to a text field. 5. The status object can be displayed in any widget of your choice that is not editable by the user. In my demo I simply used a JTextField widget. To implement this part of the assignment, you need to know about the widgets mentioned above and the associated listeners (ActionListener and DocumentListener). In addition, to implement the aware message, you need to know about threads, and the wait(time) and notify() methods. ( Instead of wait() and notify()_ you could use sleep() and thread interrupt, which is not as elegant as interrupt throws an exception.) One issue with using DocumentListener is that such a listener receives notifications both when the program changes the textfield and the user does so. Thus the listener does not know if it should change the model or not. One easy way to make this determination is to check if the textfield text is the same as the model text or of the same length which would indicate that the change was made by the program and not the user. A related issue is that if you invoke the settext() method on the textfield, several insert/delete document events will be fired, during which the model text is not consistent with the textfield and yet you do not want to change the model text. To prevent this problem, you can set a boolean variable before settext() to indicate you are changing the text field and unset it after settext(). Your listener should not set the

model if the Boolean is set. These are not elegant solutions and show the need for a better API from Swing. You can define a single Bean model (with properties of different types) for the various components described above. Ideally, the history and topic lists should use a common generic list class. The one provided in the ColabTeaching project should suffice as it is generic. Multi-View UI To ensure that you separate the user-interface and model code (important to make the application multi-user later) add a console view to the application. The console view should allow the user to: 1. enter a console line into the common message history displayed by the two UIs, 2. view the history of messages by invoking the history command 3. and quit the application by entering the quit command. The console view is a slight extension of the one shown in demo 1.This UI is implemented standalone in the class examples your job will be to stitch it to the GUI implemented in the previous art. Ideally, you should simply add the code shown in class to your project though you are free to change it. However, to aid grading, the console UI (prompts, commands, history output) should be exactly the same as shown below. The green lines are user input, the others are output. This will allow automatic grading of the assignment. You are free to add other commands to the user interface as the automatic grader will look for invariants among the output rather than the exact matches with an ideal output.

As we see above, the console view does not show the topic or the status messages, though you are free to extend it to display these data. All of the data components mentioned in the first part will be implemented as Bean (readonly or editable) properties using getters and setters (for editable properties). The setters will fire property events observed by the GUI interactor. In addition, the history object will fire elementaddition events observed by interactors for both UIs. If you use my history object, then elementaddition events are fired for you. To implement this part of the assignment you may need to understand java.beans.propertychangesupport, java.beans.propertychangelistener, and util.models. PropertyListenerRegistrar (optional and available from the util code on github and oeall22.jar). Extra Credit Demo The extra credit requires you to support three states. Please each transition possible between each pair of states. Thus, show the transition from typing to has entered and has entered to typing. Similarly show the transition from no action to typing.

Submission By the submission date, submit a link to a video (with an audio narration) showing your 1-user IM tool in action and also submit your code to Sakai. Please post the link as a private message in Piazza rather than an email (which is hard to keep track of) or a Sakai submission (the overhead of logging in to Sakai is high). Use the tag hw1videolink. If you are worried about privacy issues, free to use the other means, and post a Piazza message informing me you have done so.