|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel oracle.ide.panels.DefaultTraversablePanel oracle.ide.net.URLChooser
The URLChooser
is a replacement file chooser for JFileChooser
. The URLChooser
is designed to
work in terms of URL
rather than File
instances.
In general, most client code should not call the
URLChooser
constructors directly. Instead, use one of the
DialogUtil#newURLChooser()
variants, as this ensures that the
chooser will be initialized consistently throughout the application.
When the URLChooser
must be subclassed, however, the
constructors can be called directly but this should be followed by a
call to DialogUtil#initURLChooser(URLChooser,oracle.ide.addin.Context)
.
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 | |
static int |
APPROVE_OPTION
Return value from showOpenDialog(...) and
showSaveDialog(...) methods if open/save is chosen. |
static int |
CANCEL_OPTION
Return value from showOpenDialog(...) and
showSaveDialog(...) methods if cancel is chosen. |
static int |
DIRECTORIES_ONLY
|
static int |
DIRECTORIES_OR_FILES
|
static int |
ERROR_OPTION
Return value from showOpenDialog(...) and
showSaveDialog(...) methods if an I/O error occurred. |
static int |
FILES_ONLY
|
protected static java.lang.String |
HELP_TOPIC_SELECT_DIRECTORIES
|
protected static java.lang.String |
HELP_TOPIC_SELECT_FILES
|
protected static java.lang.String |
HELP_TOPIC_SELECT_FILES_OR_DIRECTORIES
|
static int |
MULTIPLE_INTERVAL_SELECTION
A value for setSelectionMode(int) meaning that one or
more continuous ranges of files can be selected at a time. |
static int |
SINGLE_INTERVAL_SELECTION
A value for setSelectionMode(int) meaning that one
continuous range of files can be selected at a time. |
static int |
SINGLE_SELECTION
A value for setSelectionMode(int) meaning that one
file can be selected at a time. |
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 oracle.ide.controls.GridBagConstants |
ANCHOR_C, ANCHOR_E, ANCHOR_N, ANCHOR_NE, ANCHOR_NW, ANCHOR_S, ANCHOR_SE, ANCHOR_SW, ANCHOR_W, FILL_NONE, FILL_X, FILL_XY, FILL_Y |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
URLChooser()
Constructs a default URLChooser with all file system
roots as reported by URLFileSystem.listRoots() . |
|
URLChooser(java.net.URL defaultSelection)
Constructs a default URLChooser with all file system
roots as reported by URLFileSystem.listRoots() . |
|
URLChooser(java.net.URL[] roots,
java.net.URL defaultSelection)
Constructs a URLFilter to display the specified
array of URL s as its "root" file systems and the
specified URL as the default selection. |
|
URLChooser(java.net.URL[] roots,
java.net.URL defaultSelection,
boolean showJarsAsDirs)
Deprecated. Replace with URLChooser(URL[],URL) and setShowJarsAsDirs(boolean) . |
|
URLChooser(java.net.URL defaultSelection,
boolean showJarsAsDirs)
Deprecated. Replace with URLChooser(URL) and setShowJarsAsDirs(boolean) . |
Method Summary | |
boolean |
accept(java.net.URL url)
Returns true if the specified URL should be
displayed in the URLChooser . |
void |
addChooseableURLFilter(URLFilter filter)
Adds the specified URLFilter to be one of the filters
that are shown in the "File type" combo box. |
void |
addNotify()
|
void |
addShortcutButton(javax.swing.Icon icon,
java.lang.String description,
java.net.URL url)
This method adds a shortcut button to the button panel on the left side of the URLChooser . |
void |
addURLChooserListener(oracle.ide.net.URLChooserListener ucl)
Add a URLChooserListener to this URLChooser |
boolean |
approveSelection()
|
void |
cancelSelection()
This method is called when the URLChooser is being
canceled. |
protected java.net.URL |
canonicalizeApprovalURL(java.net.URL url)
Template helper method for approveSelection() to
canonicalize the URL to be approved. |
void |
changeToParentDirectory()
|
protected boolean |
checkApprovalParentExists(java.net.URL url)
Template helper method for approveSelection() to check that
the parent directory for the approval URL exists. |
void |
clearChooseableURLFilters()
Clears the list of chooseable URLFilter s. |
protected java.net.URL |
getApprovalFileListURL()
Template helper method for approveSelection() and
getSelectedURL() to get the URL of the selected
node in the file list. |
DialogRunnerCallback |
getDialogRunnerCallback()
|
java.net.URL[] |
getExtraURLs()
Returns an array containing all URL s that have been
registered as "extra" URL s; returns null if
no URL s have previously been registed via setExtraURLs(URL[]) . |
java.lang.String |
getFileNameURL()
|
URLFilter |
getSelectedFilter()
Returns the URLFilter that is currently selected in the
file type combo box. |
java.net.URL |
getSelectedURL()
Returns the URL of the node (which may be a directory or
a file) that is currently selected in the URLChooser . |
java.net.URL[] |
getSelectedURLs()
Returns an array of URL s representing the current
selections in the URLChooser . |
boolean |
getShowJarsAsDirs()
Returns whether the URLChooser allows browsing into
archives. |
void |
removeNotify()
|
void |
removeShortcutButtons()
Removes all shortcut buttons from the button panel on the left side of the URLChooser , allowing the URLChooser
instance to be reused in a different context without retaining the
existing shortcut buttons. |
void |
removeURLChooserListener(oracle.ide.net.URLChooserListener ucl)
Remove a URLChooserListener from this URLChooser |
void |
setDialogRunnerCallback(DialogRunnerCallback callBack)
|
void |
setExtraURLs(java.net.URL[] extraURLs)
Registers a URL array that corresponds to resources that
exist only in memory and non in the file system (for example, unsaved
files). |
void |
setFileNameURL(java.lang.String text)
|
void |
setRoots(java.net.URL[] roots)
Sets the root URL s that will be traversed by the
URLChooser . |
void |
setSelectedURL(java.net.URL selection)
Sets the selected directory such that the specified URL
is shown in the file list. |
void |
setSelectionMode(int selectionMode)
Sets the selection mode for the URLChooser . |
void |
setSelectionScope(int selectionScope)
Valid values are FILES_ONLY and DIRECTORIES_ONLY . |
void |
setShowJarsAsDirs(boolean showJarsAsDirs)
Sets whether the URLChooser should allow browsing into
archives. |
void |
setURLFilter(URLFilter filter)
Sets the active URLFilter . |
int |
showOpenDialog(java.awt.Component parent)
|
int |
showOpenDialog(java.awt.Component parent,
java.lang.String title)
|
int |
showOpenDialog(java.awt.Component parent,
Traversable content,
java.lang.String title)
|
int |
showSaveDialog(java.awt.Component parent)
|
int |
showSaveDialog(java.awt.Component parent,
java.lang.String title)
|
int |
showSaveDialog(java.awt.Component parent,
Traversable content,
java.lang.String title)
|
Methods inherited from class oracle.ide.panels.DefaultTraversablePanel |
gbc, gbc, getComponent, getDefaultTitle, getExitTransition, getHelpID, getText, onEntry, onExit, setDefaultTitle, setHelpID |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, 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, 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, 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 |
Field Detail |
public static final int CANCEL_OPTION
showOpenDialog(...)
and
showSaveDialog(...)
methods if cancel is chosen.
public static final int APPROVE_OPTION
showOpenDialog(...)
and
showSaveDialog(...)
methods if open/save is chosen.
public static final int ERROR_OPTION
showOpenDialog(...)
and
showSaveDialog(...)
methods if an I/O error occurred.
public static final int MULTIPLE_INTERVAL_SELECTION
setSelectionMode(int)
meaning that one or
more continuous ranges of files can be selected at a time.
public static final int SINGLE_INTERVAL_SELECTION
setSelectionMode(int)
meaning that one
continuous range of files can be selected at a time.
public static final int SINGLE_SELECTION
setSelectionMode(int)
meaning that one
file can be selected at a time.
public static final int FILES_ONLY
public static final int DIRECTORIES_ONLY
public static final int DIRECTORIES_OR_FILES
protected static final java.lang.String HELP_TOPIC_SELECT_FILES
protected static final java.lang.String HELP_TOPIC_SELECT_DIRECTORIES
protected static final java.lang.String HELP_TOPIC_SELECT_FILES_OR_DIRECTORIES
Constructor Detail |
public URLChooser()
URLChooser
with all file system
roots as reported by URLFileSystem.listRoots()
. No
default (directory or file) is set.
public URLChooser(java.net.URL defaultSelection)
URLChooser
with all file system
roots as reported by URLFileSystem.listRoots()
. The
specified URL
is used as the default selection; if
null
, there will be no default selection.
public URLChooser(java.net.URL[] roots, java.net.URL defaultSelection)
URLFilter
to display the specified
array of URL
s as its "root" file systems and the
specified URL
as the default selection. The "root"
file systems only need to be directories and don't necessarily
have to be actual file system roots.
public URLChooser(java.net.URL defaultSelection, boolean showJarsAsDirs)
URLChooser(URL)
and setShowJarsAsDirs(boolean)
.
public URLChooser(java.net.URL[] roots, java.net.URL defaultSelection, boolean showJarsAsDirs)
URLChooser(URL[],URL)
and setShowJarsAsDirs(boolean)
.
Method Detail |
public void setExtraURLs(java.net.URL[] extraURLs)
URL
array that corresponds to resources that
exist only in memory and non in the file system (for example, unsaved
files). While it is allowable to register a URL
for a
resource that physically does exist, it is not recommended for
performance reasons.
Non-existent extra resources registered in this manner will appear in
the URLChooser
file list in italic font. This allows
the user to distinguish between actual file system resources and
in-memory only resources.
Extra resources should be registered each time the
URLChooser
becomes displayed, and they should be cleared
each time it becomes undisplayed. Displayability changes to the
URLChooser
can be detected by adding a HierarchyListener
to it with Component.addHierarchyListener(java.awt.event.HierarchyListener)
.
extraURLs
- the URL
array specifying all in-memory only
resources, or null
to clear the previously registered
URL
s.HierarchyEvent.SHOWING_CHANGED
public java.net.URL[] getExtraURLs()
URL
s that have been
registered as "extra" URL
s; returns null
if
no URL
s have previously been registed via setExtraURLs(URL[])
.
public void setDialogRunnerCallback(DialogRunnerCallback callBack)
public DialogRunnerCallback getDialogRunnerCallback()
public void setShowJarsAsDirs(boolean showJarsAsDirs)
URLChooser
should allow browsing into
archives.
public boolean getShowJarsAsDirs()
URLChooser
allows browsing into
archives.
public boolean accept(java.net.URL url)
true
if the specified URL
should be
displayed in the URLChooser
. Returns
false
otherwise.
public void addChooseableURLFilter(URLFilter filter)
URLFilter
to be one of the filters
that are shown in the "File type" combo box. If the specified
filter is null
or if the specified filter has
already been added, this method does nothing.
public void clearChooseableURLFilters()
URLFilter
s.
public void addShortcutButton(javax.swing.Icon icon, java.lang.String description, java.net.URL url)
URLChooser
. When the user clicks
on the shortcut button, the current location of the
URLChooser
will be changed to be the URL
URL
.
If the specified URL
is null
, this method
does nothing. If no shortcut buttons are added, then the shortcut
panel is not drawn.
public void removeShortcutButtons()
URLChooser
, allowing the URLChooser
instance to be reused in a different context without retaining the
existing shortcut buttons. The shortcut panel will no longer be
visible after calling this method.
public boolean approveSelection()
true
if the URLChooser
is ready
to be dismissed; false
if the user's current
selection only indicates that a custom wildcard filter or
directory change should occur instead.public void cancelSelection()
URLChooser
is being
canceled.
public void changeToParentDirectory()
public java.net.URL getSelectedURL()
URL
of the node (which may be a directory or
a file) that is currently selected in the URLChooser
.
public java.lang.String getFileNameURL()
public void setFileNameURL(java.lang.String text)
public java.net.URL[] getSelectedURLs()
URL
s representing the current
selections in the URLChooser
. This array will
contain only one element if there is only one selection or
if the user typed the name of the file into the text field.
public void setSelectionMode(int selectionMode)
URLChooser
. By
default, the URLChooser
allows multiple interval
selection.
selectionMode
- The specified mode must be one of
MULTIPLE_INTERVAL_SELECTION
,
SINGLE_INTERVAL_SELECTION
, or SINGLE_SELECTION
.
java.lang.IllegalArgumentException
- if the specified
selection mode is not one of the legal vales.public void setRoots(java.net.URL[] roots)
URL
s that will be traversed by the
URLChooser
. The roots can be any URL
that represents a directory. Even directories within jar
files are allowed.
public void setSelectedURL(java.net.URL selection)
URL
is shown in the file list. If the URL
itself is a
directory, then that directory is selected.
public void setSelectionScope(int selectionScope)
FILES_ONLY
and DIRECTORIES_ONLY
.
Note: This method must be called from the AWT event
thread.
public void setURLFilter(URLFilter filter)
URLFilter
. If the filter isn't on
the list of filters used by the URLChooser
it is
first added. If the specified URLFilter
is
null
, the default "all files" filter is set as the
current filter.
public int showOpenDialog(java.awt.Component parent)
APPROVE_OPTION
, CANCEL_OPTION
, or
ERROR_OPTION
.public int showOpenDialog(java.awt.Component parent, java.lang.String title)
APPROVE_OPTION
, CANCEL_OPTION
, or
ERROR_OPTION
.public int showOpenDialog(java.awt.Component parent, Traversable content, java.lang.String title)
APPROVE_OPTION
, CANCEL_OPTION
, or
ERROR_OPTION
.public int showSaveDialog(java.awt.Component parent)
APPROVE_OPTION
, CANCEL_OPTION
, or
ERROR_OPTION
.public int showSaveDialog(java.awt.Component parent, java.lang.String title)
APPROVE_OPTION
, CANCEL_OPTION
, or
ERROR_OPTION
.public int showSaveDialog(java.awt.Component parent, Traversable content, java.lang.String title)
APPROVE_OPTION
, CANCEL_OPTION
, or
ERROR_OPTION
.protected java.net.URL canonicalizeApprovalURL(java.net.URL url)
approveSelection()
to
canonicalize the URL
to be approved.
The default implementation calls URLFileSystem.canonicalize(URL)
. Subclasses may override to
provide differing behavior.
protected java.net.URL getApprovalFileListURL()
approveSelection()
and
getSelectedURL()
to get the URL
of the selected
node in the file list.
The default implementation gets the URL
of the selected
node in the file list. Subclasses may wish to override to
return null
in order to ignore the file list
selection.
protected boolean checkApprovalParentExists(java.net.URL url)
approveSelection()
to check that
the parent directory for the approval URL
exists.
The default implementation gets the parent of the specified URL
via URLFileSystem.getParent(URL)
and tests for that
directory's existence with URLFileSystem.exists(URL)
.
Subclasses may override to provide differing behavior (for example,
to always return true
if the parent directory need not
exist).
public void addURLChooserListener(oracle.ide.net.URLChooserListener ucl)
URLChooserListener
to this URLChooser
public void removeURLChooserListener(oracle.ide.net.URLChooserListener ucl)
URLChooserListener
from this URLChooser
public void addNotify()
public void removeNotify()
public final URLFilter getSelectedFilter()
URLFilter
that is currently selected in the
file type combo box. The value returned by this method should
always be non-null
.
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.