|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
ti.chimera.FileChooser
Like JFileChooser
, but displays itself within the provided
Dialog
, rather than a JDialog
. This is done
because we abstract windows away, so that they can either be, for example
JInternalFrame
or JDialog
. (Having an
interface that JInternalFrame
, JWindow
,
JDialog
, etc., all implement would have been a pretty smart
way of doing things, but I guess I'm expecting too much.)
It works something like this:
FileChooser chooser = new FileChooser( main.getWindowManager().getDialog("Open File") ); chooser.setFileFilter( ... ); if( chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION ) { AbstractFile file = chooser.getSelectedFile(); ... }
Nested Class Summary | |
static class |
FileChooser.AbstractFileFilter
The file-filter interface. |
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 FileChooser.AbstractFileFilter |
ALL_FILES_FILTER
|
static int |
APPROVE_OPTION
Return value if approve (yes, ok) is chosen. |
static int |
CANCEL_OPTION
Return value if cancel is chosen. |
static int |
ERROR_OPTION
Return value if an error occured. |
static int |
OPEN_DIALOG
The dialog is to be an "Open File" type dialog. |
static int |
SAVE_DIALOG
The dialog is to be a "Save File" type dialog. |
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 java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
FileChooser(Dialog dialog)
Class Constructor. |
|
FileChooser(Dialog dialog,
oscript.fs.AbstractFile file)
Class Constructor. |
Method Summary | |
void |
addChoosableFileFilter(FileChooser.AbstractFileFilter filter)
Add a file filter to the list of choosable file filters. |
void |
addNotify()
|
java.lang.String |
getApproveButtonText()
Get the approve button text. |
java.lang.String |
getDialogTitle()
Get the title of this dialog. |
FileChooser.AbstractFileFilter |
getFileFilter()
Get the current file filter. |
java.awt.Dimension |
getMaximumSize()
|
java.awt.Dimension |
getMinimumSize()
|
java.awt.Dimension |
getPreferredSize()
|
oscript.fs.AbstractFile |
getSelectedFile()
Get the selected file. |
oscript.fs.AbstractFile[] |
getSelectedFiles()
Get the set of selected files. |
boolean |
removeChoosableFileFilter(FileChooser.AbstractFileFilter filter)
Remove a file filter from the list of choosable file filters. |
void |
removeNotify()
|
void |
setDialogType(int dialogType)
Set the dialog type, ie. |
void |
setFileFilter(FileChooser.AbstractFileFilter filter)
Set the file filter. |
void |
setSelectedFile(oscript.fs.AbstractFile file)
Set the file selected by this file chooser. |
void |
setSelectedFiles(oscript.fs.AbstractFile[] files)
Set the files select by this file chooser. |
int |
showDialog(java.awt.Component parent,
java.lang.String approveButtonText)
Show the dialog. |
int |
showOpenDialog(java.awt.Component parent)
Show an "Open" file chooser dialog. |
int |
showSaveDialog(java.awt.Component parent)
Show a "Save" file chooser dialog. |
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, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, updateUI |
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
public static final int APPROVE_OPTION
public static final int ERROR_OPTION
public static final int OPEN_DIALOG
public static final int SAVE_DIALOG
public static final FileChooser.AbstractFileFilter ALL_FILES_FILTER
Constructor Detail |
public FileChooser(Dialog dialog)
dialog
- the dialog to contain the FileChooserpublic FileChooser(Dialog dialog, oscript.fs.AbstractFile file)
dialog
- the dialog to contain the FileChooserfile
- the currently selected fileMethod Detail |
public void addNotify()
public void removeNotify()
public java.lang.String getDialogTitle()
public java.lang.String getApproveButtonText()
public void setSelectedFile(oscript.fs.AbstractFile file)
file
- the file to selectpublic void setSelectedFiles(oscript.fs.AbstractFile[] files)
files
- the files to selectpublic oscript.fs.AbstractFile getSelectedFile()
null
if nonepublic oscript.fs.AbstractFile[] getSelectedFiles()
public void setFileFilter(FileChooser.AbstractFileFilter filter)
public FileChooser.AbstractFileFilter getFileFilter()
public void addChoosableFileFilter(FileChooser.AbstractFileFilter filter)
public boolean removeChoosableFileFilter(FileChooser.AbstractFileFilter filter)
public int showSaveDialog(java.awt.Component parent)
parent
- the parent of this dialog, can be null
CANCEL_OPTION
, APPROVE_OPTION
, or
ERROR_OPTION
(if an arror occurs or dialog is dismissed)public int showOpenDialog(java.awt.Component parent)
parent
- the parent of this dialog, can be null
CANCEL_OPTION
, APPROVE_OPTION
, or
ERROR_OPTION
(if an arror occurs or dialog is dismissed)public int showDialog(java.awt.Component parent, java.lang.String approveButtonText)
parent
- the parent component of the dialogapproveButtonText
- text to show on the approve button. By
default, ie. if null
, the approve button text is
determined by the dialog type
public void setDialogType(int dialogType)
OPEN_DIALOG
or SAVE_DIALOG
public java.awt.Dimension getPreferredSize()
public java.awt.Dimension getMinimumSize()
public java.awt.Dimension getMaximumSize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |