[Schmitzm-commits] r85 - trunk/src/schmitzm/geotools/gui

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Apr 23 13:17:43 CEST 2009


Author: mojays
Date: 2009-04-23 13:17:43 +0200 (Thu, 23 Apr 2009)
New Revision: 85

Modified:
   trunk/src/schmitzm/geotools/gui/FeatureCollectionFrame.java
   trunk/src/schmitzm/geotools/gui/FeatureTablePane.java
   trunk/src/schmitzm/geotools/gui/SelectableFeatureTablePane.java
Log:
FeatureTablePane
- moved getTable() to bottom of class
SelectableFeatureTablePane
- getTable() replaced by direct access of protected instance variable

Modified: trunk/src/schmitzm/geotools/gui/FeatureCollectionFrame.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/FeatureCollectionFrame.java	2009-04-23 10:31:26 UTC (rev 84)
+++ trunk/src/schmitzm/geotools/gui/FeatureCollectionFrame.java	2009-04-23 11:17:43 UTC (rev 85)
@@ -77,9 +77,9 @@
     // Because SortableJTable is used, the first col is always a checkbox.
     // TODO: How wide is a CheckBox in differnet L'n'F s?
     int selCol = featuresPane.featuresTable.convertColumnIndexToModel(0);
-    featuresPane.featuresTable.getColumnModel().getColumn(selCol).setPreferredWidth(17);
+//    featuresPane.featuresTable.getColumnModel().getColumn(selCol).setPreferredWidth(17);
     featuresPane.featuresTable.getColumnModel().getColumn(selCol).setMaxWidth(17);
-    featuresPane.featuresTable.getColumnModel().getColumn(selCol).setMinWidth(17);
+//    featuresPane.featuresTable.getColumnModel().getColumn(selCol).setMinWidth(17);
     
     this.getContentPane().add( featuresPane );
     this.pack();

Modified: trunk/src/schmitzm/geotools/gui/FeatureTablePane.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/FeatureTablePane.java	2009-04-23 10:31:26 UTC (rev 84)
+++ trunk/src/schmitzm/geotools/gui/FeatureTablePane.java	2009-04-23 11:17:43 UTC (rev 85)
@@ -67,12 +67,7 @@
   /** Tabelle in der die Features angezeigt werden. */
   protected SortableJTable featuresTable = null;
   
-  /** Erlaubt den externen Zugriff auf die Tabelle */
-  public SortableJTable getTable() {
-		return featuresTable;
-	}
-
-/** Tabellen-Modell der Feature-Tabelle. */
+  /** Tabellen-Modell der Feature-Tabelle. */
   protected FeatureCollectionTableModel featuresTableModel = null;
   /** Preview-Bereich fuer die in der Tabelle selektierten Features. */
   protected JMapPane   mapPane = null;
@@ -253,6 +248,14 @@
   }
 
   /**
+   * Liefert die Attribut-Tabelle um deren Eigenschaften (z.B. Spaltenbreite)
+   * zu aendern.
+   */
+  public SortableJTable getTable() {
+    return featuresTable;
+  }
+
+  /**
    * Liefert die angezeigten Features.
    */
   public FeatureCollection getFeatureCollection() {

Modified: trunk/src/schmitzm/geotools/gui/SelectableFeatureTablePane.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/SelectableFeatureTablePane.java	2009-04-23 10:31:26 UTC (rev 84)
+++ trunk/src/schmitzm/geotools/gui/SelectableFeatureTablePane.java	2009-04-23 11:17:43 UTC (rev 85)
@@ -25,6 +25,7 @@
 import javax.swing.JPanel;
 import javax.swing.JScrollBar;
 import javax.swing.JScrollPane;
+import javax.swing.JTable;
 import javax.swing.JToolBar;
 import javax.swing.SortOrder;
 import javax.swing.SwingUtilities;
@@ -119,6 +120,7 @@
 		// Change the sizes
 		mapPane.setPreferredSize(new Dimension(200, 300));
 		featuresTable.getParent().setPreferredSize(new Dimension(400, 300));
+	    featuresTable.setAutoResizeMode( JTable.AUTO_RESIZE_OFF );
 
 		// In the NORTH, the ToolBar and a JLabel presenting the total and selected number of features is displayed
 		JPanel north = new JPanel(new BorderLayout());
@@ -127,7 +129,7 @@
 		newPanelArroundTable.add(north, BorderLayout.NORTH);
 		newPanelArroundTable.add(getSearchBar(), BorderLayout.SOUTH);
 		
-		getTable().getSelectionModel().addListSelectionListener( new ListSelectionListener(){
+		featuresTable.getSelectionModel().addListSelectionListener( new ListSelectionListener(){
 
 			@Override
 			public void valueChanged(ListSelectionEvent e) {
@@ -141,7 +143,8 @@
 	}
 
 	/**
-	 * 
+	 * After calling the super-method the table model is encapsulated in
+	 * a {@link SelectionTableModel} to show a selection column.
 	 */
     @Override
     protected void initGUI(boolean geomPreview) {
@@ -205,7 +208,7 @@
 
 			@Override
 			public void actionPerformed(ActionEvent e) {
-				getTable().getSelectionModel().clearSelection();
+				featuresTable.getSelectionModel().clearSelection();
 			}
 
 		};
@@ -231,13 +234,13 @@
 				// moves the select rows to the top by sorting according to the
 				// first column
 
-				List<SortKey> keys = new ArrayList<SortKey>(getTable()
+				List<SortKey> keys = new ArrayList<SortKey>(featuresTable
 						.getRowSorter().getSortKeys());
 
 				SortKey sortKey = new SortKey(0, SortOrder.DESCENDING);
 				keys.add(0, sortKey);
 
-				getTable().getRowSorter().setSortKeys(keys);
+				featuresTable.getRowSorter().setSortKeys(keys);
 				
 				// Move the scrollbars to the top
 				JScrollPane scrollPane = getFeaturesTableScrollPane();
@@ -275,18 +278,18 @@
 
 				setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
 				
-				getTable().getSelectionModel().setValueIsAdjusting(true);
+				featuresTable.getSelectionModel().setValueIsAdjusting(true);
 				
-				for (int i = 0; i < getTable().getModel().getRowCount(); i++) {
-					if (getTable().getSelectionModel().isSelectedIndex(i)) {
-						getTable().getSelectionModel().removeSelectionInterval(
+				for (int i = 0; i < featuresTable.getModel().getRowCount(); i++) {
+					if (featuresTable.getSelectionModel().isSelectedIndex(i)) {
+					  featuresTable.getSelectionModel().removeSelectionInterval(
 								i, i);
 					} else {
-						getTable().getSelectionModel().addSelectionInterval(i,
+					  featuresTable.getSelectionModel().addSelectionInterval(i,
 								i);
 					}
 				}
-				getTable().getSelectionModel().setValueIsAdjusting(false);
+				featuresTable.getSelectionModel().setValueIsAdjusting(false);
 				setCursor(null);
 
 			}



More information about the Schmitzm-commits mailing list