Java Applet Development

From OpenStreetMap Wiki
Jump to: navigation, search

Want to help Develop the Java Applet? This is the page could be a good place to build up applet related development notes.

Contents

Development Status

Potlatch was deployed on the website in May 2007. This is a flash based alternative to the applet, targetted at the same audience. Since then there has been little development progress on the applet.

There is still some potential use for the applet, to provide an alternative editor for people who cannot run flash (might also run better on some devices)

The applet code will currently not work with API v0.5 (some major changes including no more 'segments') so that would be a priority for anyone wishing to revive this work.

Applet Design Goals

Simple

The applet is quite simplistic, especially compared with JOSM (standalone java app). The reasons...

  1. It should be an easy-to-learn editing environment for drawing ways and adding metadata to existing ways. A clear, uncluttered UI is paramount for this audience.
  2. It should be a fairly smooth transition from 'view' tab to 'edit' tab, as such we dont want to have lots of tool bars/panels appearing.
  3. We want it to load as fast as possible.

With simplicity in mind, a lot of new development ideas may be rejected, despite being good ideas.

Source Folders Overview

The source code and resources are under applications/editors/applet

To do a proper subversion checkout see Getting The Source

The applet directory includes build.xml - ant build script, and the following sub-directories

Implementation Description

Implemented as a Java applet - not directly on AWT, but using a library/framework from processing.org.

The UI has achieved simplicity in some ways, but maybe could do with some changes to make more intuitive - suggested enhancements are in trac.

There have been some major bugs that effectively crash the applet. Mainly these were due to a lack of appropriate synchronisation - fixes are committed and now under test - please see Concurrency below for detail on the new concurrency conventions.

The code has been tidied up somewhat recently, but the edit code is still a bit hit and miss. All the code's there though, and is eminently fixable/tidyable.

Following is what the applet's main classes do.

org.openstreetmap.processing

org.openstreetmap.client

org.openstreetmap.gui

Dialog-handling for editing of map and message boxes. NB: Not all GUI code is in this package.

org.openstreetmap.util

And some classes modelling map features (should probably be in a 'model' package, not util):

Concurrency

There have previously been problems with handling of concurrency in applet - following these conventions should keep the applet in-order, reliable and responsive:

Threads

The threads used by the application, with their lock-order conventions:

Locks

The synchronisation objects used in the applet, to be locked in orders specified in Threads above. The locks are listed below in a rough high->low order (rule of thumb: lock high level locks first, then lower, never obtain high level locks from within lowest level objects):

Applet parameters

There are a number of these, passed in html applet tag's param sub-tags (see map edit page source).

Bugs

There are a number of bugs in the java applet. We keep track of these using 'trac' (bug tracking system). Query to find all applet bugs. You can raise new bug 'tickets' directly if you create a trac account, alternatively discuss the issue via one of the Contact channels.

The applet will spew debugging information including java stack traces to the JVM console. This may be useful in diagnosing problems, particularly when the applet seems to crash. Look for a little java icon (blue coffee cup) in your system tray in the bottom right. Right click and choose 'Open console'. This may vary depending on JVM installation options and certainly operating system.

Personal tools
Namespaces
Variants
Actions
site
Toolbox