com.tensegrity.gui.swing.repository
Class RepositoryItemPanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bycom.tensegrity.gui.swing.repository.RepositoryItemPanel
All Implemented Interfaces:
javax.accessibility.Accessible, Evaluable, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
TemplateRepositoryItemPanel

public class RepositoryItemPanel
extends javax.swing.JPanel
implements Evaluable, java.awt.ItemSelectable

The RepositoryItemPanel is a container for SlideIcons, CompositeIcons and all icon types used to offer all sorts of formatting, components, layout elements in a application. Icons are layouted in a grid from topleft to bottomright, row-wise by using a vertical BoxLayout with panels for each row. We emulate a gridlayout here to avoid the component resizing of java.awt.GridLayout. This icon panel has two modes: fixed-columns mode: if columns is > 0 then n icons are in one row always. flexible-columns-mode: if columns is <= 0 then as many icons as possible are put in each row.

Version:
$Id: RepositoryItemPanel.java,v 1.28 2005/05/04 17:12:12 BurkhardWick Exp $
Author:
Gilles Iachelini, S. Rutz
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
RepositoryItemPanel()
          Constructs a label panel
RepositoryItemPanel(int initialColumns)
          Constructs a label panel with the specified number of initial columns
RepositoryItemPanel(int horizontalgap, int verticalgap)
          Constructs a label panel with the specified number of initial columns
RepositoryItemPanel(int initialColumns, int horizontalgap, int verticalgap, int iconwidth, int iconheight)
          Use insets to specify the outer gaps.
 
Method Summary
 void addIcon(Icon icon)
          Adds an icon to this panel.
 void addItemListener(java.awt.event.ItemListener l)
           
 void addJComponent(javax.swing.JComponent component)
          Adds a JComponent to this panel.
 void addRepositoryItem(AbstractRepositoryItem repItem)
          Adds an ActionRepositoryItem to this panel.
 void applyEvList()
          Tells the component to apply its UIItemEvaluationList.
 java.awt.Color getGradientEndColor()
          Returns the color for the end position of the gradient.
 float getGradientEndPosition()
          Returns the horizontal end position of the gradient relative to the size of the panel
 java.awt.Color getGradientStartColor()
          Returns the color for the start position of the gradient.
 float getGradientStartPosition()
          Returns the horizontal start position of the gradient relative to the size of the panel
 java.awt.Dimension getMaximumSize()
           
 java.awt.Dimension getPreferredSize()
           
 java.lang.Object[] getSelectedObjects()
           
 java.lang.Object getSelection()
          Returns the selection.
 void installEvList()
          Tells the component to setup its internal state.
 void paintComponent(java.awt.Graphics g)
           
protected  void postItemEvent(java.lang.Object selection)
          Method postItemEvent post a new ItemEvent to all registered listeners.
 void removeItemListener(java.awt.event.ItemListener l)
           
 void setBounds(int l, int r, int width, int height)
           
 void setGradientEndColor(java.awt.Color gradientRightColor)
          Sets the color for the end position of the gradient.
 void setGradientEndPosition(float gradientPosition)
          Sets the horizontal end position of the gradient relative to the size of the panel
 void setGradientStartColor(java.awt.Color gradientLeftColor)
          Sets the color for the start position of the gradient.
 void setGradientStartPosition(float gradientPosition)
          Sets the horizontal start position of the gradient relative to the size of the panel
 void setGraphApplication(GraphApplication graphApp)
          Deprecated. No GraphApplication required, UIManager is enough. Use setUIManager instead.
 void setHorizontalSpacing(int hSpacing)
          Sets the horizontal spacing between the items
 void setItemHeight(int height)
          Sets the height of the items in this panel.
 void setItemWidth(int width)
          Sets the width of the items in this panel.
 void setJPopupMenuSource(JPopupMenuSourceWithUpdateUI popupmenusource)
          Sets the JPopupMenuSourceWithUpdateUI to use for displaying popup menus.
 void setSelection(java.lang.Object selection)
          Sets the selection and fires an event.
 void setUIManager(UIManager uiManager)
          Sets the UIManager to use.
 void setVerticalSpacing(int vSpacing)
          Sets the vertical spacing between the items
protected  void showPopup(java.awt.event.MouseEvent e)
          This method shows the pop-up menu.
 void updateUI()
          Perform some custom ui updating.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
 
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, getMinimumSize, getNextFocusableComponent, 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, isValidateRoot, paint, paintBorder, paintChildren, 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, setLayout, 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, setComponentOrientation, 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

RepositoryItemPanel

public RepositoryItemPanel()
Constructs a label panel


RepositoryItemPanel

public RepositoryItemPanel(int initialColumns)
Constructs a label panel with the specified number of initial columns

Parameters:
initialColumns - number of initialcolumns.

RepositoryItemPanel

public RepositoryItemPanel(int horizontalgap,
                           int verticalgap)
Constructs a label panel with the specified number of initial columns

Parameters:
horizontalgap - the horizontal gap between the icons.
verticalgap - the vertical gap between the icons.

RepositoryItemPanel

public RepositoryItemPanel(int initialColumns,
                           int horizontalgap,
                           int verticalgap,
                           int iconwidth,
                           int iconheight)
Use insets to specify the outer gaps. Use the paramters to adjust inter-component gaps.

Parameters:
initialColumns - number of initialcolumns.
horizontalgap - the horizontal gap between the icons.
verticalgap - the vertical gap between the icons.
iconwidth - the reference iconwidth
iconheight - the reference iconheight
Method Detail

