Visualization and GUI for Couniverse
Total Page:16
File Type:pdf, Size:1020Kb
MASARYKOVA UNIVERZITA FAKULTA INFORMATIKY Visualization and GUI for CoUniverse BACHELOR THESIS Martin Tlachač Brno, Spring 2008 Declaration Hereby I declare, that this paper is my original authorial work, which I have worked out by my own. All sources, references and literature used or excerpted during elaboration of this work are properly cited and listed in complete reference to the due source. Advisor: RNDr. Petr Holub, Ph.D. 11 Acknowledgement I am very grateful to my advisor, RNDr. Petr Holub, Ph.D., also to RNDr. Miloš Liška for his occasional help and the whole Java team at the Masaryk University. m Abstract Goal of this thesis is implementation of graphical user interface (GUI) for component-based self-organizing collaborative framework CoUniverse. The GUI provides visual means for users to configure nodes within the CoUniverse network as well as visualization of the Co- Universe network for monitoring purposes. The GUI is implemented in Java as the whole CoUniverse uses this language. Swing Toolkit is used to build the graphical interface. IV Keywords CoUniverse, Java, Graphical User Interface (GUI), Swing Toolkit Contents 1 Introduction 3 1.1 Thesis Structure 3 2 Tools 5 2.1 CVS 5 2.2 Swing Toolkit 5 2.3 IntelliJIdea 5 2.4 Netbeans 6 2.5 JXTA 6 2.6 SwingX-WS 6 2.7 OpenStreetMap project 6 3 CoUniverse 7 3.1 System architecture 7 3.2 Network organization 7 3.3 CoUniverse components 7 3.3.1 Communication nodes 7 3.3.2 Application group controllers 8 3.3.3 GUI Controller 8 3.4 Monitoring 8 3.5 Visualization 8 4 Design of CoUniverse GUI 9 4.1 GUI designers 9 4.2 Layout managers 10 4.3 Components 10 4.3.1 How painting works 10 4.3.2 Visual states of Swing components 11 4.3.3 My image button 12 4.3.4 My text button 13 4.4 Swing Worker 21 5 GUI for CoUniverse Configuration 23 5.1 Configuration 23 5.2 Start of GUI 25 5.3 Refactoring 25 5.4 Top-level container 25 5.5 Bottom panel 25 1 5.6 Titlepanel 25 5.7 Progress Visualization 25 5.8 My components 26 6 Visualization of CoUniverse Network 27 6.1 Design 27 6.2 JXMapViewer class 27 6.3 GUI Controller 29 6.4 Layout on map 30 6.5 Visualization components 31 6.5.1 Top-level container 31 6.5.2 Map browser 31 6.5.3 GoogleTileFactory class 31 6.5.4 NasaTileFactory class 32 6.5.5 OpenStreetsTileFactory class 32 6.5.6 Node information 32 6.5.7 Bottom panel 32 7 Conclusions 33 Bibliography 33 A CD 35 2 Chapter 1 Introduction Nowadays, the requirements laid on GUI (Graphical User Interface) such as fast response time, a nice-looking design, an intuitive control, intelligent hints, an analysis of input, re strictions on the set of possible user actions based on the current state of the application etc.,—all sometimes referred to as user-friendliness—belong to commonly-expected stan dards. In many cases, the GUI is what ultimately sells the application. Even if a logic of ap plication has not a tiniest mistake, an unpleasant GUI can significantly degrade the whole application. GUI implementing all the requirements listed above can be very processor- time consuming especially when not using native host operating system's GUI controls as Java GUI framework called Swing does. On the other hand taking into consideration today's modern commonly-available hardware there is no need to worry about sufficient processing power. Therefore modern GUIs are developed to be breath-taking extent re gardless of their processor-time consumption. This thesis focuses on implementation of graphical user interface (GUI) for self- organizing collaborative framework CoUniverse. CoUniverse [1] is a framework for build ing advanced collaborative environments that can autonomously react to events happen ing in underlying networks even employing most advanced media transmission appli cations with extreme bandwidth requirements. The basic components of CoUniverse are nodes the network is comprised of. The CoUniverse schedules media streams onto links interconnecting applications while encapsulating and controlling individual media appli cations. GUI for the CoUniverse should allow users to configure the CoUniverse network, namely network nodes, and to visualize the behaviour of the network. 1.1 Thesis Structure This thesis is divided into five main chapters. Chapter 2 summarizes tools, frameworks, IDEs (Integrated Development Environments) and technologies which were or could be utilized for implementing GUIs in Java and brief description to each of them. Preferably, GUI perspective on the technologies is given in description. Basic concepts and architecture of CoUniverse framework are described in Chapter 3. The following chapters 4 through 6 describe my own work on CoUniverse GUI. Chap ter 4 takes a look at design and implementation elements of CoUniverse GUI. It also sum marizes some parts of GUI development process I found worth describing, that are either 3 1. INTRODUCTION complicated or insufficiently documented in publicly accessible documents on Internet. Chapter 5 describes first part of the CoUniverse GUI I've implemented, that allows users configuring nodes within the CoUniverse network. Subsequent Chapter 6 is about visu alization part of the CoUniverse GUI of CoUniverse network and its states. When I im plemented visualization of CoUniverse, deep comprehension of CoUniverse architecture system down to actual source code was needed. Thus in introduction of this chapter, rele vant CoUniverse components are explained. 4 Chapter 2 Tools For version control of project CVS (Concurrent Versions System) and for GUI implementa tion Swing Toolkit were used. I choose to use IntelliJ IDEA as Java IDE despite the fact I had never used it before. For visualization I found SwingX-WS project very useful so I built vi sualization on it, which saved me a lot of time. To implement the functionality SwingX-WS offers would be very difficult and time-consuming. 2.1 CVS Concurrent Versions System1 (CVS) is a version control system that enables several users to work on the same project simultaneously. It is used to maintain current and historical versions of files such as source code, web pages, and documentation in common repository. 2.2 Swing Toolkit Swing [2] is a GUI Toolkit for Java. Swing was developed to provide a more sophisticated set of GUI components than the earlier Abstract Window Toolkit. Swing provides a native look and feel that emulates the look and feel of several platforms, and also supports a pluggable look and feel that allows applications to have a look and feel unrelated to the underlying platform unlike AWT. Swing is extensible, component-oriented, customizable, configurable lightweight user interface. 2.3 IntelliJ Idea IntelliJ IDEA2 is a commercial Java Integrated Development Environment by the company JetBrains. This sophisticated tool enormously increase your productivity. 1. http://www.nongnu.org/cvs/ 2. http://www.jetbrains.com/idea/ 5 2. TOOLS 2.4 Netbeans Netbeans3 is a free, open-source Integrated Development Environment for software de velopers. All the essential functionality is supported by both IntelliJ Idea and Netbeans but for IntelliJ Idea you have to pay. Deeper comparison of these two IDEs would spread over many pages and is rather impossible due to the rhythm both IDEs keep upgrading. I myself prefer using Netbeans to IntelliJ Idea because it is open-source and the Netbeans community is bigger than the IntelliJ Idea community. 2.5 JXTA JXTA4 0uxtapose) technology is a set of open protocols that enable any connected device on the network, ranging from cell phones and wireless PDAs to PCs and servers, to com municate and collaborate in a P2P manner. JXTA peers create a virtual network where any peer can interact with other peers and resources directly, even when some of the peers and resources are behind firewalls and network address translations (NATs) or on different net work transports. 2.6 SwingX-WS Swing Web Services components, SwingX-WS [3], is one of the core projects of SwingLabs, an Open Source laboratory for exploring new ways to make Swing applications easier to write, with improved performance and greater visual appeal. It is an umbrella project for various Open Source initiatives sponsored by Sun Microsystems and is part of the java.net community. Successful code and concepts may be migrated to future versions of the Java platform. Overview of all major project is here: http: //swinglabs . org/pro jects . j sp. SwingX-WS project provides many useful classes and utilities for writing web ori ented rich client applications in Java. SwingX-WS contains a rich mapviewer component I used in visualization. The SwingX-WS project introduces a set of JavaBeans and APIs for interacting with web technologies from within Swing applications. 2.7 OpenStreetMap project OpenStreetMap is a free editable map of the whole world. You can learn about the system in more detail from [4]. 3. http://www.netbeans.org/ 4. https://jxta.dev.java.net/ 6 Chapter 3 CoUniverse 3.1 System architecture The collaborative system is organized as one or more collaborative universes, where the ac tual collaboration takes place, and a multiverse, which servers for registration and lookup of clients and universes. The collaborative universes are intended to accommodate collab- orativer groups up to medium sizes and thus can implement very advanced functionality. On the contrary the multiverse provides very limited functionality, it has to scale with re gard to large number of participating nodes. 3.2 Network organization From the networking perspective, each universe has a control plane and zero or more data planes. Both control and data planes form overlays over existing networking substrates.