in taverna-configuration-impl/src/main/java/org/apache/taverna/workbench/ui/impl/configuration/WorkbenchConfigurationPanel.java [75:187]
private void initComponents() {
this.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
// Title describing what kind of settings we are configuring here
JTextArea descriptionText = new JTextArea(
"General Workbench configuration");
descriptionText.setLineWrap(true);
descriptionText.setWrapStyleWord(true);
descriptionText.setEditable(false);
descriptionText.setFocusable(false);
descriptionText.setBorder(new EmptyBorder(10, 10, 10, 10));
gbc.anchor = WEST;
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 2;
gbc.weightx = 1.0;
gbc.weighty = 0.0;
gbc.fill = HORIZONTAL;
this.add(descriptionText, gbc);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = 2;
gbc.weightx = 0.0;
gbc.weighty = 0.0;
gbc.insets = new Insets(10, 5, 0, 0);
gbc.fill = NONE;
this.add(htmlLabel(DOT_PATH_MSG), gbc);
dotLocation.setText(workbenchConfiguration.getDotLocation());
gbc.gridy++;
gbc.gridwidth = 1;
gbc.weightx = 1.0;
gbc.insets = new Insets(0, 0, 0, 0);
gbc.fill = HORIZONTAL;
this.add(dotLocation, gbc);
JButton browseButton = new JButton();
gbc.gridx = 1;
gbc.weightx = 0.0;
gbc.fill = NONE;
this.add(browseButton, gbc);
browseButton.setAction(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
System.setProperty("com.apple.macos.use-file-dialog-packages",
"false");
JFileChooser fileChooser = new JFileChooser();
fileChooser.putClientProperty(
"JFileChooser.appBundleIsTraversable", "always");
fileChooser.putClientProperty(
"JFileChooser.packageIsTraversable", "always");
fileChooser.setDialogTitle("Browse for dot");
fileChooser.resetChoosableFileFilters();
fileChooser.setAcceptAllFileFilterUsed(false);
fileChooser.setMultiSelectionEnabled(false);
int returnVal = fileChooser
.showOpenDialog(WorkbenchConfigurationPanel.this);
if (returnVal == APPROVE_OPTION)
dotLocation.setText(fileChooser.getSelectedFile()
.getAbsolutePath());
}
});
browseButton.setIcon(openIcon);
gbc.gridx = 0;
gbc.gridy++;
gbc.gridwidth = 2;
gbc.weightx = 0.0;
gbc.weighty = 0.0;
gbc.insets = new Insets(10, 5, 0, 0);
gbc.fill = HORIZONTAL;
this.add(htmlLabel(CONTEXT_MENU_SIZE_MSG), gbc);
menuItems.setText(Integer.toString(workbenchConfiguration
.getMaxMenuItems()));
gbc.gridy++;
gbc.weightx = 1.0;
gbc.gridwidth = 1;
gbc.insets = new Insets(0, 0, 0, 0);
gbc.fill = HORIZONTAL;
this.add(menuItems, gbc);
gbc.gridx = 0;
gbc.gridy++;
gbc.gridwidth = 2;
gbc.weightx = 1.0;
gbc.fill = HORIZONTAL;
gbc.insets = new Insets(10, 0, 0, 0);
warnInternal
.setSelected(workbenchConfiguration.getWarnInternalErrors());
this.add(warnInternal, gbc);
gbc.gridy++;
gbc.insets = new Insets(0, 0, 10, 0);
captureConsole.setSelected(workbenchConfiguration.getCaptureConsole());
this.add(captureConsole, gbc);
// Add the buttons panel
gbc.gridx = 0;
gbc.gridy++;
gbc.gridwidth = 3;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
gbc.fill = BOTH;
gbc.anchor = SOUTH;
this.add(getButtonsPanel(), gbc);
}