summaryrefslogtreecommitdiff
path: root/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/table/SelectionManager.js
diff options
context:
space:
mode:
Diffstat (limited to 'webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/table/SelectionManager.js')
-rw-r--r--webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/table/SelectionManager.js163
1 files changed, 0 insertions, 163 deletions
diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/table/SelectionManager.js b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/table/SelectionManager.js
deleted file mode 100644
index 715b0d9d96..0000000000
--- a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/source/class/qx/ui/table/SelectionManager.js
+++ /dev/null
@@ -1,163 +0,0 @@
-/* ************************************************************************
-
- qooxdoo - the new era of web development
-
- http://qooxdoo.org
-
- Copyright:
- 2006 by STZ-IDA, Germany, http://www.stz-ida.de
-
- License:
- LGPL 2.1: http://www.gnu.org/licenses/lgpl.html
-
- Authors:
- * Til Schneider (til132)
-
-************************************************************************ */
-
-/* ************************************************************************
-
-#module(ui_table)
-
-************************************************************************ */
-
-/**
- * A selection manager. This is a helper class that handles all selection
- * related events and updates a SelectionModel.
- * <p>
- * Widgets that support selection should use this manager. This way the only
- * thing the widget has to do is mapping mouse or key events to indexes and
- * call the corresponding handler method.
- *
- * @see SelectionModel
- */
-qx.OO.defineClass("qx.ui.table.SelectionManager", qx.core.Object,
-function() {
- qx.core.Object.call(this);
-});
-
-
-/**
- * The selection model where to set the selection changes.
- */
-qx.OO.addProperty({ name:"selectionModel", type:"object", instance:"qx.ui.table.SelectionModel" });
-
-
-/**
- * Handles the mouse down event.
- *
- * @param index {int} the index the mouse is pointing at.
- * @param evt {Map} the mouse event.
- */
-qx.Proto.handleMouseDown = function(index, evt) {
- if (evt.isLeftButtonPressed()) {
- var selectionModel = this.getSelectionModel();
- if (!selectionModel.isSelectedIndex(index)) {
- // This index is not selected -> We react when the mouse is pressed (because of drag and drop)
- this._handleSelectEvent(index, evt);
- this._lastMouseDownHandled = true;
- } else {
- // This index is already selected -> We react when the mouse is released (because of drag and drop)
- this._lastMouseDownHandled = false;
- }
- } else if (evt.isRightButtonPressed() && evt.getModifiers() == 0) {
- var selectionModel = this.getSelectionModel();
- if (!selectionModel.isSelectedIndex(index)) {
- // This index is not selected -> Set the selection to this index
- selectionModel.setSelectionInterval(index, index);
- }
- }
-}
-
-
-/**
- * Handles the mouse up event.
- *
- * @param index {int} the index the mouse is pointing at.
- * @param evt {Map} the mouse event.
- */
-qx.Proto.handleMouseUp = function(index, evt) {
- if (evt.isLeftButtonPressed() && !this._lastMouseDownHandled) {
- this._handleSelectEvent(index, evt);
- }
-}
-
-
-/**
- * Handles the mouse click event.
- *
- * @param index {int} the index the mouse is pointing at.
- * @param evt {Map} the mouse event.
- */
-qx.Proto.handleClick = function(index, evt) {
-}
-
-
-/**
- * Handles the key down event that is used as replacement for mouse clicks
- * (Normally space).
- *
- * @param index {int} the index that is currently focused.
- * @param evt {Map} the key event.
- */
-qx.Proto.handleSelectKeyDown = function(index, evt) {
- this._handleSelectEvent(index, evt);
-};
-
-
-/**
- * Handles a key down event that moved the focus (E.g. up, down, home, end, ...).
- *
- * @param index {int} the index that is currently focused.
- * @param evt {Map} the key event.
- */
-qx.Proto.handleMoveKeyDown = function(index, evt) {
- var selectionModel = this.getSelectionModel();
- switch (evt.getModifiers()) {
- case 0:
- selectionModel.setSelectionInterval(index, index);
- break;
- case qx.event.type.DomEvent.SHIFT_MASK:
- var anchor = selectionModel.getAnchorSelectionIndex();
- if (anchor == -1) {
- selectionModel.setSelectionInterval(index, index);
- } else {
- selectionModel.setSelectionInterval(anchor, index);
- }
- break;
- }
-}
-
-
-/**
- * Handles a select event.
- *
- * @param index {int} the index the event is pointing at.
- * @param evt {Map} the mouse event.
- */
-qx.Proto._handleSelectEvent = function(index, evt) {
- var selectionModel = this.getSelectionModel();
- if (evt.getShiftKey()) {
- var leadIndex = selectionModel.getLeadSelectionIndex();
- if (index != leadIndex || selectionModel.isSelectionEmpty()) {
- // The lead selection index was changed
- var anchorIndex = selectionModel.getAnchorSelectionIndex();
- if (anchorIndex == -1) {
- anchorIndex = index;
- }
- if (evt.isCtrlOrCommandPressed()) {
- selectionModel.addSelectionInterval(anchorIndex, index);
- } else {
- selectionModel.setSelectionInterval(anchorIndex, index);
- }
- }
- } else if (evt.isCtrlOrCommandPressed()) {
- if (selectionModel.isSelectedIndex(index)) {
- selectionModel.removeSelectionInterval(index, index);
- } else {
- selectionModel.addSelectionInterval(index, index);
- }
- } else {
- selectionModel.setSelectionInterval(index, index);
- }
-}