Package org.opencms.ui.apps
Class CmsFileExplorer
- java.lang.Object
-
- org.opencms.ui.apps.CmsFileExplorer
-
- All Implemented Interfaces:
com.vaadin.navigator.ViewChangeListener
,java.io.Serializable
,I_CmsCachableApp
,I_CmsContextProvider
,I_CmsHasShortcutActions
,I_CmsWorkplaceApp
,CmsFileTable.I_FolderSelectHandler
,I_CmsWindowCloseListener
public class CmsFileExplorer extends java.lang.Object implements I_CmsWorkplaceApp, I_CmsCachableApp, com.vaadin.navigator.ViewChangeListener, I_CmsWindowCloseListener, I_CmsHasShortcutActions, I_CmsContextProvider, CmsFileTable.I_FolderSelectHandler
The file explorer app.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
CmsFileExplorer.ExplorerDropHandler
The drop handler for copy/move operations.class
CmsFileExplorer.TreeExpandListener
File tree expand listener.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ATTR_KEY
The file explorer attribute key.static java.util.Collection<CmsResourceTableProperty>
INLINE_EDIT_PROPERTIES
The in line editable resource properties.static int
LAYOUT_SPLIT_POSITION
The initial split position between folder tree and file table.protected I_CmsAppUIContext
m_appContext
The UI context.protected java.lang.String
m_savedExplorerState
Saved explorer state used by dialogs after they have finished.static java.lang.String
OPENED_PATHS
The opened paths session attribute name.static java.lang.String
SITE_CAPTION
Site selector caption property.static java.lang.String
SITE_ROOT
Site selector site root property.static int
UPDATE_FOLDER_THRESHOLD
Threshold for updating the complete folder after file changes.
-
Constructor Summary
Constructors Constructor Description CmsFileExplorer()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterViewChange(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent event)
boolean
beforeViewChange(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent event)
void
changeSite(java.lang.String siteRoot, java.lang.String path)
Changes to the given site and path.void
changeSite(java.lang.String siteRoot, java.lang.String path, boolean force)
Switches to the requested site.void
clearSelection()
Clears the file table selection.protected void
clearTreeLevel(CmsUUID parentId)
Clears the given tree level.java.util.List<CmsUUID>
getAllIds()
Gets all ids of resources in current folder.CmsUUID
getCurrentFolder()
Returns the current folder id.CmsExplorerDialogContext
getDialogContext()
Returns the dialog context for dialogs opened from the context menu.java.util.Map<com.vaadin.event.Action,java.lang.Runnable>
getShortcutActions()
Returns the shortcut actions.void
initUI(I_CmsAppUIContext context)
Within this method the app UI should be initialized.boolean
isCachable()
Returns whether this app should be cached within the user session.void
onFolderSelect(CmsUUID itemId)
Called when the folder name is left clicked.void
onRestoreFromCache()
Called after the view is fetched from the cache.void
onSiteOrProjectChange(CmsProject project, java.lang.String siteRoot)
Call if site and or project have been changed.void
onStateChange(java.lang.String state)
Called on navigation events.void
onWindowClose()
Executed on window close.void
populateFileTable(java.lang.String sitePath)
Fills the file table with the resources from the given path.protected void
readFolder(CmsUUID folderId)
Reads the given folder.protected void
readFolder(CmsUUID folderId, boolean clearFilter)
Reads the given folder.void
update(java.util.Collection<CmsUUID> ids)
Updates the table entries with the given ids.void
updateAll(boolean clearFilter)
Updates display for all contents of the current folder.protected void
updateCurrentFolder(java.util.Collection<CmsUUID> removeIds)
Updates the current folder and removes the given resource items.void
updateResourceInTree(CmsObject cms, CmsUUID id)
Updates the give tree item.void
updateTree(CmsUUID id)
Updates the tree items with the given ids.
-
-
-
Field Detail
-
ATTR_KEY
public static final java.lang.String ATTR_KEY
The file explorer attribute key.- See Also:
- Constant Field Values
-
INLINE_EDIT_PROPERTIES
public static final java.util.Collection<CmsResourceTableProperty> INLINE_EDIT_PROPERTIES
The in line editable resource properties.
-
LAYOUT_SPLIT_POSITION
public static final int LAYOUT_SPLIT_POSITION
The initial split position between folder tree and file table.- See Also:
- Constant Field Values
-
OPENED_PATHS
public static final java.lang.String OPENED_PATHS
The opened paths session attribute name.- See Also:
- Constant Field Values
-
SITE_CAPTION
public static final java.lang.String SITE_CAPTION
Site selector caption property.- See Also:
- Constant Field Values
-
SITE_ROOT
public static final java.lang.String SITE_ROOT
Site selector site root property.- See Also:
- Constant Field Values
-
UPDATE_FOLDER_THRESHOLD
public static final int UPDATE_FOLDER_THRESHOLD
Threshold for updating the complete folder after file changes.- See Also:
- Constant Field Values
-
m_appContext
protected I_CmsAppUIContext m_appContext
The UI context.
-
m_savedExplorerState
protected java.lang.String m_savedExplorerState
Saved explorer state used by dialogs after they have finished.
-
-
Constructor Detail
-
CmsFileExplorer
public CmsFileExplorer()
Constructor.
-
-
Method Detail
-
afterViewChange
public void afterViewChange(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent event)
- Specified by:
afterViewChange
in interfacecom.vaadin.navigator.ViewChangeListener
- See Also:
ViewChangeListener.afterViewChange(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent)
-
beforeViewChange
public boolean beforeViewChange(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent event)
- Specified by:
beforeViewChange
in interfacecom.vaadin.navigator.ViewChangeListener
- See Also:
ViewChangeListener.beforeViewChange(com.vaadin.navigator.ViewChangeListener.ViewChangeEvent)
-
changeSite
public void changeSite(java.lang.String siteRoot, java.lang.String path)
Changes to the given site and path.- Parameters:
siteRoot
- the site rootpath
- the path inside the site
-
changeSite
public void changeSite(java.lang.String siteRoot, java.lang.String path, boolean force)
Switches to the requested site.- Parameters:
siteRoot
- the site rootpath
- the folder path to openforce
- force the path change, even if we are currently in the same site
-
clearSelection
public void clearSelection()
Clears the file table selection.
-
getAllIds
public java.util.List<CmsUUID> getAllIds()
Gets all ids of resources in current folder.- Returns:
- the
-
getCurrentFolder
public CmsUUID getCurrentFolder()
Returns the current folder id.- Returns:
- the current folder structure id
-
getDialogContext
public CmsExplorerDialogContext getDialogContext()
Description copied from interface:I_CmsContextProvider
Returns the dialog context for dialogs opened from the context menu.- Specified by:
getDialogContext
in interfaceI_CmsContextProvider
- Returns:
- the dialog context
- See Also:
I_CmsContextProvider.getDialogContext()
-
getShortcutActions
public java.util.Map<com.vaadin.event.Action,java.lang.Runnable> getShortcutActions()
Description copied from interface:I_CmsHasShortcutActions
Returns the shortcut actions.- Specified by:
getShortcutActions
in interfaceI_CmsHasShortcutActions
- Returns:
- the shortcut actions
- See Also:
I_CmsHasShortcutActions.getShortcutActions()
-
initUI
public void initUI(I_CmsAppUIContext context)
Description copied from interface:I_CmsWorkplaceApp
Within this method the app UI should be initialized.Use the context to add the app's components to the UI.
- Specified by:
initUI
in interfaceI_CmsWorkplaceApp
- Parameters:
context
- the UI context- See Also:
I_CmsWorkplaceApp.initUI(org.opencms.ui.apps.I_CmsAppUIContext)
-
isCachable
public boolean isCachable()
Description copied from interface:I_CmsCachableApp
Returns whether this app should be cached within the user session.- Specified by:
isCachable
in interfaceI_CmsCachableApp
- Returns:
true
if the app is cachable- See Also:
I_CmsCachableApp.isCachable()
-
onFolderSelect
public void onFolderSelect(CmsUUID itemId)
Description copied from interface:CmsFileTable.I_FolderSelectHandler
Called when the folder name is left clicked.- Specified by:
onFolderSelect
in interfaceCmsFileTable.I_FolderSelectHandler
- Parameters:
itemId
- the selected folder id- See Also:
CmsFileTable.I_FolderSelectHandler.onFolderSelect(org.opencms.util.CmsUUID)
-
onRestoreFromCache
public void onRestoreFromCache()
Description copied from interface:I_CmsCachableApp
Called after the view is fetched from the cache.- Specified by:
onRestoreFromCache
in interfaceI_CmsCachableApp
- See Also:
I_CmsCachableApp.onRestoreFromCache()
-
onSiteOrProjectChange
public void onSiteOrProjectChange(CmsProject project, java.lang.String siteRoot)
Call if site and or project have been changed.- Parameters:
project
- the projectsiteRoot
- the site root
-
onStateChange
public void onStateChange(java.lang.String state)
Description copied from interface:I_CmsWorkplaceApp
Called on navigation events.- Specified by:
onStateChange
in interfaceI_CmsWorkplaceApp
- Parameters:
state
- the app state to show- See Also:
I_CmsWorkplaceApp.onStateChange(java.lang.String)
-
onWindowClose
public void onWindowClose()
Description copied from interface:I_CmsWindowCloseListener
Executed on window close.- Specified by:
onWindowClose
in interfaceI_CmsWindowCloseListener
- See Also:
I_CmsWindowCloseListener.onWindowClose()
-
populateFileTable
public void populateFileTable(java.lang.String sitePath)
Fills the file table with the resources from the given path.- Parameters:
sitePath
- a folder site path
-
update
public void update(java.util.Collection<CmsUUID> ids)
Updates the table entries with the given ids.- Parameters:
ids
- the ids of the table entries to update
-
updateAll
public void updateAll(boolean clearFilter)
Updates display for all contents of the current folder.- Parameters:
clearFilter
-true
to clear the search filter
-
updateResourceInTree
public void updateResourceInTree(CmsObject cms, CmsUUID id)
Updates the give tree item.- Parameters:
cms
- the cms contextid
- the item id
-
updateTree
public void updateTree(CmsUUID id)
Updates the tree items with the given ids.- Parameters:
id
- the
-
clearTreeLevel
protected void clearTreeLevel(CmsUUID parentId)
Clears the given tree level.- Parameters:
parentId
- the parent id
-
readFolder
protected void readFolder(CmsUUID folderId) throws CmsException
Reads the given folder.- Parameters:
folderId
- the folder id- Throws:
CmsException
- in case reading the folder fails
-
readFolder
protected void readFolder(CmsUUID folderId, boolean clearFilter) throws CmsException
Reads the given folder.- Parameters:
folderId
- the folder idclearFilter
-true
to clear the search filter- Throws:
CmsException
- in case reading the folder fails
-
updateCurrentFolder
protected void updateCurrentFolder(java.util.Collection<CmsUUID> removeIds)
Updates the current folder and removes the given resource items.- Parameters:
removeIds
- the resource item ids to remove
-
-