com.sas.net
Class ResourceLocatorInterfaceCustomizerPanel

com.sas.net.ResourceLocatorInterfaceCustomizerPanel
All Implemented Interfaces:
com.sas.beans.CustomizerClosingInterface, LayoutConstants, java.awt.event.ActionListener, java.awt.event.FocusListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.Customizer, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class ResourceLocatorInterfaceCustomizerPanel
implements java.awt.event.ActionListener, java.awt.event.FocusListener, java.beans.PropertyChangeListener

The ResourceLocatorInterfaceCustomizerPanel is a panel to be displayed in an instance of another object's customizer. It provides the interface which allow the user to edit a com.sas.new.ResourceLocatorInterface object. The ResourceLocatorInterfaceCustomizerPanel provides the user with a way of locating resources. The panel can be customized to fit the user's needs.

See Also:
Serialized Form

Field Summary
static int ABSOLUTE
           
static int APPLET_RELATIVE
           
static int CLASS_RELATIVE
           
static int DOCUMENT_RELATIVE
           
 javax.swing.JPanel firstColumn
           
protected  int pathTypeOptions
           
protected  boolean promptForCopy
           
protected  boolean promptForReplace
           
static java.lang.String RB_KEY
           
 javax.swing.JPanel secondColumn
           
protected  boolean shouldCopy
           
static int URL
           
static int WEBAF
           
static int WEBAFDEV
           
static int WEBEIS
           
 
Fields inherited from class com.sas.swing.visuals.SwingCustomizerPanel
bean, tabTitle
 
Fields inherited from interface com.sas.swing.visuals.util.LayoutConstants
DOTS_BUTTON_INSETS, EMPTY_INSETS, HGAP, HMARGIN, INDENTED_BORDER, TAB_BORDER, TEXTFIELD_INSETS, VGAP, VMARGIN
 
Constructor Summary
ResourceLocatorInterfaceCustomizerPanel()
           
ResourceLocatorInterfaceCustomizerPanel(java.lang.String tabName)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void addLinks()
           
protected  void browseAction(javax.swing.JTextField comp)
           
 void customizerClosing()
          customizerClosing() is called when the customizer for a component is closed.
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
 javax.swing.filechooser.FileFilter getFileDialogFilter()
          Returns the
 java.awt.Container getFirstColumn()
          Returns the column that contains all the labels.
 int getPathTypeOptions()
          Gets the options that are displayed in the path type JComboBox.
 com.sas.net.ResourceLocatorInterface getResourceLocatorInterface()
          Returns the instance of ResourceLocatorInterface that is created from this panel.
 java.awt.Container getSecondColumn()
          Returns the column that contains all the fields.
protected  java.awt.Container makeSettingsContainer()
           
 void propertyChange(java.beans.PropertyChangeEvent evt)
          Handle PropertyChangeEvents from the PropertyEditorHosts.
 void setDefaultValues()
           
 void setFileDialogFilter(javax.swing.filechooser.FileFilter newValue)
          Sets the
 void setObject(java.lang.Object bean)
          Sets the Object being customized.
 void setPathTypeLabel(java.lang.String newValue)
          Sets the label for the path type JComboBox.
 void setPathTypeOptions(int mode)
          Sets the options that are displayed in the path type JComboBox.
 void setPromptForCopy(boolean newValue)
          Sets whether the ResourceLocatorInterfaceCustomizerPanel should prompt the user to notify them that it is copying a resource from one directory to another.
 void setPromptForReplace(boolean newValue)
          Sets whether the ResourceLocatorInterfaceCustomizerPanel should prompt the user to notify them that it is replacing a resource in their project directory.
 void setResourcePathLabel(java.lang.String newValue)
          Sets the label for the resource path JTextField.
 void setShouldCopy(boolean newValue)
          Sets whether the ResourceLocatorInterfaceCustomizerPanel should copy the resource to the project directory if the path is suppose to be relative but is not.
protected  boolean sourceChange(java.lang.String src)
           
