|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
org.ceryle.ui.graph.ResourceSelectionDialog
public class ResourceSelectionDialog
A subclass of JDialog providing a selection list populated by a Vector. This dialog is hidden upon button action and must be disposed of manually. The result is obtained via getSelection().
Note that the dialog can be initialized with only one of the tabs showing. This is how it is used as a bookmarks editor. The value of the static boolean useTable determines whether the bookmarks display uses a list or table view, the latter more appropriate to editing (since the user can see the URLs in the list).
When a ResourceSelectionDialog is called with an optional TMPanel (TGPanel), it is assumed that the currently displayed graph is being passed to it. When this is the case, disposing of the dialog will nullify the TGPanel, so prior to doing so it is important to release and reattach the TGPanel to its original parent. An example of this is below:
// ...
GraphSettings settings = new GraphSettings(tmlp); // capture current settings
ResourceSelectionDialog dlog = new ResourceSelectionDialog(
desktop,"dialog title"
ResourceSelectionDialog.GRAPH_TAB,
ResourceSelectionDialog.SINGLE_SELECTION,
(TMLayoutPanel)tmlp.getTGPanel(),
settings);
// get current node selection
Iterator selection = dlog.getSelection();
TMPanel gp = dlog.releaseTMPanel(); // release use of TGPanel
dlog.dispose();
tmlp.initialize(gp); // reinitialize parent graph
gp.setTGScrollPane(tmlp); // reattach parent to TGPanel
settings.restore(tmlp); // restore previous settings
tmlp.setEditable(true); // turn back on editing ability
if ( selection != null ) {
// process accordingly...
| Nested Class Summary | |
|---|---|
class |
ResourceSelectionDialog.DialogDisposer
|
class |
ResourceSelectionDialog.TabbedPaneListener
The listener class to handle changes in the tabbed pane. |
| 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 | |
|---|---|
static int |
BOOKMARKS_TAB
ResourceSelectionDialog.BOOKMARKS_TAB indicates the bookmarks tab. |
static int |
DATABASE_TAB
ResourceSelectionDialog.DATABASE_TAB indicates the database tab. |
static int |
dlog_height
The preferred height of the dialog. |
static int |
dlog_width
The preferred width of the dialog. |
static int |
GRAPH_TAB
ResourceSelectionDialog.GRAPH_TAB indicates the graph tab. |
static int |
HISTORY_TAB
ResourceSelectionDialog.HISTORY_TAB indicates the history tab. |
boolean |
includeBrowse
|
static boolean |
isModalDialog
A boolean that when true sets the dialog as modal (the default) or non-modal. |
static int |
MULTIPLE_INTERVAL_SELECTION
A value for the selectionMode property: select one or more contiguous ranges of indices at a time. |
protected org.ceryle.ui.graph.ResourceSelectionDialog.NodeSelectionListener |
nsl
|
static int |
SINGLE_INTERVAL_SELECTION
A value for the selectionMode property: select one contiguous range of indices at a time. |
static int |
SINGLE_SELECTION
A value for the selectionMode property: select one list index at a time. |
static boolean |
useTable
Use a JTable display rather than a JList for the bookmark list. |
| 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, WIDTH |
| Constructor Summary | |
|---|---|
ResourceSelectionDialog(Desktop desktop,
String title,
String message,
int selectionMode)
Constructor for a dialog box containing a tabbed panel used to select a resource (URI) via one of several methods. |
|
ResourceSelectionDialog(Desktop desktop,
String title,
String message,
int whichTab,
int selectionMode,
TMPanel tmpanel,
GraphSettings settings)
Constructor for a dialog box containing a tabbed panel used to select a resource (URI) via one of several methods. |
|
| Method Summary | |
|---|---|
void |
browse()
Display a file chooser and put the result into the selection. |
void |
contentsChanged(ListDataEvent e)
Public method required by the ListDataListener API. |
protected JPanel |
createButtonPanel()
Returns the southernmost panel containing the submit and cancel buttons. |
protected JPanel |
createCenterPanel(int selectionMode,
TMPanel tmpanel)
Returns the center panel containing the selection area(s). |
protected JSplitPane |
createCollectionPanel()
Creates a scrollable, clickable selection list (as a JComboBox), returning it as a new panel. |
protected JPanel |
createNorthPanel(String message)
Returns the northernmost panel containing the message text. |
protected String |
getCollection(String cid)
Opens the Collection cid as the default Collection. |
Iterator |
getSelection()
Return the URI field contents as the provided Iterator, null if empty. |
int |
getSelectionCount()
Return the number of items in the selection. |
TMLayoutPanel |
getTMLayoutPanel()
Returns the TMLayoutPanel used by the graph tab. |
void |
go()
Open the current topmost URI in the selection list. |
protected Iterator |
indexNodes(String cid,
String nid)
Set the Node list to the contents of the Collection whose ID is cid. |
void |
intervalAdded(ListDataEvent e)
Public method required by the ListDataListener API. |
void |
intervalRemoved(ListDataEvent e)
Public method required by the ListDataListener API. |
TMPanel |
releaseTMPanel()
Returns a reference to the TGPanel used by the graph tab. |
protected void |
selectTab(int tab)
Selects the tab indicated by the int tab, using one of the enumerated constants. |
protected void |
setContent(Object content,
boolean clear,
String caller)
Set the URI field contents to the provided Object[] array (of Strings), String, (or toString()). |
void |
setTGPanel(TMPanel tmpanel)
Sets the TouchGraph panel used in the graph tab to tmpanel. |
void |
valueChanged(ListSelectionEvent e)
Public method required by the ListDataListener API. |
String |
writeMessage(int status,
String message)
Implements the MessageWriter API, passing off messages to the Desktop. |
void |
writeMessage(String message)
Implements the MessageWriter API, passing off messages to the Desktop. |
void |
writeStatus(String message)
Implements the MessageWriter API, passing off status messages to the Desktop. |
| Methods inherited from class java.awt.Dialog |
|---|
addNotify, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DATABASE_TAB
public static final int BOOKMARKS_TAB
public static final int HISTORY_TAB
public static final int GRAPH_TAB
public static int dlog_width
public static int dlog_height
public static boolean isModalDialog
public static boolean useTable
public static final int SINGLE_SELECTION
ListSelectionModel.SINGLE_SELECTION,
Constant Field Valuespublic static final int SINGLE_INTERVAL_SELECTION
ListSelectionModel.SINGLE_INTERVAL_SELECTION,
Constant Field Valuespublic static final int MULTIPLE_INTERVAL_SELECTION
ListSelectionModel.MULTIPLE_INTERVAL_SELECTION,
Constant Field Valuesprotected org.ceryle.ui.graph.ResourceSelectionDialog.NodeSelectionListener nsl
public boolean includeBrowse
| Constructor Detail |
|---|
public ResourceSelectionDialog(Desktop desktop,
String title,
String message,
int selectionMode)
Note: currently only single selection is supported.
desktop - the parent desktoptitle - the dialog titlemessage - the text prompt to displayselectionMode - a value of JList's selection mode
public ResourceSelectionDialog(Desktop desktop,
String title,
String message,
int whichTab,
int selectionMode,
TMPanel tmpanel,
GraphSettings settings)
desktop - the parent desktoptitle - the dialog titlemessage - the text prompt to displaywhichTab - the tab to displayselectionMode - a value of JList's selection modetmpanel - a supplied TMPanel (optional)settings - graph settings (optional)DATABASE_TAB,
BOOKMARKS_TAB,
HISTORY_TAB,
GRAPH_TAB| Method Detail |
|---|
protected JPanel createNorthPanel(String message)
protected JPanel createCenterPanel(int selectionMode,
TMPanel tmpanel)
protected void selectTab(int tab)
DATABASE_TAB,
BOOKMARKS_TAB,
HISTORY_TAB,
GRAPH_TABpublic int getSelectionCount()
public Iterator getSelection()
protected void setContent(Object content,
boolean clear,
String caller)
public void go()
public void browse()
protected JSplitPane createCollectionPanel()
public void contentsChanged(ListDataEvent e)
contentsChanged in interface ListDataListenerpublic void intervalAdded(ListDataEvent e)
intervalAdded in interface ListDataListenerpublic void intervalRemoved(ListDataEvent e)
intervalRemoved in interface ListDataListenerpublic void valueChanged(ListSelectionEvent e)
valueChanged in interface ListSelectionListenerprotected String getCollection(String cid)
protected Iterator indexNodes(String cid,
String nid)
public void setTGPanel(TMPanel tmpanel)
public TMLayoutPanel getTMLayoutPanel()
protected JPanel createButtonPanel()
public TMPanel releaseTMPanel()
public void writeMessage(String message)
writeMessage in interface MessageWriter
public String writeMessage(int status,
String message)
writeMessage in interface MessageWriterMessageHandlerpublic void writeStatus(String message)
writeStatus in interface MessageWriter
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||