} catch(Exception ex) {
System.out.println(ex);
}
JPanel innerPanel = new JPanel();
innerPanel.setLayout(new BorderLayout());
JPanel alignedP = new JPanel();
GridBagLayout gbLayout = new GridBagLayout();
alignedP.setLayout(gbLayout);
JLabel prefixLab = new JLabel("Prefix for file name", SwingConstants.RIGHT);
prefixLab.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
GridBagConstraints gbConstraints = new GridBagConstraints();
gbConstraints.anchor = GridBagConstraints.EAST;
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
gbConstraints.gridy = 0; gbConstraints.gridx = 0;
gbLayout.setConstraints(prefixLab, gbConstraints);
alignedP.add(prefixLab);
m_prefixText = new EnvironmentField();
m_prefixText.setEnvironment(m_env);
m_prefixText.setToolTipText("Prefix for file name "
+ "(or filename itself if relation name is not used)");
/* int width = m_prefixText.getPreferredSize().width;
int height = m_prefixText.getPreferredSize().height;
m_prefixText.setMinimumSize(new Dimension(width * 2, height));
m_prefixText.setPreferredSize(new Dimension(width * 2, height)); */
gbConstraints = new GridBagConstraints();
gbConstraints.anchor = GridBagConstraints.EAST;
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
gbConstraints.gridy = 0; gbConstraints.gridx = 1;
gbLayout.setConstraints(m_prefixText, gbConstraints);
alignedP.add(m_prefixText);
try{
// m_prefixText = new JTextField(m_dsSaver.getSaver().filePrefix(),25);
m_prefixText.setText(m_dsSaver.getSaverTemplate().filePrefix());
/* final JLabel prefixLab =
new JLabel(" Prefix for file name:", SwingConstants.LEFT); */
JLabel relationLab = new JLabel("Relation name for filename", SwingConstants.RIGHT);
relationLab.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
gbConstraints = new GridBagConstraints();
gbConstraints.anchor = GridBagConstraints.EAST;
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
gbConstraints.gridy = 1; gbConstraints.gridx = 0;
gbLayout.setConstraints(relationLab, gbConstraints);
alignedP.add(relationLab);
m_relationNameForFilename = new JCheckBox();
m_relationNameForFilename.setSelected(m_dsSaver.getRelationNameForFilename());
m_relationNameForFilename.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (m_relationNameForFilename.isSelected()) {
m_prefixText.setLabel("Prefix for file name");
m_fileChooser.setApproveButtonText("Select directory and prefix");
} else {
m_prefixText.setLabel("File name");
m_fileChooser.setApproveButtonText("Select directory and filename");
}
}
});
gbConstraints = new GridBagConstraints();
gbConstraints.anchor = GridBagConstraints.EAST;
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
gbConstraints.gridy = 1; gbConstraints.gridx = 1;
gbConstraints.weightx = 5;
gbLayout.setConstraints(m_relationNameForFilename, gbConstraints);
alignedP.add(m_relationNameForFilename);
} catch(Exception ex){
}
//innerPanel.add(m_SaverEditor, BorderLayout.SOUTH);
JPanel about = m_SaverEditor.getAboutPanel();
if (about != null) {
innerPanel.add(about, BorderLayout.NORTH);
}
add(innerPanel, BorderLayout.NORTH);
// add(m_fileChooser, BorderLayout.CENTER);
JLabel directoryLab = new JLabel("Directory", SwingConstants.RIGHT);
directoryLab.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
gbConstraints = new GridBagConstraints();
gbConstraints.anchor = GridBagConstraints.EAST;
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
gbConstraints.gridy = 2; gbConstraints.gridx = 0;
gbLayout.setConstraints(directoryLab, gbConstraints);
alignedP.add(directoryLab);
m_directoryText = new EnvironmentField();
// m_directoryText.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
m_directoryText.setEnvironment(m_env);
/* width = m_directoryText.getPreferredSize().width;
height = m_directoryText.getPreferredSize().height;
m_directoryText.setMinimumSize(new Dimension(width * 2, height));
m_directoryText.setPreferredSize(new Dimension(width * 2, height)); */
try {
m_directoryText.setText(m_dsSaver.getSaverTemplate().retrieveDir());
} catch (IOException ex) {
// ignore
}
JButton browseBut = new JButton("Browse...");
browseBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
//final JFrame jf = new JFrame("Choose directory");
final JDialog jf = new JDialog((JDialog)SaverCustomizer.this.getTopLevelAncestor(),
"Choose directory", true);
jf.setLayout(new BorderLayout());
jf.getContentPane().add(m_fileChooser, BorderLayout.CENTER);
m_fileChooserFrame = jf;
jf.pack();
jf.setVisible(true);
} catch (Exception ex) {
ex.printStackTrace();
}
}
});
JPanel efHolder = new JPanel();
efHolder.setLayout(new BorderLayout());
JPanel bP = new JPanel(); bP.setLayout(new BorderLayout());
bP.setBorder(BorderFactory.createEmptyBorder(5,0,5,5));
bP.add(browseBut, BorderLayout.CENTER);
efHolder.add(m_directoryText, BorderLayout.CENTER);
efHolder.add(bP, BorderLayout.EAST);
//efHolder.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
gbConstraints = new GridBagConstraints();
gbConstraints.anchor = GridBagConstraints.EAST;
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
gbConstraints.gridy = 2; gbConstraints.gridx = 1;
gbLayout.setConstraints(efHolder, gbConstraints);
alignedP.add(efHolder);
JLabel relativeLab = new JLabel("Use relative file paths", SwingConstants.RIGHT);
relativeLab.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
gbConstraints = new GridBagConstraints();
gbConstraints.anchor = GridBagConstraints.EAST;
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
gbConstraints.gridy = 3; gbConstraints.gridx = 0;
gbLayout.setConstraints(relativeLab, gbConstraints);
alignedP.add(relativeLab);
m_relativeFilePath = new JCheckBox();
m_relativeFilePath.
setSelected(((FileSourcedConverter)m_dsSaver.getSaverTemplate()).getUseRelativePath());
m_relativeFilePath.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
((FileSourcedConverter)m_dsSaver.getSaverTemplate()).
setUseRelativePath(m_relativeFilePath.isSelected());
}
});
gbConstraints = new GridBagConstraints();
gbConstraints.anchor = GridBagConstraints.EAST;
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
gbConstraints.gridy = 3; gbConstraints.gridx = 1;
gbLayout.setConstraints(m_relativeFilePath, gbConstraints);
alignedP.add(m_relativeFilePath);
JButton OKBut = new JButton("OK");
OKBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
(m_dsSaver.getSaverTemplate()).setFilePrefix(m_prefixText.getText());
(m_dsSaver.getSaverTemplate()).setDir(m_directoryText.getText());
m_dsSaver.
setRelationNameForFilename(m_relationNameForFilename.isSelected());
} catch (Exception ex) {
ex.printStackTrace();
}
if (m_modifyListener != null) {
m_modifyListener.setModifiedStatus(SaverCustomizer.this, true);
}
m_parentWindow.dispose();
}
});
JButton CancelBut = new JButton("Cancel");
CancelBut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (m_modifyListener != null) {
m_modifyListener.setModifiedStatus(SaverCustomizer.this, false);
}
m_parentWindow.dispose();
}
});
JPanel butHolder = new JPanel();
butHolder.setLayout(new FlowLayout());
butHolder.add(OKBut);
butHolder.add(CancelBut);
JPanel holder2 = new JPanel();
holder2.setLayout(new BorderLayout());
holder2.add(alignedP, BorderLayout.NORTH);
holder2.add(butHolder, BorderLayout.SOUTH);
add(holder2, BorderLayout.SOUTH);
}