/[schmitzm]/branches/1.0-gt2-2.6/src/skrueger/geotools/AttributeTableJDialog.java
ViewVC logotype

Annotation of /branches/1.0-gt2-2.6/src/skrueger/geotools/AttributeTableJDialog.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 315 - (hide annotations)
Wed Aug 26 11:03:27 2009 UTC (15 years, 6 months ago) by mojays
File MIME type: text/plain
File size: 7991 byte(s)
Branch created from SCHMITZM 1.0 (rev 313) to switch to gt2-2.6.x.
1 alfonx 244 /*******************************************************************************
2     * Copyright (c) 2009 Martin O. J. Schmitz.
3     *
4     * This file is part of the SCHMITZM library - a collection of utility
5 alfonx 256 * classes based on Java 1.6, focusing (not only) on Java Swing
6 alfonx 244 * and the Geotools library.
7     *
8     * The SCHMITZM project is hosted at:
9     * http://wald.intevation.org/projects/schmitzm/
10     *
11     * This program is free software; you can redistribute it and/or
12     * modify it under the terms of the GNU Lesser General Public License
13     * as published by the Free Software Foundation; either version 3
14     * of the License, or (at your option) any later version.
15     *
16     * This program is distributed in the hope that it will be useful,
17     * but WITHOUT ANY WARRANTY; without even the implied warranty of
18     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19     * GNU General Public License for more details.
20     *
21     * You should have received a copy of the GNU Lesser General Public License (license.txt)
22     * along with this program; if not, write to the Free Software
23     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24     * or try this link: http://www.gnu.org/licenses/lgpl.html
25     *
26     * Contributors:
27     * Martin O. J. Schmitz - initial API and implementation
28     * Stefan A. Krüger - additional utility classes
29     ******************************************************************************/
30 alfonx 111 //package skrueger.geotools;
31     //
32     //import java.awt.Component;
33     //import java.awt.Window;
34     //import java.awt.event.WindowAdapter;
35     //import java.awt.event.WindowEvent;
36     //import java.beans.PropertyChangeListener;
37     //import java.util.HashMap;
38     //
39     //import javax.swing.JComponent;
40     //import javax.swing.JDialog;
41     //
42     //import org.geotools.map.MapLayer;
43     //import org.opengis.filter.Filter;
44     //
45     //import schmitzm.geotools.feature.AttributeTypeFilter;
46     //import schmitzm.geotools.gui.FeatureTablePane;
47     //import schmitzm.geotools.gui.JMapPane;
48     //import schmitzm.geotools.gui.SelectableFeatureTablePane;
49     //import schmitzm.swing.SwingUtil;
50     //import skrueger.geotools.selection.StyledFeatureLayerSelectionModel;
51     //import skrueger.geotools.selection.StyledLayerSelectionModel;
52     //import skrueger.geotools.selection.StyledLayerSelectionModelSynchronizer;
53     //import skrueger.geotools.selection.TableSelectionSynchronizer;
54     //
55     ///**
56     // * A dialog to show the attribute table of a vector layer. This class implements
57 alfonx 224 // * a {@link PropertyChangeListener} which is connected to the {@link StyledLayerInterface
58     // * StyledLayerInterface's} {@link StyledLayerSelectionModel} to keep the table selection
59 alfonx 111 // * synchronized to other component's selection (e.g. Map or chart).
60     // */
61     //public class AttributeTableJDialog extends JDialog {
62     //
63     // /** A cache that manages maximum one instance of this class per layer **/
64     // private static HashMap<String, AttributeTableJDialog> dialogCache = new HashMap<String, AttributeTableJDialog>();
65     //
66     // private final StyledFeatureCollectionTableModel model;
67     //
68     // private final JMapPane mapPane;
69     //
70     // /** Holds the table and preview of the dialog. */
71     // protected FeatureTablePane featureTablePane;
72     //
73     // protected final MapLayer mapLayer;
74     //
75 alfonx 224 // private final StyledLayerInterface styledObj;
76 alfonx 111 //
77     // private AttributeTableJDialog(Window owner, MapLayer mapLayer,
78 alfonx 224 // final StyledLayerInterface styledObj, LayerPanel layerPanel) {
79 alfonx 111 // super(owner);
80     // this.styledObj = styledObj;
81     //// setTitle(RES("AttributeTable.dialog.title", styledObj
82     //// .getTitle()));
83     //
84     // this.mapLayer = mapLayer;
85     //
86     // this.mapPane = layerPanel.geoMapPane != null ? layerPanel.geoMapPane
87     // .getMapPane() : null;
88     //
89     // Filter filter = mapLayer.getQuery() != null ? mapLayer.getQuery()
90     // .getFilter() : Filter.INCLUDE;
91     //
92     // // Falsch:
93     // // FeatureOperationTreeFilter filter = new
94     // // FeatureOperationTreeFilter(dpLayer.getFilterRule());
95     //
96     // if (styledObj instanceof StyledFeatureCollectionInterface) {
97     // model = new StyledFeatureCollectionTableModel(
98     // (StyledFeatureCollectionInterface) styledObj, filter);
99     // } else if (styledObj instanceof StyledFeatureSourceInterface) {
100     // model = new StyledFeatureCollectionTableModel(
101     // (StyledFeatureSourceInterface) styledObj, filter);
102     // } else {
103     // throw new IllegalArgumentException("StyledObj must be of StyledFeatureSourceInterface or StyledFeatureCollectionInterface");
104     // }
105     //
106     // getModel().setAttributeFilter(AttributeTypeFilter.NO_GEOMETRY);
107     //
108     // initialize();
109     //
110     // StyledLayerSelectionModel<?> anySelectionModel = layerPanel
111     // .getRememberSelection(mapLayer);
112     //
113     // if ((anySelectionModel instanceof StyledFeatureLayerSelectionModel)) {
114     // StyledFeatureLayerSelectionModel selectionModel = (StyledFeatureLayerSelectionModel) anySelectionModel;
115     // // create a synchronizer to keep the feature table selection
116     // // synchronized with the other components connected to the
117     // // DpLayerSelectionModel
118     // TableSelectionSynchronizer synchronizer = new TableSelectionSynchronizer(
119     // selectionModel, featureTablePane.getTable());
120     // selectionModel
121     // .addSelectionListener((StyledLayerSelectionModelSynchronizer) synchronizer);
122     // featureTablePane.getTable().getSelectionModel()
123     // .addListSelectionListener(synchronizer);
124     // }
125     //
126     // }
127     //
128     // private void initialize() {
129     // featureTablePane = new SelectableFeatureTablePane(getModel(), true,
130     // mapPane);
131     //
132     // setContentPane(featureTablePane);
133     //
134     // SwingUtil.centerFrameOnScreenRandom(this);
135     //
136     // pack();
137     // }
138     //
139     // public StyledFeatureCollectionTableModel getModel() {
140     // return model;
141     // }
142     //
143     // /**
144     // * Checks if there exists an open instance of the AtlasAttributeTable and
145     // * disposes it.
146     // *
147     // * @param layerId
148     // * A {@link String} id that equals mapLayer.getTitle() and
149     // * dpLayer.getId()
150     // * @return <code>true</code> if a window has been disposed.
151     // */
152     // public static boolean disposeInstanceFor(String layerId) {
153     // AttributeTableJDialog atlasAttributeTableJDialog = dialogCache
154     // .get(layerId);
155     // if (atlasAttributeTableJDialog != null) {
156     // atlasAttributeTableJDialog.dispose();
157     // dialogCache.remove(layerId);
158     // return true;
159     // }
160     // return false;
161     // }
162     //
163     // /**
164 alfonx 224 // * This class manages itself, that there is always only one instance for any {@link StyledLayerInterface}
165 alfonx 111 // *
166     // * @param dpLayer
167     // * The source for the attribute table
168     // * @param owner
169     // * A {@link JComponent} that is the parent GUI Dialogue
170     // * @param layerPanel
171     // * May be <code>null</code>
172     // * @param mapLayer
173     // * If <code>null</code>, then no "ZoomToLayer" button will
174     // * appear.
175     // */
176     // public static AttributeTableJDialog getInstanceFor(Component comp,
177 alfonx 224 // MapLayer mapLayer, final StyledLayerInterface<?> styledObj,
178 alfonx 111 // LayerPanel layerPanel) {
179     //
180     // AttributeTableJDialog atlasAttributeTableJDialog = dialogCache
181     // .get(styledObj.getId());
182     //
183     // if (atlasAttributeTableJDialog == null) {
184     // Window window = SwingUtil.getParentWindow(comp);
185     // atlasAttributeTableJDialog = new AttributeTableJDialog(window,
186     // mapLayer, styledObj, layerPanel);
187     //
188     // atlasAttributeTableJDialog.addWindowListener(new WindowAdapter() {
189     // @Override
190     // public void windowClosing(WindowEvent e) {
191     // super.windowClosing(e);
192     // dialogCache.remove(styledObj.getId());
193     // }
194     // });
195     //
196     // dialogCache.put(styledObj.getId(), atlasAttributeTableJDialog);
197     // }
198     // // Changing the filter is propagated via an Event in AtlaslayerPaneGroup
199     // // else {
200     // // Filter filter = (mapLayer != null && mapLayer.getQuery() != null) ?
201     // // mapLayer
202     // // .getQuery().getFilter()
203     // // : Filter.INCLUDE;
204     // // // Check if the filter has changed...
205     // // if (!filter.equals(atlasAttributeTableJDialog.getModel()
206     // // .getFilter())) {
207     // //
208     // // atlasAttributeTableJDialog.getModel().setFilter(filter);
209     // // }
210     // // }
211     //
212     // return atlasAttributeTableJDialog;
213     //
214     // }
215     //
216     //}

Properties

Name Value
svn:eol-style native
svn:keywords Id
svn:mime-type text/plain

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26