You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by tv...@apache.org on 2009/09/04 02:58:52 UTC
svn commit: r811194 -
/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/TablePanes.java
Author: tvolkert
Date: Fri Sep 4 00:58:52 2009
New Revision: 811194
URL: http://svn.apache.org/viewvc?rev=811194&view=rev
Log:
Fixed bug with column removal in TablePane tutorial
Modified:
incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/TablePanes.java
Modified: incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/TablePanes.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/TablePanes.java?rev=811194&r1=811193&r2=811194&view=diff
==============================================================================
--- incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/TablePanes.java (original)
+++ incubator/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/layout/TablePanes.java Fri Sep 4 00:58:52 2009
@@ -48,11 +48,12 @@
this.x = x;
this.y = y;
+ // Set the enabled state of actions based on where the user clicked
+ Action.NamedActionDictionary namedActions = Action.getNamedActions();
+
int rowIndex = tablePane.getRowAt(y);
int columnIndex = tablePane.getColumnAt(x);
- Action.NamedActionDictionary namedActions = Action.getNamedActions();
-
namedActions.get("configureCell").setEnabled(rowIndex > 0 && columnIndex > 0);
namedActions.get("configureRow").setEnabled(rowIndex > 0);
namedActions.get("insertRow").setEnabled(rowIndex > 0);
@@ -61,6 +62,7 @@
namedActions.get("insertColumn").setEnabled(columnIndex > 0);
namedActions.get("removeColumn").setEnabled(columnIndex > 0);
+ // Add our menu sections
menu.getSections().add(cellSection);
menu.getSections().add(rowSection);
menu.getSections().add(columnSection);
@@ -103,7 +105,9 @@
try {
sheet = (Sheet)wtkxSerializer.readObject(this, "table_panes_configure_cell.wtkx");
- } catch (Exception exception) {
+ } catch (SerializationException exception) {
+ throw new RuntimeException(exception);
+ } catch (IOException exception) {
throw new RuntimeException(exception);
}
@@ -265,6 +269,12 @@
public void sheetClosed(Sheet sheet) {
if (prompt.getResult() && prompt.getSelectedOption() == 0) {
int columnIndex = tablePane.getColumnAt(contextMenuHandler.getX());
+
+ // Remove the component at that index from each row
+ for (TablePane.Row row : tablePane.getRows()) {
+ row.remove(columnIndex, 1);
+ }
+
tablePane.getColumns().remove(columnIndex, 1);
}
}