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