Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.scopemvc.controller.swing
Class SwingContext  view SwingContext download SwingContext.java

java.lang.Object
  extended byorg.scopemvc.controller.basic.ViewContext
      extended byorg.scopemvc.controller.swing.SwingContext

public class SwingContext
extends org.scopemvc.controller.basic.ViewContext

Swing implementation of org.scopemvc.controller.basic.ViewContext to show views inside JFrames or JDialogs and show errors using JOptionPanes. Also allows Views to take ownership of SMenuItems from their containing Window.

Version:
$Revision: 1.7 $ $Date: 2002/05/26 10:30:55 $

Nested Class Summary
(package private) static class SwingContext.NullFrame
           
(package private) static class SwingContext.WindowCloser
          Attached to windows opened by this manager so that they issue a Control on closing.
 
Field Summary
private static org.apache.commons.logging.Log LOG
           
private static long PROGRESS_START_DELAY
           
private  java.util.Timer progressStartTimer
           
protected  java.util.LinkedList rootpanes
          Keep track of all open Frames and Dialogs by keeping references to their JRootPane.
protected  java.awt.Frame sharedNullFrame
          The parent of views that get shown when no parent can be found.
private  java.util.TimerTask task
           
 
Fields inherited from class org.scopemvc.controller.basic.ViewContext
properties
 
Constructor Summary
SwingContext()
           
 
Method Summary
 boolean areAllViewsClosed()
          Are there any Views left open?
 void exit()
           
protected  org.scopemvc.view.swing.SMenuItem findMenuItem(org.scopemvc.view.swing.SwingView inView, java.lang.String inControlID)
           
protected static org.scopemvc.view.swing.SMenuItem findMenuItemInMenu(javax.swing.JMenu inMenu, java.lang.String inControlID)
           
protected  javax.swing.JRootPane findRootPaneFor(org.scopemvc.core.View inView)
          Find Rootpane that contains a SwingView or null if none.
protected  java.awt.Window getDefaultParentWindow()
          For dialogs to be opened, find the currently focussed window, or if none, the last opened window or if none, the shared null Frame.
protected  java.awt.Image getDefaultWindowIcon()
           
protected  javax.swing.JRootPane getFocussedRootPane()
          Find the rootpane that currently contains the focussed component, or null if none.
protected  java.awt.Frame getSharedNullFrame()
           
protected  java.awt.Container getTopmostContainer(org.scopemvc.view.swing.SwingView inView)
          Finds the topmost Container, stopping before any Window structure.
 void hideAllViews()
          Hide all open Views.
protected  void hideRootPane(javax.swing.JRootPane inRootPane)
           
 void hideView(org.scopemvc.core.View inView)
          Find the Window that is showing this View and then close it on Swing's event-handling thread.
 void hookMenuItem(org.scopemvc.view.swing.SwingView inView, java.lang.String inControlID, boolean inEnabled)
           
protected  boolean isFocusOwner(java.awt.Window inWindow)
          OK then, Swing loses focus from the current component when a menu is pulled down so for a Window to have focus we say it needs to either contain the focus owner OR parent a Window (not a Dialog/Frame) that owns the focus.
protected  void setupWindow(javax.swing.JRootPane inRootPane, org.scopemvc.view.swing.SwingView inView, boolean inCentreWindow)
           
 void showError(java.lang.String inErrorTitle, java.lang.String inErrorMessage)
           
 void showMessage(java.lang.String inTitle, java.lang.String inMessage)
           
 void showView(org.scopemvc.core.View inView)
           
protected  void showViewInDialog(org.scopemvc.view.swing.SwingView inView)
          Make a dialog (modal or modeless determined by SwingView.getDisplayMode()>SwingView.getDisplayMode() 55 ) parented to either currently focussed window, or last shown, or null shared frame.
protected  void showViewInPrimaryWindow(org.scopemvc.view.swing.SwingView inView)
           
 void startProgress()
           
 void stopProgress()
           