setGraphApplication

public void setGraphApplication(GraphApplication graphApp)
Deprecated. No GraphApplication required, UIManager is enough. Use setUIManager instead.

Legacy method. Allows users to set the UIManager of the application by using the application instance (GraphApplication).

Parameters:
graphApp - the GraphApplication reference to use.

setUIManager

public void setUIManager(UIManager uiManager)
Sets the UIManager to use.

Parameters:
uiManager - the UIManager to use.

showPopup

protected void showPopup(java.awt.event.MouseEvent e)
This method shows the pop-up menu.

Parameters:
e - given MouseEvent.

setJPopupMenuSource

public void setJPopupMenuSource(JPopupMenuSourceWithUpdateUI popupmenusource)
Sets the JPopupMenuSourceWithUpdateUI to use for displaying popup menus.

A popupmenusource is a source for a popupmenu and can be asked to recreate the popupmenu on demand. This is needed for ui-switches during runtime, since popupmenus do not get updated if an ui-switch occurs.

Setting a new popupmenusource will invoke the destroy() method on a previously set popupmenusource.

Parameters:
popupmenusource - the popupmenu source for the graphpanel.

updateUI

public void updateUI()
Perform some custom ui updating.


paintComponent

public void paintComponent(java.awt.Graphics g)

setBounds

public void setBounds(int l,
                      int r,
                      int width,
                      int height)

getMaximumSize

public java.awt.Dimension getMaximumSize()

getPreferredSize

public java.awt.Dimension getPreferredSize()

addIcon

public void addIcon(Icon icon)
Adds an icon to this panel.

Parameters:
icon - the icon to add to this panel.

addItemListener

public void addItemListener(java.awt.event.ItemListener l)
Specified by:
addItemListener in interface java.awt.ItemSelectable
See Also:
ItemSelectable.addItemListener(ItemListener)

getSelectedObjects

public java.lang.Object[] getSelectedObjects()
Specified by:
getSelectedObjects in interface java.awt.ItemSelectable
See Also:
ItemSelectable.getSelectedObjects()

removeItemListener

public void removeItemListener(java.awt.event.ItemListener l)
Specified by:
removeItemListener in interface java.awt.ItemSelectable
See Also:
ItemSelectable.removeItemListener(ItemListener)

getSelection

public java.lang.Object getSelection()
Returns the selection.

Returns:
the current selection.

setSelection

public void setSelection(java.lang.Object selection)
Sets the selection and fires an event.

Parameters:
selection - The selection to set

postItemEvent

protected void postItemEvent(java.lang.Object selection)
Method postItemEvent post a new ItemEvent to all registered listeners.

Parameters:
selection - the selection to post in the event.

addJComponent

public void addJComponent(javax.swing.JComponent component)
Adds a JComponent to this panel.

Parameters:
component - the Component to add.

addRepositoryItem

public void addRepositoryItem(AbstractRepositoryItem repItem)
Adds an ActionRepositoryItem to this panel.

Parameters:
repItem - the ActionRepositoryItem to add.

installEvList

public void installEvList()
Description copied from interface: Evaluable
Tells the component to setup its internal state.

Specified by:
installEvList in interface Evaluable

applyEvList

public void applyEvList()
Description copied from interface: Evaluable
Tells the component to apply its UIItemEvaluationList.

Specified by:
applyEvList in interface Evaluable

getGradientStartColor

public java.awt.Color getGradientStartColor()
Returns the color for the start position of the gradient.

Returns:
the color for the start position of the gradient.

setGradientStartColor

public void setGradientStartColor(java.awt.Color gradientLeftColor)
Sets the color for the start position of the gradient.

Parameters:
gradientLeftColor - the color to set

getGradientEndColor

public java.awt.Color getGradientEndColor()
Returns the color for the end position of the gradient.

Returns:
the color for the end position of the gradient.

setGradientEndColor

public void setGradientEndColor(java.awt.Color gradientRightColor)
Sets the color for the end position of the gradient.

Parameters:
gradientRightColor - the color to set

getGradientStartPosition

public float getGradientStartPosition()
Returns the horizontal start position of the gradient relative to the size of the panel

Returns:
the horizontal start position

setGradientStartPosition

public void setGradientStartPosition(float gradientPosition)
Sets the horizontal start position of the gradient relative to the size of the panel

Parameters:
gradientPosition - the horizontal start position

getGradientEndPosition

public float getGradientEndPosition()
Returns the horizontal end position of the gradient relative to the size of the panel

Returns:
the horizontal start position

setGradientEndPosition

public void setGradientEndPosition(float gradientPosition)
Sets the horizontal end position of the gradient relative to the size of the panel

Parameters:
gradientPosition - the horizontal end position

setHorizontalSpacing

public void setHorizontalSpacing(int hSpacing)
Sets the horizontal spacing between the items

Parameters:
hSpacing - the horizontal spacing between the items

setVerticalSpacing

public void setVerticalSpacing(int vSpacing)
Sets the vertical spacing between the items

Parameters:
vSpacing - the vertical spacing between the items

setItemWidth

public void setItemWidth(int width)
Sets the width of the items in this panel.

Parameters:
width - the width of the items in this panel.

setItemHeight

public void setItemHeight(int height)
Sets the height of the items in this panel.

Parameters:
height - the height of the items in this panel.


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.