public class NewFilePanel
extends javax.swing.JPanel
implements java.beans.VetoableChangeListener
NewFilePanel class provides UI for specifying
 the location of a new file. Two fields are provided - one
 for the directory in which to create the new file, and one
 for the name of the file. The correct extension for the file
 will be ensured. A browse button is placed next to the directory
 field so that the user can select the directory using a chooser
 dialog. javax.swing.JPanel.AccessibleJPaneljavax.swing.JComponent.AccessibleJComponentlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW| Constructor and Description | 
|---|
| NewFilePanel()Creates a new NewFilePanel instance. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected void | addMoreComponents(java.awt.GridBagConstraints gbc)The method will serve as a hook for subclasses to add more components. | 
| protected oracle.bali.ewt.dialog.DialogHeader | createDialogHeader()Creates the dialog header to use with this new file panel. | 
| javax.swing.JButton | getBrowseButton() | 
| javax.swing.JComponent | getDefaultFocusComponent() | 
| javax.swing.JTextField | getDirectoryField() | 
| javax.swing.JTextField | getFileField() | 
| java.net.URL | getFileURL()Retrieves the URL of the file being specified in this dialog. | 
| java.net.URL | getFileURL(boolean validateURL)Retrieves the URL of the file being specified in this dialog. | 
| int | getLayoutOffset()Returns the layout left justification offset. | 
| int | getLayoutOrientation()Returns the layout orientation. | 
| NewFileValidator | getNewFileURLValidator()Retrieves the current  NewFileValidator. | 
| boolean | isFolderOK() | 
| boolean | isSupportsAutoFill()Indicates whether the directory URL is created dynamically
 from the file name. | 
| boolean | isValidChar(char newCharTyped) | 
| void | requestFocus() | 
| void | resetURLCache()Resets internal URL cache. | 
| java.net.URL | runDialog(java.lang.String title)Creates and displays a dialog containing this  NewFilePanel. | 
| java.net.URL | runDialog(java.lang.String title,
         java.lang.Runnable runnable)Creates and displays a dialog containing this  NewFilePanelwhich will call the supplied Runnable as the last vetoable
 change listener. | 
| void | setAllowsEmptyFileName(boolean allowsEmptyFileName)Determines whether or not the file name can be a zero-length name 
 plus an extension. | 
| void | setBrowseButtonLabel(java.lang.String label) | 
| void | setCanOverwriteOpenNodes(boolean canOverwriteOpenNodes)Specifies whether this  NewFilePanelinstance 
 should allow the overwriting of open nodes. | 
| void | setDefaultDirectoryName(java.net.URL rootFolderURL)Deprecated.   | 
| void | setDirectoryPrompt(java.lang.String prompt)Sets the label for the directory name text field. | 
| void | setDirectoryURL(java.net.URL dir)Sets the URL used for the directory field. | 
| void | setEnabled(boolean enabled)This disables all active children in the panel as well as the panel itself. | 
| void | setEnforceFileExtension(boolean enforce)Sets whether or not to add the file extension no matter what (true), or to
 only add the extension if no extension is provided in the file name. | 
| void | setFileExtension(java.lang.String ext)Sets the extension that should be used for the new file. | 
| void | setFileName(java.lang.String fName)Sets the test to display in the file name field. | 
| void | setFilePrompt(java.lang.String prompt)Set the label for the file name text field. | 
| void | setFileType(java.lang.String type)Specifies a string used to describe the type of file. | 
| void | setInteractiveMode(boolean isInteractive)Specifies whether this  NewFilePanelis in 
 interactive mode. | 
| void | setLayoutOffset(int offset)Sets the padding offset used between labels and fields when orientation is HORIZONTAL
 Useful in compliance to UI guidelines in http://uistandards.us.oracle.com/desktopuiguide/index.html
 to help with left alignment. | 
| void | setLayoutOrientation(int orientation)Sets the layout orientation of this panel. | 
| void | setNewFileURLValidator(NewFileValidator validator)Specifies the  NewFileValidatorthat will be
 used, in addition to the default validation, to make sure
 that the URL for the new File is valid. | 
| void | setShowExtension(boolean show)Determines whether or not the file extension is shown in
 the file name field. | 
| void | setSupportsAutoFill(boolean supportsAutoFill)Specifies whether the directory URL is created dynamically
 from the file name. | 
| static java.net.URL | validateURL(java.awt.Component parent,
           java.net.URL tmpURL,
           java.lang.String type,
           boolean canOverwriteOpenNodes) | 
