#32 multiple table selection
--HG-- extra : convert_revision : svn%3Ab267cdba-c1da-11dd-874b-8bacd04a0a74/trunk%4063
This commit is contained in:
+63
-27
@@ -796,11 +796,21 @@ SQL.Table.prototype.snap = function() {
|
||||
|
||||
SQL.Table.prototype.down = function(e) { /* mousedown - start drag */
|
||||
OZ.Event.prevent(e);
|
||||
this.owner.tableManager.select(this);
|
||||
/* a non-shift click within a selection preserves the selection */
|
||||
if (e.shiftKey || ! this.selected) {
|
||||
this.owner.tableManager.select(this, e.shiftKey);
|
||||
}
|
||||
|
||||
SQL.Table.active = this;
|
||||
SQL.Table.x = this.x - e.clientX; /* position relative to mouse cursor */
|
||||
SQL.Table.y = this.y - e.clientY;
|
||||
var t = SQL.Table;
|
||||
t.active = this.owner.tableManager.selection;
|
||||
var n = t.active.length;
|
||||
t.x = new Array(n);
|
||||
t.y = new Array(n);
|
||||
for (i in SQL.Table.active) {
|
||||
/* position relative to mouse cursor */
|
||||
t.x[i] = t.active[i].x - e.clientX;
|
||||
t.y[i] = t.active[i].y - e.clientY;
|
||||
}
|
||||
|
||||
if (this.owner.getOption("hide")) { this.hideRelations(); }
|
||||
}
|
||||
@@ -889,12 +899,13 @@ SQL.Table.prototype.getComment = function() {
|
||||
|
||||
SQL.Table.move = function(e) { /* mousemove */
|
||||
var t = SQL.Table;
|
||||
var d = SQL.Designer;
|
||||
if (!t.active) { return; }
|
||||
SQL.Designer.removeSelection();
|
||||
var x = t.x + e.clientX;
|
||||
var y = t.y + e.clientY;
|
||||
t.active.moveTo(x, y);
|
||||
for (var i in t.active) {
|
||||
var x = t.x[i] + e.clientX;
|
||||
var y = t.y[i] + e.clientY;
|
||||
t.active[i].moveTo(x,y);
|
||||
}
|
||||
}
|
||||
|
||||
SQL.Table.up = function(e) {
|
||||
@@ -1323,7 +1334,7 @@ SQL.TableManager.prototype.init = function(owner) {
|
||||
name:OZ.$("tablename"),
|
||||
comment:OZ.$("tablecomment")
|
||||
};
|
||||
this.selected = null;
|
||||
this.selection = [];
|
||||
this.adding = false;
|
||||
|
||||
var ids = ["addtable","removetable","aligntables","cleartables","addrow","edittable","tablekeys"];
|
||||
@@ -1360,32 +1371,54 @@ SQL.TableManager.prototype.init = function(owner) {
|
||||
}
|
||||
|
||||
SQL.TableManager.prototype.addRow = function(e) {
|
||||
var newrow = this.selected.addRow(_("newrow"));
|
||||
var newrow = this.selection[0].addRow(_("newrow"));
|
||||
this.owner.rowManager.select(newrow);
|
||||
newrow.expand();
|
||||
}
|
||||
|
||||
SQL.TableManager.prototype.select = function(table) { /* activate table */
|
||||
if (this.selected === table) { return; }
|
||||
this.selected = table;
|
||||
SQL.TableManager.prototype.select = function(table, multi) { /* activate table */
|
||||
if (table) {
|
||||
if (multi) {
|
||||
var i = this.selection.indexOf(table);
|
||||
if (i < 0) {
|
||||
this.selection.push(table);
|
||||
} else {
|
||||
this.selection.splice(i, 1);
|
||||
}
|
||||
} else {
|
||||
if (this.selection[0] === table) { return; }
|
||||
this.selection = [table];
|
||||
}
|
||||
} else {
|
||||
this.selection = [];
|
||||
}
|
||||
|
||||
var tables = this.owner.tables;
|
||||
for (var i=0;i<tables.length;i++) {
|
||||
tables[i].deselect();
|
||||
}
|
||||
if (this.selected) {
|
||||
this.dom.removetable.disabled = false;
|
||||
if (this.selection.length == 1) {
|
||||
this.dom.addrow.disabled = false;
|
||||
this.dom.edittable.disabled = false;
|
||||
this.dom.tablekeys.disabled = false;
|
||||
this.owner.raise(this.selected);
|
||||
this.selected.select();
|
||||
this.dom.removetable.value = _("removetable");
|
||||
} else {
|
||||
this.dom.removetable.disabled = true;
|
||||
this.dom.addrow.disabled = true;
|
||||
this.dom.edittable.disabled = true;
|
||||
this.dom.tablekeys.disabled = true;
|
||||
}
|
||||
if (this.selection.length) {
|
||||
this.dom.removetable.disabled = false;
|
||||
if (this.selection.length > 1) { this.dom.removetable.value = _("removetables"); }
|
||||
} else {
|
||||
this.dom.removetable.disabled = true;
|
||||
this.dom.removetable.value = _("removetable");
|
||||
}
|
||||
for (var t in this.selection) {
|
||||
t = this.selection[t];
|
||||
t.owner.raise(t);
|
||||
t.select();
|
||||
}
|
||||
}
|
||||
|
||||
SQL.TableManager.prototype.click = function(e) { /* finish adding new table */
|
||||
@@ -1404,7 +1437,7 @@ SQL.TableManager.prototype.click = function(e) { /* finish adding new table */
|
||||
}
|
||||
this.select(newtable);
|
||||
this.owner.rowManager.select(false);
|
||||
if (this.selected) { this.edit(e); }
|
||||
if (this.selection.length == 1) { this.edit(e); }
|
||||
}
|
||||
|
||||
SQL.TableManager.prototype.preAdd = function(e) { /* click add new table */
|
||||
@@ -1428,18 +1461,21 @@ SQL.TableManager.prototype.clear = function(e) { /* remove all tables */
|
||||
}
|
||||
|
||||
SQL.TableManager.prototype.remove = function(e) {
|
||||
var result = confirm(_("confirmtable")+" '"+this.selected.getTitle()+"' ?");
|
||||
var titles = this.selection.slice(0);
|
||||
for (var i in titles) { titles[i] = "'"+titles[i].getTitle()+"'"; }
|
||||
var result = confirm(_("confirmtable")+" "+titles.join(", ")+"?");
|
||||
if (!result) { return; }
|
||||
this.owner.removeTable(this.selected);
|
||||
var sel = this.selection.slice(0);
|
||||
for (var i in sel) { this.owner.removeTable(sel[i]); }
|
||||
}
|
||||
|
||||
SQL.TableManager.prototype.edit = function(e) {
|
||||
this.owner.window.open(_("edittable"), this.dom.container, this.save);
|
||||
|
||||
var title = this.selected.getTitle();
|
||||
var title = this.selection[0].getTitle();
|
||||
this.dom.name.value = title;
|
||||
try { /* throws in ie6 */
|
||||
this.dom.comment.value = this.selected.getComment();
|
||||
this.dom.comment.value = this.selection[0].getComment();
|
||||
} catch(e) {}
|
||||
|
||||
/* pre-select table name */
|
||||
@@ -1454,16 +1490,16 @@ SQL.TableManager.prototype.edit = function(e) {
|
||||
}
|
||||
|
||||
SQL.TableManager.prototype.keys = function(e) { /* open keys dialog */
|
||||
this.owner.keyManager.open(this.selected);
|
||||
this.owner.keyManager.open(this.selection[0]);
|
||||
}
|
||||
|
||||
SQL.TableManager.prototype.save = function() {
|
||||
this.selected.setTitle(this.dom.name.value);
|
||||
this.selected.setComment(this.dom.comment.value);
|
||||
this.selection[0].setTitle(this.dom.name.value);
|
||||
this.selection[0].setComment(this.dom.comment.value);
|
||||
}
|
||||
|
||||
SQL.TableManager.prototype.press = function(e) {
|
||||
if (!this.selected) { return; }
|
||||
if (! this.selection.length) { return; }
|
||||
/* do not process keypresses if a row is selected */
|
||||
if (this.owner.rowManager.selected) { return; }
|
||||
switch (e.keyCode) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<string name="addtable">Přidat tabulku</string>
|
||||
<string name="edittable">Upravit tabulku</string>
|
||||
<string name="removetable">Smazat tabulku</string>
|
||||
<string name="removetables">Smazat tabulky</string>
|
||||
<string name="aligntables">Srovnat tabulky</string>
|
||||
<string name="cleartables">Zrušit tabulky</string>
|
||||
<string name="confirmall">Opravdu zrušit všechny tabulky</string>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<string name="addtable">Tabelle hinzufügen</string>
|
||||
<string name="edittable">Tabelle bearbeiten</string>
|
||||
<string name="removetable">Tabelle entfernen</string>
|
||||
<string name="removetables">Tabellen entfernen</string>
|
||||
<string name="aligntables">Tabellen ausrichten</string>
|
||||
<string name="cleartables">Tabellen löschen</string>
|
||||
<string name="confirmall">Wirklich alle Tabellen löschen</string>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<string name="addtable">Προσθήκη πίνακα</string>
|
||||
<string name="edittable">Επεξεργασία πίνακα</string>
|
||||
<string name="removetable">Διαγραφή πίνακα</string>
|
||||
<string name="removetables">Διαγραφή πινάκων</string>
|
||||
<string name="aligntables">Στοίχιση Πινάκων</string>
|
||||
<string name="cleartables">Καθαρισμός πινάκων</string>
|
||||
<string name="confirmall">Διαγραφή όλων των πινάκων</string>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<string name="addtable">Add table</string>
|
||||
<string name="edittable">Edit table</string>
|
||||
<string name="removetable">Remove table</string>
|
||||
<string name="removetables">Remove tables</string>
|
||||
<string name="aligntables">Align tables</string>
|
||||
<string name="cleartables">Clear tables</string>
|
||||
<string name="confirmall">Really delete all tables</string>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<string name="addtable">Aldoni la tabelon</string>
|
||||
<string name="edittable">Modifi la tabelon</string>
|
||||
<string name="removetable">Forigi la tabelon</string>
|
||||
<string name="removetables">Forigi la tabelojn</string>
|
||||
<string name="aligntables">Ĝisrandigi la tabelojn</string>
|
||||
<string name="cleartables">Vakigi la tabelon</string>
|
||||
<string name="confirmall">Ja forigi ĉiujn tabelojn</string>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<string name="addtable">Agregar tabla</string>
|
||||
<string name="edittable">Editar tabla</string>
|
||||
<string name="removetable">Remover tabla</string>
|
||||
<string name="removetable">Remover tablas</string>
|
||||
<string name="aligntables">Alinear tablas</string>
|
||||
<string name="cleartables">Limpiar tablas</string>
|
||||
<string name="confirmall">Realmente borrar todas las tablas</string>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<string name="addtable">Ajouter une table</string>
|
||||
<string name="edittable">Éditer la table</string>
|
||||
<string name="removetable">Supprimer la table</string>
|
||||
<string name="removetables">Supprimer les tables</string>
|
||||
<string name="aligntables">Aligner les tables</string>
|
||||
<string name="cleartables">Supprimer les tables</string>
|
||||
<string name="confirmall">Vraiment supprimer toutes les tables</string>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<string name="addtable">Tábla létrehozása</string>
|
||||
<string name="edittable">Tábla módosítása</string>
|
||||
<string name="removetable">Tábla törlése</string>
|
||||
<string name="removetables">Táblak törlése</string>
|
||||
<string name="aligntables">Táblák rendezése</string>
|
||||
<string name="cleartables">Táblák törlése</string>
|
||||
<string name="confirmall">Valóban töröljem az összes táblát</string>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<string name="addtable">Dodaj tabelę</string>
|
||||
<string name="edittable">Edytuj tabelę</string>
|
||||
<string name="removetable">Usuń tabelę</string>
|
||||
<string name="removetables">Usuń tabele</string>
|
||||
<string name="aligntables">Wyrównaj tabele</string>
|
||||
<string name="cleartables">Wyczyść tabele</string>
|
||||
<string name="confirmall">Czy na pewno usunąć wszystkie tabele</string>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<string name="addtable">Adicionar tabela</string>
|
||||
<string name="edittable">Editar tabela</string>
|
||||
<string name="removetable">Remover tabela</string>
|
||||
<string name="removetables">Remover tabelas</string>
|
||||
<string name="aligntables">Alinhar tabelas</string>
|
||||
<string name="cleartables">Limpar tabelas</string>
|
||||
<string name="confirmall">Realmente excluir todas as tabelas</string>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<string name="addtable">Добавить таблицу</string>
|
||||
<string name="edittable">Редактировать таблицу</string>
|
||||
<string name="removetable">Удалить таблицу</string>
|
||||
<string name="removetables">Удалить таблицы</string>
|
||||
<string name="aligntables">Выровнять таблицы</string>
|
||||
<string name="cleartables">Очистить таблицы</string>
|
||||
<string name="confirmall">Действительно удалить все таблицы</string>
|
||||
|
||||
Reference in New Issue
Block a user