com.sas.servlet.tbeans.remotefileselector2.html
Class RemoteFileSelector

com.sas.servlet.tbeans.remotefileselector2.html.RemoteFileSelector
All Implemented Interfaces:
ActionProviderViewInterface, HttpActionProviderInterface, HttpActionProviderViewInterface, com.sas.actionprovider.refresh.PartialRefreshActionsInterface, URLTemplateViewInterface, com.sas.beans.PropertyChangeSource, com.sas.collection.ContentsChangedListener, com.sas.lang.ObjectDataInterface, com.sas.servlet.tbeans.AJAXControllerURLInterface, ComplexStyleInterface, CompositeComponentInterface, RemoteFileSelectorStyleKeysInterface, RemoteFileSelectorInterface, RemoteFileSelectorKeysInterface, RenderableInterface, TemplateInterface, com.sas.servlet.tbeans.TemplateKeyInterface, TransformationInterface, com.sas.servlet.tbeans.TransformationInterface2, com.sas.util.WriteToPrintWriterInterface, java.io.Serializable, java.util.EventListener
Direct Known Subclasses:
InformationServicesSelector

public class RemoteFileSelector
implements RemoteFileSelectorInterface, RemoteFileSelectorStyleKeysInterface, RemoteFileSelectorKeysInterface

The RemoteFileSelector is a TransformationBean™ that generates the appropriate HTML 4.0 and JavaScript to represent a file selector. The RemoteFileSelector transformation bean allows the navigation and selection of directories and entries on a server. This class is primarily responsible for rendering the RemoteFileSelector component. There are three major parts to the RemoteFileSelector. There is a file view area, a tool bar area and a search facility. This component also requires a model. If a model is not specified then a nullPointerException will occur when the component is rendered.

The file view area displays folders and files in a TableView with the specific key of RFS_FILE_DETAILVIEW. OPEN_FOLDER and SELECT_FILE are the two valid actions in the RFS_FILE_DETAILVIEW. When a folder is selected the OPEN_FOLDER command is executed and the selector displays the files and folders contained in the selected folder. There is not a default command for the SELECT_FILE action. Therefore, it is defined as an external action. This is the action that should be used if there is a specific action desired when a file is selected. A fullyQualifiedLocation is provided on the request object in the case of a SELECT_FILE action or when a file is selected. These actions are only valid for the first column in the TableModel. By default Name is the first column in the TableModel. The results from a search are also displayed in the file view area in a TableView. One additional column is added to the TableView to indicate the Path of the file found when the search results are returned.

The tool bar area provides additional ways to navigate in the selector. The OPEN_FOLDER action and the UP_ONE_LEVEL action are available from the toolbar area. When selecting a folder from the location ChoiceBox component drop-down the OPEN_FOLDER command is executed. The contents of the selected folder are displayed. When selecting the folder in the toolbar area the OpenFolderCommand is executed. When an UP_ONE_LEVEL action occurs the selector displays the folders parent directory using the OpenFolderCommand. A CheckBox component to use for toggling an items description can be set for use on the RemoteFileToolBar component. When the CheckBox is selected all of the available descriptions are displayed in a row below the file or folder. Otherwise, the descriptions are hidden. The Show Description CheckBox is not available by default.

The search facility is not turned on by default. A search facility can be set by creating an instance of the RemoteFileSearch class and setting it as the RFS_SEARCH component. When the Search Button is selected the StartSearchCommand is executed. All files in a tree matching the search criteria are displayed in the file view area inside a TableView or inside the searchResultsComponent.

There is a specific implementation of the RemoteFileSelector for accessing repository data through Information Services. See the InformationServicesSelector class. The InformationServicesSelector allows navigation of an omr and a dav repository. Once the repository instance is provided this class will instatiate and initialize a default com.sas.swing.models.remotefileselector2.informationservices.InformationServicesNavigationModel. Using the RemoteFileSelector class to display an InformationServicesSelector requires the following steps:

  1. instantiate the selector
  2. instantiate the models
  3. initialize the models
  4. access repostiory instance and set on model
  5. render the selector
