use of org.jdesktop.swingx.VerticalLayout in project com.revolsys.open by revolsys.
the class RecordLayerErrors method showErrorDialog.
public boolean showErrorDialog() {
if (this.records.isEmpty()) {
return true;
} else {
Invoke.later(() -> {
final RecordLayerErrorsTableModel tableModel = new RecordLayerErrorsTableModel(this.layer, this.records, this.messages, this.exceptions, this.fieldNames);
final String layerPath = this.layer.getPath();
final BasePanel panel = new BasePanel(new VerticalLayout(), new JLabel("<html><p><b style=\"color:red\">Error " + this.title + " for layer:</b></p><p>" + layerPath + "</p>"), tableModel.newPanel());
final Rectangle screenBounds = SwingUtil.getScreenBounds();
panel.setPreferredSize(new Dimension(screenBounds.width - 300, tableModel.getRowCount() * 22 + 75));
final Window window = SwingUtil.getActiveWindow();
final JOptionPane pane = new JOptionPane(panel, JOptionPane.ERROR_MESSAGE, JOptionPane.DEFAULT_OPTION, null, null, null);
pane.setComponentOrientation(window.getComponentOrientation());
final JDialog dialog = pane.createDialog(window, "Error " + this.title + ": " + layerPath);
dialog.pack();
SwingUtil.setLocationCentre(screenBounds, dialog);
dialog.setVisible(true);
SwingUtil.dispose(dialog);
});
return false;
}
}
use of org.jdesktop.swingx.VerticalLayout in project com.revolsys.open by revolsys.
the class FieldCalculator method initFieldPanel.
@Override
protected JPanel initFieldPanel() {
final FieldDefinition fieldDefinition = this.getFieldDefinition();
final String fieldName = fieldDefinition.getName();
final JPanel fieldPanel = new JPanel(new VerticalLayout());
final ToolBar toolBar = new ToolBar();
fieldPanel.add(toolBar);
this.expressionField = new TextArea("script", 8, 1);
fieldPanel.add(new JScrollPane(this.expressionField));
this.expressionField.getDocument().addDocumentListener(this);
final AbstractRecordLayer layer = getLayer();
final List<String> fieldNames = layer.getFieldNames();
final ComboBox<String> fieldNamesField = ComboBox.newComboBox("fieldNames", fieldNames, (final Object name) -> {
return layer.getFieldTitle((String) name);
});
toolBar.addComponent("fieldName", fieldNamesField);
toolBar.add(fieldNamesField);
fieldNamesField.setMaximumSize(new Dimension(250, 30));
final Runnable addFieldAction = () -> {
final String selectedFieldName = fieldNamesField.getFieldValue();
insertText(selectedFieldName);
};
toolBar.addButton("fieldName", "Add field name", "add", addFieldAction);
for (final String text : Arrays.asList("+", "-", "*", "/")) {
addTextButton("operators", toolBar, text, text);
}
addTextButton("condition", toolBar, "if", "if (expression) {\n newValue;\n} else {\n " + fieldName + ";\n}");
addTextButton("codeTable", toolBar, "Code ID", "codeId('codeFieldName', codeValue)");
addTextButton("codeTable", toolBar, "Code Value", "codeValue('codeFieldName', codeValue)");
return fieldPanel;
}
use of org.jdesktop.swingx.VerticalLayout in project com.revolsys.open by revolsys.
the class RecordValidationDialog method showErrorDialog.
private void showErrorDialog(final String title, final Consumer<RecordValidationDialog> successAction, final Consumer<RecordValidationDialog> cancelAction) {
Invoke.later(() -> {
final String layerPath = this.layer.getPath();
final Window window = SwingUtil.getActiveWindow();
final JDialog dialog = new JDialog(window, "Error " + title + " for " + layerPath, ModalityType.APPLICATION_MODAL);
dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
dialog.setLayout(new BorderLayout());
final ToolBar toolBar = new ToolBar();
toolBar.addButtonTitleIcon("default", "Cancel " + title, "table_cancel", () -> {
dialog.setVisible(false);
cancelAction.accept(this);
});
toolBar.addButtonTitleIcon("default", "Save valid records", "table_save", () -> {
dialog.setVisible(false);
validateRecords(this.invalidRecords, true);
successAction.accept(this);
});
final TablePanel invalidRecordsTablePanel = newInvalidRecordsTablePanel();
final JLabel message = new JLabel("<html><b style=\"color:red\">Edit the invalid fields (red background) for the invalid records.</b><br />" + " Valid records will have a green background when edited.</html>");
message.setBorder(BorderFactory.createTitledBorder(layerPath));
final BasePanel panel = new //
BasePanel(//
new VerticalLayout(), //
toolBar, //
message, //
invalidRecordsTablePanel);
panel.setBorder(BorderFactory.createEmptyBorder(3, 6, 3, 6));
if (!this.validRecords.isEmpty()) {
final TablePanel validRecordsTablePanel = newValidRecordsTablePanel();
panel.add(validRecordsTablePanel);
}
dialog.add(panel, BorderLayout.NORTH);
final Rectangle screenBounds = SwingUtil.getScreenBounds();
dialog.pack();
dialog.setSize(screenBounds.width - 50, dialog.getPreferredSize().height);
SwingUtil.setLocationCentre(screenBounds, dialog);
dialog.setVisible(true);
SwingUtil.dispose(dialog);
});
}
use of org.jdesktop.swingx.VerticalLayout in project zaproxy by zaproxy.
the class OptionsProxiesPanel method getScrollPanel.
private JPanel getScrollPanel() {
if (scrollPanel == null) {
scrollPanel = new JPanel(new VerticalLayout());
scrollPanel.add(getMainProxyPanel());
scrollPanel.add(getSecurityProtocolsPanel());
scrollPanel.add(getProxiesOptionsPanel());
}
return scrollPanel;
}
use of org.jdesktop.swingx.VerticalLayout in project kotlin by JetBrains.
the class ChoosePathDialog method createCenterPanel.
@Override
protected JComponent createCenterPanel() {
VerticalLayout verticalLayout = new VerticalLayout();
verticalLayout.setGap(3);
JPanel panel = new JPanel(verticalLayout);
if (description != null) {
panel.add(new JLabel(description));
}
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
FileTextField field = FileChooserFactory.getInstance().createFileTextField(descriptor, myDisposable);
field.getField().setColumns(25);
myPathField = new TextFieldWithBrowseButton(field.getField());
myPathField.addBrowseFolderListener("Choose Destination Folder", "Choose folder", myProject, descriptor);
myPathField.setText(defaultPath);
panel.add(myPathField);
return panel;
}
Aggregations