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();
}
}
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);
}
}
}
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);
}
}
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);
}
}
}
Aggregations