The model is created and initialized for you when using the specific InformationServicesSelector class. The following steps are needed to display the selector when using the specific InformationServicesSelector class implementation:
  1. instantiate the selector
  2. access repository instance
  3. render the selector
Unless there is a need to create your own model it is easier to use the InformationServicesSelector.

Multiple trees can be viewed from the root level of the selector. If a base level is defined then the base level path specified is treated as the root level of the selector. Therefore, the selector does not allow navigation above the base path. A base path can be specified by overriding the getBasePath() method on the BaseRemoteFileServerModel.

To control the display of the columns manipulate the column model associated with the DetailsComponent or the SearchResultsComponent. This is the safest and best way to control what columns are displayed. By default all file types are displayed in the RemoteFileSelector. These file types can be filtered to only display reports, stored processes or information maps. See the setFilterValues method for more details on filtering the file types.

The RemoteFileSelector is an HTML Table containing HTML tables, Transformation Beans, and Actions. See BaseTransformation to understand more about Transformation Beans. Below the table shows the major elements of the RemoteFileSelector component. To see any sub-components of these key components select the link to view the class information for the specified Transformation Bean.

RemoteFileSelector Elements
Transformation BeansActions
RemoteFileToolBarUP_ONE_LEVEL_ACTION
OPEN_FOLDER_ACTION
TableViewSELECT_FILE_ACTION
OPEN_FOLDER_ACTION
SORT_COLUMN_ASCENDING_ACTION
SORT_COLUMN_DESCENDING_ACTION
RemoteFileSearchSTART_SEARCH_ACTION

Processing on the client is necessary for the OPEN_FOLDER_ACTION action, for searching and for the display of the description rows of the RemoteFileSelector component. Therefore, the sas_RemoteFileSelector.js entry is necessary for the search and the display of the description rows and when the toolbar is visible.

The RemoteFileSelector is one of several TransformationBeans™ that rely on a set of style classes that are used by default when generating the resulting markup language. For more information on style sheets and the default style classes that apply to this TransformationBean™, refer to the AppDev Studio Developer Site. You'll find a useful reference document entitled Cascading Style Sheets, Images, and TransformationBeans™ as well as the TransformationBeans™ Style Sheet Reference.

The RemoteFileSelector is one of several TransformationBeans™ that rely on JavaScript to provide some of its functionality. These JavaScript files are including automatically by the tbean. See JavaScriptIncludeHandler for more information about how these files are included and how to customize this behavior. The RemoteFileSelector uses the following JavaScript files:

sas_RemoteFileSelector.js

Note that the toString() method on this class calls the write method, which may have undesirable side effects. See BaseTransformation.toString() for more information. Debuggers often use toString() to show the value of a variable, and this may cause unexpected behavior while debugging

For More Information:

Visit the AppDev Studio Developer's Site to access step-by-step examples, white papers and additional usage information at http://support.sas.com/rnd/appdev/.

Examples for this class may be found on the Examples Site.

See Also:
Serialized Form

Field Summary
static java.lang.String DEFAULT_TEMPLATE_FILE_NAME
          The name of the file which will be used by default to read in the template used by this RemoteFileSelector component composite.
static java.lang.String RB_KEY
          RB key for internationalization.
static java.lang.String SEARCH_FIELDS_TEMPLATE_FILE_NAME
          The name of the file which will be used by default to read in the template used by the RemoteFileSearch component composite if one is set on the RemoteFileSelector component.
static java.lang.String SEARCH_RESULTS
          "Search Results..." model node value.
 
Fields inherited from class com.sas.servlet.tbeans.BaseActionCompositeTransformation
viewerSupport
 
Fields inherited from interface com.sas.servlet.tbeans.remotefileselector2.RemoteFileSelectorInterface
REGULAR_MODE, SEARCH_MODE
 
