From 1adb58e887092ff655a4b0f94f2003b7d3222346 Mon Sep 17 00:00:00 2001 From: Loredana Liccardo Date: Mon, 14 Jul 2014 08:29:10 +0000 Subject: [PATCH] row table editable in the grid with the correct management of the related event. git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/databases-manager-portlet@98582 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/panels/GxtBorderLayoutPanel.java | 96 +++++++++++++------ 1 file changed, 65 insertions(+), 31 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/databasesmanager/client/panels/GxtBorderLayoutPanel.java b/src/main/java/org/gcube/portlets/user/databasesmanager/client/panels/GxtBorderLayoutPanel.java index 6bed339..bbd80f2 100644 --- a/src/main/java/org/gcube/portlets/user/databasesmanager/client/panels/GxtBorderLayoutPanel.java +++ b/src/main/java/org/gcube/portlets/user/databasesmanager/client/panels/GxtBorderLayoutPanel.java @@ -753,9 +753,9 @@ public class GxtBorderLayoutPanel extends ContentPanel { // create the grid with a result list and the column model - // final EditorGrid grid = new EditorGrid(result, cm); + final EditorGrid grid = new EditorGrid(result, cm); - final Grid grid = new Grid(result, cm); +// final Grid grid = new Grid(result, cm); // grid = new Grid(result, cm); @@ -775,39 +775,73 @@ public class GxtBorderLayoutPanel extends ContentPanel { // grid.getSelectionModel().select(result.getAt(0), true); // grid.getSelectionModel().selectAll(); + + //listener for row selection in the grid - grid.getSelectionModel().addSelectionChangedListener( - new SelectionChangedListener() { +// grid.getSelectionModel().addSelectionChangedListener( +// new SelectionChangedListener() { +// +// @Override +// public void selectionChanged( +// final SelectionChangedEvent se) { +// // TODO Auto-generated method stub +// +// +// +// // System.out.println("table slected: " + +// // selectedTable); +// +// // Fire event +// eventBus.fireEvent(new SelectedTableEvent()); +// +// tablesLoaded.getButtonById(Dialog.OK) +// .addSelectionListener( +// new SelectionListener() { +// +// @Override +// public void componentSelected( +// ButtonEvent ce) { +// +// selectedTable = se.getSelectedItem().getValue(); +// +// } +// }); +// +// } +// }); - @Override - public void selectionChanged( - final SelectionChangedEvent se) { - // TODO Auto-generated method stub + grid.addListener(Events.BeforeEdit, new Listener>() { - + @Override + public void handleEvent(final GridEvent be) { + // TODO Auto-generated method stub + be.getValue().toString(); + +// System.out.println("table selected: " + +// be.getValue().toString()); + + rootLogger.log(Level.INFO, "table selected: " + be.getValue().toString()); + + // Fire event + eventBus.fireEvent(new SelectedTableEvent()); - // System.out.println("table slected: " + - // selectedTable); + tablesLoaded.getButtonById(Dialog.OK) + .addSelectionListener( + new SelectionListener() { - // Fire event - eventBus.fireEvent(new SelectedTableEvent()); + @Override + public void componentSelected( + ButtonEvent ce) { + + selectedTable = be.getValue().toString(); - tablesLoaded.getButtonById(Dialog.OK) - .addSelectionListener( - new SelectionListener() { - - @Override - public void componentSelected( - ButtonEvent ce) { - - selectedTable = se.getSelectedItem().getValue(); - - } - }); - - } - }); + } + }); + + } + }); + grid.addListener(Events.Attach, new Listener>() { public void handleEvent(GridEvent be) { @@ -2210,9 +2244,9 @@ public class GxtBorderLayoutPanel extends ContentPanel { // column2.setSortable(false); - // TextField textValue = new TextField(); - // // text.setAllowBlank(false); - // column.setEditor(new CellEditor(textValue)); + TextField textValue = new TextField(); + // text.setAllowBlank(false); + column.setEditor(new CellEditor(textValue)); configs.add(column);