All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class COM.ibm.desktop.ComponentController

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----java.applet.Applet
                                   |
                                   +----COM.ibm.desktop.ComponentController

public abstract class ComponentController
extends Applet
implements ModelSelectionOwner
ComponentController is the glue that brings the model, the view and the rest of the framework together. It provides the role of controller in the Model-View-Controller architecture. Specifically, it:
  • provides a bootstrap mechanism for program initialization
  • has a model to persist application data
  • has a view to render application user interface
  • has a GUI handler for GUI and event management
  • has a command processor for command logging and undo/redo
  • has a model selection for specification of model data
  • provides an applet for hosting the view when run as an applet


    Constructor Index

     o ComponentController()
    Default constructor.

    Method Index

     o addAndDo(Command)
    Invoke the command processor to perform the command and update the UI of the undo/redo commands.
     o addModelSelectionChangeListener(ModelSelectionChangeListener)
    Add listener to the list of listeners for model selection change.
     o fileIn(String)
    Read model in from file.
     o fileOut(String)
    Write model out to file.
     o fireModelSelectionChange()
    Notify listeners of model selection change.
     o getApplicationName()
    Return the name of the application.
     o getCommandProcessor()
    Return the command processor.
     o getComponentFrame()
    Return the component frame.
     o getGUIHandler()
    Return the GUIHandler.
     o getModel()
    Return the model.
     o getModelSelection()
    Return the model selection.
     o getResourceBundle()
    Return the resource bundle.
     o getView()
    Return the view.
     o isApplet()
    Is the program running as an applet?
     o isAppletFrame()
    Is the program running as an applet in a frame?
     o isApplication()
    Is the program running as an application?
     o lookupComponentController(Component)
    Look up for the component controller bound to the view.
     o lostOwnership(Clipboard, Transferable)
    Invoked when the ComponentController is no longer the owner of the contents of the clipboard.
     o openDocument(String)
    Open the named document.
     o removeModelSelectionChangeListener(ModelSelectionChangeListener)
    Remove listener from the list of listeners for model selection change.
     o setAppletFrame(boolean)
    Indicate to the framework whether the applet should be displayed in a frame.
     o setApplicationMain(boolean)
    Tell the framework whether the program is running as an application or not.
     o setCommandProcessor(ICommandProcessor)
    Set the command processor.
     o setGUIHandler(GUIHandler)
    Set the GUIHandler.
     o setModel(IModel)
    Set the model.
     o setModelSelection(ModelSelection)
    Set the model selection to a different selection and notify listeners.
     o setResourceBundle(ResourceBundle)
    Set the resource bundle.
     o setView(IView)
    Change the application view by removing the existing view in the application frame and adding a new one.
     o setView(IView, boolean)
    Change the application view by removing the existing view in the application frame and adding a new one.
     o showExpirationDialog(Calendar, String, String, boolean)
    Display a dialog if the current date is after the expiration date, or if the expirationDate parameter is null.
     o showSplashScreen(Class, String, int)
    Display a splash screen.
     o start()
    Invoked when the applet is started.
     o stop()
    Invoked when the applet is stopped.

    Constructors

     o ComponentController
     public ComponentController()
    
    Default constructor.

    Methods

     o showExpirationDialog
     public static void showExpirationDialog(Calendar expirationDate,
                                             String title,
                                             String message,
                                             boolean exit)
    
    Display a dialog if the current date is after the expiration date, or if the expirationDate parameter is null.

    Parameters:
    expirationDate - the expiration date
    title - dialog title
    message - dialog message
    exit - program exits if true
     o showSplashScreen
     public static void showSplashScreen(Class imageClass,
                                         String imageFile,
                                         int duration)
    
    Display a splash screen.

    Parameters:
    imageClass - the class to find the image resource file
    imageFile - the name of the image file
    duration - duration of time to show the image (in seconds)
     o lookupComponentController
     public static ComponentController lookupComponentController(Component c)
    
    Look up for the component controller bound to the view.

     o getModel
     public IModel getModel()
    
    Return the model.

     o setModel
     public void setModel(IModel model)
    
    Set the model.

     o getView
     public IView getView()
    
    Return the view.

     o setView
     public void setView(IView view)
    
    Change the application view by removing the existing view in the application frame and adding a new one.

    When invoked during program initialization, this method will create the application frame, add the view to the frame, and show the frame. This method should be called after any model, GUI handler, resource bundle, or model selection has been created.

    Parameters:
    view - the view to set to
     o setView
     public void setView(IView view,
                         boolean showFrame)
    
    Change the application view by removing the existing view in the application frame and adding a new one.

    When invoked during program initialization, this method will create the application frame, add the view to the frame, and show the frame if showFrame is true. This method should be called after any model, GUI handler, resource bundle, or model selection has been created.

    Parameters:
    view - the view to set to
    showFrame - true if tha application frame should be shown
     o getGUIHandler
     public GUIHandler getGUIHandler()
    
    Return the GUIHandler.

     o setGUIHandler
     public void setGUIHandler(GUIHandler guiHandler)
    
    Set the GUIHandler.

     o getCommandProcessor
     public ICommandProcessor getCommandProcessor()
    
    Return the command processor.

     o setCommandProcessor
     public void setCommandProcessor(ICommandProcessor commandProcessor)
    
    Set the command processor.

    Parameters:
    commandProcessor - command processor to set to
     o addAndDo
     public void addAndDo(Command command)
    
    Invoke the command processor to perform the command and update the UI of the undo/redo commands.

     o getModelSelection
     public ModelSelection getModelSelection()
    
    Return the model selection.

     o setModelSelection
     public void setModelSelection(ModelSelection selection)
    
    Set the model selection to a different selection and notify listeners.

    Parameters:
    selection - model selection to set to
     o addModelSelectionChangeListener
     public synchronized void addModelSelectionChangeListener(ModelSelectionChangeListener listener)
    
    Add listener to the list of listeners for model selection change.

    Parameters:
    listener - listener interested in model selection changes
     o removeModelSelectionChangeListener
     public synchronized void removeModelSelectionChangeListener(ModelSelectionChangeListener listener)
    
    Remove listener from the list of listeners for model selection change.

    Parameters:
    listener - listener interested in model selection changes
     o fireModelSelectionChange
     public void fireModelSelectionChange()
    
    Notify listeners of model selection change. Call the handleModelSelectionChange method for each registered listener.

     o lostOwnership
     public void lostOwnership(Clipboard clipboard,
                               Transferable contents)
    
    Invoked when the ComponentController is no longer the owner of the contents of the clipboard.

     o getResourceBundle
     public ResourceBundle getResourceBundle()
    
    Return the resource bundle.

     o setResourceBundle
     public void setResourceBundle(ResourceBundle resources)
    
    Set the resource bundle. This allows the framework to query resource strings like Application, Version, and Copyright.

     o getApplicationName
     public String getApplicationName()
    
    Return the name of the application. Default implementation reads the application name from the resource file. If you do not have a resource file, override this method to return an application name.

     o getComponentFrame
     public ComponentFrame getComponentFrame()
    
    Return the component frame.

     o start
     public void start()
    
    Invoked when the applet is started. Default implementation shows the applet frame if the applet has one.

    Overrides:
    start in class Applet
     o stop
     public void stop()
    
    Invoked when the applet is stopped. Default implementation hides the applet frame if the applet has one.

    Overrides:
    stop in class Applet
     o setApplicationMain
     public static void setApplicationMain(boolean flag)
    
    Tell the framework whether the program is running as an application or not. setApplicationMain(true) must be called in the program's main() before the component controller is created.

     o setAppletFrame
     public void setAppletFrame(boolean flag)
    
    Indicate to the framework whether the applet should be displayed in a frame.

     o isApplication
     public boolean isApplication()
    
    Is the program running as an application?

     o isAppletFrame
     public boolean isAppletFrame()
    
    Is the program running as an applet in a frame?

     o isApplet
     public boolean isApplet()
    
    Is the program running as an applet?

     o openDocument
     public void openDocument(String documentName)
    
    Open the named document. The document contains model data that has previously been saved.

    Parameters:
    documentName - name of document to open
     o fileOut
     protected void fileOut(String filename) throws IOException
    
    Write model out to file.

    Parameters:
    filename - name of the file to write model out to
    Throws: IOException
    I/O exceptions that may occur
     o fileIn
     protected void fileIn(String filename) throws ClassNotFoundException, IOException
    
    Read model in from file.

    Parameters:
    filename - name of the file to read model in from
    Throws: ClassNotFoundException
    Class of a serialized object cannot be found
    Throws: IOException
    I/O exceptions that may occur

    All Packages  Class Hierarchy  This Package  Previous  Next  Index