public SeparateGeometriesDialog(Window mainFrame, VectorDataNode vectorDataNode, String helpId, String text) { super(mainFrame, "Import Geometry", ModalDialog.ID_YES_NO_HELP, helpId); JPanel content = new JPanel(new BorderLayout()); content.add(new JLabel(text), BorderLayout.NORTH); List<AttributeType> types = vectorDataNode.getFeatureType().getTypes(); ArrayList<String> names = new ArrayList<String>(); for (AttributeType type : types) { if (type.getBinding().equals(String.class)) { names.add(type.getName().getLocalPart()); } } comboBox = new JComboBox(names.toArray(new String[names.size()])); if (names.size() > 0) { JPanel content2 = new JPanel(new BorderLayout()); content2.add(new JLabel("Attribute for mask/layer naming: "), BorderLayout.WEST); content2.add(comboBox, BorderLayout.CENTER); content.add(content2, BorderLayout.SOUTH); } setContent(content); }
public SeparateGeometriesDialog(BasicApp.MainFrame mainFrame, VectorDataNode vectorDataNode, String helpId, String text) { super(mainFrame, "Import Geometry", ModalDialog.ID_YES_NO_HELP, helpId); JPanel content = new JPanel(new BorderLayout()); content.add(new JLabel(text), BorderLayout.NORTH); List<AttributeType> types = vectorDataNode.getFeatureType().getTypes(); ArrayList<String> names = new ArrayList<String>(); for (AttributeType type : types) { if (type.getBinding().equals(String.class)) { names.add(type.getName().getLocalPart()); } } comboBox = new JComboBox(names.toArray(new String[names.size()])); if (names.size() > 0) { JPanel content2 = new JPanel(new BorderLayout()); content2.add(new JLabel("Attribute for mask/layer naming: "), BorderLayout.WEST); content2.add(comboBox, BorderLayout.CENTER); content.add(content2, BorderLayout.SOUTH); } setContent(content); }
/** * getAttributesForDatasource * Returns a list of attribute types for a datasource. If your DataStore was * a database, this would return the columns in the table to be imported. * You will probably use this when setting up the attributes on the Datasource. * Note that these are Geotools AttributeTypes and have nothing to do with * Tombolo's Attribute objects. * @param datasource The datasource being imported * @return A list of attributes for the datasource * @throws IOException */ protected List<AttributeType> getAttributesForDatasource(Datasource datasource) throws IOException { DataStore dataStore = null; try { dataStore = getDataStoreForDatasource(datasource); SimpleFeatureType schema = dataStore.getSchema(getTypeNameForDatasource(datasource)); return schema.getTypes(); } finally { if (null != dataStore) dataStore.dispose(); } }
type); for (AttributeType attributeType : type.getTypes()) { build.add(sf.getProperty(attributeType.getName()).getValue());