sub_arctic.lib
Class interactor_applet

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--sub_arctic.lib.interactor_applet
Direct Known Subclasses:
anim_test, backdrop_lens_test, circ_lens_test, constraint_test, constraint_test2, cycle_test, debug_interactor_applet, drag_container_test, drag_limit_test, edit_test, editor_test, FadingTest, focus_lens_test, frame_test, frame_test2, grabber_lens_test, gradient_test, grow_container_test, grow_test, hello_world, hierarchy_test, href_applet, interactor_dragout_applet, isolation_lens_test, isolation_test, menu_test, new_style_test, percent_test, permanent_test, picker_test, rot_test, sem_lens_test, size_test, sliding_styl_text_test, sliding_text_test, snap_container_test, style_internal_test, style_test2, tab_lens_test, text_extract_test2, text_toggle_test, thread_test, transp_test, traversal_test, vis_test

public class interactor_applet
extends java.applet.Applet
implements std_constraint_consts

This is the basic object which is used for creating applets using sub_arctic. This object is a subclass of Applet, so it can be used in any browser.

The init method of this object is final. This is so that you don't accidentally put in your own init() (which would be the normal thing to do when building an applet) and hence remove critical initializations that the toolkit depends on for operation. However, init() simply calls do_init(), and that is not final and can be overridden if absolutely necessary.

Do_init() performs toolkit initialization and then calls the methods pre_build_ui(), build_ui() and post_build_ui() in that order. These are intended for data structure initialization, user interface construction, and user_interface state manipulation respectively. These are the routines one would normally override when building a new subArctic applet.

See Also:
Serialized Form

Field Summary
protected  top_level _top_interactor
          This is the top_level associated with this applet.
protected static boolean last_evt_was_move
          (Netscape 3.0 workaround only): was the last event a move event?
protected static int last_move_evt_x
          (Netscape 3.0 workaround only): x position of last move event.
protected static int last_move_evt_y
          (Netscape 3.0 workaround only): y position of last move event.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
interactor_applet()
          Construct a new interactor_applet.
 
Method Summary
 void build_ui(base_parent_interactor top)
          This function gets called so you can construct your user interface.
 void destroy()
           
 void do_init()
          Initialize by registering the component with the manager then calling user routines.
 void init()
          Initialize by registering the component with the manager and calling the user routines: pre_build_ui(), build_ui(), and post_build_ui().
 boolean isFocusTraversable()
          Override isFocusTraversable() to make use traversable via tabs
 void make_top_level()
          This function is called to create an install a top_level interactor in this applet.
 void paint(java.awt.Graphics g)
          Part of the AWT infrastructure: This does a redraw of the applet by calling into manager to begin a drawing pass over the sub_arctic interactor tree.
 void post_build_ui(base_parent_interactor t)
          This user function is called to allow you to process the now constructed interactor tree after its built.
 void pre_build_ui()
          This user function is called to allow you to initialize data structures that are needed for building the UI.
 void processEvent(java.awt.AWTEvent e)
          This is the handler for new-style AWT events.
 void remove_top_interactor()
          Remove the association between this applet and its top_level.
 void set_top_interactor(top_level top)
          Set the top_level associated with this applet.
 void setBounds(int x, int y, int width, int height)
          Override AWT's setBounds to catch size changes and propagate those to top level interactor.
 top_level top_interactor()
          Fetch the top_level associated with this applet.
 void update(java.awt.Graphics g)
          Part of the AWT infrastructure.
 
Methods inherited from class java.applet.Applet
getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_top_interactor

protected top_level _top_interactor
This is the top_level associated with this applet.

last_evt_was_move

protected static boolean last_evt_was_move
(Netscape 3.0 workaround only): was the last event a move event?

last_move_evt_x

protected static int last_move_evt_x
(Netscape 3.0 workaround only): x position of last move event.

last_move_evt_y

