Project MVC architecture
version 0.1 - 010723

lib.gui.mvc
Class View

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--lib.gui.mvc.View
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class View
extends java.awt.Panel

View is part of the the MVC architecture.

Synopsis

Version:
2001-07-22
Author:
Ivan Wellesz - ivanw@club-internet.fr
See Also:
Serialized Form

Inner classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
protected  java.awt.Image backgroundImage
          The full view size background image.
protected  java.util.Hashtable component_Hashtable
          The table of all defined Components of the MVC.
protected  java.awt.Component default_Focus_Component
          The Component to which the input focus should be propagated when the top level Frame gains it.
protected  java.awt.Image image
          The Image used by ImageCanvas Components in their normal state.
protected  java.awt.Image image_activated
          The Image used by ImageCanvas Components in their activated state.
protected  java.awt.Image image_armed
          The Image used by ImageButton Components in their armed state.
protected  int image_height
          The height of the full view size background image.
protected  int image_width
          The width of the full view size background image.
private static java.lang.String VIEW
          Identifier used to sign warning and trace messages.
 
Fields inherited from class java.awt.Panel
base, nameCounter, serialVersionUID
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dbg, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads
 
Fields inherited from class java.awt.Component
accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
View()
           
 
Method Summary
private  void adjust_parent_size()
          private adjust_parent_size - Adjusts parent Container size to fit the background image size.
static java.awt.Frame get_top_Frame(View this_view)
          getTopLevelFrame Container - Gets the top level frame of a View.
private  java.awt.Dimension getExtent()
          private getExtent - Returns the minimum dimension necessary to display all Components.
 java.awt.Dimension getMinimumSize()
          public getMinimumSize - Returns the View minimum size.
 java.awt.Dimension getPreferredSize()
          public getPreferredSize - Returns the preferred size of this component.
 void handleResize()
          public handleResize - Handles the resize event.
 boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height)
          public imageUpdate - Adjusts parent Container size when the backgroundImage size gets known.
 boolean isDoubleBuffered()
          public isDoubleBuffered - Returns true if this View is painted to an offscreen image.
 void paint(java.awt.Graphics g)
          public paint - Paints GUI Components.
 void unDisplay()
          public unDisplay - Handles an undisplay request.
 void update(java.awt.Graphics g)
          public update - Paints GUI Components with no area clear.
 
Methods inherited from class java.awt.Panel
, addNotify, constructComponentName, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMouseEventTarget, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paintComponents, paintHeavyweightComponents, paramString, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, print, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, readObject, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusOwner, setFont, setLayout, transferFocus, validate, validateTree, writeObject
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, inside, isDisplayable, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, 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, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resetGC, reshape, resize, resize, setBackground, setBounds, 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, registerNatives, wait, wait, wait
 

Field Detail

VIEW

private static final java.lang.String VIEW
Identifier used to sign warning and trace messages.

default_Focus_Component

protected java.awt.Component default_Focus_Component
The Component to which the input focus should be propagated when the top level Frame gains it.

component_Hashtable

protected java.util.Hashtable component_Hashtable
The table of all defined Components of the MVC.

image

protected java.awt.Image image
The Image used by ImageCanvas Components in their normal state.
Defaults a null value that renders a blank background.
No error occurs when no image are provided. Inaccessible images will default to this state.

image_armed

protected java.awt.Image image_armed
The Image used by ImageButton Components in their armed state.
An imageButton is switched to its armed state when the mouse pointer enters its window area.

image_activated

protected java.awt.Image image_activated
The Image used by ImageCanvas Components in their activated state.
An imageButton is switched to its activeted state when the left mouse button is depressed in its window area.
An toggle imageButton also displays this image region when set to its true state.

backgroundImage

protected java.awt.Image backgroundImage
The full view size background image.
Defaults to a reference to the image member.
It can be a different one to allow for a different display when Components get unmapped or exchanged.

image_width

protected int image_width
The width of the full view size background image.
Its value is received by the imageUpdate method when the image has been loaded.

image_height

protected int image_height
The height of the full view size background image.
Its value is received by the imageUpdate method when the image has been loaded.
Constructor Detail

View

public View()
Method Detail

handleResize

public void handleResize()
public handleResize - Handles the resize event. // {{{
What to do when a resize event is detected by the Controler.

unDisplay

public void unDisplay()
public unDisplay - Handles an undisplay request. // {{{
What to do when the Controler says so.

get_top_Frame

public static java.awt.Frame get_top_Frame(View this_view)
getTopLevelFrame Container - Gets the top level frame of a View. // {{{
Traverses the Component parent hierarchy to return the top level Frame. If it is not a Frame class instance, null is returned.
Parameters:
component - the component leading to a top level Frame.
Returns:
the top level frame of the specified component.

update

public void update(java.awt.Graphics g)
public update - Paints GUI Components with no area clear. // {{{
Overrides:
update in class java.awt.Container
Parameters:
g - the Graphics to update.

paint

public void paint(java.awt.Graphics g)
public paint - Paints GUI Components. // {{{
Overrides:
paint in class java.awt.Container
Parameters:
g - the Graphics to update.

imageUpdate

public boolean imageUpdate(java.awt.Image img,
                           int infoflags,
                           int x,
                           int y,
                           int width,
                           int height)
public imageUpdate - Adjusts parent Container size when the backgroundImage size gets known. // {{{
ImageObserver interface method.
Overrides:
imageUpdate in class java.awt.Component
See Also:
Component.imageUpdate(java.awt.Image, int, int, int, int, int)

adjust_parent_size

private void adjust_parent_size()
private adjust_parent_size - Adjusts parent Container size to fit the background image size. // {{{
When no image can specify the parent size, the getMinimumSize and getExtent methods select the minimum dimension necessary to display all specified Components area.
 Adjust parent dimension to image size when it is larger than parent size.
 - Preserve parent insets.
 - Resize parent.
 - Re-structure Container tree.
See Also:
getMinimumSize(), getExtent()

getPreferredSize

public java.awt.Dimension getPreferredSize()
public getPreferredSize - Returns the preferred size of this component. // {{{
At first, the background image size is unknown. It takes some time to the image loader thread to inform the View through a call to its imageUpdate method.
A call to the adjust_parent_size method will be performed later.
Overrides:
getPreferredSize in class java.awt.Container
See Also:
imageUpdate(java.awt.Image, int, int, int, int, int), adjust_parent_size()

getMinimumSize

public java.awt.Dimension getMinimumSize()
public getMinimumSize - Returns the View minimum size. // {{{
Overrides:
getMinimumSize in class java.awt.Container

getExtent

private java.awt.Dimension getExtent()
private getExtent - Returns the minimum dimension necessary to display all Components. // {{{

isDoubleBuffered

public boolean isDoubleBuffered()
public isDoubleBuffered - Returns true if this View is painted to an offscreen image. // {{{
Overrides:
isDoubleBuffered in class java.awt.Component
Returns:
true (the window background must not be cleared before paint is called)

MVC architecture

Document Tech Infos - Ivan Wellesz