protected  boolean sourceChange(java.lang.String src, java.lang.String typeDesired)
           
 
Methods inherited from class com.sas.swing.visuals.SwingCustomizerPanel
getObject, getTabTitle, setTabTitle
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
See Also:
Constant Field Values

firstColumn

public javax.swing.JPanel firstColumn

secondColumn

public javax.swing.JPanel secondColumn

shouldCopy

protected boolean shouldCopy

promptForCopy

protected boolean promptForCopy

promptForReplace

protected boolean promptForReplace

pathTypeOptions

protected int pathTypeOptions

APPLET_RELATIVE

public static final int APPLET_RELATIVE
See Also:
Constant Field Values

URL

public static final int URL
See Also:
Constant Field Values

ABSOLUTE

public static final int ABSOLUTE
See Also:
Constant Field Values

DOCUMENT_RELATIVE

public static final int DOCUMENT_RELATIVE
See Also:
Constant Field Values

CLASS_RELATIVE

public static final int CLASS_RELATIVE
See Also:
Constant Field Values

WEBAF

public static final int WEBAF
See Also:
Constant Field Values

WEBEIS

public static final int WEBEIS
See Also:
Constant Field Values

WEBAFDEV

public static final int WEBAFDEV
See Also:
Constant Field Values
Constructor Detail

ResourceLocatorInterfaceCustomizerPanel

public ResourceLocatorInterfaceCustomizerPanel(java.lang.String tabName)

ResourceLocatorInterfaceCustomizerPanel

public ResourceLocatorInterfaceCustomizerPanel()
Method Detail

setPathTypeOptions

public void setPathTypeOptions(int mode)
Sets the options that are displayed in the path type JComboBox. By default, the options are URL, APPLET_RELATIVE, CLASS_RELATIVE, and ABSOLUTE. If one would like different options, just pass in the options '|' togethered. Example:
 ResourceLocatorInterfaceCustomizerPanel panel = new ResourceLocatorInterfaceCustomizerPanel();
 panel.setPathTypeOptions(panel.URL | panel.DOCUMENT_RELATIVE | panel.ABSOLUTE);
 

Parameters:
mode - the options the user wants to appear in the path type JComboBox
See Also:
getPathTypeOptions()

getPathTypeOptions

public int getPathTypeOptions()
Gets the options that are displayed in the path type JComboBox. By default, the options are URL, APPLET_RELATIVE, CLASS_RELATIVE, and ABSOLUTE.

Returns:
the options that appear in the path type JComboBox
See Also:
setPathTypeOptions(int)

browseAction

protected void browseAction(javax.swing.JTextField comp)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Specified by:
focusLost in interface java.awt.event.FocusListener

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Specified by:
focusGained in interface java.awt.event.FocusListener

sourceChange

protected boolean sourceChange(java.lang.String src)

sourceChange

protected boolean sourceChange(java.lang.String src,
                               java.lang.String typeDesired)

setDefaultValues

public void setDefaultValues()

makeSettingsContainer

protected java.awt.Container makeSettingsContainer()

setPathTypeLabel

public void setPathTypeLabel(java.lang.String newValue)
Sets the label for the path type JComboBox. By default, the label is "Location type:".

Parameters:
newValue - the new label name for the path type

setResourcePathLabel

public void setResourcePathLabel(java.lang.String newValue)
Sets the label for the resource path JTextField. By default, the label is "Location:".

Parameters:
newValue - the new label name for the resource path

getFirstColumn

public java.awt.Container getFirstColumn()
Returns the column that contains all the labels. This method is generally used with the AutoSizingGridLayout.setInterlockedColumnContainers method. This will provide the user with a way to align all the labels in ResourceLocatorInterfaceCustomizerPanel with the labels in their panel.

Returns:
the left container that holds all the labels in the panel
See Also:
AutoSizingGridLayout

getSecondColumn

public java.awt.Container getSecondColumn()
Returns the column that contains all the fields. This method is generally used with the AutoSizingGridLayout.setInterlockedColumnContainers method. This will provide the user with a way to align all the fields in ResourceLocatorInterfaceCustomizerPanel with the fields in their panel.

