Class: FolderTreeService
molecule.FolderTreeService
Hierarchy
↳
FolderTreeService
Implements
Constructors
constructor
• new FolderTreeService()
Overrides
Defined in
src/services/workbench/explorer/folderTreeService.ts:153
Properties
builtinService
• Private
Readonly
builtinService: IBuiltinService
Defined in
src/services/workbench/explorer/folderTreeService.ts:149
explorerService
• Private
Readonly
explorerService: IExplorerService
Defined in
src/services/workbench/explorer/folderTreeService.ts:148
fileContextMenu
• Private
fileContextMenu: IMenuItemProps
[] = []
Defined in
src/services/workbench/explorer/folderTreeService.ts:150
folderContextMenu
• Private
folderContextMenu: IMenuItemProps
[] = []
Defined in
src/services/workbench/explorer/folderTreeService.ts:151
state
• Protected
state: IFolderTree
Implementation of
Overrides
Defined in
src/services/workbench/explorer/folderTreeService.ts:147
Methods
add
▸ add(data
, id?
): void
Add data into folder tree
Parameters
Name | Type |
---|---|
data | IFolderTreeNodeProps |
id? | UniqueId |
Returns
void
Implementation of
Defined in
src/services/workbench/explorer/folderTreeService.ts:316
addRootFolder
▸ Private
addRootFolder(folder
): void
Parameters
Name | Type |
---|---|
folder | IFolderTreeNodeProps |
Returns
void
Defined in
src/services/workbench/explorer/folderTreeService.ts:253
count
▸ count(name
): number
Count the service event
Parameters
Name | Type | Description |
---|---|---|
name | string | Event name |
Returns
number
Implementation of
Inherited from
Defined in
src/common/event/eventBus.ts:28
emit
▸ emit(name
, ...args
): void
Emit the service event
Parameters
Name | Type | Description |
---|---|---|
name | string | Event name |
...args | any | Arguments |
Returns
void
Implementation of
Inherited from
Defined in
src/common/event/eventBus.ts:20
forceUpdate
▸ forceUpdate(): void
Force to update the Component
Returns
void
Implementation of
IFolderTreeService.forceUpdate
Inherited from
Defined in
get
▸ get(id
): null
| IFolderTreeNodeProps
Get specific data in folder tree
Parameters
Name | Type |
---|---|
id | UniqueId |
Returns
null
| IFolderTreeNodeProps
Implementation of
Defined in
src/services/workbench/explorer/folderTreeService.ts:414
getCurrentRootFolderInfo
▸ Private
getCurrentRootFolderInfo(id
): { currentRootFolder
: null
= null; index
: number
= -1; tree
: null
= null } | { currentRootFolder
: IFolderTreeNodeProps
; index
: number
; tree
: TreeViewUtil
<IFolderTreeNodeProps
> }
Parameters
Name | Type |
---|---|
id | UniqueId |
Returns
{ currentRootFolder
: null
= null; index
: number
= -1; tree
: null
= null } | { currentRootFolder
: IFolderTreeNodeProps
; index
: number
; tree
: TreeViewUtil
<IFolderTreeNodeProps
> }
Defined in
src/services/workbench/explorer/folderTreeService.ts:280
getFileContextMenu
▸ getFileContextMenu(): IMenuItemProps
[]
Get the context menus for file
Returns
Implementation of
IFolderTreeService.getFileContextMenu
Defined in
src/services/workbench/explorer/folderTreeService.ts:208
getFolderContextMenu
▸ getFolderContextMenu(): IMenuItemProps
[]
Get the context menus for folder
Returns
Implementation of
IFolderTreeService.getFolderContextMenu
Defined in
src/services/workbench/explorer/folderTreeService.ts:216
getPosOfType
▸ Private
getPosOfType(type
, folderList
): number
Parameters
Name | Type |
---|---|
type | "File" | "Folder" | "RootFolder" |
folderList | IFolderTreeNodeProps [] |
Returns
number
Defined in
src/services/workbench/explorer/folderTreeService.ts:301
getRootFolderById
▸ Private
getRootFolderById(id
): null
| IFolderTreeNodeProps
Returns the node of root folder in folderTree
Parameters
Name | Type |
---|---|
id | UniqueId |
Returns
null
| IFolderTreeNodeProps
Defined in
src/services/workbench/explorer/folderTreeService.ts:241
getRootFolderIndex
▸ Private
getRootFolderIndex(id
): number
Parameters
Name | Type |
---|---|
id | UniqueId |
Returns
number
Defined in
src/services/workbench/explorer/folderTreeService.ts:274
getState
▸ getState(): IFolderTree
Get the Component state
Returns
Implementation of
Inherited from
Defined in
isHiddenFile
▸ Private
isHiddenFile(file
): boolean
Parameters
Name | Type |
---|---|
file | IFolderTreeNodeProps |
Returns
boolean
Defined in
src/services/workbench/explorer/folderTreeService.ts:160
onContextMenu
▸ onContextMenu(callback
): void
Listen to the click event about the context menu except for built-in menus
Parameters
Name | Type |
---|---|
callback | (contextMenu : IMenuItemProps , treeNode? : IFolderTreeNodeProps ) => void |
Returns
void
Implementation of
IFolderTreeService.onContextMenu
Defined in
src/services/workbench/explorer/folderTreeService.ts:485
onCreate
▸ onCreate(callback
): void
Listen to create a node for folder tree
Parameters
Name | Type |
---|---|
callback | (type : "File" | "Folder" | "RootFolder" , nodeId? : UniqueId ) => void |
Returns
void
Implementation of
Defined in
src/services/workbench/explorer/folderTreeService.ts:479
onDropTree
▸ onDropTree(callback
): void
Listen to drop event
Parameters
Name | Type |
---|---|
callback | (source : IFolderTreeNodeProps , target : IFolderTreeNodeProps ) => void |
Returns
void
Implementation of
Defined in
src/services/workbench/explorer/folderTreeService.ts:461
onLoadData
▸ onLoadData(callback
): void
Callback for load folder tree data
Parameters
Name | Type |
---|---|
callback | (treeNode : IFolderTreeNodeProps , callback : (treeNode : IFolderTreeNodeProps ) => void ) => void |
Returns
void
Implementation of
Defined in
src/services/workbench/explorer/folderTreeService.ts:494
onRemove
▸ onRemove(callback
): void
Listen to remove a node
Parameters
Name | Type |
---|---|
callback | (id : UniqueId ) => void |
Returns
void
Implementation of
Defined in
src/services/workbench/explorer/folderTreeService.ts:449
onRename
▸ onRename(callback
): void
Listen to event about clicking rename button
Parameters
Name | Type |
---|---|
callback | (id : UniqueId ) => void |
Returns
void
Implementation of
Defined in
src/services/workbench/explorer/folderTreeService.ts:445
onRightClick
▸ onRightClick(callback
): void
Listen to right click event
Parameters
Name | Type |
---|---|
callback | (treeData : IFolderTreeNodeProps , menus : IMenuItemProps []) => void |
Returns
void
Implementation of
IFolderTreeService.onRightClick
Defined in
src/services/workbench/explorer/folderTreeService.ts:470
onSelectFile
▸ onSelectFile(callback
): void
Listen to select a file
Parameters
Name | Type |
---|---|
callback | (file : IFolderTreeNodeProps ) => void |
Returns
void
Implementation of
IFolderTreeService.onSelectFile
Defined in
src/services/workbench/explorer/folderTreeService.ts:457
onUpdateFileName
▸ onUpdateFileName(callback
): void
Listen to update file or folder name
Parameters
Name | Type |
---|---|
callback | (file : IFolderTreeNodeProps ) => void |
Returns
void
Implementation of
IFolderTreeService.onUpdateFileName
Defined in
src/services/workbench/explorer/folderTreeService.ts:453
onUpdateState
▸ onUpdateState(callback
): void
Listen to the Component state update event
Parameters
Name | Type |
---|---|
callback | (prevState : IFolderTree , nextState : IFolderTree ) => void |
Returns
void
Implementation of
IFolderTreeService.onUpdateState
Inherited from
Defined in
remove
▸ remove(id
): void
Remove specific data in folder tree
Parameters
Name | Type |
---|---|
id | UniqueId |
Returns
void
Implementation of
Defined in
src/services/workbench/explorer/folderTreeService.ts:369
removeOnUpdateState
▸ removeOnUpdateState(): void
Remove the Component update event listening
Returns
void
Implementation of
IFolderTreeService.removeOnUpdateState
Inherited from
Defined in
render
▸ render(nextState?
): void
Initiative notify the component to render the view by the state
Parameters
Name | Type |
---|---|
nextState? | IFolderTree |
Returns
void
Implementation of
Inherited from
Defined in
reset
▸ reset(): void
Reset the FolderTreeService state
Returns
void
Implementation of
Defined in
src/services/workbench/explorer/folderTreeService.ts:196
setActive
▸ setActive(id?
): void
Active specific node, or unactive any node in folder tree
Parameters
Name | Type |
---|---|
id? | UniqueId |
Returns
void
Implementation of
Defined in
src/services/workbench/explorer/folderTreeService.ts:425
setCurrentFolderLocation
▸ Private
setCurrentFolderLocation(data
, id
): void
Parameters
Name | Type |
---|---|
data | IFolderTreeNodeProps |
id | UniqueId |
Returns
void
Defined in
src/services/workbench/explorer/folderTreeService.ts:224
setEntry
▸ setEntry(entry
): void
Set a entry page for folder tree
Parameters
Name | Type |
---|---|
entry | ReactNode |
Returns
void
Implementation of
Defined in
src/services/workbench/explorer/folderTreeService.ts:439
setFileContextMenu
▸ setFileContextMenu(menus
): void
Set the context menus for file
Parameters
Name | Type |
---|---|
menus | IMenuItemProps [] |
Returns
void
Implementation of
IFolderTreeService.setFileContextMenu
Defined in
src/services/workbench/explorer/folderTreeService.ts:212
setFolderContextMenu
▸ setFolderContextMenu(menus
): void
Set the context menus for folder
Parameters
Name | Type |
---|---|
menus | IMenuItemProps [] |
Returns
void
Implementation of
IFolderTreeService.setFolderContextMenu
Defined in
src/services/workbench/explorer/folderTreeService.ts:220
setState
▸ setState(values
, callback?
): void
Set the state values, and notify the view component to re render
Parameters
Name | Type | Description |
---|---|---|
values | Partial <IFolderTree > | update target state values |
callback? | (prevState : IFolderTree , nextState : IFolderTree ) => void | - |
Returns
void
Implementation of
Inherited from
Defined in
sortTree
▸ Private
sortTree(tree
): void
Parameters
Name | Type |
---|---|
tree | IFolderTreeNodeProps [] |
Returns
void
Defined in
src/services/workbench/explorer/folderTreeService.ts:164
subscribe
▸ subscribe(name
, callback
): void
Subscribe the service event
Parameters
Name | Type | Description |
---|---|---|
name | string | string [] | Event name |
callback | Function | Callback function |
Returns
void
Implementation of
Inherited from
Defined in
src/common/event/eventBus.ts:11
unsubscribe
▸ unsubscribe(name
): void
Unsubscribe the specific event
Parameters
Name | Type | Description |
---|---|---|
name | any | The event name |
Returns
void
Implementation of
IFolderTreeService.unsubscribe
Inherited from
Defined in
src/common/event/eventBus.ts:37
update
▸ update(data
): void
Update specific data in folder tree
Parameters
Name | Type |
---|---|
data | IFolderTreeNodeProps |
Returns
void