com.tensegrity.skeleton.container.swing
Class SwingRepositoryUtil

java.lang.Object
  extended bycom.tensegrity.skeleton.container.swing.SwingRepositoryUtil

public class SwingRepositoryUtil
extends java.lang.Object

SwingRepositoryUtil is a utility class to build repositories containing items from the ElementPool, layout contexts or command items. The necessary information (name, tooltip, icon, category, size, background gradient) is loaded from an AttributeList that is usually stored in an XML file. The items are then added to SlidePanels and for each nested category in the given AttributeList another SlidePanel will be created.

Author:
BurkhardWick

Method Summary
static void buildRepository(ApplicationFrame appFrame, DragContext dragContext, javax.swing.JPanel slideRepository, AttributeList repository, ActionRepositoryItem.ClickActionProvider clickActionProvider)
          Builds a repository into a given SlidePanel.
static void buildRepository(ApplicationFrame appFrame, DragContext dragContext, SlidePanel slideRepository, java.io.File file, ActionRepositoryItem.ClickActionProvider clickActionProvider)
          Builds a repository into a given SlidePanel.
static void buildRepository(ApplicationFrame appFrame, DragContext dragContext, SlidePanel slideRepository, java.lang.String filepath, java.lang.Class refClass, ActionRepositoryItem.ClickActionProvider clickActionProvider)
          Builds a repository into a given SlidePanel.
static javax.swing.Action getCloseAction(javax.swing.JComponent slideComponent, SlidePanel parent)
          Creates the close action that removes a SlidePanel from the repository
static AttributableOnSet getSlidesVisibilityAttributableOnSet(ApplicationFrame appFrame)
          Returns an AttributableOnSet that contains all slidepanels of the application in an hierarchical structure.
static void restoreCollapsedContainersFromPreferences(SwingApplicationFrame appFrame, Preferences prefs, java.lang.String key)
          Restores the state of collapsed repository slides from a string in the preferences containing their paths.
static void restoreHiddenContainersFromPreferences(SwingApplicationFrame appFrame, Preferences prefs, java.lang.String key)
          Restores the state of hidden repository slides from a string in the preferences containing their paths.
static void storeCollapsedContainersToPreferences(SwingApplicationFrame appFrame, Preferences prefs, java.lang.String key)
          Stores a string to the preferences containing the paths to all collapsed repository slides, so their state can be restored later.
static void storeHiddenContainersToPreferences(SwingApplicationFrame appFrame, Preferences prefs, java.lang.String key)
          Stores a string to the preferences containing the paths to all hidden repository slides, so their state can be restored later.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

buildRepository

public static void buildRepository(ApplicationFrame appFrame,
                                   DragContext dragContext,
                                   SlidePanel slideRepository,
                                   java.lang.String filepath,
                                   java.lang.Class refClass,
                                   ActionRepositoryItem.ClickActionProvider clickActionProvider)
                            throws XMLParseException,
                                   ReadException
Builds a repository into a given SlidePanel.

Parameters:
appFrame - The ApplicationFrame of the application used to retrieve the CommandRegistry and the UIManager
dragContext - The drag context used to install drag and drop in items representing insertable elements
slideRepository - The root slide to build the repository into
filepath - The relative path to the file containing the repository data
refClass - The reference class for filepath
clickActionProvider - The ActionRepositoryItem.ClickActionProvider to define the behaviour when the user clicks on the repository items, may be null
Throws:
ReadException - if reading the file failed
XMLParseException - if the file contains invalid XML data

buildRepository

public static void buildRepository(ApplicationFrame appFrame,
                                   DragContext dragContext,
                                   SlidePanel slideRepository,
                                   java.io.File file,
                                   ActionRepositoryItem.ClickActionProvider clickActionProvider)
                            throws XMLParseException,
                                   ReadException
Builds a repository into a given SlidePanel.