Fields inherited from interface com.sas.servlet.tbeans.remotefileselector2.html.RemoteFileSelectorStyleKeysInterface
RFS_CONTAINER_STYLE, RFS_DETAILVIEW_STYLE, RFS_SEARCH_CONTAINER_STYLE, RFS_SEARCH_STYLE, RFS_SEARCHBUTTONS_CONTAINER_STYLE, RFS_SEARCHDATETIMELIMITS, RFS_SEARCHFIELDS_CONTAINER_STYLE, RFS_SEARCHFIELDSANDBUTTONS_CONTAINER_STYLE, RFS_SEARCHINTHELAST, RFS_SEARCHINTHELAST_CHOICECELL, RFS_SEARCHINTHELAST_ENTRYCELL, RFS_SEARCHINTHELAST_FIELDS, RFS_SEARCHINTHELAST_LABELCELL, RFS_SEARCHRESULTS_DETAILVIEW_STYLE, RFS_SEARCHSUBFOLDERS, RFS_SEARCHTEXT, RFS_SEARCHWHAT, RFS_SEARCHWHERE, RFS_TOOLBAR_CONTAINER_STYLE, RFS_TOOLBAR_STYLE
 
Fields inherited from interface com.sas.servlet.tbeans.remotefileselector2.RemoteFileSelectorKeysInterface
RFS_DETAILVIEW, RFS_EXPANDCOLLAPSE, RFS_FILE_DETAILVIEW, RFS_REMOTEFILESEARCH, RFS_SEARCH, RFS_SEARCH_DETAILVIEW, RFS_SEARCHDATETIMELIMITS_CHOICE, RFS_SEARCHDATETIMELIMITS_LABEL, RFS_SEARCHINTHELAST_LABEL, RFS_SEARCHINTHELASTUNIT_CHOICE, RFS_SEARCHINTHELASTVALUE_ENTRYFIELD, RFS_SEARCHRESULTS_DETAILVIEW, RFS_SEARCHSTART_BUTTON, RFS_SEARCHSTOP_BUTTON, RFS_SEARCHSUBFOLDERS_SELECT, RFS_SEARCHTEXT_ENTRYFIELD, RFS_SEARCHTEXT_LABEL, RFS_SEARCHWHAT_CHOICE, RFS_SEARCHWHAT_LABEL, RFS_SEARCHWHERE_CHOICE, RFS_SEARCHWHERE_LABEL, RFS_TOOLBAR, RFS_TOOLBAR_LOCATION_CHOICE, RFS_TOOLBAR_LOCATION_LABEL, RFS_TOOLBAR_SHOWDESCRIPTION_COMPONENT, RFS_UPONELEVEL_ACTION
 
Constructor Summary
RemoteFileSelector()
          Constructs a new RemoteFileSelector transformation bean.
RemoteFileSelector(RemoteFileNavigationModelInterface model)
          Constructs a new RemoteFileSelector with the specified model.
RemoteFileSelector(RemoteFileNavigationModelInterface model, java.util.Locale locale)
          Constructs a new RemoteFileSelector using the specified model and Locale.
 
Method Summary
protected  BaseTableView createDefaultFileDetailView()
          Creates and returns the default file detailView component.
protected  BaseRemoteFileToolBar createDefaultToolBar()
          Deprecated. use #createDefaultToolBar(Locale)
protected  BaseRemoteFileToolBar createDefaultToolBar(java.util.Locale locale)
          Returns the default instance for the ToolBar component.
 void postConstructionSetup()
          This method is executed only one time.
protected  void prepareToWriteDetailView()
          Prepares the detail view or the search view for rendering in the file view area of the component.
protected  void prepareToWriteSearch()
          Prepares the RFS_SEARCH component for rendering.
protected  void prepareToWriteToolBar()
          Prepares the Toolbar for rendering.
 TransformationInterface removeComponent(java.lang.String componentKey)
          Removes a component from the CompositeComponentManager.
 TransformationInterface setComponent(java.lang.String componentKey, TransformationInterface tbean)
          Adds or sets a component to the list of components contained in the composite component.
