+ this.table.getSelectionModel().addListener("changeSelection", function(){
+ this._selectionToValues(this.table.getSelectionModel(), this.getViewSelection());
+ }, this);
+
+ this.setGuiMode("chooser");
+ },
+
+ _applyGuiMode : function(newMode, oldMode){
+ this.table.getSelectionModel().clearSelection();
+ this.resetHiddenRows();
+ if(newMode == "filter"){
+ this.table.getSelectionModel().setSelectionMode(qx.ui.table.selection.Model.SINGLE_INTERVAL_SELECTION);
+ }else if(newMode == "chooser"){
+ this.table.getSelectionModel().setSelectionMode(qx.ui.table.selection.Model.MULTIPLE_INTERVAL_SELECTION_TOGGLE);
+ }else if(newMode == "clear"){
+ this.table.getSelectionModel().setSelectionMode(qx.ui.table.selection.Model.SINGLE_INTERVAL_SELECTION);
+ }
+ },
+
+ _selectionToValues : function(selectionModel, viewSelection){
+ if(viewSelection){
+ viewSelection.setBatchMode(true);
+ viewSelection.clear();
+ }
+ if(!selectionModel.getSelectedCount()) return [];
+ var ranges = selectionModel.getSelectedRanges();
+ var values = [];
+ for(var i=0;i<ranges.length;i++){
+ for(var j=ranges[i].minIndex;j<=ranges[i].maxIndex;j++){
+ values.push(this.tableModel.getData()[j][0]);
+ if(viewSelection){
+ viewSelection.addNode(this.tableModel.getData()[j][0]);
+ }
+ }
+ }
+ if(viewSelection){
+ viewSelection.setBatchMode(false);
+ }
+ return values;