| void | vetoableChange(java.beans.PropertyChangeEvent evt) | 
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, 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, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, 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, validateTreeaction, 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, transferFocusUpCyclepublic final void setLayoutOrientation(int orientation)
SwingConstants.VERTICAL, which positions the labels above the 
 fields. You can also make the orientation SwingConstants.HORIZONTAL
 which positions the labels to the left of the fields.orientation - the layout orientation of this panel. Must be 
    SwingConstants.HORIZONTAL or SwingConstants.VERTICAL.java.lang.IllegalArgumentException - if orientation is not valid.public final void setLayoutOffset(int offset)
offset - padding used to left justify existing fields with those added by the clientpublic final int getLayoutOffset()
public final int getLayoutOrientation()
SwingConstants.VERTICAL
 by default.SwingConstants.HORIZONTAL or SwingConstants.VERTICAL.protected oracle.bali.ewt.dialog.DialogHeader createDialogHeader()
This implementation returns null
public void setSupportsAutoFill(boolean supportsAutoFill)
NewFilePanel is 
 in interactive mode.supportsAutoFill - true to turn auto-fill
      on, false to turn it offpublic boolean isSupportsAutoFill()
true if auto-fill on, false
      if it's offpublic void setInteractiveMode(boolean isInteractive)
NewFilePanel is in 
 interactive mode. When in interactive mode, errors are 
 reported to the user; when not in interactive mode, errors 
 are suppressed. 
 
 By default, NewFilePanel is in interactive mode.
public void setFileExtension(java.lang.String ext)
public void setEnforceFileExtension(boolean enforce)
enforce - public void setFileType(java.lang.String type)
public void setNewFileURLValidator(NewFileValidator validator)
NewFileValidator that will be
 used, in addition to the default validation, to make sure
 that the URL for the new File is valid. The validator, for
 example, could be used to ensure that a JSP filename is
 valid.validator - the NewFileValidator to use, or null
      to only use the default validation.public NewFileValidator getNewFileURLValidator()
NewFileValidator.NewFileValidator.public void setCanOverwriteOpenNodes(boolean canOverwriteOpenNodes)
NewFilePanel instance 
 should allow the overwriting of open nodes. If it is allowed, 
 the user will be asked if she wants to overwrite the file; 
 if it is not allowed, an error will be reported. 
 
 By default, NewFilePanel can overwrite open nodes.
public java.net.URL runDialog(java.lang.String title)
NewFilePanel.title - the title to use for the dialognull
      if the user canceled the dialog.public java.net.URL runDialog(java.lang.String title,
                              java.lang.Runnable runnable)
NewFilePanel
 which will call the supplied Runnable as the last vetoable
 change listener.title - the title to use for the dialogrunnable - to run when the dialog is ok'ednull
      if the user canceled the dialog.public void resetURLCache()
public java.net.URL getFileURL()
                        throws TraversalException
TraversalException - if an error is encountered in
      determining the URL.public java.net.URL getFileURL(boolean validateURL)
                        throws TraversalException
validateURL - true if the url should be validated; false otherwise.  
 The only time false should be passed is when you know the validation has
 already been performed once and  you don't want to do it again.TraversalException - if an error is encountered in
      determining the URL.public boolean isFolderOK()
public static java.net.URL validateURL(java.awt.Component parent,
                                       java.net.URL tmpURL,
                                       java.lang.String type,
                                       boolean canOverwriteOpenNodes)
                                throws TraversalException
TraversalExceptionpublic void setDirectoryURL(java.net.URL dir)
public void setDefaultDirectoryName(java.net.URL rootFolderURL)
rootFolderURL 
 + the file name.public void setFileName(java.lang.String fName)
isShowExtensiontrue, the file extension is appended to the file 
 name. By default, the extension is not shown.fName - the file namesetFileExtension(String), 
setShowExtension(boolean)public void setShowExtension(boolean show)
show - If true, the extension is appended to 
    the file name in the file name text field, otherwise, the 
    extension is not shownpublic void setAllowsEmptyFileName(boolean allowsEmptyFileName)
allowsEmptyFileName - if true the file name can be empty
 as long as the file has an extension; if false, a non-empty file
 name is required.public void setDirectoryPrompt(java.lang.String prompt)
prompt - the labelpublic void setFilePrompt(java.lang.String prompt)
prompt - the labelpublic void setBrowseButtonLabel(java.lang.String label)
public javax.swing.JComponent getDefaultFocusComponent()
public void requestFocus()
requestFocus in class javax.swing.JComponentpublic javax.swing.JTextField getDirectoryField()
public javax.swing.JTextField getFileField()
public javax.swing.JButton getBrowseButton()
public void vetoableChange(java.beans.PropertyChangeEvent evt)
                    throws java.beans.PropertyVetoException
vetoableChange in interface java.beans.VetoableChangeListenerjava.beans.PropertyVetoExceptionprotected void addMoreComponents(java.awt.GridBagConstraints gbc)
public boolean isValidChar(char newCharTyped)
public void setEnabled(boolean enabled)
setEnabled in class javax.swing.JComponent