Revision 47355 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.snapping.app/org.gvsig.snapping.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/gui/ViewSnappingInfoImpl.java
ViewSnappingInfoImpl.java | ||
---|---|---|
7 | 7 |
|
8 | 8 |
import java.awt.Dimension; |
9 | 9 |
import java.awt.event.ActionEvent; |
10 |
import java.awt.event.ActionListener; |
|
11 | 10 |
import java.awt.event.MouseAdapter; |
12 | 11 |
import java.awt.event.MouseEvent; |
13 | 12 |
import java.net.URL; |
... | ... | |
198 | 197 |
} |
199 | 198 |
|
200 | 199 |
private static final Logger LOGGER = LoggerFactory.getLogger(ViewSnappingInfoImpl.class); |
201 |
private final MapContext mapContext;
|
|
200 |
private MapContext mapContext; |
|
202 | 201 |
|
203 |
public ViewSnappingInfoImpl(MapContext mapContext) { |
|
204 |
this.mapContext = mapContext; |
|
202 |
public ViewSnappingInfoImpl() { |
|
205 | 203 |
this.initComponents(); |
206 | 204 |
} |
207 | 205 |
|
... | ... | |
213 | 211 |
toolsSwingManager.translate(this.btnCheckAllSnapping); |
214 | 212 |
toolsSwingManager.translate(this.btnUncheckAllSnapping); |
215 | 213 |
|
216 |
List<FLayer>layers = new ArrayList<>(); |
|
217 |
Iterator<FLayer> layersUnordered = mapContext.deepiterator(); |
|
218 |
while (layersUnordered.hasNext()) { |
|
219 |
layers.add(layersUnordered.next()); |
|
220 |
} |
|
221 |
Collections.sort(layers, new Comparator<FLayer>() { |
|
222 |
@Override |
|
223 |
public int compare(FLayer o1, FLayer o2) { |
|
224 |
return o1.getName().compareToIgnoreCase(o2.getName()); |
|
225 |
} |
|
226 |
}); |
|
227 | 214 |
SnappingTableModel model = new SnappingTableModel(); |
228 |
for (FLayer layer : layers) { |
|
229 |
model.addLayer(layer); |
|
230 |
} |
|
231 |
|
|
232 | 215 |
this.tableSnapping.setModel(model); |
233 | 216 |
|
234 | 217 |
int tolerance = MapControlLocator.getMapControlManager().getTolerance(); |
235 | 218 |
this.textFieldTolSnapping.setText(String.valueOf(tolerance)); |
236 | 219 |
|
237 |
this.btnCheckAllSnapping.addActionListener(new ActionListener() { |
|
238 |
@Override |
|
239 |
public void actionPerformed(ActionEvent e) { |
|
240 |
doCheckAll(); |
|
241 |
} |
|
220 |
this.btnCheckAllSnapping.addActionListener((ActionEvent e) -> { |
|
221 |
doCheckAll(); |
|
242 | 222 |
}); |
243 |
this.btnUncheckAllSnapping.addActionListener(new ActionListener() { |
|
244 |
@Override |
|
245 |
public void actionPerformed(ActionEvent e) { |
|
246 |
doUncheckAll(); |
|
247 |
} |
|
223 |
this.btnUncheckAllSnapping.addActionListener((ActionEvent e) -> { |
|
224 |
doUncheckAll(); |
|
248 | 225 |
}); |
249 | 226 |
|
250 | 227 |
this.tableSnapping.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); |
... | ... | |
333 | 310 |
} |
334 | 311 |
this.mapContext.invalidate(); |
335 | 312 |
} |
313 |
|
|
314 |
public void setMapContext(MapContext mapContext){ |
|
315 |
this.mapContext = mapContext; |
|
316 |
|
|
317 |
List<FLayer>layers = new ArrayList<>(); |
|
318 |
Iterator<FLayer> layersUnordered = mapContext.deepiterator(); |
|
319 |
while (layersUnordered.hasNext()) { |
|
320 |
layers.add(layersUnordered.next()); |
|
321 |
} |
|
322 |
Collections.sort(layers, new Comparator<FLayer>() { |
|
323 |
@Override |
|
324 |
public int compare(FLayer o1, FLayer o2) { |
|
325 |
return o1.getName().compareToIgnoreCase(o2.getName()); |
|
326 |
} |
|
327 |
}); |
|
328 |
SnappingTableModel model = new SnappingTableModel(); |
|
329 |
for (FLayer layer : layers) { |
|
330 |
model.addLayer(layer); |
|
331 |
} |
|
336 | 332 |
|
333 |
this.tableSnapping.setModel(model); |
|
334 |
|
|
335 |
|
|
336 |
} |
|
337 |
|
|
337 | 338 |
} |
Also available in: Unified diff