@@ -43,35 +43,41 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
4343 statics : {
4444 ITEM_WIDTH : 190 ,
4545 ITEM_HEIGHT : 220 ,
46- PADDING : 10 ,
47- TITLE_PADDING : 6 ,
48- SPACING_IN : 5 ,
46+ PADDING : 6 ,
4947 SPACING : 15 ,
5048 THUMBNAIL_SIZE : 50 ,
5149 POS : {
5250 TITLE : {
5351 row : 0 ,
5452 column : 0 ,
55- rowSpan : 1 ,
56- colSpan : 4
5753 } ,
58- THUMBNAIL : {
59- row : 2 ,
54+ BODY : {
55+ row : 1 ,
6056 column : 0 ,
61- rowSpan : 1 ,
62- colSpan : 4
63- } ,
64- TAGS : {
65- row : 3 ,
66- column : 0
6757 } ,
6858 FOOTER : {
69- row : 4 ,
59+ row : 2 ,
7060 column : 0 ,
71- rowSpan : 1 ,
72- colSpan : 4
7361 }
7462 } ,
63+ HPOS : {
64+ ICON : {
65+ column : 0 ,
66+ row : 0 ,
67+ } ,
68+ TITLE : {
69+ column : 1 ,
70+ row : 0 ,
71+ } ,
72+ SUBTITLE_ICON : {
73+ column : 0 ,
74+ row : 1 ,
75+ } ,
76+ SUBTITLE_TEXT : {
77+ column : 1 ,
78+ row : 1 ,
79+ } ,
80+ } ,
7581 FPOS : {
7682 MODIFIED : {
7783 row : 0 ,
@@ -97,7 +103,7 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
97103 row : 1 ,
98104 column : 2 ,
99105 }
100- }
106+ } ,
101107 } ,
102108
103109 events : {
@@ -113,20 +119,21 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
113119 switch ( id ) {
114120 case "main-layout" : {
115121 const grid = new qx . ui . layout . Grid ( ) ;
116- grid . setSpacing ( this . self ( ) . SPACING_IN ) ;
117- grid . setRowFlex ( 2 , 1 ) ;
122+ grid . setRowFlex ( this . self ( ) . POS . BODY . row , 1 ) ;
118123 grid . setColumnFlex ( 0 , 1 ) ;
119124
120125 control = new qx . ui . container . Composite ( ) . set ( {
126+ minWidth : this . self ( ) . ITEM_WIDTH ,
127+ minHeight : this . self ( ) . ITEM_HEIGHT ,
121128 maxWidth : this . self ( ) . ITEM_WIDTH ,
122- maxHeight : this . self ( ) . ITEM_HEIGHT
129+ maxHeight : this . self ( ) . ITEM_HEIGHT ,
123130 } ) ;
124131 control . setLayout ( grid ) ;
125132 const header = this . getChildControl ( "header" ) ;
126133 const body = this . getChildControl ( "body" ) ;
127134 const footer = this . getChildControl ( "footer" ) ;
128135 control . add ( header , this . self ( ) . POS . TITLE ) ;
129- control . add ( body , this . self ( ) . POS . THUMBNAIL ) ;
136+ control . add ( body , this . self ( ) . POS . BODY ) ;
130137 control . add ( footer , this . self ( ) . POS . FOOTER ) ;
131138 this . _add ( control , {
132139 top : 0 ,
@@ -140,8 +147,8 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
140147 const hGrid = new qx . ui . layout . Grid ( ) . set ( {
141148 spacing : 6 ,
142149 } ) ;
143- hGrid . setRowFlex ( 0 , 1 ) ;
144- hGrid . setColumnFlex ( 1 , 1 ) ;
150+ hGrid . setRowFlex ( this . self ( ) . HPOS . TITLE . row , 1 ) ;
151+ hGrid . setColumnFlex ( this . self ( ) . HPOS . TITLE . column , 1 ) ;
145152 hGrid . setColumnAlign ( 0 , "right" , "middle" ) ;
146153 hGrid . setColumnAlign ( 1 , "left" , "middle" ) ;
147154 hGrid . setColumnAlign ( 2 , "center" , "middle" ) ;
@@ -157,24 +164,17 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
157164 break ;
158165 }
159166 case "body" :
160- control = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 5 ) ) . set ( {
161- decorator : "main" ,
162- allowGrowY : true ,
163- allowGrowX : true ,
164- allowShrinkX : true ,
165- padding : this . self ( ) . PADDING
166- } ) ;
167- control . getContentElement ( ) . setStyles ( {
168- "border-width" : 0
167+ control = new qx . ui . container . Composite ( new qx . ui . layout . VBox ( 6 ) ) . set ( {
168+ padding : this . self ( ) . PADDING ,
169169 } ) ;
170170 break ;
171171 case "footer" : {
172172 const fGrid = new qx . ui . layout . Grid ( ) ;
173173 fGrid . setSpacing ( 2 ) ;
174- fGrid . setColumnFlex ( 0 , 1 ) ;
174+ fGrid . setColumnFlex ( this . self ( ) . FPOS . MODIFIED . row , 1 ) ;
175175 control = new qx . ui . container . Composite ( ) . set ( {
176176 backgroundColor : "background-card-overlay" ,
177- padding : this . self ( ) . PADDING - 2 ,
177+ padding : this . self ( ) . PADDING ,
178178 maxWidth : this . self ( ) . ITEM_WIDTH ,
179179 maxHeight : this . self ( ) . ITEM_HEIGHT
180180 } ) ;
@@ -184,10 +184,7 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
184184 case "icon" : {
185185 control = osparc . dashboard . CardBase . createCardIcon ( ) ;
186186 layout = this . getChildControl ( "header" ) ;
187- layout . add ( control , {
188- column : 0 ,
189- row : 0 ,
190- } ) ;
187+ layout . add ( control , this . self ( ) . HPOS . ICON ) ;
191188 break ;
192189 }
193190 case "title" :
@@ -196,21 +193,15 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
196193 font : "text-14" ,
197194 } ) ;
198195 layout = this . getChildControl ( "header" ) ;
199- layout . add ( control , {
200- column : 1 ,
201- row : 0 ,
202- } ) ;
196+ layout . add ( control , this . self ( ) . HPOS . TITLE ) ;
203197 break ;
204198 case "subtitle-icon" : {
205199 control = new qx . ui . basic . Image ( ) . set ( {
206200 allowGrowX : false ,
207201 allowShrinkX : false ,
208202 } ) ;
209203 layout = this . getChildControl ( "header" ) ;
210- layout . add ( control , {
211- column : 0 ,
212- row : 1 ,
213- } ) ;
204+ layout . add ( control , this . self ( ) . HPOS . SUBTITLE_ICON ) ;
214205 break ;
215206 }
216207 case "subtitle-text" : {
@@ -225,10 +216,7 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
225216 allowGrowY : false
226217 } ) ;
227218 layout = this . getChildControl ( "header" ) ;
228- layout . add ( control , {
229- column : 1 ,
230- row : 1 ,
231- } ) ;
219+ layout . add ( control , this . self ( ) . HPOS . SUBTITLE_TEXT ) ;
232220 break ;
233221 }
234222 case "thumbnail" : {
@@ -322,32 +310,6 @@ qx.Class.define("osparc.dashboard.GridButtonBase", {
322310 return ;
323311 } ,
324312
325- __fitThumbnailHeight : function ( ) {
326- const thumbnailLayout = this . getChildControl ( "thumbnail" ) ;
327- let maxHeight = this . getHeight ( ) - this . getPaddingTop ( ) - this . getPaddingBottom ( ) - 5 ;
328- const checkThis = [
329- "title" ,
330- "body" ,
331- "footer" ,
332- "tags"
333- ] ;
334- const layout = this . getChildControl ( "main-layout" ) ;
335- // eslint-disable-next-line no-underscore-dangle
336- layout . _getChildren ( ) . forEach ( child => {
337- if ( checkThis . includes ( child . getSubcontrolId ( ) ) && child . getBounds ( ) ) {
338- maxHeight -= ( child . getBounds ( ) . height + this . self ( ) . SPACING_IN ) ;
339- if ( child . getSubcontrolId ( ) === "tags" ) {
340- maxHeight -= 8 ;
341- }
342- }
343- } ) ;
344- // maxHeight -= 4; // for Roboto
345- maxHeight -= 18 ; // for Manrope
346- thumbnailLayout . getChildControl ( "image" ) . setMaxHeight ( maxHeight ) ;
347- thumbnailLayout . setMaxHeight ( maxHeight ) ;
348- thumbnailLayout . recheckSize ( ) ;
349- } ,
350-
351313 /**
352314 * Event handler for the pointer over event.
353315 */
0 commit comments