Search in sources :

Example 6 with ValueField

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

the class RecordStoreLayer method newPropertiesTabGeneralPanelSource.

@Override
protected ValueField newPropertiesTabGeneralPanelSource(final BasePanel parent) {
    final ValueField panel = super.newPropertiesTabGeneralPanelSource(parent);
    final Map<String, String> connectionProperties = getProperty("connection");
    String connectionName = null;
    String url = null;
    String user = null;
    if (isExists()) {
        final RecordStore recordStore = getRecordStore();
        url = recordStore.getUrl();
        user = recordStore.getUsername();
    }
    if (connectionProperties != null) {
        connectionName = connectionProperties.get("name");
        if (!isExists()) {
            url = connectionProperties.get("url");
            user = connectionProperties.get("user");
        }
    }
    if (connectionName != null) {
        SwingUtil.addLabelledReadOnlyTextField(panel, "Record Store Name", connectionName);
    }
    if (url != null) {
        SwingUtil.addLabelledReadOnlyTextField(panel, "Record Store URL", url);
    }
    if (user != null) {
        SwingUtil.addLabelledReadOnlyTextField(panel, "Record Store Username", user);
    }
    SwingUtil.addLabelledReadOnlyTextField(panel, "Type Path", this.typePath);
    GroupLayouts.makeColumns(panel, 2, true);
    return panel;
}
Also used : RecordStore(com.revolsys.record.schema.RecordStore) ValueField(com.revolsys.swing.component.ValueField)

Example 7 with ValueField

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

the class AbstractRecordLayer method newPropertiesTabGeneralPanelFilter.

protected ValueField newPropertiesTabGeneralPanelFilter(final BasePanel parent) {
    final ValueField filterPanel = new ValueField(this);
    Borders.titled(filterPanel, "Filter");
    final QueryFilterField field = new QueryFilterField(this, "where", getWhere());
    filterPanel.add(field);
    Property.addListener(field, "where", getBeanPropertyListener());
    GroupLayouts.makeColumns(filterPanel, 1, true);
    parent.add(filterPanel);
    return filterPanel;
}
Also used : QueryFilterField(com.revolsys.swing.map.layer.record.style.panel.QueryFilterField) ValueField(com.revolsys.swing.component.ValueField)

Example 8 with ValueField

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

the class WebServiceConnectionTrees method editConnection.

@SuppressWarnings("deprecation")
private static void editConnection(final WebServiceConnection connection) {
    final WebServiceConnectionRegistry registry = connection.getRegistry();
    final ValueField panel = new ValueField();
    panel.setTitle("Edit Web Service Connection");
    Borders.titled(panel, "Web Service Connection");
    SwingUtil.addLabel(panel, "Name");
    final MapEx config = connection.getConfig();
    final String oldName = connection.getName();
    final TextField nameField = new TextField("name", oldName, 20);
    panel.add(nameField);
    SwingUtil.addLabel(panel, "Service URL");
    String serviceUrl = config.getString("serviceUrl");
    final TextField urlField = new TextField("serviceUrl", serviceUrl, 50);
    panel.add(urlField);
    SwingUtil.addLabel(panel, "Username");
    String username = config.getString("username");
    final TextField usernameField = new TextField("username", username, 30);
    panel.add(usernameField);
    SwingUtil.addLabel(panel, "Password");
    String password = PasswordUtil.decrypt(config.getString("password"));
    final PasswordField passwordField = new PasswordField("password", password, 30);
    panel.add(passwordField);
    GroupLayouts.makeColumns(panel, 2, true);
    panel.showDialog();
    if (panel.isSaved()) {
        serviceUrl = urlField.getText();
        if (serviceUrl != null) {
            final String name = nameField.getText();
            username = usernameField.getText();
            password = passwordField.getText();
            config.put("name", name);
            config.put("serviceUrl", serviceUrl);
            config.put("username", username);
            config.put("password", PasswordUtil.encrypt(password));
            if (Strings.equals(oldName, name)) {
                connection.setProperties(config);
            } else {
                registry.removeConnection(connection);
                registry.newConnection(config);
            }
        }
    }
}
Also used : MapEx(com.revolsys.collection.map.MapEx) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) WebServiceConnectionRegistry(com.revolsys.webservice.WebServiceConnectionRegistry) TextField(com.revolsys.swing.field.TextField) PasswordField(com.revolsys.swing.field.PasswordField) ValueField(com.revolsys.swing.component.ValueField)

Example 9 with ValueField

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

the class FolderConnectionsTrees method addConnection.

private static void addConnection(final FolderConnectionRegistry registry) {
    final ValueField panel = new ValueField();
    panel.setTitle("Add Folder Connection");
    Borders.titled(panel, "Folder Connection");
    SwingUtil.addLabel(panel, "Name");
    final TextField nameField = new TextField(20);
    panel.add(nameField);
    SwingUtil.addLabel(panel, "Folder");
    final FileField folderField = new FileField(JFileChooser.DIRECTORIES_ONLY);
    panel.add(folderField);
    GroupLayouts.makeColumns(panel, 2, true);
    panel.showDialog();
    if (panel.isSaved()) {
        final Path file = folderField.getPath();
        if (file != null && Paths.exists(file)) {
            final String connectionName = nameField.getText();
            registry.addConnection(connectionName, file);
        }
    }
}
Also used : Path(java.nio.file.Path) TextField(com.revolsys.swing.field.TextField) FileField(com.revolsys.swing.field.FileField) ValueField(com.revolsys.swing.component.ValueField)

Example 10 with ValueField

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

the class TiledGriddedElevationModelLayer 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, "Base Directory", fileName);
    } else {
        SwingUtil.addLabelledReadOnlyTextField(panel, "Base URL", this.url);
    }
    SwingUtil.addLabelledReadOnlyTextField(panel, "File Prefix", this.filePrefix);
    if (Property.hasValue(this.fileExtension)) {
        SwingUtil.addLabelledReadOnlyTextField(panel, "File Extension", this.fileExtension);
        final GriddedElevationModelReadFactory factory = IoFactory.factoryByFileExtension(GriddedElevationModelReadFactory.class, this.fileExtension);
        if (factory != null) {
            SwingUtil.addLabelledReadOnlyTextField(panel, "File Type", factory.getName());
        }
    }
    SwingUtil.addLabelledReadOnlyTextField(panel, "Tile Size Pixels", this.tileSizePixels);
    GroupLayouts.makeColumns(panel, 2, true);
    return panel;
}
Also used : GriddedElevationModelReadFactory(com.revolsys.elevation.gridded.GriddedElevationModelReadFactory) 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