[tiled] r693 - in trunk: . src/tiled/mapeditor/dialogs

svn@biggeruniverse.com svn at biggeruniverse.com
Mon Aug 14 07:26:01 PDT 2006


Author: bjorn
Date: 2006-08-14 09:26:00 -0500 (Mon, 14 Aug 2006)
New Revision: 693

Modified:
   trunk/CHANGES
   trunk/src/tiled/mapeditor/dialogs/PropertiesDialog.java
Log:
Fixed properties dialog to also save values that were still being edited

Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES	2006-08-10 22:13:15 UTC (rev 692)
+++ trunk/CHANGES	2006-08-14 14:26:00 UTC (rev 693)
@@ -4,6 +4,7 @@
 * Added ability to create stamp brushes from the tile palette
 * Embedded the tile palette
 * Report out of memory error when saving map as image
+* Fixed properties dialog to also save values that were still being edited
 
 0.6.1 - July 15th, 2006
 

Modified: trunk/src/tiled/mapeditor/dialogs/PropertiesDialog.java
===================================================================
--- trunk/src/tiled/mapeditor/dialogs/PropertiesDialog.java	2006-08-10 22:13:15 UTC (rev 692)
+++ trunk/src/tiled/mapeditor/dialogs/PropertiesDialog.java	2006-08-14 14:26:00 UTC (rev 693)
@@ -18,6 +18,7 @@
 import java.util.Enumeration;
 import java.util.Properties;
 import javax.swing.*;
+import javax.swing.table.TableCellEditor;
 
 import tiled.mapeditor.Resources;
 import tiled.mapeditor.util.PropertiesTableModel;
@@ -28,7 +29,7 @@
  */
 public class PropertiesDialog extends JDialog
 {
-    private JTable tProperties;
+    private JTable propertiesTable;
     private final Properties properties;
     private final PropertiesTableModel tableModel = new PropertiesTableModel();
 
@@ -47,8 +48,8 @@
     }
 
     private void init() {
-        tProperties = new JTable(tableModel);
-        JScrollPane propScrollPane = new JScrollPane(tProperties);
+        propertiesTable = new JTable(tableModel);
+        JScrollPane propScrollPane = new JScrollPane(propertiesTable);
         propScrollPane.setPreferredSize(new Dimension(200, 150));
 
         JButton okButton = new JButton(OK_BUTTON);
@@ -119,7 +120,13 @@
     }
 
     private void buildPropertiesAndDispose() {
-    	// Copy over the new set of properties from the properties table
+        // Make sure there is no active cell editor anymore
+        TableCellEditor editor = propertiesTable.getCellEditor();
+        if (editor != null) {
+            editor.stopCellEditing();
+        }
+
+        // Copy over the new set of properties from the properties table
         // model.
         properties.clear();
 
@@ -134,12 +141,12 @@
     }
 
     private void deleteSelected() {
-    	int total = tProperties.getSelectedRowCount();
+    	int total = propertiesTable.getSelectedRowCount();
         Object[] keys = new Object[total];
-        int[] selRows = tProperties.getSelectedRows();
+        int[] selRows = propertiesTable.getSelectedRows();
 
         for(int i = 0; i < total; i++) {
-            keys[i] = tProperties.getValueAt(selRows[i], 0);
+            keys[i] = propertiesTable.getValueAt(selRows[i], 0);
         }
 
         for (int i = 0; i < total; i++) {




More information about the tiled-commit mailing list