diff options
author | Derrell Lipman <derrell@samba.org> | 2007-02-11 20:22:45 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:44:59 -0500 |
commit | 7deea1aead01beabde1218379b72dd20f64f93ce (patch) | |
tree | e23a057f604558f7a6c9d4267bbf39ef7cf9f8ea /webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/table/Table.js | |
parent | 9bdb49455aa6ad38f71375f602e691d2b7765d04 (diff) | |
download | samba-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/Table.js')
-rw-r--r-- | webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/table/Table.js | 64 |
1 files changed, 61 insertions, 3 deletions
diff --git a/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/table/Table.js b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/table/Table.js index d0950211bf..22eab024c1 100644 --- a/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/table/Table.js +++ b/webapps/qooxdoo-0.6.5-sdk/frontend/framework/source/class/qx/ui/table/Table.js @@ -28,8 +28,20 @@ /** * A table. * - * @param tableModel {qx.ui.table.TableModel, null} The table model to read the - * data from. + * @param tableModel {qx.ui.table.TableModel, null} + * The table model to read the data from. + * + * @event columnVisibilityMenuCreateStart {qx.event.type.DataEvent} + * Dispatched before adding the column list to the column visibility menu. + * The event data is a map with two properties: table and menu. Listeners + * may add additional items to the menu, which appear at the top of the + * menu. + * + * @event columnVisibilityMenuCreateEnd {qx.event.type.DataEvent} + * Dispatched after adding the column list to the column visibility menu. + * The event data is a map with two properties: table and menu. Listeners + * may add additional items to the menu, which appear at the bottom of the + * menu. */ qx.OO.defineClass("qx.ui.table.Table", qx.ui.layout.VerticalBoxLayout, function(tableModel) { @@ -282,7 +294,7 @@ qx.Proto._modifySelectionModel = function(propValue, propOldValue, propData) { // property modifier qx.Proto._modifyTableModel = function(propValue, propOldValue, propData) { - this.getTableColumnModel().init(propValue.getColumnCount()); + this.getTableColumnModel().init(propValue.getColumnCount(), this); if (propOldValue != null) { propOldValue.removeEventListener(qx.ui.table.TableModel.EVENT_TYPE_META_DATA_CHANGED, this._onTableModelMetaDataChanged, this); @@ -309,6 +321,25 @@ qx.Proto._modifyTableColumnModel = function(propValue, propOldValue, propData) { propValue.addEventListener("widthChanged", this._onColWidthChanged, this); propValue.addEventListener("orderChanged", this._onColOrderChanged, this); + // Get the current table model + var tm = this.getTableModel(); + + // If one is already in effect... + if (tm) + { + // ... then initialize this new table column model now. + propValue.init(tm.getColumnCount(), this); + } + + // Reset the table column model in each table pane model + var scrollerArr = this._getPaneScrollerArr(); + for (var i = 0; i < scrollerArr.length; i++) + { + var paneScroller = scrollerArr[i]; + var paneModel = paneScroller.getTablePaneModel(); + paneModel._tableColumnModel = propValue; + } + return true; }; @@ -1070,6 +1101,20 @@ qx.Proto._toggleColumnVisibilityMenu = function() { var tableModel = this.getTableModel(); var columnModel = this.getTableColumnModel(); + + // Inform listeners who may want to insert menu items at the beginning + if (this.hasEventListeners("columnVisibilityMenuCreateStart")) + { + var data = + { + table : this, + menu : menu + }; + var event = + new qx.event.type.DataEvent("columnVisibilityMenuCreateStart", data); + this.dispatchEvent(event, true); + } + for (var x = 0; x < columnModel.getOverallColumnCount(); x++) { var col = columnModel.getOverallColumnAtX(x); var visible = columnModel.isColumnVisible(col); @@ -1083,6 +1128,19 @@ qx.Proto._toggleColumnVisibilityMenu = function() { menu.add(bt); } + // Inform listeners who may want to insert menu items at the end + if (this.hasEventListeners("columnVisibilityMenuCreateEnd")) + { + var data = + { + table : this, + menu : menu + }; + var event = + new qx.event.type.DataEvent("columnVisibilityMenuCreateEnd", data); + this.dispatchEvent(event, true); + } + menu.setParent(this.getTopLevelWidget()); this._columnVisibilityMenu = menu; |