Skip to main content
Version: 0.9.0-beta.2

Class: FolderTreeService

molecule.FolderTreeService

Hierarchy

Implements

Constructors

constructor

new FolderTreeService()

Overrides

Component.constructor

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

IFolderTreeService.state

Overrides

Component.state

Defined in

src/services/workbench/explorer/folderTreeService.ts:147

Methods

add

add(data, id?): void

Add data into folder tree

Parameters

NameType
dataIFolderTreeNodeProps
id?UniqueId

Returns

void

Implementation of

IFolderTreeService.add

Defined in

src/services/workbench/explorer/folderTreeService.ts:316


addRootFolder

Private addRootFolder(folder): void

Parameters

NameType
folderIFolderTreeNodeProps

Returns

void

Defined in

src/services/workbench/explorer/folderTreeService.ts:253


count

count(name): number

Count the service event

Parameters

NameTypeDescription
namestringEvent name

Returns

number

Implementation of

IFolderTreeService.count

Inherited from

Component.count

Defined in

src/common/event/eventBus.ts:28


emit

emit(name, ...args): void

Emit the service event

Parameters

NameTypeDescription
namestringEvent name
...argsanyArguments

Returns

void

Implementation of

IFolderTreeService.emit

Inherited from

Component.emit

Defined in

src/common/event/eventBus.ts:20


forceUpdate

forceUpdate(): void

Force to update the Component

Returns

void

Implementation of

IFolderTreeService.forceUpdate

Inherited from

Component.forceUpdate

Defined in

src/react/component.ts:79


get

get(id): null | IFolderTreeNodeProps

Get specific data in folder tree

Parameters

NameType
idUniqueId

Returns

null | IFolderTreeNodeProps

Implementation of

IFolderTreeService.get

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

NameType
idUniqueId

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

IMenuItemProps[]

Implementation of

IFolderTreeService.getFileContextMenu

Defined in

src/services/workbench/explorer/folderTreeService.ts:208


getFolderContextMenu

getFolderContextMenu(): IMenuItemProps[]

Get the context menus for folder

Returns

IMenuItemProps[]

Implementation of

IFolderTreeService.getFolderContextMenu

Defined in

src/services/workbench/explorer/folderTreeService.ts:216


getPosOfType

Private getPosOfType(type, folderList): number

Parameters

NameType
type"File" | "Folder" | "RootFolder"
folderListIFolderTreeNodeProps[]

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

NameType
idUniqueId

Returns

null | IFolderTreeNodeProps

Defined in

src/services/workbench/explorer/folderTreeService.ts:241


getRootFolderIndex

Private getRootFolderIndex(id): number

Parameters

NameType
idUniqueId

Returns

number

Defined in

src/services/workbench/explorer/folderTreeService.ts:274


getState

getState(): IFolderTree

Get the Component state

Returns

IFolderTree

Implementation of

IFolderTreeService.getState

Inherited from

Component.getState

Defined in

src/react/component.ts:83


isHiddenFile

Private isHiddenFile(file): boolean

Parameters

NameType
fileIFolderTreeNodeProps

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

NameType
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

NameType
callback(type: "File" | "Folder" | "RootFolder", nodeId?: UniqueId) => void

Returns

void

Implementation of

IFolderTreeService.onCreate

Defined in

src/services/workbench/explorer/folderTreeService.ts:479


onDropTree

onDropTree(callback): void

Listen to drop event

Parameters

NameType
callback(source: IFolderTreeNodeProps, target: IFolderTreeNodeProps) => void

Returns

void

Implementation of

IFolderTreeService.onDropTree

Defined in

src/services/workbench/explorer/folderTreeService.ts:461


onLoadData

onLoadData(callback): void

Callback for load folder tree data

Parameters

NameType
callback(treeNode: IFolderTreeNodeProps, callback: (treeNode: IFolderTreeNodeProps) => void) => void

Returns

void

Implementation of

