/[schmitzm]/trunk/src/skrueger/geotools/AttributeTableJDialog.java
ViewVC logotype

Annotation of /trunk/src/skrueger/geotools/AttributeTableJDialog.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 224 - (hide annotations)
Tue Jul 14 15:57:19 2009 UTC (15 years, 7 months ago) by alfonx
File MIME type: text/plain
File size: 6576 byte(s)
* big biG BIG refactoring: StyledMap[Interface,Util,Style] never dealt with Maps (=Orchestrations of layers), but always only with single Layers. Now it has been refactored to StyledLayer[Interface,Util,Style]. 
* Some variable names and methodNames have been corrected also, but many will still be missing.
* New JARs committed
1 alfonx 111 //package skrueger.geotools;
2     //
3     //import java.awt.Component;
4     //import java.awt.Window;
5     //import java.awt.event.WindowAdapter;
6     //import java.awt.event.WindowEvent;
7     //import java.beans.PropertyChangeListener;
8     //import java.util.HashMap;
9     //
10     //import javax.swing.JComponent;
11     //import javax.swing.JDialog;
12     //
13     //import org.geotools.map.MapLayer;
14     //import org.opengis.filter.Filter;
15     //
16     //import schmitzm.geotools.feature.AttributeTypeFilter;
17     //import schmitzm.geotools.gui.FeatureTablePane;
18     //import schmitzm.geotools.gui.JMapPane;
19     //import schmitzm.geotools.gui.SelectableFeatureTablePane;
20     //import schmitzm.swing.SwingUtil;
21     //import skrueger.geotools.selection.StyledFeatureLayerSelectionModel;
22     //import skrueger.geotools.selection.StyledLayerSelectionModel;
23     //import skrueger.geotools.selection.StyledLayerSelectionModelSynchronizer;
24     //import skrueger.geotools.selection.TableSelectionSynchronizer;
25     //
26     ///**
27     // * A dialog to show the attribute table of a vector layer. This class implements
28 alfonx 224 // * a {@link PropertyChangeListener} which is connected to the {@link StyledLayerInterface
29     // * StyledLayerInterface's} {@link StyledLayerSelectionModel} to keep the table selection
30 alfonx 111 // * synchronized to other component's selection (e.g. Map or chart).
31     // */
32     //public class AttributeTableJDialog extends JDialog {
33     //
34     // /** A cache that manages maximum one instance of this class per layer **/
35     // private static HashMap<String, AttributeTableJDialog> dialogCache = new HashMap<String, AttributeTableJDialog>();
36     //
37     // private final StyledFeatureCollectionTableModel model;
38     //
39     // private final JMapPane mapPane;
40     //
41     // /** Holds the table and preview of the dialog. */
42     // protected FeatureTablePane featureTablePane;
43     //
44     // protected final MapLayer mapLayer;
45     //
46 alfonx 224 // private final StyledLayerInterface styledObj;
47 alfonx 111 //
48     // private AttributeTableJDialog(Window owner, MapLayer mapLayer,
49 alfonx 224 // final StyledLayerInterface styledObj, LayerPanel layerPanel) {
50 alfonx 111 // super(owner);
51     // this.styledObj = styledObj;
52     //// setTitle(RES("AttributeTable.dialog.title", styledObj
53     //// .getTitle()));
54     //
55     // this.mapLayer = mapLayer;
56     //
57     // this.mapPane = layerPanel.geoMapPane != null ? layerPanel.geoMapPane
58     // .getMapPane() : null;
59     //
60     // Filter filter = mapLayer.getQuery() != null ? mapLayer.getQuery()
61     // .getFilter() : Filter.INCLUDE;
62     //
63     // // Falsch:
64     // // FeatureOperationTreeFilter filter = new
65     // // FeatureOperationTreeFilter(dpLayer.getFilterRule());
66     //
67     // if (styledObj instanceof StyledFeatureCollectionInterface) {
68     // model = new StyledFeatureCollectionTableModel(
69     // (StyledFeatureCollectionInterface) styledObj, filter);
70     // } else if (styledObj instanceof StyledFeatureSourceInterface) {
71     // model = new StyledFeatureCollectionTableModel(
72     // (StyledFeatureSourceInterface) styledObj, filter);
73     // } else {
74     // throw new IllegalArgumentException("StyledObj must be of StyledFeatureSourceInterface or StyledFeatureCollectionInterface");
75     // }
76     //
77     // getModel().setAttributeFilter(AttributeTypeFilter.NO_GEOMETRY);
78     //
79     // initialize();
80     //
81     // StyledLayerSelectionModel<?> anySelectionModel = layerPanel
82     // .getRememberSelection(mapLayer);
83     //
84     // if ((anySelectionModel instanceof StyledFeatureLayerSelectionModel)) {
85     // StyledFeatureLayerSelectionModel selectionModel = (StyledFeatureLayerSelectionModel) anySelectionModel;
86     // // create a synchronizer to keep the feature table selection
87     // // synchronized with the other components connected to the
88     // // DpLayerSelectionModel
89     // TableSelectionSynchronizer synchronizer = new TableSelectionSynchronizer(
90     // selectionModel, featureTablePane.getTable());
91     // selectionModel
92     // .addSelectionListener((StyledLayerSelectionModelSynchronizer) synchronizer);
93     // featureTablePane.getTable().getSelectionModel()
94     // .addListSelectionListener(synchronizer);
95     // }
96     //
97     // }
98     //
99     // private void initialize() {
100     // featureTablePane = new SelectableFeatureTablePane(getModel(), true,
101     // mapPane);
102     //
103     // setContentPane(featureTablePane);
104     //
105     // SwingUtil.centerFrameOnScreenRandom(this);
106     //
107     // pack();
108     // }
109     //
110     // public StyledFeatureCollectionTableModel getModel() {
111     // return model;
112     // }
113     //
114     // /**
115     // * Checks if there exists an open instance of the AtlasAttributeTable and
116     // * disposes it.
117     // *
118     // * @param layerId
119     // * A {@link String} id that equals mapLayer.getTitle() and
120     // * dpLayer.getId()
121     // * @return <code>true</code> if a window has been disposed.
122     // */
123     // public static boolean disposeInstanceFor(String layerId) {
124     // AttributeTableJDialog atlasAttributeTableJDialog = dialogCache
125     // .get(layerId);
126     // if (atlasAttributeTableJDialog != null) {
127     // atlasAttributeTableJDialog.dispose();
128     // dialogCache.remove(layerId);
129     // return true;
130     // }
131     // return false;
132     // }
133     //
134     // /**
135 alfonx 224 // * This class manages itself, that there is always only one instance for any {@link StyledLayerInterface}
136 alfonx 111 // *
137     // * @param dpLayer
138     // * The source for the attribute table
139     // * @param owner
140     // * A {@link JComponent} that is the parent GUI Dialogue
141     // * @param layerPanel
142     // * May be <code>null</code>
143     // * @param mapLayer
144     // * If <code>null</code>, then no "ZoomToLayer" button will
145     // * appear.
146     // */
147     // public static AttributeTableJDialog getInstanceFor(Component comp,
148 alfonx 224 // MapLayer mapLayer, final StyledLayerInterface<?> styledObj,
149 alfonx 111 // LayerPanel layerPanel) {
150     //
151     // AttributeTableJDialog atlasAttributeTableJDialog = dialogCache
152     // .get(styledObj.getId());
153     //
154     // if (atlasAttributeTableJDialog == null) {
155     // Window window = SwingUtil.getParentWindow(comp);
156     // atlasAttributeTableJDialog = new AttributeTableJDialog(window,
157     // mapLayer, styledObj, layerPanel);
158     //
159     // atlasAttributeTableJDialog.addWindowListener(new WindowAdapter() {
160     // @Override
161     // public void windowClosing(WindowEvent e) {
162     // super.windowClosing(e);
163     // dialogCache.remove(styledObj.getId());
164     // }
165     // });
166     //
167     // dialogCache.put(styledObj.getId(), atlasAttributeTableJDialog);
168     // }
169     // // Changing the filter is propagated via an Event in AtlaslayerPaneGroup
170     // // else {
171     // // Filter filter = (mapLayer != null && mapLayer.getQuery() != null) ?
172     // // mapLayer
173     // // .getQuery().getFilter()
174     // // : Filter.INCLUDE;
175     // // // Check if the filter has changed...
176     // // if (!filter.equals(atlasAttributeTableJDialog.getModel()
177     // // .getFilter())) {
178     // //
179     // // atlasAttributeTableJDialog.getModel().setFilter(filter);
180     // // }
181     // // }
182     //
183     // return atlasAttributeTableJDialog;
184     //
185     // }
186     //
187     //}

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