@@ -9,6 +9,10 @@ import WidgetFactory from './WidgetFactory';
99import TabsetIconFactory from './TabsetIconFactory'
1010import defaultLayoutConfiguration from './layoutConf.json' ;
1111import simulateLayoutConfiguration from './simulateLayoutConf.json' ;
12+ import Icon from '@material-ui/core/Icon' ;
13+
14+ import { withStyles } from '@material-ui/core/styles'
15+
1216
1317/**
1418 * Transforms a widget configutation into a flexlayout node descriptor
@@ -29,7 +33,20 @@ function widget2Node (configuration) {
2933 } ;
3034}
3135
32- export default class LayoutManager extends Component {
36+ const styles = ( { spacing } ) => ( {
37+ container : {
38+ position : 'relative' ,
39+ flexGrow : 1 ,
40+ display : 'flex' ,
41+ flexDirection : 'row' ,
42+ alignItems : 'stretch'
43+ } ,
44+ spacer : { width : spacing ( 1 ) } ,
45+ flexlayout : { position : 'relative' , flexGrow : 1 }
46+ } )
47+
48+
49+ class LayoutManager extends Component {
3350
3451 constructor ( props ) {
3552 super ( props ) ;
@@ -256,31 +273,31 @@ export default class LayoutManager extends Component {
256273 model . doAction ( FlexLayout . Actions . moveNode ( node . getId ( ) , 'bottomPanel' , FlexLayout . DockLocation . CENTER , 0 ) ) ;
257274 }
258275
259- onRenderTabSet ( panel , renderValues ) {
260- const model = this . getModel ( )
261- if ( panel . getType ( ) === "tabset" ) {
262- if ( panel . getId ( ) != 'leftPanel' && panel . getChildren ( ) . length > 0 ) {
263- renderValues . buttons . push ( < div key = { panel . getId ( ) } className = "fa fa-window-minimize customIconFlexLayout" onClick = { ( ) => {
264- model . doAction ( FlexLayout . Actions . moveNode ( panel . getSelectedNode ( ) . getId ( ) , "border_bottom" , FlexLayout . DockLocation . CENTER , 0 ) ) ;
265- } } /> ) ;
266- }
267- }
276+ onRenderTab ( node , renderValues ) {
277+ renderValues . leading = < Icon className = { node . getConfig ( ) . icon } />
268278 }
269279 render ( ) {
270-
280+ const { classes } = this . props
271281 return (
272- < div style = { { position : 'relative' , flexGrow : 1 } } >
273- < FlexLayout . Layout
274- ref = "layout"
275- model = { this . getModel ( ) }
276- factory = { this . factory . bind ( this ) }
277- iconFactory = { this . iconFactory . bind ( this ) }
278- onAction = { action => this . onAction ( action ) }
279- clickOnBordersAction = { node => this . clickOnBordersAction ( node ) }
280- onRenderTabSet = { ( node , renderValues ) => this . onRenderTabSet ( node , renderValues ) }
281- />
282-
282+ < div className = { classes . container } >
283+ < div className = { classes . spacer } />
284+ < div className = { classes . flexlayout } >
285+ < FlexLayout . Layout
286+ ref = "layout"
287+ model = { this . getModel ( ) }
288+ factory = { this . factory . bind ( this ) }
289+ iconFactory = { this . iconFactory . bind ( this ) }
290+ onAction = { action => this . onAction ( action ) }
291+ clickOnBordersAction = { node => this . clickOnBordersAction ( node ) }
292+ onRenderTab = { ( node , renderValues ) => this . onRenderTab ( node , renderValues ) }
293+ />
294+ </ div >
295+
296+ < div className = { classes . spacer } />
283297 </ div >
284298 )
285299 }
286- }
300+ }
301+
302+
303+ export default withStyles ( styles ) ( LayoutManager )
0 commit comments