org.jscroll.widgets
Class DesktopMediator

java.lang.Object
  |
  +--org.jscroll.widgets.DesktopMediator
All Implemented Interfaces:
DesktopConstants

public class DesktopMediator
extends Object
implements DesktopConstants

This class coordinates state changes between other classes in the system. Based upon the "mediator" design pattern.

Version:
1.0 11-Aug-2001
Author:
Tom Tessier

Field Summary
 
Fields inherited from interface org.jscroll.widgets.DesktopConstants
CONTENTS_CHANGED_COLOR, MAX_FRAMES, MAXIMUM_BUTTON_WIDTH, MINIMUM_BUTTON_WIDTH, X_OFFSET, Y_OFFSET
 
Constructor Summary
DesktopMediator(JScrollDesktopPane mainPane)
          creates the DesktopMediator object.
 
Method Summary
 void actionPerformed(ActionEvent e)
          propogates actionPerformed event to DesktopListener
 void add(JInternalFrame frame, int x, int y)
          adds an internal frame to the scrollable desktop pane
 JInternalFrame add(String title, ImageIcon icon, JPanel frameContents, boolean isClosable, int x, int y)
          adds an internal frame to the scrollable desktop pane
 void cascadeInternalFrames()
          propogates cascadeInternalFrames to DesktopScrollPane
 void centerView(JScrollInternalFrame f)
          propogates centerView to DesktopScrollPane
 void closeSelectedFrame()
          propogates closeSelectedFrame to DesktopScrollPane
 void flagContentsChanged(JInternalFrame f)
          propogates flagContentsChanged to DesktopScrollPane
 JInternalFrame getSelectedFrame()
          propogates getSelectedFrame to DesktopScrollPane
 void registerMenuBar(JMenuBar mb)
          registers a menubar with the mediator, applying the "Window" menu items to that menubar in the process.
 void removeAssociatedComponents(JScrollInternalFrame f)
          removes the secondary components associated with an internal frame, such as toggle and menu buttons, and selects the next available frame
 void resizeDesktop()
          propogates resizeDesktop to DesktopScrollPane
 void revalidateViewport()
          propogates revalidateViewport to DesktopScrollPane
 void setAutoTile(boolean tileMode)
          propogates setAutoTile to DesktopScrollPane
 void setSelectedFrame(JInternalFrame f)
          propogates setSelectedFrame to DesktopScrollPane
 void tileInternalFrames()
          propogates tileInternalFrames to DesktopScrollPane
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DesktopMediator

public DesktopMediator(JScrollDesktopPane mainPane)
creates the DesktopMediator object.

Parameters:
mainPane - a reference to the JScrollDesktopPane that this object is to mediate.
Method Detail

registerMenuBar

public void registerMenuBar(JMenuBar mb)
registers a menubar with the mediator, applying the "Window" menu items to that menubar in the process.

Parameters:
mb - the menubar to register

add

public JInternalFrame add(String title,
                          ImageIcon icon,
                          JPanel frameContents,
                          boolean isClosable,
                          int x,
                          int y)
adds an internal frame to the scrollable desktop pane

Parameters:
title - the title displayed in the title bar of the internal frame
icon - the icon displayed in the title bar of the internal frame
frameContents - the contents of the internal frame
isClosable - boolean indicating whether internal frame is closable
x - x coordinates of internal frame within the scrollable desktop -1 indicates the virtual desktop is to determine the position
y - y coordinates of internal frame within the scrollable desktop -1 indicates the virtual desktop is to determine the position
Returns:
the internal frame that was created

add

public void add(JInternalFrame frame,
                int x,
                int y)
adds an internal frame to the scrollable desktop pane

Parameters:
frame - the internal frame of class JScrollInternalFrame to add
x - x coordinates of internal frame within the scrollable desktop -1 indicates the virtual desktop is to determine the position
y - y coordinates of internal frame within the scrollable desktop -1 indicates the virtual desktop is to determine the position

removeAssociatedComponents

public void removeAssociatedComponents(JScrollInternalFrame f)
removes the secondary components associated with an internal frame, such as toggle and menu buttons, and selects the next available frame

Parameters:
f - the internal frame whose associated components are to be removed

getSelectedFrame

public JInternalFrame getSelectedFrame()
propogates getSelectedFrame to DesktopScrollPane

Returns:
the currently selected internal frame

setSelectedFrame

public void setSelectedFrame(JInternalFrame f)
propogates setSelectedFrame to DesktopScrollPane

Parameters:
f - the internal frame to set as selected

flagContentsChanged

public void flagContentsChanged(JInternalFrame f)
propogates flagContentsChanged to DesktopScrollPane

Parameters:
f - the internal frame to flag as "contents changed"

resizeDesktop

public void resizeDesktop()
propogates resizeDesktop to DesktopScrollPane


revalidateViewport

public void revalidateViewport()
propogates revalidateViewport to DesktopScrollPane


centerView

public void centerView(JScrollInternalFrame f)
propogates centerView to DesktopScrollPane

Parameters:
f - the internal frame to center the view about

closeSelectedFrame

public void closeSelectedFrame()
propogates closeSelectedFrame to DesktopScrollPane


tileInternalFrames

public void tileInternalFrames()
propogates tileInternalFrames to DesktopScrollPane


cascadeInternalFrames

public void cascadeInternalFrames()
propogates cascadeInternalFrames to DesktopScrollPane


setAutoTile

public void setAutoTile(boolean tileMode)
propogates setAutoTile to DesktopScrollPane

Parameters:
tileMode - true indicates tile internal frames, false indicates cascade internal frames

actionPerformed

public void actionPerformed(ActionEvent e)
propogates actionPerformed event to DesktopListener

Parameters:
e - the ActionEvent to propogate


Copyright © 2001-2003 JScroll.org. All Rights Reserved.