summaryrefslogtreecommitdiff
path: root/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/table/AbstractResizeBehavior.js
diff options
context:
space:
mode:
authorDerrell Lipman <derrell@samba.org>2007-02-11 20:22:45 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:44:59 -0500
commit7deea1aead01beabde1218379b72dd20f64f93ce (patch)
treee23a057f604558f7a6c9d4267bbf39ef7cf9f8ea /webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/table/AbstractResizeBehavior.js
parent9bdb49455aa6ad38f71375f602e691d2b7765d04 (diff)
downloadsamba-7deea1aead01beabde1218379b72dd20f64f93ce.tar.gz
samba-7deea1aead01beabde1218379b72dd20f64f93ce.tar.bz2
samba-7deea1aead01beabde1218379b72dd20f64f93ce.zip
r21285: - Add the new ResizeTableColumnModel and make use of it in TreeVirtual. This
allows the Ldb Browser tree to properly size itself upon initially appearing and upon window resizes. There are still a few problems with it that I need to resolve, including an occasional set of double scrollbars, and making it resize the tree column when the splitter is resized. (This used to be commit c3c93ad36a9e850865aa8b09e319a77441243b01)
Diffstat (limited to 'webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/table/AbstractResizeBehavior.js')
-rw-r--r--webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/table/AbstractResizeBehavior.js166
1 files changed, 166 insertions, 0 deletions
diff --git a/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/table/AbstractResizeBehavior.js b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/table/AbstractResizeBehavior.js
new file mode 100644
index 0000000000..0446c47289
--- /dev/null
+++ b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/table/AbstractResizeBehavior.js
@@ -0,0 +1,166 @@
+/* ************************************************************************
+
+ qooxdoo - the new era of web development
+
+ http://qooxdoo.org
+
+ Copyright:
+ 2007 Derrell Lipman
+
+ License:
+ LGPL: http://www.gnu.org/licenses/lgpl.html
+ EPL: http://www.eclipse.org/org/documents/epl-v10.php
+ See the LICENSE file in the project's top-level directory for details.
+
+ Authors:
+ * Derrell Lipman (derrell)
+
+************************************************************************ */
+
+/* ************************************************************************
+
+#module(table)
+
+************************************************************************ */
+
+/**
+ * An abstract resize behavior. All resize behaviors should extend this
+ * class.
+ */
+qx.OO.defineClass("qx.ui.table.AbstractResizeBehavior",
+ qx.core.Object,
+function()
+{
+ qx.core.Object.call(this);
+
+ this._resizeColumnData = [ ];
+});
+
+
+
+/**
+ * Called when the ResizeTableColumnModel is initialized, and upon loading of
+ * a new TableModel, to allow the Resize Behaviors to know how many columns
+ * are in use.
+ *
+ * @param numColumns {Integer}
+ * The numbrer of columns in use.
+ */
+qx.Proto._setNumColumns = function(numColumns)
+{
+ throw new Error("_setNumColumns is abstract");
+};
+
+
+/**
+ * Called when the table has first been rendered.
+ *
+ * @param tableColumnModel {qx.ui.table.ResizeTableColumnModel}
+ * The table column model in use. Of particular interest is the property
+ * <i>_table</i> which is a reference to the table widget. This allows
+ * access to any other features of the table, for use in calculating widths
+ * of columns.
+ *
+ * @param event
+ * The <i>onappear</i> event object.
+ */
+qx.Proto.onAppear = function(tableColumnModel, event)
+{
+ throw new Error("onAppear is abstract");
+};
+
+
+/**
+ * Called when the window is resized.
+ *
+ * @param tableColumnModel {qx.ui.table.ResizeTableColumnModel}
+ * The table column model in use. Of particular interest is the property
+ * <i>_table</i> which is a reference to the table widget. This allows
+ * access to any other features of the table, for use in calculating widths
+ * of columns.
+ *
+ * @param event
+ * The <i>onwindowresize</i> event object.
+ */
+qx.Proto.onWindowResize = function(tableColumnModel, event)
+{
+ throw new Error("onWindowResize is abstract");
+};
+
+
+/**
+ * Called when a column width is changed.
+ *
+ * @param tableColumnModel {qx.ui.table.ResizeTableColumnModel}
+ * The table column model in use. Of particular interest is the property
+ * <i>_table</i> which is a reference to the table widget. This allows
+ * access to any other features of the table, for use in calculating widths
+ * of columns.
+ *
+ * @param event
+ * The <i>widthChanged</i> event object. This event has data, obtained via
+ * event.getData(), which is an object with three properties: the column
+ * which changed width (data.col), the old width (data.oldWidth) and the new
+ * width (data.newWidth).
+ */
+qx.Proto.onColumnWidthChanged = function(tableColumnModel, event)
+{
+ throw new Error("onColumnWidthChanged is abstract");
+};
+
+
+/**
+ * Called when a column visibility is changed.
+ *
+ * @param tableColumnModel {qx.ui.table.ResizeTableColumnModel}
+ * The table column model in use. Of particular interest is the property
+ * <i>_table</i> which is a reference to the table widget. This allows
+ * access to any other features of the table, for use in calculating widths
+ * of columns.
+ *
+ * @param event
+ * The <i>visibilityChanged</i> event object. This event has data, obtained
+ * via event.getData(), which is an object with two properties: the column
+ * which changed width (data.col) and the new visibility of the column
+ * (data.visible).
+ */
+qx.Proto.onVisibilityChanged = function(tableColumnModel, event)
+{
+ throw new Error("onVisibilityChanged is abstract");
+};
+
+
+/*
+ * Determine the inner width available to columns in the table.
+ *
+ * @param tableColumnModel {qx.ui.table.ResizeTableColumnModel}
+ * The table column model in use.
+ *
+ */
+qx.Proto._getAvailableWidth = function(tableColumnModel)
+{
+ // Get the inner width off the table
+ var el = tableColumnModel._table.getElement();
+ var width = qx.html.Dimension.getInnerWidth(el) - 2;
+
+ // Get the last meta column scroller
+ var scrollers = tableColumnModel._table._getPaneScrollerArr();
+ var lastScroller = scrollers[scrollers.length - 1];
+
+ // Update the scroll bar visibility so we can determine if the vertical bar
+ // is displayed. If it is, we'll need to reduce available space by its
+ // width.
+ tableColumnModel._table._updateScrollBarVisibility();
+
+ // If the column visibility button is displayed or a verticalscroll bar is
+ // being displayed, then reduce the available width by the width of those.
+ if (tableColumnModel._table.getColumnVisibilityButtonVisible() ||
+ (lastScroller._verScrollBar.getVisibility() &&
+ lastScroller._verScrollBar.getWidth() == "auto"))
+ {
+ width -= 16;
+ }
+
+ return width;
+};
+