<@doc hierarchy="GMLDOM"> TileViwe Layout Aspect (c) SAP AG 2003-2006. All rights reserved. Aspect TileViewLayout for Layout; inherit FormViewLayout; constructor(board, parent) this.supercall(); // the UI elements presenting the non editable tiles (all but the first tile) this.tiles = null; // rulers to control the the width and height of a Tile: this.tileWRuler = null; this.tileHRuler = null; end override virtual method repaint(attr) try { this.supercall(attr); this.paintAdditionalTiles(); } catch (e) { #LOG[2, 'Failed to paint ' + (base.getTitle()||base.Class.name)]; } end override virtual method resizeFeatures() this.supercall(); if (this.tileWRuler) { var rulest = this.tileWRuler.elem&&this.tileWRuler.elem.style; rulest.left = this.contents.offsetWidth-5; rulest.height = "100%"; rulest.cursor = 'col-resize'; } if (this.tileHRuler) { var rulest = this.tileHRuler.elem&&this.tileHRuler.elem.style; var offsH = this.contents.offsetHeight; rulest.top = offsH + this.contents.offsetTop; rulest.width = "100%"; rulest.cursor = 'row-resize'; // set the initHeight when needs to be used be the compiler: if (!base.hasProperty("formHeight")) base.setProperty("initHeight", offsH); } this.paintAdditionalTiles(); end override virtual method repaintRulers(visibility) this.supercall(visibility); if (!this.tileHRuler) { this.tileHRuler = $ENV.createObject('#NS[TileRuler]', this.board, this, 0, false); this.tileHRuler.setVisible(true); this.tileHRuler.setSelectable(true); } end override virtual method calcContentsW(w) return w / base.tileColumns; end <@doc scope="public"> get the height of each tile on the TileView. note that this method is called also when not all base's data is available. override virtual method calcContentsH(h) var grid = base.grid; // the default minimum for a new TileView is three rows: var minH = this.getContentsMinH() * 3; var maxH = SPLIT(base.size)[1]; maxH -= this.getContentsTop(); maxH -= MIN(base.tileGap, 4); // height was already set by the user (using the Ruler): if (base.hasProperty("formHeight")) { if (base.formHeight > maxH) base.setProperty("formHeight", maxH); return base.formHeight; } // consider also a case where the Tile is shorter than minH: if (ISEMPTY(base.controls) || ISEMPTY(grid.data)) { height = MIN(maxH, minH); } else { // compute according to controls: var cell = grid.map[grid.data.formRow][grid.data.formCol]; height = MAX(cell.y2, minH); height = MIN(height, maxH); } return height; end <@doc scope="public"> paint non editable tiles to create a TileView impression virtual method paintAdditionalTiles() this.elem.style.overflow = "hidden"; var w = this.contents.offsetWidth; var maxH = SPLIT(base.size)[1]; var tileH = this.contents.offsetHeight; var gap = base.tileGap; var totalH = tileH + this.getContentsTop(); if (!this.tiles) this.tiles = []; // cleanup: var i = 0; for (var len = this.tiles.length ;i < len; ++i) { this.tiles[i].style.display = "none"; } // add tiles as capacity allows: for (i = 0 ;totalH + gap < maxH; ++i) { var y = totalH + gap; var freeH = maxH - y; var currTileH = MIN(tileH, freeH); // create a missing tile: if (i >= this.tiles.length) { var tile = this.createHtmlElement('DIV', "BOX-CONTENT WD-INT-BORDER", null, this.elem); this.tiles.push(tile); } var st = this.tiles[i].style; st.display = "block"; st.width = w; st.height = currTileH; st.top = y; st.left = 0; st.overflowY = "hidden"; totalH += gap + currTileH; } end method getContentsTop() // Note: this.contents.offsetTop might not return the deired result var top = 0; if (base.showTitlebar) top += #[LYT_TTLBAR_HEIGHT]; if (base.showToolbar) top += INT(SPLIT(base.toolbar.size)[1]); return top; end method getContentsMinH() var defs = RULE('defineWidget', null, base); return defs['defaultRowHeight']; end