diff options
Diffstat (limited to 'webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout')
7 files changed, 1462 insertions, 0 deletions
diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/BoxLayout.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/BoxLayout.js new file mode 100644 index 0000000000..c31e9c796c --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/BoxLayout.js @@ -0,0 +1,273 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_basic) +#module(ui_layout) + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.layout.BoxLayout", qx.ui.core.Parent, +function(vOrientation) +{ + qx.ui.core.Parent.call(this); + + // apply orientation + if (qx.util.Validation.isValidString(vOrientation)) { + this.setOrientation(vOrientation); + } +}); + +qx.ui.layout.BoxLayout.STR_REVERSED = "-reversed"; + + + +/* +--------------------------------------------------------------------------- + PROPERTIES +--------------------------------------------------------------------------- +*/ + +/*! + The orientation of the layout control. Allowed values are "horizontal" (default) and "vertical". +*/ +qx.OO.addProperty({ name : "orientation", type : "string", possibleValues : [ "horizontal", "vertical" ], addToQueueRuntime : true }); + +/*! + The spacing between childrens. Could be any positive integer value. +*/ +qx.OO.addProperty({ name : "spacing", type : "number", defaultValue : 0, addToQueueRuntime : true, impl : "layout" }); + +/*! + The horizontal align of the children. Allowed values are: "left", "center" and "right" +*/ +qx.OO.addProperty({ name : "horizontalChildrenAlign", type : "string", defaultValue : "left", possibleValues : [ "left", "center", "right" ], impl : "layoutOrder", addToQueueRuntime : true }); + +/*! + The vertical align of the children. Allowed values are: "top", "middle" and "bottom" +*/ +qx.OO.addProperty({ name : "verticalChildrenAlign", type : "string", defaultValue : "top", possibleValues : [ "top", "middle", "bottom" ], impl : "layoutOrder", addToQueueRuntime : true }); + +/*! + Should the children be layouted in reverse order? +*/ +qx.OO.addProperty({ name : "reverseChildrenOrder", type : "boolean", defaultValue : false, impl : "layoutOrder", addToQueueRuntime : true }); + +/*! + Should the widgets be stretched to the available width (orientation==vertical) or height (orientation==horizontal)? + This only applies if the child has not configured a own value for this axis. +*/ +qx.OO.addProperty({ name : "stretchChildrenOrthogonalAxis", type : "boolean", defaultValue : true, addToQueueRuntime : true }); + +/*! + If there are min/max values in combination with flex try to optimize placement. + This is more complex and produces more time for the layouter but sometimes this feature is needed. +*/ +qx.OO.addProperty({ name : "useAdvancedFlexAllocation", type : "boolean", defaultValue : false, addToQueueRuntime : true }); + + + + + +/* +--------------------------------------------------------------------------- + INIT LAYOUT IMPL +--------------------------------------------------------------------------- +*/ + +/*! + This creates an new instance of the layout impl this widget uses +*/ +qx.Proto._createLayoutImpl = function() { + return this.getOrientation() == "vertical" ? new qx.renderer.layout.VerticalBoxLayoutImpl(this) : new qx.renderer.layout.HorizontalBoxLayoutImpl(this); +} + + + + + + +/* +--------------------------------------------------------------------------- + HELPERS +--------------------------------------------------------------------------- +*/ + +qx.Proto._layoutHorizontal = false; +qx.Proto._layoutVertical = false; +qx.Proto._layoutMode = "left"; + +qx.Proto.isHorizontal = function() { + return this._layoutHorizontal; +} + +qx.Proto.isVertical = function() { + return this._layoutVertical; +} + +qx.Proto.getLayoutMode = function() +{ + if (this._layoutMode == null) { + this._updateLayoutMode(); + } + + return this._layoutMode; +} + +qx.Proto._updateLayoutMode = function() +{ + this._layoutMode = this._layoutVertical ? this.getVerticalChildrenAlign() : this.getHorizontalChildrenAlign(); + + if (this.getReverseChildrenOrder()) { + this._layoutMode += qx.ui.layout.BoxLayout.STR_REVERSED; + } +} + +qx.Proto._invalidateLayoutMode = function() { + this._layoutMode = null; +} + + + + + + +/* +--------------------------------------------------------------------------- + MODIFIERS +--------------------------------------------------------------------------- +*/ + +qx.Proto._modifyOrientation = function(propValue, propOldValue, propData) +{ + // update fast access variables + this._layoutHorizontal = propValue == "horizontal"; + this._layoutVertical = propValue == "vertical"; + + // Layout Implementation + if (this._layoutImpl) + { + this._layoutImpl.dispose(); + this._layoutImpl = null; + } + + if (qx.util.Validation.isValidString(propValue)) { + this._layoutImpl = this._createLayoutImpl(); + } + + // call other core modifier + return this._modifyLayoutOrder(propValue, propOldValue, propData); +} + +qx.Proto._modifyLayoutOrder = function(propValue, propOldValue, propData) +{ + // update layout mode + this._invalidateLayoutMode(); + + // call other core modifier + return this._modifyLayout(propValue, propOldValue, propData); +} + +qx.Proto._modifyLayout = function(propValue, propOldValue, propData) +{ + // invalidate inner preferred dimensions + this._invalidatePreferredInnerDimensions(); + + // accumulated width needs to be invalidated + this._invalidateAccumulatedChildrenOuterWidth(); + this._invalidateAccumulatedChildrenOuterHeight(); + + // make property handling happy :) + return true; +} + + + + + +/* +--------------------------------------------------------------------------- + ACCUMULATED CHILDREN WIDTH/HEIGHT +-------------------------------------------------------------------------------- + + Needed for center/middle and right/bottom alignment + +--------------------------------------------------------------------------- +*/ + +qx.OO.addCachedProperty({ name : "accumulatedChildrenOuterWidth", defaultValue : null }); +qx.OO.addCachedProperty({ name : "accumulatedChildrenOuterHeight", defaultValue : null }); + +qx.Proto._computeAccumulatedChildrenOuterWidth = function() +{ + var ch=this.getVisibleChildren(), chc, i=-1, sp=this.getSpacing(), s=-sp; + + while(chc=ch[++i]) { + s += chc.getOuterWidth() + sp; + } + + return s; +} + +qx.Proto._computeAccumulatedChildrenOuterHeight = function() +{ + var ch=this.getVisibleChildren(), chc, i=-1, sp=this.getSpacing(), s=-sp; + + while(chc=ch[++i]) { + s += chc.getOuterHeight() + sp; + } + + return s; +} + + + + + + + +/* +--------------------------------------------------------------------------- + STRETCHING SUPPORT +--------------------------------------------------------------------------- +*/ + +qx.Proto._recomputeChildrenStretchingX = function() +{ + var ch=this.getVisibleChildren(), chc, i=-1; + + while(chc=ch[++i]) + { + if (chc._recomputeStretchingX() && chc._recomputeBoxWidth()) { + chc._recomputeOuterWidth(); + } + } +} + +qx.Proto._recomputeChildrenStretchingY = function() +{ + var ch=this.getVisibleChildren(), chc, i=-1; + + while(chc=ch[++i]) + { + if (chc._recomputeStretchingY() && chc._recomputeBoxHeight()) { + chc._recomputeOuterHeight(); + } + } +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/CanvasLayout.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/CanvasLayout.js new file mode 100644 index 0000000000..977d6a8525 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/CanvasLayout.js @@ -0,0 +1,45 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_core) +#module(ui_layout) + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.layout.CanvasLayout", qx.ui.core.Parent, +function() { + qx.ui.core.Parent.call(this); +}); + + + + +/* +--------------------------------------------------------------------------- + INIT LAYOUT IMPL +--------------------------------------------------------------------------- +*/ + +/*! + This creates an new instance of the layout impl this widget uses +*/ +qx.Proto._createLayoutImpl = function() { + return new qx.renderer.layout.CanvasLayoutImpl(this); +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/DockLayout.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/DockLayout.js new file mode 100644 index 0000000000..7002036e5f --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/DockLayout.js @@ -0,0 +1,116 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_layout) + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.layout.DockLayout", qx.ui.core.Parent, +function() { + qx.ui.core.Parent.call(this); +}); + +/*! + The layout mode (in which order the children should be layouted) +*/ +qx.OO.addProperty({ name : "mode", type : "string", defaultValue : "vertical", possibleValues : [ "vertical", "horizontal", "ordered" ], addToQueueRuntime : true }); + +/* + Overwrite from qx.ui.core.Widget, we do not support 'auto' and 'flex' +*/ +qx.OO.changeProperty({ name : "width", addToQueue : true, unitDetection : "pixelPercent" }); +qx.OO.changeProperty({ name : "minWidth", defaultValue : -Infinity, addToQueue : true, unitDetection : "pixelPercent" }); +qx.OO.changeProperty({ name : "minWidth", defaultValue : -Infinity, addToQueue : true, unitDetection : "pixelPercent" }); +qx.OO.changeProperty({ name : "height", addToQueue : true, unitDetection : "pixelPercent" }); +qx.OO.changeProperty({ name : "minHeight", defaultValue : -Infinity, addToQueue : true, unitDetection : "pixelPercent" }); +qx.OO.changeProperty({ name : "minHeight", defaultValue : -Infinity, addToQueue : true, unitDetection : "pixelPercent" }); + + + + + + +/* +--------------------------------------------------------------------------- + INIT LAYOUT IMPL +--------------------------------------------------------------------------- +*/ + +/*! + This creates an new instance of the layout impl this widget uses +*/ +qx.Proto._createLayoutImpl = function() { + return new qx.renderer.layout.DockLayoutImpl(this); +} + + + + +/* +--------------------------------------------------------------------------- + ENHANCED CHILDREN FEATURES +--------------------------------------------------------------------------- +*/ + +/*! + Add multiple childrens and make them left aligned +*/ +qx.Proto.addLeft = function() { + this._addAlignedHorizontal("left", arguments); +} + +/*! + Add multiple childrens and make them right aligned +*/ +qx.Proto.addRight = function() { + this._addAlignedHorizontal("right", arguments); +} + +/*! + Add multiple childrens and make them top aligned +*/ +qx.Proto.addTop = function() { + this._addAlignedVertical("top", arguments); +} + +/*! + Add multiple childrens and make them bottom aligned +*/ +qx.Proto.addBottom = function() { + this._addAlignedVertical("bottom", arguments); +} + +qx.Proto._addAlignedVertical = function(vAlign, vArgs) +{ + for (var i=0, l=vArgs.length; i<l; i++) { + vArgs[i].setVerticalAlign(vAlign); + } + + this.add.apply(this, vArgs); +} + +qx.Proto._addAlignedHorizontal = function(vAlign, vArgs) +{ + for (var i=0, l=vArgs.length; i<l; i++) { + vArgs[i].setHorizontalAlign(vAlign); + } + + this.add.apply(this, vArgs); +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/FlowLayout.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/FlowLayout.js new file mode 100644 index 0000000000..d2c1d934b8 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/FlowLayout.js @@ -0,0 +1,106 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_layout) + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.layout.FlowLayout", qx.ui.core.Parent, +function() { + qx.ui.core.Parent.call(this); +}); + +/*! + The spacing between childrens. Could be any positive integer value. +*/ +qx.OO.addProperty({ name : "horizontalSpacing", type : "number", defaultValue : 0, addToQueueRuntime : true, impl : "layout" }); + +/*! + The spacing between childrens. Could be any positive integer value. +*/ +qx.OO.addProperty({ name : "verticalSpacing", type : "number", defaultValue : 0, addToQueueRuntime : true, impl : "layout" }); + +/*! + The horizontal align of the children. Allowed values are: "left" and "right" +*/ +qx.OO.addProperty({ name : "horizontalChildrenAlign", type : "string", defaultValue : "left", possibleValues : [ "left", "right" ], addToQueueRuntime : true }); + +/*! + The vertical align of the children. Allowed values are: "top" and "bottom" +*/ +qx.OO.addProperty({ name : "verticalChildrenAlign", type : "string", defaultValue : "top", possibleValues : [ "top", "bottom" ], addToQueueRuntime : true }); + +/*! + Should the children be layouted in reverse order? +*/ +qx.OO.addProperty({ name : "reverseChildrenOrder", type : "boolean", defaultValue : false, addToQueueRuntime : true, impl : "layout" }); + + + + + + +/* +--------------------------------------------------------------------------- + INIT LAYOUT IMPL +--------------------------------------------------------------------------- +*/ + +/*! + This creates an new instance of the layout impl this widget uses +*/ +qx.Proto._createLayoutImpl = function() { + return new qx.renderer.layout.FlowLayoutImpl(this); +} + + + + + +/* +--------------------------------------------------------------------------- + DIMENSION CACHE +--------------------------------------------------------------------------- +*/ + +qx.Proto._changeInnerWidth = function(vNew, vOld) +{ + qx.ui.core.Parent.prototype._changeInnerWidth.call(this, vNew, vOld); + + // allow 'auto' values for height to update when the inner width changes + this._invalidatePreferredInnerHeight(); +} + + + + +/* +--------------------------------------------------------------------------- + MODIFIER +--------------------------------------------------------------------------- +*/ + +qx.Proto._modifyLayout = function(propValue, propOldValue, propData) +{ + // invalidate inner preferred dimensions + this._invalidatePreferredInnerDimensions(); + + return true; +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/GridLayout.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/GridLayout.js new file mode 100644 index 0000000000..d823c5b9d9 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/GridLayout.js @@ -0,0 +1,864 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_layout) + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.layout.GridLayout", qx.ui.core.Parent, +function() +{ + qx.ui.core.Parent.call(this); + + this._columnData = []; + this._rowData = []; + + this._spans = []; +}); + + + + +/* +--------------------------------------------------------------------------- + PROPERTIES +--------------------------------------------------------------------------- +*/ + +/*! + The spacing between childrens. Could be any positive integer value. +*/ +qx.OO.addProperty({ name : "horizontalSpacing", type : "number", defaultValue : 0, addToQueueRuntime : true, impl : "layout" }); + +/*! + The spacing between childrens. Could be any positive integer value. +*/ +qx.OO.addProperty({ name : "verticalSpacing", type : "number", defaultValue : 0, addToQueueRuntime : true, impl : "layout" }); + +/*! + The horizontal align of the children. Allowed values are: "left", "center" and "right" +*/ +qx.OO.addProperty({ name : "horizontalChildrenAlign", type : "string", defaultValue : "left", possibleValues : [ "left", "center", "right" ], addToQueueRuntime : true }); + +/*! + The vertical align of the children. Allowed values are: "top", "middle" and "bottom" +*/ +qx.OO.addProperty({ name : "verticalChildrenAlign", type : "string", defaultValue : "top", possibleValues : [ "top", "middle", "bottom" ], addToQueueRuntime : true }); + +/*! + Cell padding top of all cells, if not locally defined +*/ +qx.OO.addProperty({ name : "cellPaddingTop", type : "number" }); + +/*! + Cell padding right of all cells, if not locally defined +*/ +qx.OO.addProperty({ name : "cellPaddingRight", type : "number" }); + +/*! + Cell padding bottom of all cells, if not locally defined +*/ +qx.OO.addProperty({ name : "cellPaddingBottom", type : "number" }); + +/*! + Cell padding left of all cells, if not locally defined +*/ +qx.OO.addProperty({ name : "cellPaddingLeft", type : "number" }); + + + + + + +/* +--------------------------------------------------------------------------- + INIT LAYOUT IMPL +--------------------------------------------------------------------------- +*/ + +/*! + This creates an new instance of the layout impl this widget uses +*/ +qx.Proto._createLayoutImpl = function() { + return new qx.renderer.layout.GridLayoutImpl(this); +} + + + + + + + +/* +--------------------------------------------------------------------------- + CORE FUNCTIONS +--------------------------------------------------------------------------- +*/ + +qx.Proto.add = function(vChild, vCol, vRow) +{ + vChild._col = vCol; + vChild._row = vRow; + + if (this.isFillCell(vCol, vRow)) { + throw new Error("Could not insert child " + vChild + " into a fill cell: " + vCol + "x" + vRow); + } + + qx.ui.core.Parent.prototype.add.call(this, vChild); +} + + + + + + + +/* +--------------------------------------------------------------------------- + MODIFIER +--------------------------------------------------------------------------- +*/ + +qx.Proto._modifyLayout = function(propValue, propOldValue, propData) +{ + // invalidate inner preferred dimensions + this._invalidatePreferredInnerDimensions(); + + return true; +} + + + + + +/* +--------------------------------------------------------------------------- + GRID SETUP +--------------------------------------------------------------------------- +*/ + +qx.Proto._syncDataFields = function(vData, vOldLength, vNewLength) +{ + if (vNewLength > vOldLength) + { + for (var i=vOldLength; i<vNewLength; i++) { + vData[i] = {}; + } + } + else if (vOldLength > vNewLength) + { + vData.splice(vNewLength, vOldLength - vNewLength); + } +} + + + + + + +/* +--------------------------------------------------------------------------- + GRID SETUP: COLUMNS +--------------------------------------------------------------------------- +*/ + +qx.Proto._columnCount = 0; + +qx.Proto.setColumnCount = function(vCount) +{ + this._columnCount = vCount; + this._syncColumnDataFields(); +} + +qx.Proto.getColumnCount = function() { + return this._columnCount; +} + +qx.Proto.addColumn = function() +{ + this._columnCount++; + this._syncColumnDataFields(); +} + +qx.Proto.removeColumn = function() +{ + if (this._columnCount > 0) + { + this._columnCount--; + this._syncColumnDataFields(); + } +} + +qx.Proto._syncColumnDataFields = function() +{ + var vData = this._columnData; + var vOldLength = vData.length; + var vNewLength = this._columnCount; + + this._syncDataFields(vData, vOldLength, vNewLength); +} + + + + + +/* +--------------------------------------------------------------------------- + GRID SETUP: ROWS +--------------------------------------------------------------------------- +*/ + +qx.Proto._rowCount = 0; + +qx.Proto.setRowCount = function(vCount) +{ + this._rowCount = vCount; + this._syncRowDataFields(); +} + +qx.Proto.getRowCount = function() { + return this._rowCount; +} + +qx.Proto.addRow = function() +{ + this._rowCount++; + this._syncRowDataFields(); +} + +qx.Proto.removeRow = function() +{ + if (this._rowCount > 0) + { + this._rowCount--; + this._syncRowDataFields(); + } +} + +qx.Proto._syncRowDataFields = function() +{ + var vData = this._rowData; + var vOldLength = vData.length; + var vNewLength = this._rowCount; + + this._syncDataFields(vData, vOldLength, vNewLength); +} + + + + + + + +/* +--------------------------------------------------------------------------- + DATA HANDLING: COLUMNS +--------------------------------------------------------------------------- +*/ + +qx.Proto._getColumnProperty = function(vColumnIndex, vProperty) +{ + try + { + return this._columnData[vColumnIndex][vProperty] || null; + } + catch(ex) + { + this.error("Error while getting column property (" + vColumnIndex + "|" + vProperty + ")", ex); + return null; + } +} + +qx.Proto._setupColumnProperty = function(vColumnIndex, vProperty, vValue) +{ + this._columnData[vColumnIndex][vProperty] = vValue; + this._invalidateColumnLayout(); +} + +qx.Proto._removeColumnProperty = function(vColumnIndex, vProperty, vValue) +{ + delete this._columnData[vColumnIndex][vProperty]; + this._invalidateColumnLayout(); +} + +qx.Proto._invalidateColumnLayout = function() +{ + if (!this._initialLayoutDone || !this._isDisplayable) { + return; + } + + this.forEachVisibleChild(function() { + this.addToQueue("width"); + }); +} + + + + + + +/* +--------------------------------------------------------------------------- + DATA HANDLING: ROWS +--------------------------------------------------------------------------- +*/ + +qx.Proto._getRowProperty = function(vRowIndex, vProperty) +{ + try + { + return this._rowData[vRowIndex][vProperty] || null; + } + catch(ex) + { + this.error("Error while getting row property (" + vRowIndex + "|" + vProperty + ")", ex); + return null; + } +} + +qx.Proto._setupRowProperty = function(vRowIndex, vProperty, vValue) +{ + this._rowData[vRowIndex][vProperty] = vValue; + this._invalidateRowLayout(); +} + +qx.Proto._removeRowProperty = function(vRowIndex, vProperty, vValue) +{ + delete this._rowData[vRowIndex][vProperty]; + this._invalidateRowLayout(); +} + +qx.Proto._invalidateRowLayout = function() +{ + if (!this._initialLayoutDone || !this._isDisplayable) { + return; + } + + this.forEachVisibleChild(function() { + this.addToQueue("height"); + }); +} + + + + + + +/* +--------------------------------------------------------------------------- + UTILITIES: CELL DIMENSIONS +--------------------------------------------------------------------------- +*/ + +// SETTER + +qx.Proto.setColumnWidth = function(vIndex, vValue) +{ + this._setupColumnProperty(vIndex, "widthValue", vValue); + + var vType = qx.ui.core.Parent.prototype._evalUnitsPixelPercentAutoFlex(vValue); + + this._setupColumnProperty(vIndex, "widthType", vType); + + var vParsed, vComputed; + + switch(vType) + { + case qx.ui.core.Widget.TYPE_PIXEL: + vParsed = vComputed = Math.round(vValue); + break; + + case qx.ui.core.Widget.TYPE_PERCENT: + case qx.ui.core.Widget.TYPE_FLEX: + vParsed = parseFloat(vValue); + vComputed = null; + break; + + case qx.ui.core.Widget.TYPE_AUTO: + vParsed = vComputed = null; + break; + + default: + vParsed = vComputed = null; + } + + this._setupColumnProperty(vIndex, "widthParsed", vParsed); + this._setupColumnProperty(vIndex, "widthComputed", vComputed); +} + +qx.Proto.setRowHeight = function(vIndex, vValue) +{ + this._setupRowProperty(vIndex, "heightValue", vValue); + + var vType = qx.ui.core.Widget.prototype._evalUnitsPixelPercentAutoFlex(vValue); + this._setupRowProperty(vIndex, "heightType", vType); + + var vParsed, vComputed; + + switch(vType) + { + case qx.ui.core.Widget.TYPE_PIXEL: + vParsed = vComputed = Math.round(vValue); + break; + + case qx.ui.core.Widget.TYPE_PERCENT: + case qx.ui.core.Widget.TYPE_FLEX: + vParsed = parseFloat(vValue); + vComputed = null; + break; + + case qx.ui.core.Widget.TYPE_AUTO: + vParsed = vComputed = null; + break; + + default: + vParsed = vComputed = null; + } + + this._setupRowProperty(vIndex, "heightParsed", vParsed); + this._setupRowProperty(vIndex, "heightComputed", vComputed); +} + + + +// GETTER: BOX + +qx.Proto.getColumnBoxWidth = function(vIndex) +{ + var vComputed = this._getColumnProperty(vIndex, "widthComputed"); + + if (vComputed != null) { + return vComputed; + } + + var vType = this._getColumnProperty(vIndex, "widthType"); + var vParsed = this._getColumnProperty(vIndex, "widthParsed"); + var vComputed = null; + + switch(vType) + { + case qx.ui.core.Widget.TYPE_PIXEL: + vComputed = Math.max(0, vParsed); + break; + + case qx.ui.core.Widget.TYPE_PERCENT: + vComputed = this.getInnerWidth() * Math.max(0, vParsed) * 0.01; + break; + + case qx.ui.core.Widget.TYPE_AUTO: + // TODO + vComputed = null; + break; + + case qx.ui.core.Widget.TYPE_FLEX: + // TODO + vComputed = null; + break; + } + + this._setupColumnProperty(vIndex, "widthComputed", vComputed); + return vComputed; +} + +qx.Proto.getRowBoxHeight = function(vIndex) +{ + var vComputed = this._getRowProperty(vIndex, "heightComputed"); + + if (vComputed != null) { + return vComputed; + } + + var vType = this._getRowProperty(vIndex, "heightType"); + var vParsed = this._getRowProperty(vIndex, "heightParsed"); + var vComputed = null; + + switch(vType) + { + case qx.ui.core.Widget.TYPE_PIXEL: + vComputed = Math.max(0, vParsed); + break; + + case qx.ui.core.Widget.TYPE_PERCENT: + vComputed = this.getInnerHeight() * Math.max(0, vParsed) * 0.01; + break; + + case qx.ui.core.Widget.TYPE_AUTO: + // TODO + vComputed = null; + break; + + case qx.ui.core.Widget.TYPE_FLEX: + // TODO + vComputed = null; + break; + } + + this._setupRowProperty(vIndex, "heightComputed", vComputed); + return vComputed; +} + + +// GETTER: PADDING + +qx.Proto.getComputedCellPaddingLeft = function(vCol, vRow) { + return this.getColumnPaddingLeft(vCol) || this.getRowPaddingLeft(vRow) || this.getCellPaddingLeft() || 0; +} + +qx.Proto.getComputedCellPaddingRight = function(vCol, vRow) { + return this.getColumnPaddingRight(vCol) || this.getRowPaddingRight(vRow) || this.getCellPaddingRight() || 0; +} + +qx.Proto.getComputedCellPaddingTop = function(vCol, vRow) { + return this.getRowPaddingTop(vRow) || this.getColumnPaddingTop(vCol) || this.getCellPaddingTop() || 0; +} + +qx.Proto.getComputedCellPaddingBottom = function(vCol, vRow) { + return this.getRowPaddingBottom(vRow) || this.getColumnPaddingBottom(vCol) || this.getCellPaddingBottom() || 0; +} + + +// GETTER: INNER + +qx.Proto.getColumnInnerWidth = function(vCol, vRow) { + return this.getColumnBoxWidth(vCol) - this.getComputedCellPaddingLeft(vCol, vRow) - this.getComputedCellPaddingRight(vCol, vRow); +} + +qx.Proto.getRowInnerHeight = function(vCol, vRow) { + return this.getRowBoxHeight(vRow) - this.getComputedCellPaddingTop(vCol, vRow) - this.getComputedCellPaddingBottom(vCol, vRow); +} + + + + + + + + +/* +--------------------------------------------------------------------------- + UTILITIES: CELL ALIGNMENT +--------------------------------------------------------------------------- +*/ + +// SETTER + +qx.Proto.setColumnHorizontalAlignment = function(vIndex, vValue) { + this._setupColumnProperty(vIndex, "horizontalAlignment", vValue); +} + +qx.Proto.setColumnVerticalAlignment = function(vIndex, vValue) { + this._setupColumnProperty(vIndex, "verticalAlignment", vValue); +} + +qx.Proto.setRowHorizontalAlignment = function(vIndex, vValue) { + this._setupRowProperty(vIndex, "horizontalAlignment", vValue); +} + +qx.Proto.setRowVerticalAlignment = function(vIndex, vValue) { + this._setupRowProperty(vIndex, "verticalAlignment", vValue); +} + + + +// GETTER + +qx.Proto.getColumnHorizontalAlignment = function(vIndex) { + return this._getColumnProperty(vIndex, "horizontalAlignment"); +} + +qx.Proto.getColumnVerticalAlignment = function(vIndex) { + return this._getColumnProperty(vIndex, "verticalAlignment"); +} + +qx.Proto.getRowHorizontalAlignment = function(vIndex) { + return this._getRowProperty(vIndex, "horizontalAlignment"); +} + +qx.Proto.getRowVerticalAlignment = function(vIndex) { + return this._getRowProperty(vIndex, "verticalAlignment"); +} + + + + + + +/* +--------------------------------------------------------------------------- + UTILITIES: CELL PADDING +--------------------------------------------------------------------------- +*/ + +// SETTER + +qx.Proto.setColumnPaddingTop = function(vIndex, vValue) { + this._setupColumnProperty(vIndex, "paddingTop", vValue); +} + +qx.Proto.setColumnPaddingRight = function(vIndex, vValue) { + this._setupColumnProperty(vIndex, "paddingRight", vValue); +} + +qx.Proto.setColumnPaddingBottom = function(vIndex, vValue) { + this._setupColumnProperty(vIndex, "paddingBottom", vValue); +} + +qx.Proto.setColumnPaddingLeft = function(vIndex, vValue) { + this._setupColumnProperty(vIndex, "paddingLeft", vValue); +} + +qx.Proto.setRowPaddingTop = function(vIndex, vValue) { + this._setupRowProperty(vIndex, "paddingTop", vValue); +} + +qx.Proto.setRowPaddingRight = function(vIndex, vValue) { + this._setupRowProperty(vIndex, "paddingRight", vValue); +} + +qx.Proto.setRowPaddingBottom = function(vIndex, vValue) { + this._setupRowProperty(vIndex, "paddingBottom", vValue); +} + +qx.Proto.setRowPaddingLeft = function(vIndex, vValue) { + this._setupRowProperty(vIndex, "paddingLeft", vValue); +} + + + +// GETTER + +qx.Proto.getColumnPaddingTop = function(vIndex) { + return this._getColumnProperty(vIndex, "paddingTop"); +} + +qx.Proto.getColumnPaddingRight = function(vIndex) { + return this._getColumnProperty(vIndex, "paddingRight"); +} + +qx.Proto.getColumnPaddingBottom = function(vIndex) { + return this._getColumnProperty(vIndex, "paddingBottom"); +} + +qx.Proto.getColumnPaddingLeft = function(vIndex) { + return this._getColumnProperty(vIndex, "paddingLeft"); +} + +qx.Proto.getRowPaddingTop = function(vIndex) { + return this._getRowProperty(vIndex, "paddingTop"); +} + +qx.Proto.getRowPaddingRight = function(vIndex) { + return this._getRowProperty(vIndex, "paddingRight"); +} + +qx.Proto.getRowPaddingBottom = function(vIndex) { + return this._getRowProperty(vIndex, "paddingBottom"); +} + +qx.Proto.getRowPaddingLeft = function(vIndex) { + return this._getRowProperty(vIndex, "paddingLeft"); +} + + + + + + +/* +--------------------------------------------------------------------------- + DIMENSION CACHE +--------------------------------------------------------------------------- +*/ + +qx.Proto._changeInnerWidth = function(vNew, vOld) +{ + for (var i=0, l=this.getColumnCount(); i<l; i++) { + if (this._getColumnProperty(i, "widthType") == qx.ui.core.Widget.TYPE_PERCENT) { + this._setupColumnProperty(i, "widthComputed", null); + } + } + + qx.ui.core.Parent.prototype._changeInnerWidth.call(this, vNew, vOld); +} + +qx.Proto._changeInnerHeight = function(vNew, vOld) +{ + for (var i=0, l=this.getRowCount(); i<l; i++) { + if (this._getRowProperty(i, "heightType") == qx.ui.core.Widget.TYPE_PERCENT) { + this._setupRowProperty(i, "heightComputed", null); + } + } + + qx.ui.core.Parent.prototype._changeInnerHeight.call(this, vNew, vOld); +} + + + + + + +/* +--------------------------------------------------------------------------- + DIMENSION CACHE +--------------------------------------------------------------------------- +*/ + +qx.Proto.getInnerWidthForChild = function(vChild) { + return this._getColumnProperty(vChild._col, "widthComputed"); +} + +qx.Proto.getInnerHeightForChild = function(vChild) { + return this._getRowProperty(vChild._row, "heightComputed"); +} + + + + + +/* +--------------------------------------------------------------------------- + SPAN CELLS +--------------------------------------------------------------------------- +*/ + +qx.Proto.mergeCells = function(vStartCol, vStartRow, vColLength, vRowLength) +{ + var vSpans = this._spans; + var vLength = vSpans.length; + + // Find end cols/rows + var vEndCol = vStartCol + vColLength - 1; + var vEndRow = vStartRow + vRowLength - 1; + + if (this._collidesWithSpans(vStartCol, vStartRow, vEndCol, vEndRow)) + { + this.debug("Span collision detected!"); + + // Send out warning + return false; + } + + // Finally store new span entry + vSpans.push({ startCol : vStartCol, startRow : vStartRow, endCol : vEndCol, endRow : vEndRow, colLength : vColLength, rowLength : vRowLength }); + + // Send out ok + return true; +} + +qx.Proto.hasSpans = function() { + return this._spans.length > 0; +} + +qx.Proto.getSpanEntry = function(vCol, vRow) +{ + for (var i=0, s=this._spans, l=s.length, c; i<l; i++) + { + c = s[i]; + + if (vCol >= c.startCol && vCol <= c.endCol && vRow >= c.startRow && vRow <= c.endRow) { + return c; + } + } + + return null; +} + +qx.Proto.isSpanStart = function(vCol, vRow) +{ + for (var i=0, s=this._spans, l=s.length, c; i<l; i++) + { + c = s[i]; + + if (c.startCol == vCol && c.startRow == vRow) { + return true; + } + } + + return false; +} + +qx.Proto.isSpanCell = function(vCol, vRow) +{ + for (var i=0, s=this._spans, l=s.length, c; i<l; i++) + { + c = s[i]; + + if (vCol >= c.startCol && vCol <= c.endCol && vRow >= c.startRow && vRow <= c.endRow) { + return true; + } + } + + return false; +} + +qx.Proto.isFillCell = function(vCol, vRow) +{ + for (var i=0, s=this._spans, l=s.length, c; i<l; i++) + { + c = s[i]; + + if (vCol >= c.startCol && vCol <= c.endCol && vRow >= c.startRow && vRow <= c.endRow && (vCol > c.startCol || vRow > c.startRow)) { + return true; + } + } + + return false; +} + +qx.Proto._collidesWithSpans = function(vStartCol, vStartRow, vEndCol, vEndRow) +{ + for (var i=0, s=this._spans, l=s.length, c; i<l; i++) + { + c = s[i]; + + if (vEndCol >= c.startCol && vStartCol <= c.endCol && vEndRow >= c.startRow && vStartRow <= c.endRow ) { + return true; + } + } + + return false; +} + + + + + + + +/* +--------------------------------------------------------------------------- + DISPOSER +--------------------------------------------------------------------------- +*/ + +qx.Proto.dispose = function() +{ + if (this.getDisposed()) { + return; + } + + + delete this._columnData; + delete this._rowData; + + delete this._spans; + + return qx.ui.core.Parent.prototype.dispose.call(this); +} diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/HorizontalBoxLayout.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/HorizontalBoxLayout.js new file mode 100644 index 0000000000..8eb08fec65 --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/HorizontalBoxLayout.js @@ -0,0 +1,29 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_basic) +#module(ui_layout) + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.layout.HorizontalBoxLayout", qx.ui.layout.BoxLayout, +function() { + qx.ui.layout.BoxLayout.call(this, "horizontal"); +}); diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/VerticalBoxLayout.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/VerticalBoxLayout.js new file mode 100644 index 0000000000..9b188f613a --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/layout/VerticalBoxLayout.js @@ -0,0 +1,29 @@ +/* ************************************************************************ + + qooxdoo - the new era of web development + + http://qooxdoo.org + + Copyright: + 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org + + License: + LGPL 2.1: http://www.gnu.org/licenses/lgpl.html + + Authors: + * Sebastian Werner (wpbasti) + * Andreas Ecker (ecker) + +************************************************************************ */ + +/* ************************************************************************ + +#module(ui_basic) +#module(ui_layout) + +************************************************************************ */ + +qx.OO.defineClass("qx.ui.layout.VerticalBoxLayout", qx.ui.layout.BoxLayout, +function() { + qx.ui.layout.BoxLayout.call(this, "vertical"); +}); |