Parameters:
appFrame - The ApplicationFrame of the application used to retrieve the CommandRegistry and the UIManager
dragContext - The drag context used to install drag and drop in items representing insertable elements
slideRepository - The root slide to build the repository into
file - The File to read the data to build the repository from
clickActionProvider - The ActionRepositoryItem.ClickActionProvider to define the behaviour when the user clicks on the repository items, may be null
Throws:
ReadException - if reading the file failed
XMLParseException - if the file contains invalid XML data

buildRepository

public static void buildRepository(ApplicationFrame appFrame,
                                   DragContext dragContext,
                                   javax.swing.JPanel slideRepository,
                                   AttributeList repository,
                                   ActionRepositoryItem.ClickActionProvider clickActionProvider)
Builds a repository into a given SlidePanel.

Parameters:
appFrame - The ApplicationFrame of the application used to retrieve the CommandRegistry and the UIManager
dragContext - The drag context used to install drag and drop in items representing insertable elements
slideRepository - The root slide to build the repository into
repository - The AttributeList containing the data to build the repository from
clickActionProvider - The ActionRepositoryItem.ClickActionProvider to define the behaviour when the user clicks on the repository items, may be null

getCloseAction

public static final javax.swing.Action getCloseAction(javax.swing.JComponent slideComponent,
                                                      SlidePanel parent)
Creates the close action that removes a SlidePanel from the repository

Parameters:
slideComponent - The slide component of the slide to remove
parent - The parent slide to remove the component from
Returns:
the close action that removes a SlidePanel from the repository

storeCollapsedContainersToPreferences

public static final void storeCollapsedContainersToPreferences(SwingApplicationFrame appFrame,
                                                               Preferences prefs,
                                                               java.lang.String key)
Stores a string to the preferences containing the paths to all collapsed repository slides, so their state can be restored later. If the given key does not exist in the preferences, the state will not be stored.

Parameters:
appFrame - The application frame used to retrieve all "containers" representing SlidePanels
prefs - The preferences to store the state in
key - The key to store the state under

restoreCollapsedContainersFromPreferences

public static final void restoreCollapsedContainersFromPreferences(SwingApplicationFrame appFrame,
                                                                   Preferences prefs,
                                                                   java.lang.String key)
Restores the state of collapsed repository slides from a string in the preferences containing their paths. If the given key does not exist in the preferences, the state will not be restored.

Parameters:
appFrame - The application frame used to retrieve all "containers" representing SlidePanels
prefs - The preferences to get the state from
key - The key to retrieve the state

storeHiddenContainersToPreferences

public static final void storeHiddenContainersToPreferences(SwingApplicationFrame appFrame,
                                                            Preferences prefs,
                                                            java.lang.String key)
Stores a string to the preferences containing the paths to all hidden repository slides, so their state can be restored later. If the given key does not exist in the preferences, the state will not be stored.

Parameters:
appFrame - The application frame used to retrieve all "containers" representing SlidePanels
prefs - The preferences to store the state in
key - The key to store the state under

restoreHiddenContainersFromPreferences

public static final void restoreHiddenContainersFromPreferences(SwingApplicationFrame appFrame,
                                                                Preferences prefs,
                                                                java.lang.String key)
Restores the state of hidden repository slides from a string in the preferences containing their paths. If the given key does not exist in the preferences, the state will not be restored.

Parameters:
appFrame - The application frame used to retrieve all "containers" representing SlidePanels
prefs - The preferences to get the state from
key - The key to retrieve the state

getSlidesVisibilityAttributableOnSet

public static final AttributableOnSet getSlidesVisibilityAttributableOnSet(ApplicationFrame appFrame)
Returns an AttributableOnSet that contains all slidepanels of the application in an hierarchical structure. On the top level all containers (AttributeEditorContainer, NavigatorContainer, etc. and custom containers) are listed and below there are the slides of the containers. Each attribute representing a slide has a Boolean as value, so the user can use a checkbox to edit the value. This AttributableOnSet is used to toggle the hidden or collapsed state of slides.

Parameters:
appFrame - The application frame used to retrieve all containers of the application gui
Returns:
The AttributableOnSet that can be used to edit the visibility


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