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);
}