Homework 4: Constraints & window management
Description
In this homework assignment, you are asked to implement some of the window
managment techniques in the QuickSpace system (by Hutchings and Stasko) using
constraints. The techniques you must implement are the expand
, friendly expand and shove operations. More detail on
QuickSpace and the full set of techniques can be found in the following papers:
http://www.gvu.gatech.edu/ii/space/hutchings-stasko-quickspace.pdf
The toolkit you must use to implement the following homework assignment is
the subArctic toolkit (by Hudson and Smith). While subArctic is a fully
implemented GUI toolkit, you will only need to work with the portion of the
toolkit that deals with constraints. More information on this toolkit
can be found at the following URL:
http://www.cc.gatech.edu/gvu/ui/sub_arctic
To minimize the amount of programming using subArctic you will need to be
exposed to, we provide you with two Java files. The
quick_space.java
file handles the reading of test case files, rendering it appropriately
and invoking different method functions based on user input through the interface.
Rather than actually working with windows on the desktop, assume that
the canvas rendered in the quick_space application is the desktop and the
objects contained in it are the windows. These objects are defined
by the labeled_object.java
file (you will not need to modify this file).
You are provided with different test cases (discussed in the remainder of this
homework assignment):
hw4-test1.txt
hw4-test2.txt
hw4-test3.txt
You can also create your own test cases. The test file contains a description
of the labeled_objects (representing windows) to render in the following
format:
object_name: x_position y_position width height
The quick_space application can be launched using the following command:
java quick_space test-filename
Each labeled_object described in the test file is added to the
labeled_objects Vector (and you can access each of these objects through
this Vector).
Figure 1. The quick_space application,
after it is launched and the child_2 labeled_object is given
the focus.
Expand
Once the application has been launched, any labeled_object can
be given the focus (see Figure 1, where child_2 is given the
focus), different window management operations can be performed on that object
--allowing it to consume more space on the desktop canvas.
The first operation expands an object in each direction until it encounters
another object. In Figure 2, child_2 is expanded to the
right until it runs into child_3. It expands to the bottom until
it hits the parent's border. It cannot expand to the left or to the
top because of child_1.
Figure 2. child_2 expanded to the
right and to the bottom until it encounters child_3 and the bottom
of the parent_obj's boundary.
To support this operation, you must implement the expand( ) method
in the quick_space application. This operation can be performed
without the use of constraints. It is recommended you implement this
operation first to get accustomed with the quick_space.java and labeled_object.java
files.
Friendly Expand
In a friendly expand, those components immediately touching the object
with the focus (known as friends) can slide along with the focused object
until the focused object or the friend encounters another object or the parent's
boundary. Referring to Figure 1, child_1 is a friend
with child_2. If a friendly expand is performed on Figure
1, again, child_2 expands to the right and to the bottom until
it encounters child_3 and the parent_obj's boundary. However,
now it can expand to the left and to the top by sliding child_1 until
the friend encounters the parent_obj's top and left boundaries (see
Figure 3).
Figure 3. child_2 expanded to the right and to the bottom
until it encounters
child_3 and the bottom of the
parent_obj
's boundary, but also slides it's friend (
child_1) to the top and
to the left until child_1 encounters the
parent_obj's top and left
boundaries.
Note that the friendly expand only affects the layout relationship
between the object in focus and objects it overlaps. If an
object is overlapping two objects, that also overlap each other, these
two friends do not necessarily need to remain overlapping after the
friendly expansion is completed.
Also note, the portion of the amount of surface area the friend has exposed
under the focused object remains the same after the friendly expansion is
completed. For example, if the focused object exists completely inside
of a friend's borders by 30 pixels in every direction, the friend is
still larger than the focused object by 30 pixels in every direction after
the friendly expansion.
To support this operation, you must implement the friendly_expand(
) method in the quick_space application.
Shove
During a shove, a focused object and its friends will grow to form neighborhoods.
When a new object is encountered, it becomes part of the focused object's
neighborhood. This new relationship allows the focused object to continue
to grow in each direction until it or its friends or neighbors encounters
the parent's boundary.
From Figure 3, after the friendly expansion, child_3 becomes
child_2's neighbor. The focus object can then shove this neighbor
right until it touches the parent's right boundary (see Figure 4).
Figure 4. child_2 shoves
child_3 to the right.
Note, in this operation relationships can now exist between objects when
they start touching. Figure 5, shows child_1
expanding and shoving child_2 into child_3 and
then child_4, continuing to shove these neighbors until child_3
touches child_5. The shove is completed once child_5
touches the parent_obj's right boundary.
Figure 5. child_1 expands and then
shoves all the neighbors to the right.
Note, each neighbor may have friends that will need to be preserved. In
Figure 6, child_3 is a friend of child_2. This
relationship is preserved during the shove operation.
Figure 6. child_1 expands and then shoves all the neighbors
to the right. Note that friend relationship between child_2 and child_3
is preserved.
To support this operation, you must implement the shove( ) method
in the quick_space application.
Deliverables
These techniques MUST be implemented inside the provided quick_space.java
file and should work with the included labeled_object.java file. You must
use constraints in the friendly_expand( ) and shove( ) methods.
Please work on this homework assignment alone; please do not consult
others.
This homework assignment should be done using the subArctic toolkit.
Please zip up your source code and mail the zip file to the TA
( khai@cc.gatech.edu
) when you have completed the assignment (and remember to CC
yourself on the email). Please include in the email instructions
on how to run your application.
The due date and time for both parts of this assignment is: October
7, 2002, 12:00 PM EST.