protected  void unhookMenuItemImpl(java.lang.String inControlID, org.scopemvc.view.swing.SwingView inView)
           
 
Methods inherited from class org.scopemvc.controller.basic.ViewContext
addProperty, clearProperties, clearThreadContext, getProperty, getViewContext, removeProperty, setGlobalContext, setThreadContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.commons.logging.Log LOG

sharedNullFrame

protected java.awt.Frame sharedNullFrame
The parent of views that get shown when no parent can be found. Ensures everything has the application icon.


rootpanes

protected java.util.LinkedList rootpanes
Keep track of all open Frames and Dialogs by keeping references to their JRootPane. Don't bother tracking Message Boxes because they're modal and don't interact with Controllers directly. This is an ordered list: the last opened rootpane is at the end.


PROGRESS_START_DELAY

private static final long PROGRESS_START_DELAY

progressStartTimer

private java.util.Timer progressStartTimer

task

private java.util.TimerTask task
Constructor Detail

SwingContext

public SwingContext()
Method Detail

getSharedNullFrame

protected java.awt.Frame getSharedNullFrame()

getDefaultWindowIcon

protected java.awt.Image getDefaultWindowIcon()

findRootPaneFor

protected javax.swing.JRootPane findRootPaneFor(org.scopemvc.core.View inView)
Find Rootpane that contains a SwingView or null if none.


getFocussedRootPane

protected javax.swing.JRootPane getFocussedRootPane()
Find the rootpane that currently contains the focussed component, or null if none.


isFocusOwner

protected boolean isFocusOwner(java.awt.Window inWindow)
OK then, Swing loses focus from the current component when a menu is pulled down so for a Window to have focus we say it needs to either contain the focus owner OR parent a Window (not a Dialog/Frame) that owns the focus.


getDefaultParentWindow

protected java.awt.Window getDefaultParentWindow()
For dialogs to be opened, find the currently focussed window, or if none, the last opened window or if none, the shared null Frame.


hideRootPane

protected void hideRootPane(javax.swing.JRootPane inRootPane)

setupWindow

protected void setupWindow(javax.swing.JRootPane inRootPane,
                           org.scopemvc.view.swing.SwingView inView,
                           boolean inCentreWindow)

showView

public void showView(org.scopemvc.core.View inView)

getTopmostContainer

protected java.awt.Container getTopmostContainer(org.scopemvc.view.swing.SwingView inView)
Finds the topmost Container, stopping before any Window structure.


showViewInDialog

protected void showViewInDialog(org.scopemvc.view.swing.SwingView inView)
Make a dialog (modal or modeless determined by SwingView.getDisplayMode()>SwingView.getDisplayMode() 55 ) parented to either currently focussed window, or last shown, or null shared frame.


showViewInPrimaryWindow

protected void showViewInPrimaryWindow(org.scopemvc.view.swing.SwingView inView)

hideView

public void hideView(org.scopemvc.core.View inView)
Find the Window that is showing this View and then close it on Swing's event-handling thread. Does nothing if the passed View isn't showing.


hideAllViews

public void hideAllViews()
Hide all open Views.


areAllViewsClosed

public boolean areAllViewsClosed()
Are there any Views left open?


showError

public void showError(java.lang.String inErrorTitle,
                      java.lang.String inErrorMessage)

showMessage

public void showMessage(java.lang.String inTitle,
                        java.lang.String inMessage)

exit

public void exit()

startProgress

public void startProgress()

stopProgress

public void stopProgress()

hookMenuItem

public void hookMenuItem(org.scopemvc.view.swing.SwingView inView,
                         java.lang.String inControlID,
                         boolean inEnabled)

unhookMenuItemImpl

protected void unhookMenuItemImpl(java.lang.String inControlID,
                                  org.scopemvc.view.swing.SwingView inView)

findMenuItem

protected org.scopemvc.view.swing.SMenuItem findMenuItem(org.scopemvc.view.swing.SwingView inView,
                                                         java.lang.String inControlID)

findMenuItemInMenu

protected static org.scopemvc.view.swing.SMenuItem findMenuItemInMenu(javax.swing.JMenu inMenu,
                                                                      java.lang.String inControlID)