protected  void setLocaleDependentProperties(java.util.Locale locale)
          Sets the locale dependent properties.
protected  void setupDetailView()
          Binds the sort model to the navigation model and the sort model to the search model and to the corresponding TableView components.
 void setupShowDescription(BaseCheckBox showDescComponent, BaseFieldRenderer descColumnCellRenderer)
          This method sets up the ShowDescription component so that the correct JavaScript method, sas_RemoteFileSelector_updateDescriptionDisplayStatus, is executed when the CheckBox component is selected.
protected  void setupView(BaseTableView table, BaseRemoteFileModelInterface model)
          Bind the viewer and the model.
 void sort(BaseTableView table, BaseRemoteFileModelInterface model, java.lang.String sortColumnName, int sortOrder)
          The folders are sorted on top in ASCENDING order by default if a isFolder column exists.
protected  void writeContent(java.io.PrintWriter out)
          Writes the transformation's main content which is everything except for the following:
Opening container html element.
 
Methods inherited from class com.sas.servlet.tbeans.remotefileselector2.BaseRemoteFileSelector
contentsChanged, getMode, getModel, isDetailViewVisibilityControlOn, setActionProvider, setDetailViewVisibilityControlOn, setMode, setModel
 
Methods inherited from class com.sas.servlet.tbeans.BaseActionCompositeTransformation
applyTemplate, applyTemplate, dispose, getActionFilter, getActionSupportType, getComponentAction, getComponentActionType, getUniqueId, getViewerSupport, isActionVisible, listActionTypes, listAreaTypes, moveActionAttributesToComponent, setActionSupportType, setActionVisible, setComponent, setComponentActionType, setUniqueId, writeTemplate
 
Methods inherited from class com.sas.servlet.tbeans.BaseCompositeTransformation
getActionProvider, getComponent, getComponents, getDefaultTemplate, getStyleInfo, getStyleMap, getTemplate, getTemplateDictionary, getTemplateFileName, getTemplateLocation, getVisibleComponents, isFlushEnabled, propertyChange, setCleanUpResourcesOn, setFlushEnabled, setId, setLocale, setRequest, setResponse, setStyleInfo, setTemplate, setTemplate, setTemplateDictionary, setTemplateFileName, setTemplateLocation
 
Methods inherited from class com.sas.servlet.tbeans.BaseTransformation
addPropertyChangeListener, addPropertyChangeListener, cleanUpResources, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getCustomAttributes, getDescription, getId, getInputTransform, getLocale, getName, getObjectData, getObjectDataProperty, getOutputTransform, getRequest, getResponse, getTagEpilog, getTagProlog, hasListeners, isCleanUpResourcesOn, isVisible, removePropertyChangeListener, removePropertyChangeListener, setCustomAttributes, setInputTransform, setName, setObjectData, setObjectDataProperty, setOutputTransform, setTagEpilog, setTagProlog, setVisible, toString, write, write, write
 
Methods inherited from interface com.sas.servlet.tbeans.remotefileselector2.RemoteFileSelectorInterface
getMode, getModel
 
Methods inherited from interface com.sas.servlet.tbeans.TransformationInterface
getCustomAttributes, getDescription, getId, getLocale, getName, getRequest, getResponse, getTagEpilog, getTagProlog, isVisible, setCustomAttributes, setDescription, setId, setLocale, setName, setRequest, setResponse, setTagEpilog, setTagProlog, setVisible, write, write, write
 
Methods inherited from interface com.sas.actionprovider.HttpActionProviderViewInterface
getRequest, setRequest
 
Methods inherited from interface com.sas.actionprovider.HttpActionProviderInterface
getActionProvider
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
RB key for internationalization.

See Also:
Constant Field Values

SEARCH_RESULTS

public static final java.lang.String SEARCH_RESULTS
"Search Results..." model node value.

See Also:
Constant Field Values

DEFAULT_TEMPLATE_FILE_NAME

public static final java.lang.String DEFAULT_TEMPLATE_FILE_NAME
The name of the file which will be used by default to read in the template used by this RemoteFileSelector component composite.

