in taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationPanel.java [120:289]
private void initComponents() {
shownOption = httpProxyConfiguration.getProperty(PROXY_USE_OPTION);
this.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
// Title describing what kind of settings we are configuring here
JTextArea descriptionText = new JTextArea("HTTP proxy 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);
/**
* Generate the three radio buttons and put them in a group. Each button
* is bound to an action that alters the shownOption and re-populates
* the shown HTTP property fields.
*/
useNoProxy = new JRadioButton("Do not use a proxy");
useNoProxy.setAlignmentX(LEFT_ALIGNMENT);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = 2;
gbc.weightx = 0.0;
gbc.weighty = 0.0;
gbc.fill = NONE;
gbc.insets = new Insets(10, 0, 0, 0);
this.add(useNoProxy, gbc);
ActionListener useNoProxyListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
shownOption = USE_NO_PROXY_OPTION;
populateFields();
}
};
useNoProxy.addActionListener(useNoProxyListener);
useSystemProperties = new JRadioButton("Use system properties");
useSystemProperties.setAlignmentX(LEFT_ALIGNMENT);
gbc.gridx = 0;
gbc.gridy = 2;
gbc.insets = new Insets(0, 0, 0, 0);
this.add(useSystemProperties, gbc);
ActionListener systemPropertiesListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
shownOption = USE_SYSTEM_PROPERTIES_OPTION;
populateFields();
}
};
useSystemProperties.addActionListener(systemPropertiesListener);
useSpecifiedValues = new JRadioButton("Use specified values");
useSpecifiedValues.setAlignmentX(LEFT_ALIGNMENT);
gbc.gridx = 0;
gbc.gridy = 3;
this.add(useSpecifiedValues, gbc);
ActionListener specifiedValuesListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
shownOption = USE_SPECIFIED_VALUES_OPTION;
populateFields();
}
};
useSpecifiedValues.addActionListener(specifiedValuesListener);
ButtonGroup bg = new ButtonGroup();
bg.add(useSystemProperties);
bg.add(useSpecifiedValues);
bg.add(useNoProxy);
/**
* Create the fields to show the HTTP proxy property values. These
* become editable if the shown option is to use specified values.
*/
proxyHostField = new JTextField(TEXTFIELD_SIZE);
gbc.gridx = 0;
gbc.gridy = 4;
gbc.gridwidth = 1;
gbc.fill = NONE;
gbc.insets = new Insets(10, 0, 0, 0);
this.add(new JLabel("Proxy host"), gbc);
gbc.gridx = 1;
gbc.gridy = 4;
gbc.gridwidth = 1;
gbc.fill = HORIZONTAL;
this.add(proxyHostField, gbc);
proxyPortField = new JTextField(TEXTFIELD_SIZE);
gbc.gridx = 0;
gbc.gridy = 5;
gbc.gridwidth = 1;
gbc.fill = NONE;
gbc.insets = new Insets(0, 0, 0, 0);
this.add(new JLabel("Proxy port"), gbc);
gbc.gridx = 1;
gbc.gridy = 5;
gbc.gridwidth = 1;
gbc.fill = HORIZONTAL;
this.add(proxyPortField, gbc);
proxyUserField = new JTextField(TEXTFIELD_SIZE);
gbc.gridx = 0;
gbc.gridy = 6;
gbc.gridwidth = 1;
gbc.fill = NONE;
this.add(new JLabel("Proxy user"), gbc);
gbc.gridx = 1;
gbc.gridy = 6;
gbc.gridwidth = 1;
gbc.fill = HORIZONTAL;
this.add(proxyUserField, gbc);
proxyPasswordField = new JTextField(TEXTFIELD_SIZE);
gbc.gridx = 0;
gbc.gridy = 7;
gbc.gridwidth = 1;
gbc.fill = NONE;
this.add(new JLabel("Proxy password"), gbc);
gbc.gridx = 1;
gbc.gridy = 7;
gbc.gridwidth = 1;
gbc.fill = HORIZONTAL;
this.add(proxyPasswordField, gbc);
nonProxyHostsArea = new DialogTextArea(10, 40);
nonProxyScrollPane = new JScrollPane(nonProxyHostsArea);
nonProxyScrollPane
.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_AS_NEEDED);
nonProxyScrollPane
.setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_AS_NEEDED);
// nonProxyScrollPane.setPreferredSize(new Dimension(300, 500));
gbc.gridx = 0;
gbc.gridy = 8;
gbc.gridwidth = 2;
gbc.fill = NONE;
gbc.insets = new Insets(10, 0, 0, 0);
this.add(new JLabel("Non-proxy hosts"), gbc);
gbc.gridx = 0;
gbc.gridy = 9;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
gbc.gridwidth = 2;
gbc.insets = new Insets(0, 0, 0, 0);
gbc.fill = BOTH;
this.add(nonProxyScrollPane, gbc);
// Add buttons panel
gbc.gridx = 0;
gbc.gridy = 10;
gbc.weightx = 0.0;
gbc.weighty = 0.0;
gbc.gridwidth = 2;
gbc.fill = HORIZONTAL;
gbc.anchor = CENTER;
gbc.insets = new Insets(10, 0, 0, 0);
this.add(createButtonPanel(), gbc);
setFields();
}