org.jscroll.widgets
Class DesktopScrollPane

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JScrollPane
                          |
                          +--org.jscroll.widgets.DesktopScrollPane
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, ScrollPaneConstants, Serializable

public class DesktopScrollPane
extends JScrollPane

This class provides the scrollpane that contains the virtual desktop.

Version:
1.0 11-Aug-2001
Author:
Tom Tessier
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.JScrollPane
columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewport
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.ScrollPaneConstants
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DesktopScrollPane(DesktopMediator desktopMediator)
          creates the DesktopScrollPane object
 
Method Summary
 void add(DesktopListener dListener, JInternalFrame f, int x, int y)
          adds an internal frame to the virtual desktop
 JScrollInternalFrame add(DesktopListener dListener, String title, ImageIcon icon, JPanel frameContents, boolean isClosable, int x, int y)
          creates a JScrollInternalFrame and adds it to the virtual desktop
 Point cascadeInternalFrame(JInternalFrame f)
          propogates cascadeInternalFrame to FramePositioning
 void cascadeInternalFrames()
          propogates cascadeInternalFrames to FramePositioning
 void centerView(JScrollInternalFrame f)
          centers the viewport of the virtual desktop around the provided internal frame
 void closeSelectedFrame()
          closes the internal frame currently selected upon the virtual desktop
 void flagContentsChanged(JInternalFrame f)
          flags the specified internal frame as "contents changed." Used to notify the user when the contents of an inactive internal frame have changed.
 JInternalFrame[] getAllFrames()
          returns all internal frames placed upon the virtual desktop
 boolean getAutoTile()
          propogates getAutoTile to FramePositioning
 Dimension getDesktopSize()
          returns the preferred size of the virtual desktop
 int getNumberOfFrames()
          returns the number of internal frames upon the virtual desktop
 JInternalFrame getSelectedFrame()
          returns the internal frame currently selected upon the virtual desktop
 void removeAssociatedComponents(JScrollInternalFrame f)
          propogates removeAssociatedComponents to DesktopMediator
 void resizeDesktop()
          resizes the virtual desktop based upon the locations of its internal frames.
 void selectNextFrame()
          selects the next available frame upon the virtual desktop
 void setAutoTile(boolean autoTile)
          propogates setAutoTile to FramePositioning
 void setDesktopSize(Dimension dim)
          sets the preferred size of the virtual desktop
 void setSelectedFrame(JInternalFrame f)
          selects the specified internal frame upon the virtual desktop
 void tileInternalFrames()
          propogates tileInternalFrames to FramePositioning
 
Methods inherited from class javax.swing.JScrollPane
createHorizontalScrollBar, createVerticalScrollBar, createViewport, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setWheelScrollingEnabled, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DesktopScrollPane

public DesktopScrollPane(DesktopMediator desktopMediator)
creates the DesktopScrollPane object

Parameters:
desktopMediator - a reference to the DesktopMediator object
Method Detail

add

public JScrollInternalFrame add(DesktopListener dListener,
                                String title,
                                ImageIcon icon,
                                JPanel frameContents,
                                boolean isClosable,
                                int x,
                                int y)
creates a JScrollInternalFrame and adds it to the virtual desktop

Parameters:
dListener - a reference to the DesktopListener
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 JScrollInternalFrame that was created

add

public void add(DesktopListener dListener,
                JInternalFrame f,
                int x,
                int y)
adds an internal frame to the virtual desktop

Parameters:
dListener - a reference to the DesktopListener
f - the internal frame 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

getAllFrames

public JInternalFrame[] getAllFrames()
returns all internal frames placed upon the virtual desktop

Returns:
a JInternalFrame array containing references to the internal frames

getSelectedFrame

public JInternalFrame getSelectedFrame()
returns the internal frame currently selected upon the virtual desktop

Returns:
a reference to the active JInternalFrame

closeSelectedFrame

public void closeSelectedFrame()
closes the internal frame currently selected upon the virtual desktop


setSelectedFrame

public void setSelectedFrame(JInternalFrame f)
selects the specified internal frame upon the virtual desktop

Parameters:
f - the internal frame to select

flagContentsChanged

public void flagContentsChanged(JInternalFrame f)
flags the specified internal frame as "contents changed." Used to notify the user when the contents of an inactive internal frame have changed.

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

selectNextFrame

public void selectNextFrame()
selects the next available frame upon the virtual desktop


getNumberOfFrames

public int getNumberOfFrames()
returns the number of internal frames upon the virtual desktop

Returns:
an int representing the number of internal frames

setDesktopSize

public void setDesktopSize(Dimension dim)
sets the preferred size of the virtual desktop

Parameters:
dim - a Dimension object representing the desired preferred size

getDesktopSize

public Dimension getDesktopSize()
returns the preferred size of the virtual desktop

Returns:
a Dimension object representing the current preferred size

setAutoTile

public void setAutoTile(boolean autoTile)
propogates setAutoTile to FramePositioning

Parameters:
autoTile - boolean representing autoTile mode. If true, then all new frames are tiled automatically. If false, then all new frames are cascaded automatically.

getAutoTile

public boolean getAutoTile()
propogates getAutoTile to FramePositioning

Returns:
boolean representing current autoTile mode

cascadeInternalFrame

public Point cascadeInternalFrame(JInternalFrame f)
propogates cascadeInternalFrame to FramePositioning

Parameters:
f - the internal frame to cascade
Returns:
a Point object representing the position of the internal frame

cascadeInternalFrames

public void cascadeInternalFrames()
propogates cascadeInternalFrames to FramePositioning


tileInternalFrames

public void tileInternalFrames()
propogates tileInternalFrames to FramePositioning


centerView

public void centerView(JScrollInternalFrame f)
centers the viewport of the virtual desktop around the provided internal frame

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

resizeDesktop

public void resizeDesktop()
resizes the virtual desktop based upon the locations of its internal frames. This updates the desktop scrollbars in real-time. Executes as an "invoked later" thread for a slight perceived performance boost.


removeAssociatedComponents

public void removeAssociatedComponents(JScrollInternalFrame f)
propogates removeAssociatedComponents to DesktopMediator

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


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