Fix failure to load the schema on read-only DB.
[Samba/ekacnet.git] / swat / style / qooxdoo / widgets / widgets / QxFlowLayout.js
blobc62b09aba884ace0493a53f2877fd8413d99688b
1 /* Copyright (c): 2002-2005 (Germany): United Internet, 1&1, GMX, Schlund+Partner, Alturo */
2 function QxFlowLayout(){QxLayout.call(this);};QxFlowLayout.extend(QxLayout,"QxFlowLayout");QxFlowLayout.addProperty({name:"horizontalSpacing",type:Number,defaultValue:0});QxFlowLayout.addProperty({name:"verticalSpacing",type:Number,defaultValue:0});QxFlowLayout.addProperty({name:"horizontalBlockAlign",type:String,defaultValue:"left"});QxFlowLayout.addProperty({name:"verticalChildrenAlign",type:String,defaultValue:"top"});proto._d1=function(){var innerWidth=this.getInnerWidth();var innerHeight=this.getInnerHeight();var blockAlign=this.getHorizontalBlockAlign();var childrenAlign=this.getVerticalChildrenAlign();var spacingX=this.getHorizontalSpacing();var spacingY=this.getVerticalSpacing();var paddingLeft=this.getPaddingLeft();var paddingTop=this.getPaddingTop();var accumulatedWidth=0;var accumulatedHeight=0;var childNeededWidth;var childNeededHeight;var currentRow;var childCalculatedLeft,childCalculatedTop;var maxRequiredRowHeight=0;var rows=[];var childOffsetLeft=[];function storeRow(accumulatedWidth,accumulatedHeight,maxRequiredRowHeight){var r={width:accumulatedWidth,height:maxRequiredRowHeight,offsetTop:accumulatedHeight
3 };switch(blockAlign){case "center":r.offsetLeft=(innerWidth-accumulatedWidth)/2;break;case "right":r.offsetLeft=innerWidth-accumulatedWidth;break;default:r.offsetLeft=0;};rows.push(r);};var ch=this.getChildren();var chl=ch.length;var chc;for(var i=0;i<chl;i++){chc=ch[i];childNeededWidth=chc.getMarginLeft()+chc.getAnyWidth()+chc.getMarginRight();childNeededHeight=chc.getAnyHeight();if((accumulatedWidth+childNeededWidth)>innerWidth){storeRow(accumulatedWidth,accumulatedHeight,maxRequiredRowHeight);chc.__row=rows.length;accumulatedHeight+=maxRequiredRowHeight+spacingY;childOffsetLeft.push(0);accumulatedWidth=childNeededWidth+spacingX;maxRequiredRowHeight=childNeededHeight;}else {chc.__row=rows.length;childOffsetLeft.push(accumulatedWidth);accumulatedWidth+=childNeededWidth+spacingX;maxRequiredRowHeight=Math.max(maxRequiredRowHeight,childNeededHeight);};};storeRow(accumulatedWidth,accumulatedHeight,maxRequiredRowHeight);for(var i=0;i<chl;i++){chc=ch[i];currentRow=rows[chc.__row];delete chc.__row;childCalculatedLeft=paddingLeft+currentRow.offsetLeft+childOffsetLeft[i];childCalculatedTop=paddingTop+currentRow.offsetTop;switch(childrenAlign){case "middle":childCalculatedTop+=(currentRow.height-chc.getAnyHeight())/2;break;case "bottom":childCalculatedTop+=currentRow.height-chc.getAnyHeight();break;};chc._d3Horizontal(childCalculatedLeft);chc._d3Vertical(childCalculatedTop);};return true;};proto._d2=function(){return true;};proto._d5Width=function(_e4,_e5){throw new Error("Auto Width is not supported by QxFlowLayout");};proto._d5Height=function(_e4,_e5){throw new Error("Auto Height is not supported by QxFlowLayout");};