@@ -46,9 +46,10 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
4646 PADDING : 10 ,
4747 SPACING_IN : 5 ,
4848 SPACING : 15 ,
49+ ICON_SIZE : 32 ,
4950 // TITLE_MAX_HEIGHT: 34, // two lines in Roboto
5051 TITLE_MAX_HEIGHT : 40 , // two lines in Manrope
51- ICON_SIZE : 50 ,
52+ THUMBNAIL_SIZE : 50 ,
5253 POS : {
5354 TITLE : {
5455 row : 0 ,
@@ -138,18 +139,20 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
138139 } ) ;
139140 break ;
140141 }
141- case "header" :
142- control = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 5 ) ) . set ( {
143- anonymous : true ,
144- allowGrowX : true ,
145- allowShrinkX : false ,
146- alignY : "middle" ,
147- padding : this . self ( ) . PADDING
142+ case "header" : {
143+ const hGrid = new qx . ui . layout . Grid ( ) . set ( {
144+ spacing : 0 , // the sub-elements will take care of the padding
148145 } ) ;
149- control . set ( {
150- backgroundColor : "background-card-overlay"
146+ hGrid . setColumnFlex ( 1 , 1 ) ;
147+ control = new qx . ui . container . Composite ( ) . set ( {
148+ backgroundColor : "background-card-overlay" ,
149+ padding : 0 ,
150+ maxWidth : this . self ( ) . ITEM_WIDTH ,
151+ maxHeight : this . self ( ) . ITEM_HEIGHT
151152 } ) ;
153+ control . setLayout ( hGrid ) ;
152154 break ;
155+ }
153156 case "body" :
154157 control = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 5 ) ) . set ( {
155158 decorator : "main" ,
@@ -175,53 +178,51 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
175178 control . setLayout ( fGrid ) ;
176179 break ;
177180 }
178- case "title-row" :
179- control = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 6 ) ) . set ( {
180- anonymous : true ,
181- maxWidth : this . self ( ) . ITEM_WIDTH - 2 * this . self ( ) . PADDING
182- } ) ;
183- layout = this . getChildControl ( "header" ) ;
184- layout . addAt ( control , 1 , {
185- flex : 1
186- } ) ;
187- break ;
188181 case "icon" : {
189- layout = this . getChildControl ( "body" ) ;
190- const maxWidth = this . self ( ) . ITEM_WIDTH ;
191- control = new osparc . ui . basic . Thumbnail ( null , maxWidth , 124 ) ;
182+ control = new osparc . ui . basic . Thumbnail ( null , this . self ( ) . ICON_SIZE , this . self ( ) . ICON_SIZE ) . set ( {
183+ minHeight : this . self ( ) . ICON_SIZE ,
184+ minWidth : this . self ( ) . ICON_SIZE ,
185+ } ) ;
192186 control . getChildControl ( "image" ) . set ( {
193187 anonymous : true ,
194- alignY : "middle " ,
195- alignX : "center " ,
188+ alignY : "top " ,
189+ alignX : "left " ,
196190 allowGrowX : true ,
197- allowGrowY : true
191+ allowGrowY : true ,
198192 } ) ;
199- layout . getContentElement ( ) . setStyles ( {
200- "border-width" : "0px"
193+ layout = this . getChildControl ( "header" ) ;
194+ layout . add ( control , {
195+ column : 0 ,
196+ row : 0 ,
201197 } ) ;
202- layout . add ( control , { flex : 1 } ) ;
203198 break ;
204199 }
205200 case "title" :
206201 control = new qx . ui . basic . Label ( ) . set ( {
207202 textColor : "contrasted-text-light" ,
208203 font : "text-14" ,
204+ padding : this . self ( ) . PADDING ,
209205 maxWidth : this . self ( ) . ITEM_WIDTH - 2 * this . self ( ) . PADDING ,
210206 maxHeight : this . self ( ) . TITLE_MAX_HEIGHT
211207 } ) ;
212- layout = this . getChildControl ( "title-row " ) ;
208+ layout = this . getChildControl ( "header " ) ;
213209 layout . addAt ( control , 0 , {
214- flex : 1
210+ column : 1 ,
211+ row : 0 ,
215212 } ) ;
216213 break ;
217214 case "subtitle" :
218215 control = new qx . ui . container . Composite ( new qx . ui . layout . HBox ( 6 ) ) . set ( {
219216 anonymous : true ,
220- height : 20
217+ height : 20 ,
218+ padding : 6 ,
219+ paddingLeft : 20 , // align with icon
221220 } ) ;
222- layout = this . getChildControl ( "title-row" ) ;
223- layout . addAt ( control , 1 , {
224- flex : 1
221+ layout = this . getChildControl ( "header" ) ;
222+ layout . addAt ( control , 0 , {
223+ column : 0 ,
224+ row : 1 ,
225+ colSpan : 2 ,
225226 } ) ;
226227 break ;
227228 case "subtitle-icon" : {
@@ -293,23 +294,27 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
293294
294295 // overridden
295296 _applyIcon : function ( value , old ) {
296- console . log ( "show icon" , value ) ;
297+ const image = this . getChildControl ( "icon" ) . getChildControl ( "image" ) ;
298+ image . set ( {
299+ source : value ,
300+ decorator : "rounded" ,
301+ } ) ;
297302 } ,
298303
299304 // overridden
300305 _applyThumbnail : function ( value , old ) {
301306 if ( value . includes ( "@FontAwesome5Solid/" ) ) {
302- value += this . self ( ) . ICON_SIZE ;
307+ value += this . self ( ) . THUMBNAIL_SIZE ;
303308 const image = this . getChildControl ( "thumbnail" ) . getChildControl ( "image" ) ;
304309 image . set ( {
305- source : value
310+ source : value ,
306311 } ) ;
307312
308313 [
309314 "appear" ,
310315 "loaded"
311316 ] . forEach ( eventName => {
312- image . addListener ( eventName , ( ) => this . __fitIconHeight ( ) , this ) ;
317+ image . addListener ( eventName , ( ) => this . __fitThumbnailHeight ( ) , this ) ;
313318 } ) ;
314319 } else {
315320 this . getContentElement ( ) . setStyles ( {
@@ -334,8 +339,8 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
334339 return ;
335340 } ,
336341
337- __fitIconHeight : function ( ) {
338- const iconLayout = this . getChildControl ( "icon " ) ;
342+ __fitThumbnailHeight : function ( ) {
343+ const thumbnailLayout = this . getChildControl ( "thumbnail " ) ;
339344 let maxHeight = this . getHeight ( ) - this . getPaddingTop ( ) - this . getPaddingBottom ( ) - 5 ;
340345 const checkThis = [
341346 "title" ,
@@ -355,9 +360,9 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
355360 } ) ;
356361 // maxHeight -= 4; // for Roboto
357362 maxHeight -= 18 ; // for Manrope
358- iconLayout . getChildControl ( "image" ) . setMaxHeight ( maxHeight ) ;
359- iconLayout . setMaxHeight ( maxHeight ) ;
360- iconLayout . recheckSize ( ) ;
363+ thumbnailLayout . getChildControl ( "image" ) . setMaxHeight ( maxHeight ) ;
364+ thumbnailLayout . setMaxHeight ( maxHeight ) ;
365+ thumbnailLayout . recheckSize ( ) ;
361366 } ,
362367
363368 replaceIcon : function ( newIcon ) {
0 commit comments