See Also:
BaseCompositeTransformation.setTemplateFileName(String), BaseCompositeTransformation.getDefaultTemplate(), Constant Field Values

SEARCH_FIELDS_TEMPLATE_FILE_NAME

public static final java.lang.String SEARCH_FIELDS_TEMPLATE_FILE_NAME
The name of the file which will be used by default to read in the template used by the RemoteFileSearch component composite if one is set on the RemoteFileSelector component.

See Also:
BaseCompositeTransformation.setTemplateFileName(String), BaseCompositeTransformation.getDefaultTemplate(), Constant Field Values
Constructor Detail

RemoteFileSelector

public RemoteFileSelector()
Constructs a new RemoteFileSelector transformation bean.


RemoteFileSelector

public RemoteFileSelector(RemoteFileNavigationModelInterface model)
Constructs a new RemoteFileSelector with the specified model.

There are five keys for components that are initialized for this component. The keys are as follows:

All of the keys can be queried for their value.

By default the template name is RemoteFileSelector.html. This template file determines the layout of the component based on the placement of the keys within some html.

The model must be assigned a value before the component can be successfully rendered. A null model value is allowed during initialization.

A default style map containing the following keys is set for the component during initialization:

Parameters:
model - RemoteFileNavigationModelInteface
See Also:
RemoteFileSearch

RemoteFileSelector

public RemoteFileSelector(RemoteFileNavigationModelInterface model,
                          java.util.Locale locale)
Constructs a new RemoteFileSelector using the specified model and Locale.

Parameters:
model - RemoteFileNavigationModelInterface instance
locale - application locale
See Also:
RemoteFileSelector(RemoteFileNavigationModelInterface)
Method Detail

setComponent

public TransformationInterface setComponent(java.lang.String componentKey,
                                            TransformationInterface tbean)
Adds or sets a component to the list of components contained in the composite component. Components .must all have a unique componentKey. ComponentKeys are defined for complex and composite components in com.sas.servlet.tbeans.component-name.component-nameKeysInterface.

In addition this set component also performs initialization when certain keys are set. The RemoteFileSelectorInterface model is set on the RFS_TOOLBAR component when it is set. The SEARCH_FIELDS_TEMPLATE_FILE_NAME is set and the RFS_SEARCH_DETAILVIEW is set when a RFS_SEARCH component is set.

Specified by:
setComponent in interface CompositeComponentInterface
Overrides:
setComponent in class BaseCompositeTransformation
Parameters:
componentKey - unique component keys.
tbean - Transformation Bean.
Returns:
the object that was added if successful or null if the add is unsuccessful.

removeComponent

public TransformationInterface removeComponent(java.lang.String componentKey)
Removes a component from the CompositeComponentManager.

When the RFS_SEARCH component is removed then the RFS_SEARCH_DETAILVIEW component is also removed. There is no longer a need for this TableView.

Specified by:
removeComponent in interface CompositeComponentInterface
Overrides:
removeComponent in class BaseCompositeTransformation
Parameters:
TransformationInerface - object
Returns:
TransformationInterface object if successful null if unsuccessful

prepareToWriteToolBar

protected void prepareToWriteToolBar()
Prepares the Toolbar for rendering.


prepareToWriteSearch

protected void prepareToWriteSearch()
Prepares the RFS_SEARCH component for rendering. By default a Search component is not set.

See Also:
BaseActionCompositeTransformation2.write(java.io.PrintWriter)

prepareToWriteDetailView

protected void prepareToWriteDetailView()
Prepares the detail view or the search view for rendering in the file view area of the component. The visibility is set to false for the viewer that is not displayed in the file view area. This limits the amount of processing. In other words getActions() is not called for the component that is not visible. To change this behavior use the BaseRemoteFileSelector.setDetailViewVisibilityControlOn(boolean) method.

See Also:
BaseRemoteFileSelector.setDetailViewVisibilityControlOn(boolean)

postConstructionSetup

