In Elastic Windows a new window is opened next to an existing window by double-clicking on any of the borders of the existing window. The new window is opened either north, south, east or west of the existing window depending on the location of the border clicked. For example, double-clicking on the left border of an existing window opens the new window to the left of that window.
The pseudo-code algorithm of the open operation (OpenWindow) is
listed in Appendix . Input parameters of the
OpenWindow function are the identification number of the existing
window and the direction of the new window. The highest level node
affected by this operation is returned as an output parameter in order
to update the screen appropriately. A pointer to the new window is
also returned.
The open algorithm first checks the window type of the existing window
and compares it with the location of the new window. In the case of a
match, the new window is inserted into the parent window of the
existing window at the appropriate index (Case 1,
Figure ). If the types do not match, a G-Node is
created in place of the existing window. Depending on whether the
existing window has children another G-Node is inserted to preserve
the type of the existing window (Case 3). If the existing window does
not have any children then simply its type is changed (Case 2). If the
existing window is the root (Case 4), a G-Node of opposite type is
created and both the existing and the new windows are inserted as
children of this node, and it becomes the root of the window
hierarchy.
The only input parameter to the close algorithm is the identification
number of the window to be closed. The only output parameter is the
highest level node affected by the close operation to be used for the
screen update. The pseudo-code algorithm of the close operation (
CloseWindow) is listed in Appendix .
The close algorithm first climbs up in the window hierarchy as long
the parent of the window is a G-Node with a single child, call this
node W. If W is the only child of an H-Node (Case 1,
Figure), simply remove it from its parent and
make the parent an L-Node. Otherwise (Case 2), remove W from its
parent, and update coordinates of all children of the parent node
proportionally and propagate the changes to lower levels. The close
algorithm then enters a clean-up phase (Figure
)
where unnecessary G-Nodes are removed in pairs up the hierarchy.
The World-Wide Web browser application uses an open-within algorithm
in order to open a new web page in the same hierarchy as its
parent. The open-within algorithm
(Figure ), basically creates an H-Node in
place of the existing window, where the existing window becomes its
child via an intermediary G-Node to preserve node type. The new window
is then opened to the right of this G-Node. The border of the existing
window is made invisible by setting its width to 0. Thus, the visual
effects of this operation is that the child window is opened inside
the contents of the parent window. Pseudo-code of the open-within
algorithm is listed in Appendix
.