On Thu, Jul 31, 2008 at 3:20 PM, Guilherme Aiolfi <[EMAIL PROTECTED]> wrote:
> > The examples would be the same as with the Simple model, as the cell
> editor communication is with the model. If you implement the > methods by
> the abstract Remote model class, you should have use of cell editors with no
> other work.
>
> I haven't figured out how to use remote models and be able to use cell
> editors yet. Every example that has cell editors uses
> tableModel.setColumnEditable(columnIndex, bool) method. This method is
> avaiable just in the Simple Model Class.
>
> What am I missing?
>
Ah, sorry, you're missing the mixin. I don't believe I ever received any
confirmation from anyone way-back-when that this works and I haven't tested
it. That's why I never checked it in. You'll see that this patch modifies
Simple to use the provided mixin and you'll have to do similarly with
Remote:
qx.Class.patch(qx.ui.table.model.Remote, qx.ui.table.model.MEditable);
I don't recall the details of why this couldn't just be added to Abstract
but there was something with breaking backward compatibility.
Please let me know how this patch works for you.
Cheers,
Derrell
diff --git a/qooxdoo/frontend/framework/source/class/qx/ui/table/model/MEditable.js b/qooxdoo/frontend/framework/source/class/qx/ui/table/model/MEditable.js
new file mode 100644
index 0000000..949d711
--- /dev/null
+++ b/qooxdoo/frontend/framework/source/class/qx/ui/table/model/MEditable.js
@@ -0,0 +1,91 @@
+/* ************************************************************************
+
+ qooxdoo - the new era of web development
+
+ http://qooxdoo.org
+
+ Copyright:
+ 2006 STZ-IDA, Germany, http://www.stz-ida.de
+ 2008 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:
+ * Til Schneider (til132)
+ * Derrell Lipman (derrell)
+
+************************************************************************ */
+
+/* ************************************************************************
+
+#module(ui_table)
+
+************************************************************************ */
+
+/**
+ *
+ */
+qx.Mixin.define("qx.ui.table.model.MEditable",
+{
+ construct : function()
+ {
+ this._editableColArr = null;
+ },
+
+ members :
+ {
+ /**
+ * Sets all columns editable or not editable.
+ *
+ * @type member
+ * @param editable {Boolean} whether all columns are editable.
+ * @return {void}
+ */
+ setEditable : function(editable)
+ {
+ this._editableColArr = [];
+
+ for (var col=0; col<this.getColumnCount(); col++) {
+ this._editableColArr[col] = editable;
+ }
+
+ this.createDispatchEvent(qx.ui.table.ITableModel.EVENT_TYPE_META_DATA_CHANGED);
+ },
+
+
+ /**
+ * Sets whether a column is editable.
+ *
+ * @type member
+ * @param columnIndex {Integer} the column of which to set the editable state.
+ * @param editable {Boolean} whether the column should be editable.
+ * @return {void}
+ */
+ setColumnEditable : function(columnIndex, editable)
+ {
+ if (editable != this.isColumnEditable(columnIndex))
+ {
+ if (this._editableColArr == null) {
+ this._editableColArr = [];
+ }
+
+ this._editableColArr[columnIndex] = editable;
+
+ this.createDispatchEvent(qx.ui.table.ITableModel.EVENT_TYPE_META_DATA_CHANGED);
+ }
+ },
+
+ // overridden
+ isColumnEditable : function(columnIndex) {
+ return this._editableColArr ? (this._editableColArr[columnIndex] == true) : false;
+ }
+ },
+
+ destruct : function()
+ {
+ this._disposeFields("_editableColArr");
+ }
+});
diff --git a/qooxdoo/frontend/framework/source/class/qx/ui/table/model/Simple.js b/qooxdoo/frontend/framework/source/class/qx/ui/table/model/Simple.js
index 68b8631..f30cc28 100644
--- a/qooxdoo/frontend/framework/source/class/qx/ui/table/model/Simple.js
+++ b/qooxdoo/frontend/framework/source/class/qx/ui/table/model/Simple.js
@@ -30,7 +30,6 @@ qx.Class.define("qx.ui.table.model.Simple",
{
extend : qx.ui.table.model.Abstract,
-
construct : function()
{
this.base(arguments);
@@ -42,7 +41,13 @@ qx.Class.define("qx.ui.table.model.Simple",
// Array of objects, each with property "ascending" and "descending"
this._sortMethods = [];
- this._editableColArr = null;
+ // If we haven't yet patched ourself with the standard Editable features,
+ // do so now. Note that we must patch() rather than include() because
+ // a default isColumnEditable() is defined in Abstract.js.
+ if (this._editableColArr === undefined)
+ {
+ qx.Class.patch(qx.ui.table.model.Simple, qx.ui.table.model.MEditable);
+ }
},
properties :
@@ -165,53 +170,6 @@ qx.Class.define("qx.ui.table.model.Simple",
/**
- * Sets all columns editable or not editable.
- *
- * @type member
- * @param editable {Boolean} whether all columns are editable.
- * @return {void}
- */
- setEditable : function(editable)
- {
- this._editableColArr = [];
-
- for (var col=0; col<this.getColumnCount(); col++) {
- this._editableColArr[col] = editable;
- }
-
- this.createDispatchEvent(qx.ui.table.ITableModel.EVENT_TYPE_META_DATA_CHANGED);
- },
-
-
- /**
- * Sets whether a column is editable.
- *
- * @type member
- * @param columnIndex {Integer} the column of which to set the editable state.
- * @param editable {Boolean} whether the column should be editable.
- * @return {void}
- */
- setColumnEditable : function(columnIndex, editable)
- {
- if (editable != this.isColumnEditable(columnIndex))
- {
- if (this._editableColArr == null) {
- this._editableColArr = [];
- }
-
- this._editableColArr[columnIndex] = editable;
-
- this.createDispatchEvent(qx.ui.table.ITableModel.EVENT_TYPE_META_DATA_CHANGED);
- }
- },
-
- // overridden
- isColumnEditable : function(columnIndex) {
- return this._editableColArr ? (this._editableColArr[columnIndex] == true) : false;
- },
-
-
- /**
* Sets whether a column is sortable.
*
* @param columnIndex {Integer} the column of which to set the sortable state.
@@ -552,6 +510,6 @@ qx.Class.define("qx.ui.table.model.Simple",
destruct : function() {
- this._disposeFields("_rowArr", "_editableColArr", "_sortMethods");
+ this._disposeFields("_rowArr", "_sortMethods");
}
});
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel