Class: WorkspaceClient

Workspace Client

The workspace client manages all calls to load, save, rename, and delete workspaces. Before reading this, please check out workspaces.

Members

activeWorkspaceWorkspaceClient

Reference to the activeWorkspace

workspaceIsDirtyWorkspaceClient

Whether the active workspace is dirty.

workspacesWorkspaceClient

List of workspaces available to the application.

Methods

autoArrange
(cb)

clients/workspaceClient.js, line 68

AutoArranges windows.

Name Type Description
cb function optional

Callback

Example
FSBL.Clients.WorkspaceClient.autoArrange(function(err, response){
		//do something after the autoarrange, maybe make all of the windows flash or notify the user that their monitor is now tidy.
});

bringWindowsToFront
(params, cb)

clients/workspaceClient.js, line 82

Brings all windows to the front.

TODO
  • rename to something like bringToFront and put the 'Only affects visible windows' bit in the documentation.
Name Type Description
params object
Name Type Description
monitorDimensions object

The dimensions of the monitor where windows should be brought forward.

cb function optional

Callback.

Example
FSBL.Clients.WorkspaceClient.bringWindowsToFront();

clone
(params, cb)

clients/workspaceClient.js, line 263

Makes a clone of the workspace.

Name Type Description
params object
Name Type Description
name string

Name of workspace to clone.

cb function

Callback

Example

This method is used to clone workspaces.

FSBL.Clients.WorkspaceClient.clone({	 		
		name: 'The best workspace'
	  }, function(err, response){
	 		//Do something.
	  });

createNewWorkspace
(cb)

clients/workspaceClient.js, line 390

Creates a new workspace. if "New Workspace" is already created, it increments the name.

Name Type Description
cb function

Callback

Example

This function creates the workspace 'My Workspace'.

FSBL.Clients.WorkspaceClient.createNewWorkspace({	 
		name: 'My Workspace',		
	  }, function(err, response){
	 		//Do something like notify the user that the workspace has been created.
	  });

getActiveWorkspace
(cb)

clients/workspaceClient.js, line 107

Gets the currently active workspace.

Name Type Description
cb function

Callback

Example

This function is useful for setting the initial state of a menu or dialog. It is used in the toolbar component to set the initial state.

FSBL.Clients.WorkspaceClient.getActiveWorkspace(function (err, response) {
		//setState is a React component method.
		self.setState({
			workspaces: response
		});
	});

getWorkspaces
(cb)

clients/workspaceClient.js, line 134

Returns the list of saved workspaces.

Name Type Description
cb function

Callback

Example

This function is useful for setting the initial state of a menu or dialog.

FSBL.Clients.WorkspaceClient.getWorkspaces(function (err, response) {
		//setState is a React component method.
		self.setState({
			workspaces: response
		});
	});

isWorkspaceDirty
(cb)

clients/workspaceClient.js, line 367

Checks to see if the workspace is dirty. If it's already dirty, the window doesn't need to compare its state to the saved state.

Name Type Description
cb function

Callback

Example

This function will let you know if the activeWorkspace is dirty.

FSBL.Clients.WorkspaceClient.isWorkspaceDirty(function(err, response){
	 		//Do something like prompt the user if they'd like to save the currently loaded workspace before switching.
	  });

remove
(params, cb)

clients/workspaceClient.js, line 165

Removes a workspace. Either the workspace object or its name must be provided.

Name Type Description
params object
Name Type Default Description
persist Boolean false optional

Whether to persist the change.

workspace Object optional

Workspace

name string optional

Workspace Name

cb function optional

Callback to fire after 'WorkspaceService.update' is transmitted.

Example

This function removes 'My Workspace' from the main menu and the default storage tied to the applicaton.

FSBL.Clients.WorkspaceClient.remove({	 
		name: 'My Workspace',
		persist: true
	  }, function(err, response){
	 		//You typically won't do anything here. If you'd like to do something when a workspace change happens, we suggest listening on the `WorkspaceService.update` channel.
	  });

removeWindow
(params, cb)

clients/workspaceClient.js, line 198

Removes window from active workspace.

Name Type Description
params object
Name Type Description
name string

Window name

cb function optional

Callback

Example

This method removes a window from a workspace. It is rarely called by the developer. It is called when a window that is using the window manager is closed. That way, the next time the app is loaded, that window is not spawned.

FSBL.Clients.WorkspaceClient.removeWindow({name:windowName}, function(err, response){
		 //do something after removing the window.
	 });

rename
(params, cb)

clients/workspaceClient.js, line 231

Renames the workspace with the provided name. Also removes all references in storage to the old workspace's name.

Name Type Description
params object
Name Type Default Description
oldName string

Name of workspace to rename.

newName string

What to rename the workspace to.

removeOldWorkspace boolean true optional

Whether to remove references to old workspace after renaming.

overwriteExisting boolean false optional

Whether to overwrite an existing workspace.

cb function optional

Callback

Example

This method is used to rename workspaces. It is used in the main Menu component.

FSBL.Clients.WorkspaceClient.rename({	 
		oldName: 'My Workspace',
		newName: 'The best workspace',
		removeOldWorkspace: true,
	  }, function(err, response){
	 		//Do something.
	  });

save
(cb)

clients/workspaceClient.js, line 288

Saves the currently active workspace. It does not overwrite the saved instance of the workspace. It simply overwrites the activeWorkspace key in storage.

Name Type Description
cb function

Callback

Example

This function persists the currently active workspace.

FSBL.Clients.WorkspaceClient.save(function(err, response){
	 		//Do something.
	  });

saveAs
(params, cb)

clients/workspaceClient.js, line 321

Saves the currently active workspace with the provided name.

Name Type Description
params object
Name Type Default Description
name string

new name to save workspace under.

force string false optional

Whether to overwrite a workspace already saved with the provided name.

cb function

Callback

Example

This function persists the currently active workspace with the provided name.

FSBL.Clients.WorkspaceClient.saveAs({	 
		name: 'My Workspace',		
	  }, function(err, response){
	 		//Do something.
	  });

switchTo
(params, cb)

clients/workspaceClient.js, line 354

Switches to a workspace.

Name Type Description
params object
Name Type Description
name string

Workspace Name

cb function

Callback

Example

This function loads the workspace 'My Workspace' from the storage tied to the application.

FSBL.Clients.WorkspaceClient.switchTo({	 
		name: 'My Workspace',		
	  }, function(err, response){
	 		//Do something.
	  });