Search in sources :

Example 21 with ValueField

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

the class LayerStylePanel method saveStylePanel.

protected void saveStylePanel() {
    final Window window = SwingUtil.getWindowAncestor(this);
    if (window != null) {
        final Component component = window.getFocusOwner();
        if (component instanceof ValueField) {
            final ValueField valueField = (ValueField) component;
            valueField.save();
        }
    }
    final Component view = this.editStyleContainer.getViewport().getView();
    if (view instanceof ValueField) {
        final ValueField valueField = (ValueField) view;
        valueField.save();
    }
}
Also used : Window(java.awt.Window) Component(java.awt.Component) ValueField(com.revolsys.swing.component.ValueField)

Example 22 with ValueField

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

the class PathTreeNode method actionAddFolderConnection.

private void actionAddFolderConnection() {
    if (isDirectory()) {
        final Path path = getPath();
        final String fileName = getName();
        final ValueField panel = new ValueField();
        panel.setTitle("Add Folder Connection");
        Borders.titled(panel, "Folder Connection");
        SwingUtil.addLabel(panel, "Folder");
        final JLabel fileLabel = new JLabel(path.toString());
        panel.add(fileLabel);
        SwingUtil.addLabel(panel, "Name");
        final TextField nameField = new TextField(20);
        panel.add(nameField);
        nameField.setText(fileName);
        SwingUtil.addLabel(panel, "Folder Connections");
        final List<FolderConnectionRegistry> registries = new ArrayList<>();
        for (final FolderConnectionRegistry registry : FileConnectionManager.get().getVisibleConnectionRegistries()) {
            if (!registry.isReadOnly()) {
                registries.add(registry);
            }
        }
        final ComboBox<FolderConnectionRegistry> registryField = ComboBox.newComboBox("registry", new Vector<>(registries));
        panel.add(registryField);
        GroupLayouts.makeColumns(panel, 2, true);
        panel.showDialog();
        if (panel.isSaved()) {
            final FolderConnectionRegistry registry = registryField.getSelectedItem();
            String connectionName = nameField.getText();
            if (!Property.hasValue(connectionName)) {
                connectionName = fileName;
            }
            registry.addConnection(connectionName, path);
        }
    }
}
Also used : Path(java.nio.file.Path) FolderConnectionRegistry(com.revolsys.io.file.FolderConnectionRegistry) ArrayList(java.util.ArrayList) JLabel(javax.swing.JLabel) TextField(com.revolsys.swing.field.TextField) ValueField(com.revolsys.swing.component.ValueField)

Example 23 with ValueField

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

the class PathRecordStoreTreeNode method addRecordStoreConnection.

public void addRecordStoreConnection() {
    final Path path = getPath();
    final String fileName = Paths.getBaseName(path);
    final ValueField panel = new ValueField();
    panel.setTitle("Add Record Store Connection");
    Borders.titled(panel, "Record Store Connection");
    SwingUtil.addLabel(panel, "File");
    final JLabel fileLabel = new JLabel(Paths.toPathString(path));
    panel.add(fileLabel);
    SwingUtil.addLabel(panel, "Name");
    final TextField nameField = new TextField(20);
    panel.add(nameField);
    nameField.setText(fileName);
    SwingUtil.addLabel(panel, "Record Store Connections");
    final List<RecordStoreConnectionRegistry> registries = new ArrayList<>();
    for (final RecordStoreConnectionRegistry registry : RecordStoreConnectionManager.get().getVisibleConnectionRegistries()) {
        if (!registry.isReadOnly()) {
            registries.add(registry);
        }
    }
    final ComboBox<RecordStoreConnectionRegistry> registryField = ComboBox.newComboBox("registry", registries);
    panel.add(registryField);
    GroupLayouts.makeColumns(panel, 2, true);
    panel.showDialog();
    if (panel.isSaved()) {
        final RecordStoreConnectionRegistry registry = registryField.getSelectedItem();
        String connectionName = nameField.getText();
        if (!Property.hasValue(connectionName)) {
            connectionName = fileName;
        }
        final String baseConnectionName = connectionName;
        int i = 0;
        while (registry.getConnection(connectionName) != null) {
            connectionName = baseConnectionName + i;
            i++;
        }
        final Map<String, Object> connection = getRecordStoreConnectionMap();
        final Map<String, Object> config = new HashMap<>();
        config.put("name", connectionName);
        config.put("connection", connection);
        registry.newConnection(config);
    }
}
Also used : Path(java.nio.file.Path) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) JLabel(javax.swing.JLabel) RecordStoreConnectionRegistry(com.revolsys.record.io.RecordStoreConnectionRegistry) TextField(com.revolsys.swing.field.TextField) ValueField(com.revolsys.swing.component.ValueField)

Example 24 with ValueField

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

the class WebServiceConnectionTrees method addWebServiceConnection.

@SuppressWarnings("deprecation")
private static void addWebServiceConnection(final WebServiceConnectionRegistry registry, final String type) {
    final ValueField panel = new ValueField();
    panel.setTitle("Add Web Service Connection");
    Borders.titled(panel, "Web Service Connection");
    SwingUtil.addLabel(panel, "Name");
    final TextField nameField = new TextField(20);
    panel.add(nameField);
    SwingUtil.addLabel(panel, "Service URL");
    final TextField urlField = new TextField(50);
    panel.add(urlField);
    SwingUtil.addLabel(panel, "Username");
    final TextField usernameField = new TextField(30);
    panel.add(usernameField);
    SwingUtil.addLabel(panel, "Password");
    final PasswordField passwordField = new PasswordField(30);
    panel.add(passwordField);
    GroupLayouts.makeColumns(panel, 2, true);
    panel.showDialog();
    if (panel.isSaved()) {
        final String url = urlField.getText();
        if (url != null) {
            final String name = nameField.getText();
            final String username = usernameField.getText();
            final String password = passwordField.getText();
            final MapEx config = new LinkedHashMapEx();
            config.put("j:type", type);
            config.put("name", name);
            config.put("serviceUrl", url);
            config.put("username", username);
            config.put("password", PasswordUtil.encrypt(password));
            registry.newConnection(config);
        }
    }
}
Also used : MapEx(com.revolsys.collection.map.MapEx) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) TextField(com.revolsys.swing.field.TextField) PasswordField(com.revolsys.swing.field.PasswordField) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) 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