public void postConstructionSetup()
This method is executed only one time. It takes care of any additional setup that was not done at construction time. The setupDetailView() method is called to bind the SortableTableModelAdapter to the model of the RemoteFileSelector component and to the detail view.


setupDetailView

protected void setupDetailView()
Binds the sort model to the navigation model and the sort model to the search model and to the corresponding TableView components. This method calls the setupView method in order to do the necessary binding. A search component does not have to exists but the detail view for the navigation model must exists for the RemoteFileSelector to render as expected.

Parameters:
out - The output stream
See Also:
setupView(com.sas.servlet.tbeans.tableview.BaseTableView, com.sas.swing.models.remotefileselector2.BaseRemoteFileModelInterface)

setupView

protected void setupView(BaseTableView table,
                         BaseRemoteFileModelInterface model)
Bind the viewer and the model. A default camparator with a locale is setup for use on the RFSSortableTableModelAdapter.

This method is executed only one time for each viewer. Therefore this is a good method to override to add tasks that need to be performed one time once the viewer and the models are bound together.

Parameters:
table - detailViewComponent or searchResultsViewComponent that will make use of the RemoteFileServerModelInterface instance
model - model instance that will be attached to the detailViewComponent or searchResultsViewComponent
See Also:
setupDetailView()

setupShowDescription

public void setupShowDescription(BaseCheckBox showDescComponent,
                                 BaseFieldRenderer descColumnCellRenderer)
This method sets up the ShowDescription component so that the correct JavaScript method, sas_RemoteFileSelector_updateDescriptionDisplayStatus, is executed when the CheckBox component is selected. The onClick event is setup for the component.

The display status for the description column is updated based on whether the CheckBox component is selected or not. If the CheckBox is selected then the display status of the description column is set to block otherwise it is set to none.

Parameters:
showDescComponent - BaseCheckBox component that requires the onClick action setup
descColumnCellRenderer - BaseFieldRenderer used to write out the description

sort

public void sort(BaseTableView table,
                 BaseRemoteFileModelInterface model,
                 java.lang.String sortColumnName,
                 int sortOrder)
The folders are sorted on top in ASCENDING order by default if a isFolder column exists. If a NAME column exists then it is used as a third sort column. Therefore each column is sorted by the sort column, the isFolder column and by the Name column.

if the isFolder column does not exists then an alphabetical sort is performed on the items.

Parameters:
table - viewer with a SortableTableModelAdapter bound to it
model - model containing data for sorting
sortColumnName - Column for primary sort

createDefaultToolBar

protected BaseRemoteFileToolBar createDefaultToolBar()
Deprecated. use #createDefaultToolBar(Locale)

Returns the default instance for the ToolBar component.

Returns:
default tool bar instance

createDefaultToolBar

protected BaseRemoteFileToolBar createDefaultToolBar(java.util.Locale locale)
Returns the default instance for the ToolBar component.

Returns:
default tool bar instance

createDefaultFileDetailView

protected BaseTableView createDefaultFileDetailView()
Creates and returns the default file detailView component. The default file detail view Component is a TableView. The cellpadding and cellspacing is 0 for the table. There are no row headers defined for the table. A different row renderer exists for the even and odd rows. This allows different styles to be used for every other row.

Returns:
detail component which is a TableView by default

setLocaleDependentProperties

protected void setLocaleDependentProperties(java.util.Locale locale)
Description copied from class: BaseTransformation
Sets the locale dependent properties. Not operational at this level.

Overrides:
setLocaleDependentProperties in class BaseTransformation

writeContent

protected void writeContent(java.io.PrintWriter out)
                     throws java.io.IOException
Description copied from class: BaseActionCompositeTransformation2
Writes the transformation's main content which is everything except for the following:

Specified by:
writeContent in class com.sas.servlet.tbeans.BaseActionCompositeTransformation2
Throws:
java.io.IOException
See Also:
BaseActionCompositeTransformation2.write(PrintWriter)



Copyright © 2009 SAS Institute Inc. All Rights Reserved.