org.ceryle.ui.tree
Class TopicTreeDialog

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
                  extended by javax.swing.JDialog
                      extended by org.ceryle.ui.tree.TopicTreeDialog
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class TopicTreeDialog
extends JDialog

Extends JDialog to provide a selection dialog for selecting a Topic from a list. The list is generated from one or more query Topics in the constructor, from which either a ancestor or descendent list is generated and displayed in the form of a tree.

This dialog is hidden upon button action and must be disposed of manually. The result is obtained via getSelection():

     TopicTreeDialog dlog = new TopicTreeDialog(
             myJFrame,
             "dialog title",
             "dialog message",
             "optional description",
             queryTopics );
     Topic selected = dlog.getSelection();
 

Following use of the dialog, the button pressed can be obtained by calling getSelectedButton(), which returns one of the following JOptionPane values:

If the dialog is closed via its window being closed, JOptionPane.CANCEL_OPTION is returned.

Since:
JDK1.3
Version:
$Id: TopicTreeDialog.java,v 3.8 2007-06-20 01:28:29 altheim Exp $
Author:
Murray Altheim
See Also:
Serialized Form

Nested Class Summary
 class TopicTreeDialog.DialogDisposer
           
 
Nested classes/interfaces inherited from class javax.swing.JDialog
JDialog.AccessibleJDialog
 
Nested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  JButton btn_cancel
           
protected  JButton btn_help
           
protected  JButton btn_select
           
protected  JPanel centerPanel
           
static int DEFAULT_COLUMN_WIDTH
          The default column width (in characters) for the display list.
static int DEFAULT_ROW_COUNT
          The default number of rows to show in the display list.
protected  JTextArea desc
           
protected  JTextArea help
           
protected  JPanel helpPanel
           
protected  StackSet m_query
           
protected  JPanel northPanel
           
protected  int selectedButton
           
protected  JPanel southPanel
           
protected  Services srvs
           
static int WIDTH
          Window width in pixels.
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS
 
Constructor Summary
TopicTreeDialog(JFrame frame, String title, String message, String description, List queryTopics, TopicTreeModel treemodel, boolean superclasses, boolean initVisible)
          Constructor for a dialog box containing a selection list.
 
Method Summary
protected  JPanel createCenterPanel()
          Returns the center panel containing the selection area(s).
protected  JPanel createNorthPanel(String message, String description)
          Returns the northernmost panel containing the message text and optional description.
protected  JPanel createSouthPanel(boolean includeHelp)
          Returns the southernmost panel containing the submit and cancel buttons.
protected  void doSomething(Object content)
          Do something with the selection.
 int getSelectedButton()
          Returns the value of the selected button as one of the JOptionPane options JOptionPane.YES_OPTION, JOptionPane.NO_OPTION, or JOptionPane.CANCEL_OPTION.
 int getSelectedCount()
          Returns the number of selected items in the list.
 Topic getSelection()
          Returns the selected Object, null if there is no selection.
 boolean isHelpVisible()
           
 void query(List queryTopics, boolean superclasses)
          Clears the existing display and sets the new tree to one based on the contents of the provided Vector, which contains zero or more Topics.
protected  void setDescription(String s)
          Do something with the selection.
 void setHelpText(String content)
          Set the help text to the String content.
protected  void setSelectedButton(int value)
           
protected  void updateFromSelection(Object o)
          Updates any features based on the current selected Topic.
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Dialog
addNotify, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WIDTH

public static int WIDTH
Window width in pixels. This defaults to 0, but this will force it to any size larger than the current width.


DEFAULT_COLUMN_WIDTH

public static int DEFAULT_COLUMN_WIDTH
The default column width (in characters) for the display list.


DEFAULT_ROW_COUNT

public static int DEFAULT_ROW_COUNT
The default number of rows to show in the display list.


srvs

protected Services srvs

selectedButton

protected int selectedButton

btn_help

protected JButton btn_help

btn_cancel

protected JButton btn_cancel

btn_select

protected JButton btn_select

northPanel

protected JPanel northPanel

centerPanel

protected JPanel centerPanel

southPanel

protected JPanel southPanel

helpPanel

protected JPanel helpPanel

desc

protected JTextArea desc

help

protected JTextArea help

m_query

protected StackSet m_query
Constructor Detail

TopicTreeDialog

public TopicTreeDialog(JFrame frame,
                       String title,
                       String message,
                       String description,
                       List queryTopics,
                       TopicTreeModel treemodel,
                       boolean superclasses,
                       boolean initVisible)
                throws TopicMapException
Constructor for a dialog box containing a selection list. The list should be supplied as an AbstractListModel or Vector containing a list of values. The result is returned from the the method getSelection(), and is one or more selected values, or null if there isn't a selection.

The setting on whether or not to indicate facets in the renderer is based on the value of TopicTreeModel.facetMode at the time of instantiation. If the default behaviour isn't wanted, this must be set explicitly using TopicTreeModel.setFacetMode(int).

Parameters:
frame - the parent frame window
title - the dialog title
message - the text to display above the list
description - an optional text description
queryTopics - a StackSet containing query Topics
treemodel - the optional TopicTreeModel being displayed
superclasses - a boolean indicating that when true indicates the direction should be towards superclasses, otherwise subclasses
initVisible - when true, displays the dialog upon instantiation
Throws:
TopicMapException
Method Detail

query

public void query(List queryTopics,
                  boolean superclasses)
Clears the existing display and sets the new tree to one based on the contents of the provided Vector, which contains zero or more Topics.


createNorthPanel

protected JPanel createNorthPanel(String message,
                                  String description)
Returns the northernmost panel containing the message text and optional description.


updateFromSelection

protected void updateFromSelection(Object o)
Updates any features based on the current selected Topic.


createCenterPanel

protected JPanel createCenterPanel()
Returns the center panel containing the selection area(s).


createSouthPanel

protected JPanel createSouthPanel(boolean includeHelp)
Returns the southernmost panel containing the submit and cancel buttons.


doSomething

protected void doSomething(Object content)
Do something with the selection.


setSelectedButton

protected void setSelectedButton(int value)

getSelectedButton

public int getSelectedButton()
Returns the value of the selected button as one of the JOptionPane options JOptionPane.YES_OPTION, JOptionPane.NO_OPTION, or JOptionPane.CANCEL_OPTION.


setDescription

protected void setDescription(String s)
Do something with the selection.


isHelpVisible

public boolean isHelpVisible()

setHelpText

public void setHelpText(String content)
Set the help text to the String content.


getSelection

public Topic getSelection()
Returns the selected Object, null if there is no selection.


getSelectedCount

public int getSelectedCount()
Returns the number of selected items in the list.



The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.