Class FileViewerContext
- java.lang.Object
-
- net.sf.basedb.clients.web.extensions.fileviewer.FileViewerContext
-
public class FileViewerContext extends Object
This class is used for holding information about a file that is beeing displayed in the GUI in some context. A file item is always available by thegetFile()
method. ThegetType()
can be used to determine what other information that is possible available.- Since:
- 3.16
- Author:
- nicklas
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FileViewerContext.Type
-
Field Summary
Fields Modifier and Type Field Description private AnyToAny
any
private File
file
private DataFileType
fileType
private FileSetMember
member
private BasicItem
parentItem
private FileViewerContext.Type
type
-
Constructor Summary
Constructors Modifier Constructor Description private
FileViewerContext(FileViewerContext.Type type, BasicItem parentItem)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FileViewerContext
anyToAny(BasicItem parentItem)
Creates an any-to-any listing context where files belong to a parent item.static FileViewerContext
dataFile(BasicItem parentItem)
Creates a data-file listing context where files belong to a parent item.static FileViewerContext
file()
Creates a file-listing or single-file context without any other related items.AnyToAny
getAnyToAny()
Get the current any-to-any link pointing to the file.File
getFile()
Get the current file.DataFileType
getFileType()
Get the current data file type.FileSetMember
getMember()
Get the current file set member information for the file.BasicItem
getParentItem()
If the context has a parent item this method returns it.FileViewerContext.Type
getType()
Get the context type that the file is being displayed in.void
setCurrentAnyToAny(BasicItem parentItem, File file, AnyToAny any)
Sets the current any-to-any linked file and change the parent item.void
setCurrentAnyToAny(File file, AnyToAny any)
Sets the current any-to-any linked file.void
setCurrentDataFile(BasicItem parentItem, File file, DataFileType fileType, FileSetMember member)
Sets the current data file and change the parent item.void
setCurrentDataFile(File file, DataFileType fileType, FileSetMember member)
Sets the current data file.void
setCurrentFile(File file)
Set the current file.
-
-
-
Field Detail
-
type
private FileViewerContext.Type type
-
parentItem
private BasicItem parentItem
-
file
private File file
-
any
private AnyToAny any
-
member
private FileSetMember member
-
fileType
private DataFileType fileType
-
-
Constructor Detail
-
FileViewerContext
private FileViewerContext(FileViewerContext.Type type, BasicItem parentItem)
-
-
Method Detail
-
file
public static FileViewerContext file()
Creates a file-listing or single-file context without any other related items.- See Also:
FileViewerContext.Type.FILE
-
dataFile
public static FileViewerContext dataFile(BasicItem parentItem)
Creates a data-file listing context where files belong to a parent item. The parent item is aFileStoreEnabled
item and the context also contains aFileSetMember
andDataFileType
.- See Also:
FileViewerContext.Type.DATA_FILE
-
anyToAny
public static FileViewerContext anyToAny(BasicItem parentItem)
Creates an any-to-any listing context where files belong to a parent item. The parent item can be anyBasicItem
item and the context also contains anAnyToAny
link.- See Also:
FileViewerContext.Type.ANY_TO_ANY
-
getType
public FileViewerContext.Type getType()
Get the context type that the file is being displayed in.
-
getParentItem
public BasicItem getParentItem()
If the context has a parent item this method returns it.
-
getFile
public File getFile()
Get the current file.
-
getAnyToAny
public AnyToAny getAnyToAny()
Get the current any-to-any link pointing to the file. This should always be available if the type isFileViewerContext.Type.ANY_TO_ANY
or null otherwise.
-
getFileType
public DataFileType getFileType()
Get the current data file type. This should always be available if the type isFileViewerContext.Type.DATA_FILE
or null otherwise.
-
getMember
public FileSetMember getMember()
Get the current file set member information for the file. This should always be available if the type isFileViewerContext.Type.DATA_FILE
or null otherwise.
-
setCurrentFile
public void setCurrentFile(File file)
Set the current file.
-
setCurrentDataFile
public void setCurrentDataFile(File file, DataFileType fileType, FileSetMember member)
Sets the current data file.
-
setCurrentDataFile
public void setCurrentDataFile(BasicItem parentItem, File file, DataFileType fileType, FileSetMember member)
Sets the current data file and change the parent item.- Since:
- 3.17
-
setCurrentAnyToAny
public void setCurrentAnyToAny(File file, AnyToAny any)
Sets the current any-to-any linked file.
-
-