com.sun.webui.jsf.model
Class FileChooserModel

java.lang.Object
  extended by com.sun.webui.jsf.model.FileChooserModel
All Implemented Interfaces:
com.sun.webui.jsf.model.ResourceModel, java.io.Serializable

public class FileChooserModel
extends java.lang.Object
implements com.sun.webui.jsf.model.ResourceModel, java.io.Serializable

See Also:
Serialized Form

Constructor Summary
FileChooserModel()
          Creates a new instance of FileChooserModel
 
Method Summary
 boolean canRead(java.lang.String resourceName)
          This methods checks if the resource path in question can be accessed by the user trying to select or view it.
 boolean canWrite(java.lang.String resourceName)
          This methods checks if the resource path in question can be accessed for writes by the user.
 java.lang.String getAbsoluteRoot()
          Returns the root value of the file system in question.
 java.lang.String getCurrentDir()
          This method is called to get the current directory of the resuource list being displayed in the filechooser's listbox If the current directory has not been set, root directory is returned by calling getAbsoluteRoot().
 java.lang.String getDelimiterChar()
           
 java.lang.String getEscapeChar()
           
 java.lang.String getFilterValue()
          Return the filter String currently in use.
 com.sun.webui.jsf.model.ResourceItem[] getFolderContent(java.lang.String folder, boolean disableFiles, boolean disableFolders)
          Returns the list of files in the directory represented by the folder parameter.
 java.lang.String getParentFolder()
          Return the parent folder of the value of getCurrentDir.
 com.sun.webui.jsf.model.ResourceItem getResourceItem(java.lang.String itemKey)
          Given a ResourceItem key return the ResourceItem.
 java.lang.String[] getRoots()
          Return all available roots.
 java.lang.Object[] getSelectedContent(java.lang.String[] content, boolean selectFolders)
          Return a File[] of the selections in content validating the the entries.
 java.lang.String getSeparatorString()
          Return the separator String for this resource system.
 java.lang.String getServerName()
          Get the Server namefrom where the resources are being loaded.
 java.lang.String getSortValue()
          Return the sort field that is currently active.
 boolean isFolderType(java.lang.String path)
          Returns true if the supplied absolute path is a folder type.
 void setAbsoluteRoot(java.lang.String absRoot)
          Sets the root value of the resource system in question.
 void setCurrentDir(java.lang.String dir)
          This method is called to set the current directory of the resuource list that would be displayed in the next display cycle.
 void setFilterValue(java.lang.String filterValue)
          Set the filter String entered by the user in the Filter text field.
 void setServerName(java.lang.String serverName)
          Set the server name from where the resources are being loaded.
 void setSortValue(java.lang.String sortValue)
          Set the sort field chosen by the user from the drop down menu.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileChooserModel

public FileChooserModel()
Creates a new instance of FileChooserModel

Method Detail

getAbsoluteRoot

public java.lang.String getAbsoluteRoot()
Returns the root value of the file system in question. For example, in the default implementation of this interface for local filesystems the root value would be "/" in Unix and "C:\" on Windows.

Specified by:
getAbsoluteRoot in interface com.sun.webui.jsf.model.ResourceModel
Returns:
returns the absolute root (directory for files and folders).

getRoots

public java.lang.String[] getRoots()
Return all available roots.

Specified by:
getRoots in interface com.sun.webui.jsf.model.ResourceModel

setAbsoluteRoot

public void setAbsoluteRoot(java.lang.String absRoot)
Sets the root value of the resource system in question. For example, in the default implementation of this interface for local filesystems the root value could be set to "/" in Unix and "C:\" on Windows.

Specified by:
setAbsoluteRoot in interface com.sun.webui.jsf.model.ResourceModel
Parameters:
absRoot - - the value to be used as the root of this resource system

getSeparatorString

public java.lang.String getSeparatorString()
Return the separator String for this resource system. For a file system chooser this would be File.separator.

Specified by:
getSeparatorString in interface com.sun.webui.jsf.model.ResourceModel
Returns:
returns the separator String.

getServerName

public java.lang.String getServerName()
Get the Server namefrom where the resources are being loaded.

Specified by:
getServerName in interface com.sun.webui.jsf.model.ResourceModel
Returns:
the server name

setServerName

public void setServerName(java.lang.String serverName)
Set the server name from where the resources are being loaded.

Specified by:
setServerName in interface com.sun.webui.jsf.model.ResourceModel
Parameters:
serverName - - the server name to be set

