Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

columns autoresize in tables

dialogs width incremented
cell values copy implemented in tables
  • Loading branch information...
commit bf5ec2835bb11d4eb120981d7a5f0d1a15548238 1 parent b91111a
tomek authored
View
3  src/main/frontend/source/class/helenos/Application.js
@@ -40,8 +40,9 @@ qx.Class.define("helenos.Application",
ZeroClipboard.setMoviePath("resource/ZeroClipboard10.swf");
- // apply some required mixin to TreeVirtual to enable context menu
+ // apply MTableContextMenu mixin to TreeVirtual and Table to enable context menu
qx.Class.include(qx.ui.treevirtual.TreeVirtual, qx.ui.table.MTableContextMenu);
+ qx.Class.include(helenos.ui.table.Table, qx.ui.table.MTableContextMenu);
// Enable logging in debug variant
if (qx.core.Environment.get("qx.debug"))
View
18 src/main/frontend/source/class/helenos/components/SchemaPane.js
@@ -93,12 +93,18 @@ qx.Class.define("helenos.components.SchemaPane",
}
}
};
- dialog.Dialog.form('<h3>Create new keyspace</h3>', formData, function(context, result) {
- if (result != null) {
- helenos.util.RpcActionsProvider.createKeyspace(result);
- helenos.util.GuiObserver.refreshSchemaTree();
- }
- }, this);
+ (new dialog.Form({
+ "message" : '<h3>Create new keyspace</h3>',
+ "formData" : formData,
+ "allowCancel" : true,
+ "callback" : function(context, result) {
+ if (result != null) {
+ helenos.util.RpcActionsProvider.createKeyspace(result);
+ helenos.util.GuiObserver.refreshSchemaTree();
+ }
+ },
+ "context" : this
+ })).set({width : 450}).show();
},
refreshSchemaTree : function() {
View
56 src/main/frontend/source/class/helenos/components/menu/ColumnFamilyContextMenu.js
@@ -20,35 +20,39 @@ qx.Class.define('helenos.components.menu.ColumnFamilyContextMenu',
construct : function(ksName, cfName)
{
this.base(arguments);
-
- var propsButton = new qx.ui.menu.Button('Properties', 'icon/16/status/dialog-information.png');
- propsButton.setUserData('KSNAME', ksName);
- propsButton.setUserData('CFNAME', cfName);
- propsButton.addListener('execute', this.__showProperties);
- this.add(propsButton);
-
- var browseButton = new qx.ui.menu.Button('Browse data', 'icon/16/apps/office-spreadsheet.png');
- browseButton.setUserData('KSNAME', ksName);
- browseButton.setUserData('CFNAME', cfName);
- browseButton.addListener('execute', this.__showBrowseByPredicatePane);
- this.add(browseButton);
-
- this.add(new qx.ui.menu.Separator());
-
- var dropButton = new qx.ui.menu.Button('Drop', 'icon/16/actions/edit-delete.png');
- dropButton.setUserData('KSNAME', ksName);
- dropButton.setUserData('CFNAME', cfName);
- dropButton.addListener('execute', this.__dropColumnFamily);
- this.add(dropButton);
-
- var truncateButton = new qx.ui.menu.Button('Truncate', 'icon/16/actions/edit-clear.png');
- truncateButton.setUserData('KSNAME', ksName);
- truncateButton.setUserData('CFNAME', cfName);
- truncateButton.addListener('execute', this.__truncateColumnFamily);
- this.add(truncateButton);
+ this.__initMenuItems(ksName, cfName);
},
members : {
+
+ __initMenuItems : function(ksName, cfName) {
+ var propsButton = new qx.ui.menu.Button('Properties', 'icon/16/status/dialog-information.png');
+ propsButton.setUserData('KSNAME', ksName);
+ propsButton.setUserData('CFNAME', cfName);
+ propsButton.addListener('execute', this.__showProperties);
+
+ var browseButton = new qx.ui.menu.Button('Browse data', 'icon/16/apps/office-spreadsheet.png');
+ browseButton.setUserData('KSNAME', ksName);
+ browseButton.setUserData('CFNAME', cfName);
+ browseButton.addListener('execute', this.__showBrowseByPredicatePane);
+
+ var dropButton = new qx.ui.menu.Button('Drop', 'icon/16/actions/edit-delete.png');
+ dropButton.setUserData('KSNAME', ksName);
+ dropButton.setUserData('CFNAME', cfName);
+ dropButton.addListener('execute', this.__dropColumnFamily);
+
+ var truncateButton = new qx.ui.menu.Button('Truncate', 'icon/16/actions/edit-clear.png');
+ truncateButton.setUserData('KSNAME', ksName);
+ truncateButton.setUserData('CFNAME', cfName);
+ truncateButton.addListener('execute', this.__truncateColumnFamily);
+
+ this.add(propsButton);
+ this.add(browseButton);
+ this.add(new qx.ui.menu.Separator());
+ this.add(dropButton);
+ this.add(truncateButton);
+ },
+
__showProperties : function(e) {
var ksName = e.getTarget().getUserData('KSNAME');
var cfName = e.getTarget().getUserData('CFNAME');
View
38 src/main/frontend/source/class/helenos/components/menu/KeyspaceContextMenu.js
@@ -18,26 +18,30 @@ qx.Class.define('helenos.components.menu.KeyspaceContextMenu',
construct : function(ksName)
{
this.base(arguments);
-
- var propsButton = new qx.ui.menu.Button('Properties', 'icon/16/status/dialog-information.png');
- propsButton.setUserData('KSNAME', ksName);
- propsButton.addListener('execute', this.__showProperties);
- this.add(propsButton);
-
- this.add(new qx.ui.menu.Separator());
-
- var addCFButton = new qx.ui.menu.Button('Add column family', 'icon/16/actions/list-add.png');
- addCFButton.setUserData('KSNAME', ksName);
- addCFButton.addListener('execute', this.__addColumnFamily);
- this.add(addCFButton);
-
- var dropButton = new qx.ui.menu.Button('Drop', 'icon/16/actions/edit-delete.png');
- dropButton.setUserData('KSNAME', ksName);
- dropButton.addListener('execute', this.__dropKeyspace);
- this.add(dropButton);
+ this.__initMenuItems(ksName);
},
members : {
+
+ __initMenuItems : function(ksName) {
+ var propsButton = new qx.ui.menu.Button('Properties', 'icon/16/status/dialog-information.png');
+ propsButton.setUserData('KSNAME', ksName);
+ propsButton.addListener('execute', this.__showProperties);
+
+ var addCFButton = new qx.ui.menu.Button('Add column family', 'icon/16/actions/list-add.png');
+ addCFButton.setUserData('KSNAME', ksName);
+ addCFButton.addListener('execute', this.__addColumnFamily);
+
+ var dropButton = new qx.ui.menu.Button('Drop', 'icon/16/actions/edit-delete.png');
+ dropButton.setUserData('KSNAME', ksName);
+ dropButton.addListener('execute', this.__dropKeyspace);
+
+ this.add(propsButton);
+ this.add(new qx.ui.menu.Separator());
+ this.add(addCFButton);
+ this.add(dropButton);
+ },
+
__showProperties : function(e) {
var ksName = e.getTarget().getUserData('KSNAME');
helenos.util.GuiObserver.showKeyspaceInfoTab(ksName);
View
4 src/main/frontend/source/class/helenos/components/tab/AbstractCloseablePage.js
@@ -13,8 +13,6 @@ qx.Class.define("helenos.components.tab.AbstractCloseablePage",
construct : function()
{
this.base(arguments);
- this.set({
- showCloseButton: true
- });
+ this.setShowCloseButton(true);
}
});
View
21 src/main/frontend/source/class/helenos/components/tab/ColumnFamilyInfoPage.js
@@ -50,8 +50,8 @@ qx.Class.define("helenos.components.tab.ColumnFamilyInfoPage",
},
__addCommentArea : function(cfDef) {
- var gb = new qx.ui.groupbox.GroupBox('Comment');
- gb.setLayout(new qx.ui.layout.VBox());
+ var gb = new helenos.ui.GroupBoxV('Comment');
+
var ta = new qx.ui.form.TextField(cfDef.comment).set({readOnly : true})
gb.add(ta, {flex : 1});
@@ -59,9 +59,7 @@ qx.Class.define("helenos.components.tab.ColumnFamilyInfoPage",
},
__getCacheInfoPane : function(cfDef) {
- var gb = new qx.ui.groupbox.GroupBox('Cache');
- gb.setLayout(new qx.ui.layout.VBox());
-
+ var gb = new helenos.ui.GroupBoxV('Cache');
gb.add(new helenos.ui.RichAtom('Row cache size: <b>' + cfDef.rowCacheSize + '</b>'));
gb.add(new helenos.ui.RichAtom('Row cache save period: <b>' + cfDef.rowCacheSavePeriodInSeconds.className + ' seconds</b>'));
@@ -77,8 +75,7 @@ qx.Class.define("helenos.components.tab.ColumnFamilyInfoPage",
},
__getMemInfoPane : function(cfDef) {
- var gb = new qx.ui.groupbox.GroupBox('Memtable & threshold');
- gb.setLayout(new qx.ui.layout.VBox());
+ var gb = new helenos.ui.GroupBoxV('Memtable & threshold');
gb.add(new helenos.ui.RichAtom('Max compaction threshold: <b>' + cfDef.maxCompactionThreshold + '</b>'));
gb.add(new helenos.ui.RichAtom('Min compaction threshold: <b>' + cfDef.minCompactionThreshold + '</b>'));
@@ -90,8 +87,7 @@ qx.Class.define("helenos.components.tab.ColumnFamilyInfoPage",
},
__getTypesInfoPane : function(cfDef) {
- var gb = new qx.ui.groupbox.GroupBox('Types');
- gb.setLayout(new qx.ui.layout.VBox());
+ var gb = new helenos.ui.GroupBoxV('Types');
gb.add(new helenos.ui.RichAtom('Column: <b>' + cfDef.columnType + '</b>'));
gb.add(new helenos.ui.RichAtom('Comparator: <b>' + cfDef.comparatorType.className.replace('org.apache.cassandra.db.marshal.','') + '</b>'));
@@ -109,10 +105,11 @@ qx.Class.define("helenos.components.tab.ColumnFamilyInfoPage",
tableModel.setColumns(['Name','Validation class', 'Index name', 'Index type'],['name','validationClass','indexName', 'indexType']);
tableModel.setDataAsMapArray(cfDef.columnMetadata);
- var table = new qx.ui.table.Table(tableModel);
+ var table = new helenos.ui.table.Table(tableModel);
+ table.setContextMenuHandlers([0,1,2,3]);
+ table.setColumnsWidth([28,28,28,16]);
- var gb = new qx.ui.groupbox.GroupBox('Column metadata');
- gb.setLayout(new qx.ui.layout.VBox());
+ var gb = new helenos.ui.GroupBoxV('Column metadata');
var sp = new qx.ui.core.scroll.ScrollPane();
sp.add(table);
View
46 src/main/frontend/source/class/helenos/components/tab/ConnectionsEditorPage.js
@@ -43,9 +43,11 @@ qx.Class.define("helenos.components.tab.ConnectionsEditorPage",
__deleteButton : null,
__addConnectionsTable : function() {
- this.__connectionsTable = new qx.ui.table.Table(new helenos.remote.ConnectionsTableModel());
+ this.__connectionsTable = new helenos.ui.table.Table(new helenos.remote.ConnectionsTableModel());
this.__connectionsTable.getTableColumnModel().setDataCellRenderer(3, new qx.ui.table.cellrenderer.Boolean());
this.__connectionsTable.getSelectionModel().addListener('changeSelection', this.__onTableSelectionChanged, this);
+ this.__connectionsTable.setContextMenuHandlers([0,1,2]);
+ this.__connectionsTable.setColumnsWidth([15,45,25,15]);
var gb = new qx.ui.groupbox.GroupBox('Available connections');
gb.setLayout(new qx.ui.layout.VBox(5));
@@ -118,13 +120,19 @@ qx.Class.define("helenos.components.tab.ConnectionsEditorPage",
}
}
};
- dialog.Dialog.form('<h3>Create connection</h3>', formData, function(context, result) {
- if (result != null) {
- result['active'] = false;
- helenos.util.RpcActionsProvider.storeConnection(result);
- context._reloadConnectionsTable();
- }
- }, this);
+ (new dialog.Form({
+ "message" : '<h3>Create new connection</h3>',
+ "formData" : formData,
+ "allowCancel" : true,
+ "callback" : function(context, result) {
+ if (result != null) {
+ result['active'] = false;
+ helenos.util.RpcActionsProvider.storeConnection(result);
+ context._reloadConnectionsTable();
+ }
+ },
+ "context" : this
+ })).set({width : 550}).show();
},
/**
@@ -152,14 +160,20 @@ qx.Class.define("helenos.components.tab.ConnectionsEditorPage",
}
}
};
- dialog.Dialog.form('<h3>Edit connection</h3>', formData, function(context, result) {
- if (result != null) {
- result['alias'] = cc.alias;
- result['active'] = cc.active;
- helenos.util.RpcActionsProvider.storeConnection(result);
- context._reloadConnectionsTable();
- }
- }, this);
+ (new dialog.Form({
+ "message" : '<h3>Edit connection</h3>',
+ "formData" : formData,
+ "allowCancel" : true,
+ "callback" : function(context, result) {
+ if (result != null) {
+ result['alias'] = cc.alias;
+ result['active'] = cc.active;
+ helenos.util.RpcActionsProvider.storeConnection(result);
+ context._reloadConnectionsTable();
+ }
+ },
+ "context" : this
+ })).set({width : 550}).show();
},
/**
View
9 src/main/frontend/source/class/helenos/components/tab/KeyspaceInfoPage.js
@@ -46,8 +46,7 @@ qx.Class.define("helenos.components.tab.KeyspaceInfoPage",
},
__addBasicInfoGroup : function(ksDef) {
- var gb = new qx.ui.groupbox.GroupBox('Basic');
- gb.setLayout(new qx.ui.layout.VBox());
+ var gb = new helenos.ui.GroupBoxV('Basic');
var a1 = new helenos.ui.RichAtom('Strategy class: <b>' + ksDef.strategyClass + '</b>');
var a2 = new helenos.ui.RichAtom('Replication factor: <b>' + ksDef.replicationFactor + '</b>');
@@ -64,9 +63,9 @@ qx.Class.define("helenos.components.tab.KeyspaceInfoPage",
// qx.lang.Core.arrayForEach(this.__convertCF, ksDef.cfDefs);
tableModel.setDataAsMapArray(ksDef.cfDefs.map(this.__convertCF));
- //alert(qx.lang.Object.getKeysAsString(ksDef.cfDefs[0]));
- var table = new qx.ui.table.Table(tableModel);
-
+ var table = new helenos.ui.table.Table(tableModel);
+ table.setContextMenuHandlers([0,1]);
+ table.setColumnsWidth([10,10,10,10,10,10,10,10,10,10]);
var gb = new qx.ui.groupbox.GroupBox('Column families');
gb.setLayout(new qx.ui.layout.VBox());
View
35 src/main/frontend/source/class/helenos/ui/table/MZeroClipboardCtxHandler.js
@@ -0,0 +1,35 @@
+/* ************************************************************************
+Copyright:
+ 2012 Tomek Kuprowski
+License:
+ GPLv2: http://www.gnu.org/licences/gpl.html
+Authors:
+ Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ ************************************************************************ */
+qx.Mixin.define("helenos.ui.table.MZeroClipboardCtxHandler",
+{
+ members : {
+ contextMenuHandler : function(col, row, table, dataModel, contextMenu) {
+ var copyBtn = new qx.ui.menu.Button('Copy to clipboard');
+ var clip = new ZeroClipboard.Client();
+
+ clip.addEventListener('complete', function (client, text) {
+ client.destroy();
+ },this);
+ if (!table.getSelectionModel().isSelectionEmpty()) {
+ var text = dataModel.getValue(col, row);
+ if (qx.lang.Type.isObject(text)) {
+ text = text.label
+ }
+ clip.setText(text);
+ }
+
+ copyBtn.addListener("appear", function(e) {
+ clip.glue(e.getTarget().getContentElement().getDomElement());
+ }, this);
+
+ contextMenu.add(copyBtn);
+ return true;
+ }
+ }
+});
View
26 src/main/frontend/source/class/helenos/ui/table/Table.js
@@ -9,10 +9,34 @@ Authors:
qx.Class.define("helenos.ui.table.Table",
{
extend : qx.ui.table.Table,
+ include : [helenos.ui.table.MZeroClipboardCtxHandler],
construct : function(tableModel)
{
this.base(arguments, tableModel);
- this.setToolTipText('Double click to edit and copy values');
+ },
+
+ members : {
+ _columnsWidth: null,
+
+ setContextMenuHandlers : function(colIds) {
+ var i;
+ for (i=0; i < colIds.length; i++) {
+ this.setContextMenuHandler(colIds[i], this.contextMenuHandler);
+ }
+ },
+
+ setColumnsWidth : function(colsWidth) {
+ this._columnsWidth = colsWidth;
+ this.addListener('resize', function(e) {
+ this._resizeTableColumns(e);
+ }, this);
+ },
+
+ _resizeTableColumns : function(e) {
+ for (var i = 0; i < this._columnsWidth.length; i++) {
+ this.setColumnWidth(i, e.getData()['width'] * this._columnsWidth[i] / 100);
+ }
+ }
}
});
View
23 src/main/frontend/source/class/helenos/ui/table/model/EditableSimple.js
@@ -1,23 +0,0 @@
-/* ************************************************************************
-Copyright:
- 2012 Tomek Kuprowski
-License:
- GPLv2: http://www.gnu.org/licences/gpl.html
-Authors:
- Tomek Kuprowski (tomekkuprowski at gmail dot com)
- ************************************************************************ */
-qx.Class.define("helenos.ui.table.model.EditableSimple",
-{
- extend : qx.ui.table.model.Simple,
-
- construct : function()
- {
- this.base(arguments);
- },
-
- members : {
- isColumnEditable : function(index) {
- return true;
- }
- }
-});
View
32 src/main/frontend/source/class/helenos/ui/treevirtual/ResultsTree.js
@@ -9,6 +9,7 @@ Authors:
qx.Class.define("helenos.ui.treevirtual.ResultsTree",
{
extend : qx.ui.treevirtual.TreeVirtual,
+ include : [helenos.ui.table.MZeroClipboardCtxHandler],
construct : function(data)
{
@@ -21,37 +22,14 @@ qx.Class.define("helenos.ui.treevirtual.ResultsTree",
this.setData(data);
- this.setContextMenuHandler(0, this._contextMenuHandler);
- this.setContextMenuHandler(1, this._contextMenuHandler);
- this.setContextMenuHandler(2, this._contextMenuHandler);
- this.setContextMenuHandler(3, this._contextMenuHandler);
+ this.setContextMenuHandler(0, this.contextMenuHandler);
+ this.setContextMenuHandler(1, this.contextMenuHandler);
+ this.setContextMenuHandler(2, this.contextMenuHandler);
+ this.setContextMenuHandler(3, this.contextMenuHandler);
},
members : {
- _contextMenuHandler : function(col, row, table, dataModel, contextMenu) {
- var copyBtn = new qx.ui.menu.Button('Copy to clipboard');
- var clip = new ZeroClipboard.Client();
-
- clip.addEventListener('complete', function (client, text) {
- client.destroy();
- },this);
- if (!table.getSelectionModel().isSelectionEmpty()) {
- var text = dataModel.getValue(col, row);
- if (qx.lang.Type.isObject(text)) {
- text = text.label
- }
- clip.setText(text);
- }
-
- copyBtn.addListener("appear", function(e) {
- clip.glue(e.getTarget().getContentElement().getDomElement());
- }, this);
-
- contextMenu.add(copyBtn);
- return true;
- },
-
setData : function(data) {
if (data == null) {
return
View
2  src/main/frontend/source/translation/en.po
@@ -20,7 +20,7 @@ msgstr "Error"
#: helenos/components/menu/ColumnFamilyContextMenu.js:80
#: helenos/components/menu/ColumnFamilyContextMenu.js:106
msgid "loss.data.alert"
-msgstr "<h3>Are you sure ?! You will lose all your data !!!</h3>"
+msgstr "<h2><p>Are you sure ?!</p></h2><h4>You will lose all your data !!!</h4>"
#: helenos/components/tab/ConnectionsEditorPage.js:97
msgid "are.you.sure"
Please sign in to comment.
Something went wrong with that request. Please try again.