public class ConverterFileChooser extends JFileChooser
setCapabilitiesFilter(Capabilities)
,
Serialized FormJFileChooser.AccessibleJFileChooser
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static int |
LOADER_DIALOG
the loader dialog
|
protected Capabilities |
m_CapabilitiesFilter
the Capabilities filter for the savers
|
protected JButton |
m_ConfigureButton
the configure button
|
protected boolean |
m_CoreConvertersOnly
whether to display only core converters (hardcoded in ConverterUtils).
|
protected Object |
m_CurrentConverter
the converter that was chosen by the user
|
protected int |
m_DialogType
the type of dialog to display
|
protected boolean |
m_FileMustExist
whether the file to be opened must exist (only open dialog)
|
protected FileFilter |
m_LastFilter
the last filter that was used for opening/saving
|
protected PropertyChangeListener |
m_Listener
the propertychangelistener
|
protected static Vector<ExtensionFileFilter> |
m_LoaderFileFilters
the file filters for the loaders
|
protected boolean |
m_OverwriteWarning
whether to popup a dialog in case the file already exists (only save
dialog)
|
protected static Vector<ExtensionFileFilter> |
m_SaverFileFilters
the file filters for the savers
|
protected ConverterFileChooser |
m_Self
the file chooser itself
|
static int |
SAVER_DIALOG
the saver dialog
|
static int |
UNHANDLED_DIALOG
unhandled type of dialog
|
ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY, accessibleContext, ACCESSORY_CHANGED_PROPERTY, APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY, APPROVE_BUTTON_TEXT_CHANGED_PROPERTY, APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY, APPROVE_OPTION, APPROVE_SELECTION, CANCEL_OPTION, CANCEL_SELECTION, CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY, CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY, CUSTOM_DIALOG, DIALOG_TITLE_CHANGED_PROPERTY, DIALOG_TYPE_CHANGED_PROPERTY, DIRECTORIES_ONLY, DIRECTORY_CHANGED_PROPERTY, ERROR_OPTION, FILE_FILTER_CHANGED_PROPERTY, FILE_HIDING_CHANGED_PROPERTY, FILE_SELECTION_MODE_CHANGED_PROPERTY, FILE_SYSTEM_VIEW_CHANGED_PROPERTY, FILE_VIEW_CHANGED_PROPERTY, FILES_AND_DIRECTORIES, FILES_ONLY, MULTI_SELECTION_ENABLED_CHANGED_PROPERTY, OPEN_DIALOG, SAVE_DIALOG, SELECTED_FILE_CHANGED_PROPERTY, SELECTED_FILES_CHANGED_PROPERTY
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
ConverterFileChooser()
onstructs a FileChooser pointing to the user's default directory.
|
ConverterFileChooser(File currentDirectory)
Constructs a FileChooser using the given File as the path.
|
ConverterFileChooser(String currentDirectory)
Constructs a FileChooser using the given path.
|
Modifier and Type | Method and Description |
---|---|
protected void |
configureCurrentConverter(int dialogType)
configures the current converter
|
protected Vector<ExtensionFileFilter> |
filterNonCoreLoaderFileFilters(Vector<ExtensionFileFilter> list)
filters out all non-core loaders if only those should be displayed
|
protected Vector<ExtensionFileFilter> |
filterNonCoreSaverFileFilters(Vector<ExtensionFileFilter> list)
filters out all non-core savers if only those should be displayed
|
protected Vector<ExtensionFileFilter> |
filterSaverFileFilters(Vector<ExtensionFileFilter> list)
filters the list of file filters according to the currently set
Capabilities
|
Capabilities |
getCapabilitiesFilter()
returns the capabilities filter for the savers, can be null if all are
listed.
|
boolean |
getCoreConvertersOnly()
Returns whether only the hardcoded core converters are displayed.
|
boolean |
getFileMustExist()
Returns whether the selected file must exist (only open dialog).
|
AbstractFileLoader |
getLoader()
returns the loader that was chosen by the user, can be null in case the
user aborted the dialog or the save dialog was shown
|
boolean |
getOverwriteWarning()
Returns whether a popup appears with a warning that the file already
exists (only save dialog).
|
AbstractFileSaver |
getSaver()
returns the saver that was chosen by the user, can be null in case the
user aborted the dialog or the open dialog was shown
|
protected static void |
initFilters(boolean loader,
Vector<String> classnames)
initializes the ExtensionFileFilters
|
protected void |
initGUI(int dialogType)
initializes the GUI
|
static void |
main(String[] args)
For testing the file chooser
|
void |
setCapabilitiesFilter(Capabilities value)
sets the capabilities that the savers must have.
|
void |
setCoreConvertersOnly(boolean value)
Whether to display only the hardocded core converters.
|
void |
setFileMustExist(boolean value)
Whether the selected file must exst (only open dialog).
|
void |
setOverwriteWarning(boolean value)
Whether a warning is popped up if the file that is to be saved already
exists (only save dialog).
|
int |
showDialog(Component parent,
String approveButtonText)
Pops a custom file chooser dialog with a custom approve button.
|
int |
showOpenDialog(Component parent)
Pops up an "Open File" file chooser dialog.
|
int |
showSaveDialog(Component parent)
Pops up an "Save File" file chooser dialog.
|
protected void |
updateCurrentConverter()
sets the current converter according to the current filefilter
|
accept, addActionListener, addChoosableFileFilter, approveSelection, cancelSelection, changeToParentDirectory, createDialog, ensureFileIsVisible, fireActionPerformed, getAcceptAllFileFilter, getAccessibleContext, getAccessory, getActionListeners, getApproveButtonMnemonic, getApproveButtonText, getApproveButtonToolTipText, getChoosableFileFilters, getControlButtonsAreShown, getCurrentDirectory, getDescription, getDialogTitle, getDialogType, getDragEnabled, getFileFilter, getFileSelectionMode, getFileSystemView, getFileView, getIcon, getName, getSelectedFile, getSelectedFiles, getTypeDescription, getUI, getUIClassID, isAcceptAllFileFilterUsed, isDirectorySelectionEnabled, isFileHidingEnabled, isFileSelectionEnabled, isMultiSelectionEnabled, isTraversable, paramString, removeActionListener, removeChoosableFileFilter, rescanCurrentDirectory, resetChoosableFileFilters, setAcceptAllFileFilterUsed, setAccessory, setApproveButtonMnemonic, setApproveButtonMnemonic, setApproveButtonText, setApproveButtonToolTipText, setControlButtonsAreShown, setCurrentDirectory, setDialogTitle, setDialogType, setDragEnabled, setFileFilter, setFileHidingEnabled, setFileSelectionMode, setFileSystemView, setFileView, setMultiSelectionEnabled, setSelectedFile, setSelectedFiles, setup, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int UNHANDLED_DIALOG
public static final int LOADER_DIALOG
public static final int SAVER_DIALOG
protected ConverterFileChooser m_Self
protected static Vector<ExtensionFileFilter> m_LoaderFileFilters
protected static Vector<ExtensionFileFilter> m_SaverFileFilters
protected int m_DialogType
protected Object m_CurrentConverter
protected JButton m_ConfigureButton
protected PropertyChangeListener m_Listener
protected FileFilter m_LastFilter
protected Capabilities m_CapabilitiesFilter
protected boolean m_OverwriteWarning
protected boolean m_FileMustExist
protected boolean m_CoreConvertersOnly
public ConverterFileChooser()
public ConverterFileChooser(File currentDirectory)
currentDirectory
- the path to start inpublic ConverterFileChooser(String currentDirectory)
currentDirectory
- the path to start inprotected Vector<ExtensionFileFilter> filterNonCoreLoaderFileFilters(Vector<ExtensionFileFilter> list)
list
- the list of filters to checkm_CoreConvertersOnly
protected Vector<ExtensionFileFilter> filterNonCoreSaverFileFilters(Vector<ExtensionFileFilter> list)
list
- the list of filters to checkm_CoreConvertersOnly
protected Vector<ExtensionFileFilter> filterSaverFileFilters(Vector<ExtensionFileFilter> list)
list
- the filters to checkprotected static void initFilters(boolean loader, Vector<String> classnames)
loader
- if true then the loader filter are initializedclassnames
- the classnames of the convertersprotected void initGUI(int dialogType)
dialogType
- the type of dialog to setup the GUI forpublic void setCapabilitiesFilter(Capabilities value)
value
- the minimum Capabilities the savers must havepublic Capabilities getCapabilitiesFilter()
public void setOverwriteWarning(boolean value)
value
- if true a warning will be popuppublic boolean getOverwriteWarning()
public void setFileMustExist(boolean value)
value
- if true the file must existpublic boolean getFileMustExist()
public void setCoreConvertersOnly(boolean value)
value
- if true only the core converters will be displayedm_CoreConvertersOnly
public boolean getCoreConvertersOnly()
m_CoreConvertersOnly
public int showDialog(Component parent, String approveButtonText)
showDialog
in class JFileChooser
parent
- the parent of this dialogapproveButtonText
- the text for the OK buttonpublic int showOpenDialog(Component parent)
showOpenDialog
in class JFileChooser
parent
- the parent of this file chooserpublic int showSaveDialog(Component parent)
showSaveDialog
in class JFileChooser
parent
- the parent of this file chooserpublic AbstractFileLoader getLoader()
public AbstractFileSaver getSaver()
protected void updateCurrentConverter()
protected void configureCurrentConverter(int dialogType)
dialogType
- the type of dialog to configure forCopyright © 2015 University of Waikato, Hamilton, NZ. All rights reserved.