getFilterValue

public java.lang.String getFilterValue()
Return the filter String currently in use.

Specified by:
getFilterValue in interface com.sun.webui.jsf.model.ResourceModel
Returns:
returns the filter String.

setFilterValue

public void setFilterValue(java.lang.String filterValue)
Set the filter String entered by the user in the Filter text field.

Specified by:
setFilterValue in interface com.sun.webui.jsf.model.ResourceModel
Parameters:
filterValue - - the filter string to be used subsequently.

getSortValue

public java.lang.String getSortValue()
Return the sort field that is currently active.

Specified by:
getSortValue in interface com.sun.webui.jsf.model.ResourceModel
Returns:
returns the sort field in use.

setSortValue

public void setSortValue(java.lang.String sortValue)
Set the sort field chosen by the user from the drop down menu.

Specified by:
setSortValue in interface com.sun.webui.jsf.model.ResourceModel
Parameters:
sortValue - - string representing sortValue selected by the user.

getCurrentDir

public java.lang.String getCurrentDir()
This method is called to get the current directory of the resuource list being displayed in the filechooser's listbox If the current directory has not been set, root directory is returned by calling getAbsoluteRoot().

Specified by:
getCurrentDir in interface com.sun.webui.jsf.model.ResourceModel
Returns:
returns the current directory or the root directory.

setCurrentDir

public void setCurrentDir(java.lang.String dir)
                   throws ResourceModelException
This method is called to set the current directory of the resuource list that would be displayed in the next display cycle.

Specified by:
setCurrentDir in interface com.sun.webui.jsf.model.ResourceModel
Parameters:
dir - - the value to be set the new current root node.
Throws:
ResourceModelException

getFolderContent

public com.sun.webui.jsf.model.ResourceItem[] getFolderContent(java.lang.String folder,
                                                               boolean disableFiles,
                                                               boolean disableFolders)
Returns the list of files in the directory represented by the folder parameter. If folder is null the contents of folder returned by getCurrentDir are returned. This method returns an Array of ResourecItem objects

Specified by:
getFolderContent in interface com.sun.webui.jsf.model.ResourceModel
Returns:
returns the contents of folder or the current directory.

getResourceItem

public com.sun.webui.jsf.model.ResourceItem getResourceItem(java.lang.String itemKey)
Given a ResourceItem key return the ResourceItem.

Specified by:
getResourceItem in interface com.sun.webui.jsf.model.ResourceModel
Parameters:
itemKey - the resource item key which is the same as the value of the Option element in the listbox.
Returns:
the ResourceItem object

isFolderType

public boolean isFolderType(java.lang.String path)
Returns true if the supplied absolute path is a folder type.

Specified by:
isFolderType in interface com.sun.webui.jsf.model.ResourceModel
Parameters:
path - - the absolute path to the resource
Returns:
returns the current root (directory for files and folders).

canRead

public boolean canRead(java.lang.String resourceName)
This methods checks if the resource path in question can be accessed by the user trying to select or view it.

Specified by:
canRead in interface com.sun.webui.jsf.model.ResourceModel
Parameters:
resourceName - - the resource name to check for read access
Returns:
true if the user can select the resource specified by the resource name.

canWrite

public boolean canWrite(java.lang.String resourceName)
This methods checks if the resource path in question can be accessed for writes by the user.

Specified by:
canWrite in interface com.sun.webui.jsf.model.ResourceModel
Parameters:
resourceName - - the resource name to check for write access
Returns:
true if the user can select the resource specified by the resource name for write.

getParentFolder

public java.lang.String getParentFolder()
Return the parent folder of the value of getCurrentDir. If the current directory does not have a parent null is returned.

Specified by:
getParentFolder in interface com.sun.webui.jsf.model.ResourceModel

getEscapeChar

public java.lang.String getEscapeChar()
Specified by:
getEscapeChar in interface com.sun.webui.jsf.model.ResourceModel

getDelimiterChar

public java.lang.String getDelimiterChar()
Specified by:
getDelimiterChar in interface com.sun.webui.jsf.model.ResourceModel

getSelectedContent

public java.lang.Object[] getSelectedContent(java.lang.String[] content,
                                             boolean selectFolders)
                                      throws ResourceModelException
Return a File[] of the selections in content validating the the entries.

Specified by:
getSelectedContent in interface com.sun.webui.jsf.model.ResourceModel
Throws:
ResourceModelException


Copyright © 2008 Sun Microsystems, Inc. All Rights Reserved.