protected static int last_move_evt_y
(Netscape 3.0 workaround only): y position of last move event.
Constructor Detail

interactor_applet

public interactor_applet()
Construct a new interactor_applet. Nothing to do since we use init() for initialization (once more of the AWT infrastructure has been initialized).
Method Detail

init

public final void init()
Initialize by registering the component with the manager and calling the user routines: pre_build_ui(), build_ui(), and post_build_ui(). This function is final to prevent users from accidentally overriding it and getting very hosed. The real work is done in do_init() which is not final and can be overridden as needed.
Overrides:
init in class java.applet.Applet

do_init

public void do_init()
Initialize by registering the component with the manager then calling user routines. This does the real work for init() which is final to prevent users from accidentally overriding it and getting very hosed. This function calls four other functions: pre_build_ui(), make_top_level(), build_ui(top_level), and post_build_ui(top_level). The build_*() functions, and in particular the build_ui() function, is the primary place for UI construction, although you may want to do non-UI initialization in pre_build_ui(). Note that pre_build_ui() is called after make_toplevel(); this is useful if you wish to install constraints on the top_level before the user interface is constructed into it.

isFocusTraversable

public boolean isFocusTraversable()
Override isFocusTraversable() to make use traversable via tabs
Overrides:
isFocusTraversable in class java.awt.Component

pre_build_ui

public void pre_build_ui()
This user function is called to allow you to initialize data structures that are needed for building the UI. By default, it does nothing.

post_build_ui

public void post_build_ui(base_parent_interactor t)
This user function is called to allow you to process the now constructed interactor tree after its built.
Parameters:
base_parent_interactor - t root of the newly constructed tree

make_top_level

public void make_top_level()
This function is called to create an install a top_level interactor in this applet. By default it creates a toplevel of the same size as the interactor and then installs it. Note: this routine sets the top level object created to be invisible so we don't try to draw it before the UI is built. This is reset to visible after post_build_ui() is called in do_init().

build_ui

public void build_ui(base_parent_interactor top)
This function gets called so you can construct your user interface. The top_level provided is already installed as the root of your interactor tree for this applet. This is typically the main user routine for initializing the interface. By default, this function does nothing.
Parameters:
base_parent_interactor - top the new root interactor for this applet

destroy

public void destroy()
Overrides:
destroy in class java.applet.Applet

top_interactor

public top_level top_interactor()
Fetch the top_level associated with this applet.
Returns:
top_level the top_level interactor of this applet

set_top_interactor

public void set_top_interactor(top_level top)
Set the top_level associated with this applet.
Parameters:
top_level - top the new top_level interactor

remove_top_interactor

public void remove_top_interactor()
Remove the association between this applet and its top_level. Leaves the applet with no current top_level.

update

public void update(java.awt.Graphics g)
Part of the AWT infrastructure. This does a redraw of the applet by calling into manager to begin a drawing pass over the sub_arctic interactor tree.
Parameters:
Graphics - g the graphics object to draw with.
Overrides:
update in class java.awt.Container

paint

public void paint(java.awt.Graphics g)
Part of the AWT infrastructure: This does a redraw of the applet by calling into manager to begin a drawing pass over the sub_arctic interactor tree.

This really should never get called (update() should be called instead), but apparently Netscape calls it direct in certain cases, so we just do the same as update (we don't just call update() since in the superclass, update() calls paint(), and update() can call super.update()).

Overrides:
paint in class java.awt.Container

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Override AWT's setBounds to catch size changes and propagate those to top level interactor.
Parameters:
int - x new X position of this applet
int - y new Y position of this applet
int - width new width of this applet
int - height new height of this applet
Overrides:
setBounds in class java.awt.Component

processEvent

public void processEvent(java.awt.AWTEvent e)
This is the handler for new-style AWT events. All this does is hand the event through to the manager, who starts the dispatching of the event in the SubArctic world.
Overrides:
processEvent in class java.awt.Container