Returns:
the right container that holds all the fields in the panel
See Also:
AutoSizingGridLayout

getResourceLocatorInterface

public com.sas.net.ResourceLocatorInterface getResourceLocatorInterface()
Returns the instance of ResourceLocatorInterface that is created from this panel. Anytime the user changes the type of path, a new ResourceLocatorInterface instance is created. This method provides the user with a way to retrieve the ResourceLocatorInterface.

Returns:
the instance of ResourceLocatorInterface present in the panel

setFileDialogFilter

public void setFileDialogFilter(javax.swing.filechooser.FileFilter newValue)
Sets the FileFilter on the JFileChooser used in the file dialog for the URL, AbsolutePath, or Relative to Applet or Document. This DOES NOT change the FileFilter on the dialog that appears when the user is selecting a context as that has to be either a directory or a .zip or .jar file.

Parameters:
newValue - the new FileFilter to use on the file dialog
See Also:
getFileDialogFilter()

getFileDialogFilter

public javax.swing.filechooser.FileFilter getFileDialogFilter()
Returns the FileFilter used on the file dialog for URL, Absolute, Relative to Applet, and Relative to Document path types.

Returns:
the FileFilter used on the file dialog
See Also:
setFileDialogFilter(FileFilter)

setPromptForCopy

public void setPromptForCopy(boolean newValue)
Sets whether the ResourceLocatorInterfaceCustomizerPanel should prompt the user to notify them that it is copying a resource from one directory to another. This only occurs if the resource is suppose to be relative but is not. If this is set to false, the copying will be done and the user will not be notified. Default value is true.

Parameters:
newValue - whether to prompt to copy the file or not
See Also:
setPromptForReplace(boolean), setShouldCopy(boolean), ResourceCopier

setPromptForReplace

public void setPromptForReplace(boolean newValue)
Sets whether the ResourceLocatorInterfaceCustomizerPanel should prompt the user to notify them that it is replacing a resource in their project directory. This only occurs if the resource is suppose to be relative but is not and the a file already exists in their project directory with the same name. If this is set to false, the replacing will be done and the user will not be notified. Default value is true.

Parameters:
newValue - whether to prompt to copy the file or not
See Also:
setPromptForCopy(boolean), setShouldCopy(boolean), ResourceCopier

setShouldCopy

public void setShouldCopy(boolean newValue)
Sets whether the ResourceLocatorInterfaceCustomizerPanel should copy the resource to the project directory if the path is suppose to be relative but is not. Be default, this is true. If this is set to false and the user selects a non-relative resource, the path type will be switched to Absolute automatically.

Parameters:
whether - to copy a resource that does not have a relative path but is suppose to have one, default is true
See Also:
setPromptForCopy(boolean), setPromptForReplace(boolean), ResourceCopier

setObject

public void setObject(java.lang.Object bean)
Description copied from class: SwingCustomizerPanel
Sets the Object being customized.

Specified by:
setObject in interface java.beans.Customizer
Overrides:
setObject in class SwingCustomizerPanel
Parameters:
bean - the Object being customized.
See Also:
Customizer.setObject(java.lang.Object)

addLinks

public void addLinks()

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Handle PropertyChangeEvents from the PropertyEditorHosts. Get the value of the property from the host and set it on the bean.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener

customizerClosing

public void customizerClosing()
Description copied from class: SwingCustomizerPanel
customizerClosing() is called when the customizer for a component is closed. customizerClosing() of the customizerView calls customizerClosing() on each of the panels in the CustomizerView which extend CustomizerPanel.

customizerClosing() should "unhook" the bean from the customizer by removing any event listeners the panel added to the bean.

Subclasses should call super in case we add some functionality to this method in the future.

Specified by:
customizerClosing in interface com.sas.beans.CustomizerClosingInterface
Overrides:
customizerClosing in class SwingCustomizerPanel



Copyright © 2009 SAS Institute Inc. All Rights Reserved.