Search in sources :

Example 11 with ValueField

use of com.revolsys.swing.component.ValueField in project com.revolsys.open by revolsys.

the class PointCloudLayer method newPropertiesTabGeneralPanelSource.

@Override
protected ValueField newPropertiesTabGeneralPanelSource(final BasePanel parent) {
    final ValueField panel = super.newPropertiesTabGeneralPanelSource(parent);
    if (this.url.startsWith("file:")) {
        final String fileName = this.url.replaceFirst("file:(//)?", "");
        SwingUtil.addLabelledReadOnlyTextField(panel, "File", fileName);
    } else {
        SwingUtil.addLabelledReadOnlyTextField(panel, "URL", this.url);
    }
    final String fileNameExtension = FileUtil.getFileNameExtension(this.url);
    if (Property.hasValue(fileNameExtension)) {
        SwingUtil.addLabelledReadOnlyTextField(panel, "File Extension", fileNameExtension);
    // final PointCloud factory = IoFactory
    // .factoryByFileExtension(PointCloudReadFactory.class, fileNameExtension);
    // if (factory != null) {
    // SwingUtil.addLabelledReadOnlyTextField(panel, "File Type", factory.getName());
    // }
    }
    GroupLayouts.makeColumns(panel, 2, true);
    return panel;
}
Also used : ValueField(com.revolsys.swing.component.ValueField)

Example 12 with ValueField

use of com.revolsys.swing.component.ValueField in project com.revolsys.open by revolsys.

the class MapPanel method promptCoordinateSystem.

/**
 * Prompt for a coordinate system if the geometry factory does not have a coordinate system.
 * @author Paul Austin <paul.austin@revolsys.com>
 * @param geometryFactoryProxy
 * @param action
 */
public static <GFP extends GeometryFactoryProxy> void promptCoordinateSystem(final String title, final GFP geometryFactoryProxy, final Consumer<GeometryFactory> action) {
    if (geometryFactoryProxy.isHasCoordinateSystem()) {
        final GeometryFactory geometryFactory = geometryFactoryProxy.getGeometryFactory();
        action.accept(geometryFactory);
    } else {
        Invoke.later(() -> {
            final Project project = Project.get();
            final MapPanel mapPanel = project.getMapPanel();
            final int mapCoordinateSystemId = mapPanel.getCoordinateSystemId();
            final CoordinateSystemField coordinateSystemField = new CoordinateSystemField("coordinateSystem");
            coordinateSystemField.setSelectedItem(mapCoordinateSystemId);
            final JPanel fieldPanel = new BasePanel(new JLabel("Coordinate System"), coordinateSystemField);
            GroupLayouts.makeColumns(fieldPanel, 2, true);
            final ValueField valueField = new ValueField(fieldPanel);
            valueField.add(fieldPanel);
            valueField.showDialog();
            if (valueField.isSaved()) {
                final GeometryFactory geometryFactory = coordinateSystemField.getGeometryFactory();
                if (geometryFactory.isHasCoordinateSystem()) {
                    Invoke.background(title, () -> action.accept(geometryFactory));
                }
            }
        });
    }
}
Also used : Project(com.revolsys.swing.map.layer.Project) JPanel(javax.swing.JPanel) BasePanel(com.revolsys.swing.component.BasePanel) GeometryFactory(com.revolsys.geometry.model.GeometryFactory) CoordinateSystemField(com.revolsys.swing.map.component.CoordinateSystemField) JLabel(javax.swing.JLabel) Point(com.revolsys.geometry.model.Point) ValueField(com.revolsys.swing.component.ValueField)

Example 13 with ValueField

use of com.revolsys.swing.component.ValueField in project com.revolsys.open by revolsys.

the class TriangulatedIrregularNetworkLayer method newPropertiesTabGeneralPanelSource.

