in taverna-external-tool-activity-ui/src/main/java/org/apache/taverna/activities/externaltool/manager/ToolInvocationConfigurationPanel.java [91:175]
public ToolInvocationConfigurationPanel(List<MechanismCreator> mechanismCreators,
List<InvocationMechanismEditor<?>> invocationMechanismEditors, InvocationGroupManager manager) {
super();
this.mechanismCreators = mechanismCreators;
this.invocationMechanismEditors = invocationMechanismEditors;
this.manager = manager;
manager.addObserver(this);
this.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
headerText = new JTextArea(HEADER_TEXT);
headerText.setLineWrap(true);
headerText.setWrapStyleWord(true);
headerText.setEditable(false);
headerText.setFocusable(false);
headerText.setBorder(new EmptyBorder(10, 10, 10, 10));
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(0, 0, 10, 0);
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 1;
gbc.weightx = 1.0;
gbc.weighty = 0.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
add(headerText, gbc);
JPanel locationPanel = new JPanel(new BorderLayout());
JPanel subPanel = new JPanel(new FlowLayout());
JLabel modify = new JLabel("Modify:");
locationTypeCombo.setSelectedItem(EXPLICIT_LOCATIONS);
locationTypeCombo.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
switchList();
}
});
subPanel.add(modify);
subPanel.add(locationTypeCombo);
populateLists();
switchList();
locationList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
locationList.setCellRenderer(new DefaultListCellRenderer() {
public Component getListCellRendererComponent(JList list, Object value, int index,
boolean isSelected, boolean cellHasFocus) {
Object toShow = value;
if (value instanceof InvocationGroup) {
InvocationGroup invocationGroup = (InvocationGroup) value;
toShow = invocationGroup.getName() + " --> "
+ invocationGroup.getMechanismName();
}
return super.getListCellRendererComponent(list, toShow, index, isSelected,
cellHasFocus);
}
});
locationPanel.add(new JScrollPane(locationList), BorderLayout.CENTER);
locationPanel.add(subPanel, BorderLayout.NORTH);
JPanel buttonPanel = new JPanel(new FlowLayout());
JButton helpButton = new DeselectingButton("Help", new AbstractAction() {
public void actionPerformed(ActionEvent e) {
Helper.showHelp(ToolInvocationConfigurationPanel.this);
}
});
buttonPanel.add(helpButton);
buttonPanel.add(addLocationButton());
buttonPanel.add(removeLocationButton());
buttonPanel.add(editLocationButton());
locationPanel.add(buttonPanel, BorderLayout.SOUTH);
gbc.gridy++;
gbc.weighty = 1;
gbc.fill = GridBagConstraints.BOTH;
gbc.anchor = GridBagConstraints.SOUTH;
gbc.insets = new Insets(10, 0, 0, 0);
this.add(locationPanel, gbc);
}