Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 1.65 KB

how-to-modify-layout.md

File metadata and controls

37 lines (25 loc) · 1.65 KB

SCION Workbench

SCION Workbench Projects Overview Changelog Contributing Sponsoring

The workbench layout is a grid of parts. Parts are aligned relative to each other. A part is a stack of views. Content is displayed in views.

How to modify the workbench layout

The workbench layout can be modified using the navigate method of the WorkbenchRouter by passing a function. The router will invoke this function with the current workbench layout. The layout has methods for modifying it. The layout is immutable, so each modification creates a new instance. Use the instance for further modifications and finally return it.

The following example adds a part to the left of the main area, inserts a view and navigates it.

import {inject} from '@angular/core';
import {MAIN_AREA, WorkbenchRouter} from '@scion/workbench';

inject(WorkbenchRouter).navigate(layout => layout
  .addPart('left', {relativeTo: MAIN_AREA, align: 'left'})
  .addView('navigator', {partId: 'left'})
  .navigateView('navigator', ['path/to/view'])
  .activateView('navigator')
);

The function can call inject to get any required dependencies.