uk.ac.starlink.connect
Class FilestoreChooser
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
uk.ac.starlink.connect.FilestoreChooser
- All Implemented Interfaces:
- Accessible, ImageObserver, MenuContainer, Serializable
- public class FilestoreChooser
- extends JPanel
Generalised file browser which can browse virtual remote filesystems
as well as the local filesystem. The objects it holds are instances
of the Node
interface.
Though written from scratch, this class is effectively a generalisation
of JFileChooser
. JFileChooser looks like it ought
to be generalisable by providing alternative
FileSystemView implementations, but
I've tried it, and that way lies misery.
- Since:
- 18 Feb 2005
- See Also:
- Serialized Form
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, isValidateRoot, 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, 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, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
FilestoreChooser
public FilestoreChooser()
- Constructor.
FilestoreChooser
public FilestoreChooser(Branch branch)
- Constructs a new chooser pointing to a given branch.
- Parameters:
branch
- initial branch
getConnectorActions
public List getConnectorActions()
- Returns a mutable list of the connector instances used by this chooser.
You can manipulate this list either by adding/removing items from
it or overriding this method.
- Returns:
- mutable list of
ConnectorAction
objects
getOkAction
public Action getOkAction()
- Returns the action which is equivalent to hitting an OK button,
that is performing a selection.
- Returns:
- OK action
setEnabled
public void setEnabled(boolean enabled)
addDefaultBranches
public void addDefaultBranches()
- Populate this browser with a default set of branches.
This includes the current directory and possibly some
connectors for remote filestores.
The selection is also set to a sensible initial value
(probably the current directory).
setBranch
public void setBranch(Branch branch)
- Sets the current selected branch. This may or may not add a new
branch to the selector.
- Parameters:
branch
- branch
refreshList
public void refreshList()
- Ensures that the list contains the correct children for the
currently selected branch.
getBranch
public Branch getBranch()
- Returns the currently selected branch.
- Returns:
- current branch
addConnection
public void addConnection(ConnectorAction connAct)
- Adds a new branch representing a connection to a remote service to
this chooser.
- Parameters:
connAct
- connector action
getSelectedNodes
public Node[] getSelectedNodes()
- Returns the array of all nodes currently selected.
- Returns:
- array of selected nodes
getSelectedNode
public Node getSelectedNode()
- Returns the single selected node. If more than one is selected,
null is returned. A node is considered selected if its name is
currently entered in the text field (as well as if it's been
selected in the list in the usual way).
- Returns:
- unique selected node, or null
getModel
public ComboBoxModel getModel()
- Returns an object which contains the state of this chooser.
The object is the ComboBoxModel which defines the state of the
selector at the top of the window which selects the current
branch.
- Returns:
- data model for this chooser
setModel
public void setModel(ComboBoxModel model)
- Sets the model which contains the state of this chooser.
The object is the ComboBoxModel which defines the state of the
selector at the top of the window which selects the current branch.
Note you can't just bung any old CombBoxModel in here; it must
be one obtained from a
getModel()
call on another
FilestoreChooser.
- Parameters:
model
- data model to use
leafSelected
protected void leafSelected(Leaf leaf)
- This method is called if a successful selection of a single leaf
has taken place. The default implementation does nothing.
- Parameters:
leaf
- selected leaf (not null)
main
public static void main(String[] args)