private void initGUI() {
setTitle("Application Description Advance Options");
setModal(true);
setBounds(100, 100, 600, 400);
setLocationRelativeTo(null);
GridPanel buttonPane = new GridPanel();
okButton = new JButton("Update");
okButton.setActionCommand("OK");
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
saveApplicationDescriptionAdvancedOptions();
close();
}
});
getRootPane().setDefaultButton(okButton);
JButton cancelButton = new JButton("Cancel");
cancelButton.setActionCommand("Cancel");
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
close();
}
});
GridPanel panel = new GridPanel();
txtInputDir = new XBayaTextField();
XBayaLabel lblInputDirectory = new XBayaLabel("Input directory",txtInputDir);
JLabel lblLocations = new JLabel("Locations");
lblLocations.setFont(new Font("Tahoma", Font.BOLD, 11));
txtOutputDir = new XBayaTextField();
XBayaLabel lblOutputDirectory = new XBayaLabel("Output directory",txtOutputDir);
txtWorkingDir = new XBayaTextField();
XBayaLabel lblWorkingDir = new XBayaLabel("Static Working directory",txtWorkingDir);
JLabel lblProgramData = new JLabel("Program data");
lblProgramData.setFont(new Font("Tahoma", Font.BOLD, 11));
txtSTDIN = new XBayaTextField();
XBayaLabel lblStdin = new XBayaLabel("STDIN",txtSTDIN);
txtSTDOUT = new XBayaTextField();
XBayaLabel lblStdout = new XBayaLabel("STDOUT",txtSTDOUT);
txtSTDERR = new XBayaTextField();
XBayaLabel lblStderr = new XBayaLabel("STDERR",txtSTDERR);
JLabel other = new JLabel("Other");
other.setFont(new Font("Tahoma", Font.BOLD, 11));
JSeparator separator_1 = new JSeparator();
separator_1.setOrientation(SwingConstants.VERTICAL);
JLabel lblEnvironmentalVariables = new JLabel("Environmental Variables");
lblEnvironmentalVariables.setFont(new Font("Tahoma", Font.BOLD, 11));
JScrollPane scrollPane = new JScrollPane();
btnDeleteVariable = new JButton("Delete variable");
btnDeleteVariable.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
deleteSelectedRows();
}
});
btnDeleteVariable.setEnabled(false);
tblEnv = new JTable();
tblEnv.setFillsViewportHeight(true);
scrollPane.setViewportView(tblEnv);
tblEnv.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
defaultTableModel = new DefaultTableModel(new Object[][] { { null, null }, }, new String[] { "Name",
"Value" }) {
@SuppressWarnings("rawtypes")
Class[] columnTypes = new Class[] { String.class, String.class };
@SuppressWarnings({ "rawtypes", "unchecked" })
public Class getColumnClass(int columnIndex) {
return columnTypes[columnIndex];
}
};
tblEnv.setModel(defaultTableModel);
defaultTableModel.addTableModelListener(new TableModelListener() {
@Override
public void tableChanged(TableModelEvent arg0) {
if (!tableModelChanging) {
addNewRowIfLastIsNotEmpty();
}
}
});
tblEnv.getColumnModel().getColumn(0).setPreferredWidth(67);
tblEnv.getColumnModel().getColumn(1).setPreferredWidth(158);
ListSelectionModel selectionModel = tblEnv.getSelectionModel();
selectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
selectionModel.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
btnDeleteVariable.setEnabled(tblEnv.getSelectedRows().length > 0);
}
});
GridPanel leftPanel = new GridPanel();
leftPanel.add(lblLocations);
leftPanel.add(new JLabel());
leftPanel.add(lblInputDirectory);
leftPanel.add(txtInputDir);
leftPanel.add(lblOutputDirectory);
leftPanel.add(txtOutputDir);
leftPanel.add(lblWorkingDir);
leftPanel.add(txtWorkingDir);
leftPanel.add(lblProgramData);
leftPanel.add(new JLabel());
leftPanel.add(lblStdin);
leftPanel.add(txtSTDIN);
leftPanel.add(lblStdout);
leftPanel.add(txtSTDOUT);
leftPanel.add(lblStderr);
leftPanel.add(txtSTDERR);
SwingUtil.layoutToGrid(leftPanel.getSwingComponent(), 8, 2, SwingUtil.WEIGHT_NONE, 1);
GridPanel rightPanel = new GridPanel();
rightPanel.add(lblEnvironmentalVariables);
rightPanel.add(scrollPane);
rightPanel.add(btnDeleteVariable);
rightPanel.getSwingComponent().setSize(150, -1);
leftPanel.getSwingComponent().setSize(150, -1);
SwingUtil.layoutToGrid(rightPanel.getSwingComponent(), 3, 1, 1, 0);
GridPanel p=new GridPanel();
p.add(leftPanel);
p.add(new JSeparator(JSeparator.VERTICAL));
p.layout(1,2, 0,0);
panel.add(p);
panel.add(rightPanel);
panel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
SwingUtil.layoutToGrid(panel.getSwingComponent(), 1, 2, SwingUtil.WEIGHT_NONE, SwingUtil.WEIGHT_EQUALLY);