[Schmitzm-commits] r84 - trunk/src/schmitzm/geotools/gui
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Apr 23 12:31:26 CEST 2009
Author: mojays
Date: 2009-04-23 12:31:26 +0200 (Thu, 23 Apr 2009)
New Revision: 84
Modified:
trunk/src/schmitzm/geotools/gui/FeatureCollectionFrame.java
trunk/src/schmitzm/geotools/gui/FeatureTablePane.java
trunk/src/schmitzm/geotools/gui/SelectableFeatureTablePane.java
Log:
SelectionTableModel functionality removed from FeatureTablePane and added to sub-classes SelectableFeatureTablePane/FeatureCollectionFrame
Modified: trunk/src/schmitzm/geotools/gui/FeatureCollectionFrame.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/FeatureCollectionFrame.java 2009-04-22 15:08:51 UTC (rev 83)
+++ trunk/src/schmitzm/geotools/gui/FeatureCollectionFrame.java 2009-04-23 10:31:26 UTC (rev 84)
@@ -18,6 +18,7 @@
import org.geotools.feature.FeatureCollection;
import schmitzm.geotools.gui.FeatureTablePane;
+import schmitzm.swing.table.SelectionTableModel;
/**
* Dieses Fenster stellt eine {@link FeatureCollection} als Tabelle dar.
@@ -68,6 +69,18 @@
this.setLayout( new BorderLayout() );
this.setDefaultCloseOperation( JFrame.HIDE_ON_CLOSE );
this.featuresPane = new FeatureTablePane(fc,geomPreview);
+ // Reset the table model to show a selection column
+ this.featuresPane.featuresTable.setModel( new SelectionTableModel(
+ this.featuresPane.featuresTableModel,
+ this.featuresPane.featuresTable
+ ));
+ // 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).setMaxWidth(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-22 15:08:51 UTC (rev 83)
+++ trunk/src/schmitzm/geotools/gui/FeatureTablePane.java 2009-04-23 10:31:26 UTC (rev 84)
@@ -201,16 +201,10 @@
}
// Tabelle fuer FeatureCollection
-// featuresTable = new JTable();
-// featuresTable.setAutoCreateRowSorter(true);
featuresTable = new SortableJTable();
- featuresTable.setModel( new SelectionTableModel(featuresTableModel, featuresTable) );
+ featuresTable.setModel( featuresTableModel );
featuresTable.setAutoResizeMode( JTable.AUTO_RESIZE_OFF );
featuresTable.setColumnSelectionAllowed(false);
-
- // Added by SK: If i see it right, then because SortableJTable is used, the first col is always a checkbox. TODO: How wide is a CheckBox in differnet L'n'F s?
- featuresTable.getColumnModel().getColumn((int)0).setMaxWidth(17);
-
featuresTable.setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION );
// Wenn Auswahl in Tabelle sich aendert, Vorschau anpassen
featuresTable.getSelectionModel().addListSelectionListener( new ListSelectionListener() {
Modified: trunk/src/schmitzm/geotools/gui/SelectableFeatureTablePane.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/SelectableFeatureTablePane.java 2009-04-22 15:08:51 UTC (rev 83)
+++ trunk/src/schmitzm/geotools/gui/SelectableFeatureTablePane.java 2009-04-23 10:31:26 UTC (rev 84)
@@ -36,6 +36,7 @@
import schmitzm.geotools.GTUtil;
import schmitzm.geotools.feature.FeatureUtil;
+import schmitzm.swing.table.SelectionTableModel;
/**
* Extends the {@link FeatureTablePane} with buttons and functionality to select
@@ -64,7 +65,24 @@
private JLabel statusLabel;
- /**
+ /**
+ * @param fc
+ * {@link FeatureCollection} that holds the data.
+ * @param geomPreview
+ * If <code>true</code>, a preview {@link JMapPane} is attached
+ * to the left of the table.
+ * @param externalMapPane
+ * <code>null</code> if this component is NOT linked to an
+ * external JMapPane. If mapPane == <code>null</code>, the
+ * "ZoomToSelection" Button is automatically disabled. If a
+ * {@link JMapPane} is passed, the "ZoomToSelectedFeature"
+ * function will be enabled.
+ */
+ public SelectableFeatureTablePane(FeatureCollection fc, boolean geomPreview, JMapPane externalMapPane) {
+ this(new FeatureCollectionTableModel(fc), geomPreview, externalMapPane);
+ }
+
+ /**
* @param model
* {@link FeatureCollectionTableModel} that holds the data.
* @param geomPreview
@@ -123,6 +141,20 @@
}
/**
+ *
+ */
+ @Override
+ protected void initGUI(boolean geomPreview) {
+ super.initGUI(geomPreview);
+ // Reset the table model to show a selection column
+ featuresTable.setModel( new SelectionTableModel(featuresTableModel, featuresTable) );
+ // 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 = featuresTable.convertColumnIndexToModel(0);
+ featuresTable.getColumnModel().getColumn(selCol).setMaxWidth(17);
+ }
+
+ /**
* This Label present something like "40 of 56 Polygons selected". It is lazily constructed. Later calls will only update the existing label.
*/
private JLabel getStatusLabel() {
More information about the Schmitzm-commits
mailing list