Extension SDK

oracle.ide.component
Class NewFilePanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--oracle.ide.component.NewFilePanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.beans.VetoableChangeListener

public class NewFilePanel
extends javax.swing.JPanel
implements java.beans.VetoableChangeListener

The 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.

Since:
9.0.3
See Also:
Serialized Form

Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
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
NewFilePanel()
          Creates a new NewFilePanel instance.
 
Method Summary
 java.net.URL getFileURL()
          Retrieves the URL of the file being specified in this dialog.
 NewFileValidator getNewFileURLValidator()
          Retrieves the current NewFileValidator.
 void requestFocus()
           
 java.net.URL runDialog(java.lang.String title)
          Creates and displays a dialog containing this NewFilePanel
 void setCanOverwriteOpenNodes(boolean canOverwriteOpenNodes)
          Specifies whether this NewFilePanel instance should allow the overwriting of open nodes.
 void setDirectoryPrompt(java.lang.String prompt)
           
 void setDirectoryURL(java.net.URL dir)
          Sets the URL used for the directory field.
 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 file name.
 void setFilePrompt(java.lang.String prompt)
           
 void setFileType(java.lang.String type)
          Specifies a string used to describe the type of file.
 void setInteractiveMode(boolean isInteractive)
          Specifies whether this NewFilePanel is in interactive mode.
 void setNewFileURLValidator(NewFileValidator validator)
          Specifies the NewFileValidator that will be used, in addition to the default validation, to make sure that the URL for the new File is valid.
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)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NewFilePanel

public NewFilePanel()
Creates a new NewFilePanel instance.
Method Detail

setInteractiveMode

public void setInteractiveMode(boolean isInteractive)
Specifies whether this NewFilePanel is in interactive mode. When in interactive mode, errors are reported to the user; when not in interactive mode, errors are suppressed.

setFileExtension

public void setFileExtension(java.lang.String ext)
Sets the extension that should be used for the new file.

setFileType

public void setFileType(java.lang.String type)
Specifies a string used to describe the type of file. This string is used in error messages. NewProjectFile UI might specify a FileType of "project file", for example.

setNewFileURLValidator

public void setNewFileURLValidator(NewFileValidator validator)
Specifies the 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.
Parameters:
validator - the NewFileValidator to use, or null to only use the default validation.

getNewFileURLValidator

public NewFileValidator getNewFileURLValidator()
Retrieves the current NewFileValidator.
Returns:
the current NewFileValidator.

setCanOverwriteOpenNodes

public void setCanOverwriteOpenNodes(boolean canOverwriteOpenNodes)
Specifies whether this 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.

runDialog

public java.net.URL runDialog(java.lang.String title)
Creates and displays a dialog containing this NewFilePanel
Parameters:
title - the title to use for the dialog
Returns:
the URL of the file specified by the user, or null if the user canceled the dialog.

getFileURL

public java.net.URL getFileURL()
                        throws TraversalException
Retrieves the URL of the file being specified in this dialog.
Returns:
the URL of the file
Throws:
TraversalException - if an error is encountered in determining the URL.

validateURL

public static java.net.URL validateURL(java.awt.Component parent,
                                       java.net.URL tmpURL,
                                       java.lang.String type,
                                       boolean canOverwriteOpenNodes)
                                throws TraversalException

setDirectoryURL

public void setDirectoryURL(java.net.URL dir)
Sets the URL used for the directory field.

setFileName

public void setFileName(java.lang.String fName)
Sets the file name.

vetoableChange

public void vetoableChange(java.beans.PropertyChangeEvent evt)
                    throws java.beans.PropertyVetoException
Specified by:
vetoableChange in interface java.beans.VetoableChangeListener

requestFocus

public void requestFocus()
Overrides:
requestFocus in class javax.swing.JComponent

setDirectoryPrompt

public void setDirectoryPrompt(java.lang.String prompt)

setFilePrompt

public void setFilePrompt(java.lang.String prompt)

Extension SDK