public class EdalFileChooser extends EdalTitleDialog
EDALFileChooser provides a simple mechanism for the user to
choose a file from EDAL File System.
The following code pops up a file chooser for the user that sees only .jpg
and .gif images:
EDALFileChooser chooser = new EDALFileChooser((Frame) window, rootDirectory);
EdalFileNameExtensionFilter filter = new EdalFileNameExtensionFilter("JPG & GIF Images", "jpg", "gif");
chooser.setFileFilter(filter);
int returnVal = chooser.showOpenDialog();
if (returnVal == EDALFileChooser.APPROVE_OPTION) {
System.out.println("You chose to open this file: " + chooser.getSelectedFile().getName());
}
attribute: isContainer false description: A component which allows for the
interactive selection of a file.JDialog.AccessibleJDialogDialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityTypeWindow.AccessibleAWTWindow, Window.TypeContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
static int |
APPROVE_OPTION
Return value if approve (yes, ok) is chosen.
|
static int |
CANCEL_OPTION
Return value if cancel is chosen.
|
protected ClientPrimaryDataDirectory |
currentdir |
static int |
DIRECTORIES_ONLY
Instruction to display only directories.
|
static int |
ERROR_OPTION
Return value if an error occured.
|
static int |
FILES_AND_DIRECTORIES
Instruction to display both files and directories.
|
static int |
FILES_ONLY
Instruction to display only files.
|
protected JButton |
okbutton |
protected JTextField |
pathtext |
protected ClientPrimaryDataEntity |
selectedFile |
accessibleContext, rootPane, rootPaneCheckingEnabledDEFAULT_MODALITY_TYPEBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTDISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSEABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
EdalFileChooser(Dialog owner,
ClientDataManager client)
Constructs a
EDALFileChooser that is initialized with
owner as the swing container owner(JDialog),
rootDirectory as the root directory, and client
as the rmi client datamanager. |
EdalFileChooser(Frame owner,
ClientDataManager client)
Constructs a
EDALFileChooser that is initialized with
owner as the swing container owner(JFrame),
rootDirectory as the root directory, and client
as the rmi client datamanager. |
| Modifier and Type | Method and Description |
|---|---|
EdalAbstractFileFilter |
getFileFilter()
Returns the currently selected file filter.
|
int |
getFileSelectionMode()
Returns the current file-selection mode.
|
ClientPrimaryDataEntity |
getSelectedFile()
Returns the selected file.
|
ClientPrimaryDataEntity[] |
getSelectedFiles()
Returns a list of selected files if the file chooser is set to allow
multiple selection.
|
protected void |
init(ClientPrimaryDataDirectory rootDirectory) |
protected void |
initViewers() |
void |
setFileFilter(EdalAbstractFileFilter filter)
Sets the current file filter.
|
void |
setFileSelectionMode(int mode)
Sets the
EDALFileChooser to allow the user to just select
files, just select directories, or select both files and directories. |
void |
setMultiSelectionEnabled(boolean b)
Sets the file chooser to allow multiple file selections.
|
void |
showConnectionButton(boolean showconnbutton)
show the "changeconnection" or not.
|
int |
showOpenDialog()
Pops up an "Open File" file chooser dialog.
|
int |
showSaveDialog()
Pops up a "Save File" file chooser dialog.
|
getContentPane, getTitleComponent, setContentPane, setIconImage, setResizable, setTitle, setUndecoratedaddImpl, createRootPane, dialogInit, getAccessibleContext, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, updateaddNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setShape, setVisible, show, toBackaddPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFrontadd, 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, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTreeaction, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, 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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleprotected final JTextField pathtext
protected ClientPrimaryDataEntity selectedFile
protected ClientPrimaryDataDirectory currentdir
protected JButton okbutton
public static final int CANCEL_OPTION
public static final int APPROVE_OPTION
public static final int ERROR_OPTION
public static final int FILES_ONLY
public static final int DIRECTORIES_ONLY
public static final int FILES_AND_DIRECTORIES
public EdalFileChooser(Dialog owner, ClientDataManager client)
EDALFileChooser that is initialized with
owner as the swing container owner(JDialog),
rootDirectory as the root directory, and client
as the rmi client datamanager. If any of the parameters are
null this method will not initialize.owner - the swing container ownerclient - the rmi client datamanagerpublic EdalFileChooser(Frame owner, ClientDataManager client)
EDALFileChooser that is initialized with
owner as the swing container owner(JFrame),
rootDirectory as the root directory, and client
as the rmi client datamanager. If any of the parameters are
null this method will not initialize.owner - the swing container ownerclient - the rmi client datamanagerpublic EdalAbstractFileFilter getFileFilter()
setFileFilter(de.ipk_gatersleben.bit.bi.edal.rmi.client.util.EdalAbstractFileFilter)public int getFileSelectionMode()
EDALFileChooser.FILES_ONLY.setFileSelectionMode(int)public ClientPrimaryDataEntity getSelectedFile()
public ClientPrimaryDataEntity[] getSelectedFiles()
protected void init(ClientPrimaryDataDirectory rootDirectory)
protected void initViewers()
public void setFileFilter(EdalAbstractFileFilter filter)
filter - the new current file filter to usegetFileFilter()public void setFileSelectionMode(int mode)
EDALFileChooser to allow the user to just select
files, just select directories, or select both files and directories. The
default is EDALFileChooser.FILES_ONLY.mode - the type of files to be displayed:
IllegalArgumentException - if mode is an illegal file selection mode
Beaninfo preferred: true bound: true description: Sets the
types of files that the JFileChooser can choose. enum:
FILES_ONLY EDALFileChooser.FILES_ONLY DIRECTORIES_ONLY
EDALFileChooser.DIRECTORIES_ONLY
EDALFileChooser.FILES_AND_DIRECTORIESgetFileSelectionMode()public void setMultiSelectionEnabled(boolean b)
b - true if multiple files may be selected Beaninfo bound: true
description: Sets multiple file selection mode.public int showOpenDialog()
public int showSaveDialog()
public void showConnectionButton(boolean showconnbutton)
showconnbutton - false if you want to hidden the buttonCopyright © 2016 Leibniz Institute of Plant Genetics and Crop Plant Research (IPK). All rights reserved.