@Override public void setValueAt(Object value, int rowIndex, int columnIndex) { final Placemark placemark = getPlacemarkAt(rowIndex); switch (columnIndex) { case 0: placemark.setName((String) value); break; case 1: setGeoPosLat(value, placemark); break; case 2: setGeoPosLon(value, placemark); break; case 3: setDateTime((Date) value, placemark); break; default: throw new IllegalArgumentException(String.format("Invalid columnIndex = %d", columnIndex)); } fireTableCellUpdated(rowIndex, columnIndex); }
private boolean makePlacemarkNameUnique0(Placemark placemark, Product targetProduct) { ProductNodeGroup<Placemark> placemarkGroup = getPlacemarkGroup(targetProduct); if (placemarkGroup.get(placemark.getName()) == placemark) { return false; } String name0 = placemark.getName(); String name = name0; int id = 1; while (placemarkGroup.contains(name)) { name = name0 + "_" + id; id++; } if (!name0.equals(name)) { placemark.setName(name); return true; } return false; }
@Override public void actionPerformed(ActionEvent e) { PropertyMap preferences = appContext.getPreferences(); final BeamFileChooser fileChooser = getFileChooser( preferences.getPropertyString(LAST_OPEN_CSV_DIR, SystemUtils.getUserHomeDir().getPath())); int answer = fileChooser.showDialog(parent, "Select"); if (answer == JFileChooser.APPROVE_OPTION) { File selectedFile = fileChooser.getSelectedFile(); preferences.setPropertyString(LAST_OPEN_CSV_DIR, selectedFile.getParent()); try { final List<SimpleFeature> extendedFeatures = PixExOpUtils.extractFeatures(selectedFile); for (SimpleFeature extendedFeature : extendedFeatures) { final GenericPlacemarkDescriptor placemarkDescriptor = new GenericPlacemarkDescriptor( extendedFeature.getFeatureType()); final Placemark placemark = placemarkDescriptor.createPlacemark(extendedFeature); if (extendedFeature.getAttribute("Name") != null) { placemark.setName(extendedFeature.getAttribute("Name").toString()); } setPlacemarkGeoPos(extendedFeature, placemark); tableModel.addPlacemark(placemark); } } catch (IOException exception) { appContext.handleError(String.format("Error occurred while reading file: %s \n" + exception.getLocalizedMessage() + "\nPossible reason: Other char separator than tabulator used", selectedFile), exception); } } }
final Placemark placemark = placemarkDescriptor.createPlacemark(f); placemark.setGeoPos(new GeoPos(coordinate.getLat(), coordinate.getLon())); placemark.setName(coordinate.getName()); coordinateTableModel.addPlacemark(placemark);
placemark.setName(dialog.getName()); placemark.setLabel(dialog.getLabel()); placemark.setDescription(dialog.getDescription());