Class JFileChooser
java.lang.Object
vaadinx.awt.Component
vaadinx.awt.Container
vaadinx.swing.JComponent
vaadinx.swing.JFileChooser
- All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Emulator for
JFileChooser. Emulator-only host (no
surrogate): showOpenDialog composes an internal modal JDialog
hosting a Vaadin Upload, parks the calling virtual thread via the
JDialog modal machinery, and returns APPROVE_OPTION /
CANCEL_OPTION once the user uploads + confirms (or cancels).
showSaveDialog picks a name, hands back a per-session temp target via
getSelectedFile(), and opens the synthetic download affordance.
Selection getters return java.io.Files pointing at per-session temp
files. Transfer mechanics are shared with FileDialog via
BrowserFileTransfer.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final Stringstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final Stringstatic final Stringstatic final intstatic final Stringstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final intstatic final Stringstatic final intstatic final intstatic final Stringstatic final StringFields inherited from class JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, FILL_CHROME, FILL_DEFAULT, LEFT_ALIGNMENT, listenerList, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionJFileChooser(File currentDirectory) JFileChooser(String currentDirectoryPath) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChoosableFileFilter(FileFilter filter) intbooleanintintFile[]booleanbooleanbooleanbooleanbooleanbooleanvoidvoidsetAcceptAllFileFilterUsed(boolean b) voidsetAccessory(JComponent newAccessory) voidsetApproveButtonMnemonic(char mnemonic) voidsetApproveButtonMnemonic(int mnemonic) voidsetApproveButtonText(String approveButtonText) voidsetApproveButtonToolTipText(String toolTipText) voidsetControlButtonsAreShown(boolean b) voidsetCurrentDirectory(File dir) voidsetDialogTitle(String dialogTitle) voidsetDialogType(int dialogType) voidsetFileFilter(FileFilter filter) voidsetFileHidingEnabled(boolean b) voidsetFileSelectionMode(int mode) voidsetFileView(FileView fileView) voidsetMultiSelectionEnabled(boolean b) voidsetSelectedFile(File file) voidsetSelectedFiles(File[] selectedFiles) intshowDialog(Component parent, String approveButtonText) Deprecated.intshowOpenDialog(Component parent) intshowSaveDialog(Component parent) Methods inherited from class JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, 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, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, 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, updateUIMethods inherited from class Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, addSlotChild, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, fireHierarchyEvent, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, peerContentElement, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeSlotChild, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, applyBackgroundToPeer, applyVisibleToPeer, awtListeners, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, defaultFillCssClass, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, fireComponentEvent, 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, isThemeDefault, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, peerIs, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, 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, setMixingCutoutShape, setName, setSize, setSize, show, show, size, suppressMouseBridge, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, withPeer, withPeerOnLiveUI
-
Field Details
-
CANCEL_OPTION
public static final int CANCEL_OPTION- See Also:
-
APPROVE_OPTION
public static final int APPROVE_OPTION- See Also:
-
ERROR_OPTION
public static final int ERROR_OPTION- See Also:
-
OPEN_DIALOG
public static final int OPEN_DIALOG- See Also:
-
SAVE_DIALOG
public static final int SAVE_DIALOG- See Also:
-
CUSTOM_DIALOG
public static final int CUSTOM_DIALOG- See Also:
-
FILES_ONLY
public static final int FILES_ONLY- See Also:
-
DIRECTORIES_ONLY
public static final int DIRECTORIES_ONLY- See Also:
-
FILES_AND_DIRECTORIES
public static final int FILES_AND_DIRECTORIES- See Also:
-
CANCEL_SELECTION
- See Also:
-
APPROVE_SELECTION
- See Also:
-
SELECTED_FILE_CHANGED_PROPERTY
- See Also:
-
SELECTED_FILES_CHANGED_PROPERTY
- See Also:
-
DIRECTORY_CHANGED_PROPERTY
- See Also:
-
MULTI_SELECTION_ENABLED_CHANGED_PROPERTY
- See Also:
-
FILE_SYSTEM_VIEW_CHANGED_PROPERTY
- See Also:
-
FILE_VIEW_CHANGED_PROPERTY
- See Also:
-
FILE_HIDING_CHANGED_PROPERTY
- See Also:
-
FILE_FILTER_CHANGED_PROPERTY
- See Also:
-
FILE_SELECTION_MODE_CHANGED_PROPERTY
- See Also:
-
ACCESSORY_CHANGED_PROPERTY
- See Also:
-
ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY
- See Also:
-
DIALOG_TITLE_CHANGED_PROPERTY
- See Also:
-
DIALOG_TYPE_CHANGED_PROPERTY
- See Also:
-
APPROVE_BUTTON_TEXT_CHANGED_PROPERTY
- See Also:
-
APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY
- See Also:
-
APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY
- See Also:
-
CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY
- See Also:
-
CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY
- See Also:
-
-
Constructor Details
-
JFileChooser
public JFileChooser() -
JFileChooser
-
JFileChooser
-
-
Method Details
-
showOpenDialog
-
showSaveDialog
-
showDialog
Deprecated.triage the call site toshowOpenDialog(Component)(the app reads the file) orshowSaveDialog(Component)(the app writes it). To keep a custom label, callsetDialogType(int)with the matching type and only thensetApproveButtonText(String): changing the type resets the label, as in the JDK. The deprecation is deliberate divergence from the JDK, and is what makes an untriaged call site visible at compile time rather than only when someone walks that path.Unsupported in the browser, always throws — the sole throw on this class (R_match_swing_errors throw-trigger case (4), D_showdialog_throws).CUSTOM_DIALOGdeclares no LOAD/SAVE direction, and the two are different browser mechanisms that must be committed before the dialog opens, so no default is defensible: mapping it to LOAD silently produces an unreachable file whenever the app was naming an output. Nothing is mutated before the throw — the call is a no-op plus an exception.setDialogType(CUSTOM_DIALOG)itself stays faithful and round-trips; only the show is refused.- Throws:
IllegalStateException- always, carrying the triage rule.
-
getSelectedFile
-
setSelectedFile
-
getSelectedFiles
-
setSelectedFiles
-
isMultiSelectionEnabled
public boolean isMultiSelectionEnabled() -
setMultiSelectionEnabled
public void setMultiSelectionEnabled(boolean b) -
getCurrentDirectory
-
setCurrentDirectory
-
getFileSelectionMode
public int getFileSelectionMode() -
setFileSelectionMode
public void setFileSelectionMode(int mode) -
isFileSelectionEnabled
public boolean isFileSelectionEnabled() -
isDirectorySelectionEnabled
public boolean isDirectorySelectionEnabled() -
getDialogTitle
-
setDialogTitle
-
getDialogType
public int getDialogType() -
setDialogType
public void setDialogType(int dialogType) -
getFileFilter
-
setFileFilter
-
addChoosableFileFilter
-
removeChoosableFileFilter
-
resetChoosableFileFilters
public void resetChoosableFileFilters() -
getChoosableFileFilters
-
isAcceptAllFileFilterUsed
public boolean isAcceptAllFileFilterUsed() -
setAcceptAllFileFilterUsed
public void setAcceptAllFileFilterUsed(boolean b) -
isFileHidingEnabled
public boolean isFileHidingEnabled() -
setFileHidingEnabled
public void setFileHidingEnabled(boolean b) -
getAccessory
-
setAccessory
- Parameters:
newAccessory- the accessory component. Typedvaadinx.swing, notjavax.swing: the JDK declares this signature, so per R_no_vaadin_in_api limb 1 it must speak the emulator's types. It took the JDK type until D_reverse_fanout_rows, which made the method impossible to call from import-swapped code at all — a migrator'sJPanelis avaadinx.swing.JPanel.
-
getFileView
-
setFileView
-
getControlButtonsAreShown
public boolean getControlButtonsAreShown() -
setControlButtonsAreShown
public void setControlButtonsAreShown(boolean b) -
getApproveButtonText
-
setApproveButtonText
-
getApproveButtonToolTipText
-
setApproveButtonToolTipText
-
getApproveButtonMnemonic
public int getApproveButtonMnemonic() -
setApproveButtonMnemonic
public void setApproveButtonMnemonic(int mnemonic) -
setApproveButtonMnemonic
public void setApproveButtonMnemonic(char mnemonic) -
getAccessibleContext
- Specified by:
getAccessibleContextin interfaceAccessible- Overrides:
getAccessibleContextin classComponent
-
showOpenDialog(Component)(the app reads the file) orshowSaveDialog(Component)(the app writes it).