Skip to content
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.

Commit

Permalink
more generic name for the renderers
Browse files Browse the repository at this point in the history
  • Loading branch information
sccolbert committed Jun 16, 2016
1 parent 50f3212 commit 6e72e84
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 19 deletions.
36 changes: 18 additions & 18 deletions src/ui/splitpanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ class SplitPanel extends Panel {
}

/**
* The handle renderer used by the split panel.
* The renderer used by the split panel.
*
* #### Notes
* This is a read-only property.
*/
get renderer(): SplitPanel.IHandleRenderer {
get renderer(): SplitPanel.IRenderer {
return (this.layout as SplitLayout).renderer;
}

Expand Down Expand Up @@ -398,22 +398,22 @@ namespace SplitPanel {
type Orientation = SplitLayout.Orientation;

/**
* A type alias for a split handler renderer;
* A type alias for a split panel renderer;
*/
export
type IHandleRenderer = SplitLayout.IHandleRenderer;
type IRenderer = SplitLayout.IRenderer;

/**
* An options object for initializing a split panel.
*/
export
interface IOptions {
/**
* The renderer to use for creating split handles.
* The renderer to use for the split panel.
*
* The default is a shared renderer instance.
*/
renderer?: IHandleRenderer;
renderer?: IRenderer;

/**
* The layout orientation of the panel.
Expand All @@ -440,14 +440,14 @@ namespace SplitPanel {
}

/**
* The default `IHandleRenderer` instance.
* The default `IRenderer` instance.
*/
export
const defaultRenderer: IHandleRenderer = {
const defaultRenderer: IRenderer = {
/**
* Create a new handle node for use with a split layout.
* Create a new handle node for use with a split panel.
*
* @returns A new handle node.
* @returns A new handle node for a split panel.
*/
createHandleNode: () => {
let node = document.createElement('div');
Expand Down Expand Up @@ -548,12 +548,12 @@ class SplitLayout extends PanelLayout {
}

/**
* The handle renderer used by the split layout.
* The renderer used by the split layout.
*
* #### Notes
* This is a read-only property.
*/
get renderer(): SplitLayout.IHandleRenderer {
get renderer(): SplitLayout.IRenderer {
return this._renderer;
}

Expand Down Expand Up @@ -993,9 +993,9 @@ class SplitLayout extends PanelLayout {
private _spacing = 4;
private _dirty = false;
private _box: IBoxSizing = null;
private _renderer: SplitLayout.IRenderer;
private _sizers = new Vector<BoxSizer>();
private _handles = new Vector<HTMLElement>();
private _renderer: SplitLayout.IHandleRenderer;
private _orientation: SplitLayout.Orientation = 'horizontal';
}

Expand All @@ -1017,9 +1017,9 @@ namespace SplitLayout {
export
interface IOptions {
/**
* The renderer to use for creating split handles.
* The renderer to use for the split layout.
*/
renderer: IHandleRenderer;
renderer: IRenderer;

/**
* The orientation of the layout.
Expand All @@ -1037,10 +1037,10 @@ namespace SplitLayout {
}

/**
* A renderer which creates handles for a split layout.
* A renderer for use with a split layout.
*/
export
interface IHandleRenderer {
interface IRenderer {
/**
* Create a new handle node for use with a split layout.
*
Expand Down Expand Up @@ -1137,7 +1137,7 @@ namespace Private {
* Create a new split handle node using the given renderer.
*/
export
function createHandle(renderer: SplitLayout.IHandleRenderer): HTMLElement {
function createHandle(renderer: SplitLayout.IRenderer): HTMLElement {
let node = renderer.createHandleNode();
node.style.position = 'absolute';
return node;
Expand Down
10 changes: 10 additions & 0 deletions src/ui/tabpanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,16 @@ class TabPanel extends Widget {
this._tabBar.tabsMovable = value;
}

/**
* The content renderer for the panel's tab bar.
*
* #### Notes
* This is a read-only property.
*/
get renderer(): TabBar.IContentRenderer {
return this._tabBar.renderer;
}

/**
* The tab bar associated with the tab panel.
*
Expand Down
2 changes: 1 addition & 1 deletion test/src/ui/splitpanel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
} from '../../../lib/ui/widget';


const customRenderer: SplitPanel.IHandleRenderer = {
const customRenderer: SplitPanel.IRenderer = {
createHandleNode: () => {
let node = document.createElement('div');
node.className = 'p-SplitPanel-handle customRenderer';
Expand Down
15 changes: 15 additions & 0 deletions test/src/ui/tabpanel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,21 @@ describe('ui/tabpanel', () => {

});

describe('#renderer', () => {

it('should be the content renderer for the panel', () => {
let renderer = Object.create(TabBar.defaultRenderer);
let panel = new TabPanel({ renderer });
expect(panel.renderer).to.be(renderer);
});

it('should be read-only', () => {
let panel = new TabPanel();
expect(() => { panel.renderer = null; }).to.throwError();
});

});

describe('#tabBar', () => {

it('should get the tab bar associated with the tab panel', () => {
Expand Down

0 comments on commit 6e72e84

Please sign in to comment.