in taverna-graph-view/src/main/java/org/apache/taverna/workbench/views/graph/config/GraphViewConfigurationPanel.java [79:227]
public GraphViewConfigurationPanel(GraphViewConfiguration configuration) {
this.configuration = configuration;
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
setLayout(gridbag);
// Title describing what kind of settings we are configuring here
JTextArea descriptionText = new JTextArea(
"Default settings for the workflow diagram");
descriptionText.setLineWrap(true);
descriptionText.setWrapStyleWord(true);
descriptionText.setEditable(false);
descriptionText.setFocusable(false);
descriptionText.setBorder(new EmptyBorder(10, 10, 10, 10));
JLabel defaultLayoutLabel = new JLabel("Service display");
noPorts = new JRadioButton();
allPorts = new JRadioButton();
blobs = new JRadioButton();
JLabel noPortsLabel = new JLabel("Name only", noportIcon, LEFT);
JLabel allPortsLabel = new JLabel("Name and ports", allportIcon, LEFT);
JLabel blobsLabel = new JLabel("No text", blobIcon, LEFT);
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(noPorts);
buttonGroup.add(allPorts);
buttonGroup.add(blobs);
JLabel defaultAlignmentLabel = new JLabel("Diagram alignment");
vertical = new JRadioButton();
horizontal = new JRadioButton();
JLabel verticalLabel = new JLabel("Vertical", verticalIcon, LEFT);
JLabel horizontalLabel = new JLabel("Horizontal", horizontalIcon, LEFT);
ButtonGroup alignmentButtonGroup = new ButtonGroup();
alignmentButtonGroup.add(horizontal);
alignmentButtonGroup.add(vertical);
animation = new JCheckBox("Enable animation");
animationSpeedLabel = new JLabel("Animation speed");
animationSpeedSlider = new JSlider(ANIMATION_SPEED_MIN,
ANIMATION_SPEED_MAX);
animationSpeedSlider.setMajorTickSpacing(500);
animationSpeedSlider.setMinorTickSpacing(100);
animationSpeedSlider.setPaintTicks(true);
animationSpeedSlider.setPaintLabels(true);
animationSpeedSlider.setInverted(true);
animationSpeedSlider.setSnapToTicks(true);
Hashtable<Integer, JLabel> labelTable = new Hashtable<>();
labelTable.put(new Integer(ANIMATION_SPEED_MIN), new JLabel("Fast"));
labelTable.put(new Integer(
((ANIMATION_SPEED_MAX - ANIMATION_SPEED_MIN) / 2)
+ ANIMATION_SPEED_MIN), new JLabel("Medium"));
labelTable.put(new Integer(ANIMATION_SPEED_MAX), new JLabel("Slow"));
animationSpeedSlider.setLabelTable(labelTable);
animation.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
boolean animationEnabled = animation.isSelected();
animationSpeedLabel.setEnabled(animationEnabled);
animationSpeedSlider.setEnabled(animationEnabled);
}
});
// Set current configuration values
setFields(configuration);
c.anchor = WEST;
c.gridx = 0;
c.gridwidth = REMAINDER;
c.weightx = 1d;
c.weighty = 0d;
c.fill = HORIZONTAL;
add(descriptionText, c);
c.insets = new Insets(10, 0, 10, 0);
add(defaultLayoutLabel, c);
c.insets = new Insets(0, 20, 0, 0);
c.gridwidth = 1;
c.weightx = 0d;
add(noPorts, c);
c.insets = new Insets(0, 5, 0, 0);
c.gridx = RELATIVE;
add(noPortsLabel, c);
c.insets = new Insets(0, 10, 0, 0);
add(allPorts, c);
c.insets = new Insets(0, 5, 0, 0);
add(allPortsLabel, c);
c.insets = new Insets(0, 10, 0, 0);
add(blobs, c);
c.insets = new Insets(0, 5, 0, 0);
c.gridwidth = REMAINDER;
c.weightx = 1d;
add(blobsLabel, c);
// alignment
c.insets = new Insets(20, 0, 10, 0);
c.gridx = 0;
add(defaultAlignmentLabel, c);
c.insets = new Insets(0, 20, 0, 0);
c.gridx = 0;
c.gridwidth = 1;
c.weightx = 0d;
add(vertical, c);
c.insets = new Insets(0, 5, 0, 0);
c.gridx = RELATIVE;
add(verticalLabel, c);
c.insets = new Insets(0, 10, 0, 0);
add(horizontal, c);
c.insets = new Insets(0, 5, 0, 0);
c.gridwidth = REMAINDER;
c.weightx = 1d;
add(horizontalLabel, c);
// animation
c.gridx = 0;
c.gridwidth = REMAINDER;
c.insets = new Insets(20, 0, 10, 0);
add(animation, c);
c.insets = new Insets(0, 20, 0, 0);
add(animationSpeedLabel, c);
c.insets = new Insets(0, 20, 10, 30);
c.anchor = NORTHWEST;
c.weighty = 0d;
add(animationSpeedSlider, c);
// Buttons
c.gridx = 0;
c.insets = new Insets(0, 20, 10, 30);
c.anchor = NORTHWEST;
c.weighty = 1d;
add(createButtonPanel(), c);
}