IFolderTreeService.onLoadData

Defined in

src/services/workbench/explorer/folderTreeService.ts:494


onRemove

onRemove(callback): void

Listen to remove a node

Parameters

NameType
callback(id: UniqueId) => void

Returns

void

Implementation of

IFolderTreeService.onRemove

Defined in

src/services/workbench/explorer/folderTreeService.ts:449


onRename

onRename(callback): void

Listen to event about clicking rename button

Parameters

NameType
callback(id: UniqueId) => void

Returns

void

Implementation of

IFolderTreeService.onRename

Defined in

src/services/workbench/explorer/folderTreeService.ts:445


onRightClick

onRightClick(callback): void

Listen to right click event

Parameters

NameType
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

NameType
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

NameType
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

NameType
callback(prevState: IFolderTree, nextState: IFolderTree) => void

Returns

void

Implementation of

IFolderTreeService.onUpdateState

Inherited from

Component.onUpdateState

Defined in

src/react/component.ts:71


remove

remove(id): void

Remove specific data in folder tree

Parameters

NameType
idUniqueId

Returns

void

Implementation of

IFolderTreeService.remove

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

Component.removeOnUpdateState

Defined in

src/react/component.ts:75


render

render(nextState?): void

Initiative notify the component to render the view by the state

Parameters

NameType
nextState?IFolderTree

Returns

void

Implementation of

IFolderTreeService.render

Inherited from

Component.render

Defined in

src/react/component.ts:67


reset

reset(): void

Reset the FolderTreeService state

Returns

void

Implementation of

IFolderTreeService.reset

Defined in

src/services/workbench/explorer/folderTreeService.ts:196


setActive

setActive(id?): void

Active specific node, or unactive any node in folder tree

Parameters

NameType
id?UniqueId

Returns

void

Implementation of

IFolderTreeService.setActive

Defined in

src/services/workbench/explorer/folderTreeService.ts:425


setCurrentFolderLocation

Private setCurrentFolderLocation(data, id): void

Parameters

NameType
dataIFolderTreeNodeProps
idUniqueId

Returns

void

Defined in

src/services/workbench/explorer/folderTreeService.ts:224


setEntry

setEntry(entry): void

Set a entry page for folder tree

Parameters

NameType
entryReactNode

Returns

void

Implementation of

IFolderTreeService.setEntry

Defined in

src/services/workbench/explorer/folderTreeService.ts:439


setFileContextMenu

setFileContextMenu(menus): void

Set the context menus for file

Parameters

NameType
menusIMenuItemProps[]

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

NameType
menusIMenuItemProps[]

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

NameTypeDescription
valuesPartial<IFolderTree>update target state values
callback?(prevState: IFolderTree, nextState: IFolderTree) => void-

Returns

void

Implementation of

IFolderTreeService.setState

Inherited from

Component.setState

Defined in

src/react/component.ts:54


sortTree

Private sortTree(tree): void

Parameters

NameType
treeIFolderTreeNodeProps[]

Returns

void

Defined in

src/services/workbench/explorer/folderTreeService.ts:164


subscribe

subscribe(name, callback): void

Subscribe the service event

Parameters

NameTypeDescription
namestring | string[]Event name
callbackFunctionCallback function

Returns

void

Implementation of

IFolderTreeService.subscribe

Inherited from

Component.subscribe

Defined in

src/common/event/eventBus.ts:11


unsubscribe

unsubscribe(name): void

Unsubscribe the specific event

Parameters

NameTypeDescription
nameanyThe event name

Returns

void

Implementation of

IFolderTreeService.unsubscribe

Inherited from

Component.unsubscribe

Defined in

src/common/event/eventBus.ts:37


update

update(data): void

Update specific data in folder tree

Parameters

NameType
dataIFolderTreeNodeProps

Returns

void

Implementation of

IFolderTreeService.update

Defined in

src/services/workbench/explorer/folderTreeService.ts:389