@Override
protected ValueField newPropertiesTabGeneralPanelSource(final BasePanel parent) {
    final ValueField panel = super.newPropertiesTabGeneralPanelSource(parent);
    if (this.url.startsWith("file:")) {
        final String fileName = this.url.replaceFirst("file:(//)?", "");
        SwingUtil.addLabelledReadOnlyTextField(panel, "File", fileName);
    } else {
        SwingUtil.addLabelledReadOnlyTextField(panel, "URL", this.url);
    }
    final String fileNameExtension = FileUtil.getFileNameExtension(this.url);
    if (Property.hasValue(fileNameExtension)) {
        SwingUtil.addLabelledReadOnlyTextField(panel, "File Extension", fileNameExtension);
        final TriangulatedIrregularNetworkReadFactory factory = IoFactory.factoryByFileExtension(TriangulatedIrregularNetworkReadFactory.class, fileNameExtension);
        if (factory != null) {
            SwingUtil.addLabelledReadOnlyTextField(panel, "File Type", factory.getName());
        }
    }
    GroupLayouts.makeColumns(panel, 2, true);
    return panel;
}
Also used : TriangulatedIrregularNetworkReadFactory(com.revolsys.elevation.tin.TriangulatedIrregularNetworkReadFactory) ValueField(com.revolsys.swing.component.ValueField)

Example 14 with ValueField

use of com.revolsys.swing.component.ValueField in project com.revolsys.open by revolsys.

the class Project method newPropertiesTabGeneralPanelSource.

@Override
protected ValueField newPropertiesTabGeneralPanelSource(final BasePanel parent) {
    final ValueField panel = super.newPropertiesTabGeneralPanelSource(parent);
    if (this.resource != null) {
        SwingUtil.addLabelledReadOnlyTextField(panel, "URL", this.resource.getURL());
        GroupLayouts.makeColumns(panel, 2, true);
    }
    return panel;
}
Also used : ValueField(com.revolsys.swing.component.ValueField)

Example 15 with ValueField

use of com.revolsys.swing.component.ValueField in project com.revolsys.open by revolsys.

the class AbstractLayer method newPropertiesTabGeneral.

protected BasePanel newPropertiesTabGeneral(final TabbedValuePanel tabPanel) {
    final BasePanel generalPanel = new BasePanel(new VerticalLayout(5));
    generalPanel.setScrollableHeightHint(ScrollableSizeHint.FIT);
    tabPanel.addTab("General", generalPanel);
    newPropertiesTabGeneralPanelGeneral(generalPanel);
    final ValueField sourcePanel = newPropertiesTabGeneralPanelSource(generalPanel);
    if (sourcePanel.getComponentCount() == 0) {
        generalPanel.remove(sourcePanel);
    }
    return generalPanel;
}
Also used : BasePanel(com.revolsys.swing.component.BasePanel) VerticalLayout(org.jdesktop.swingx.VerticalLayout) ValueField(com.revolsys.swing.component.ValueField)

Aggregations

ValueField (com.revolsys.swing.component.ValueField)24 TextField (com.revolsys.swing.field.TextField)7 Path (java.nio.file.Path)3 JLabel (javax.swing.JLabel)3 LinkedHashMapEx (com.revolsys.collection.map.LinkedHashMapEx)2 MapEx (com.revolsys.collection.map.MapEx)2 GriddedElevationModelReadFactory (com.revolsys.elevation.gridded.GriddedElevationModelReadFactory)2 BasePanel (com.revolsys.swing.component.BasePanel)2 PasswordField (com.revolsys.swing.field.PasswordField)2 ArrayList (java.util.ArrayList)2 TriangulatedIrregularNetworkReadFactory (com.revolsys.elevation.tin.TriangulatedIrregularNetworkReadFactory)1 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)1 LineString (com.revolsys.geometry.model.LineString)1 Point (com.revolsys.geometry.model.Point)1 FolderConnectionRegistry (com.revolsys.io.file.FolderConnectionRegistry)1 GeoreferencedImageReadFactory (com.revolsys.raster.GeoreferencedImageReadFactory)1 RecordReaderFactory (com.revolsys.record.io.RecordReaderFactory)1 RecordStoreConnectionRegistry (com.revolsys.record.io.RecordStoreConnectionRegistry)1 RecordStore (com.revolsys.record.schema.RecordStore)1 Field (com.revolsys.swing.field.Field)1