package com.niklim.clicktrace.dialog;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JTextField;
import net.miginfocom.swing.MigLayout;
public class HtmlExportView extends AbstractDialogView {
JTextField outputDirPath;
JFileChooser outputDirFileChooser;
public HtmlExportView() {
dialog.getContentPane().setLayout(new MigLayout("", "[]rel[fill]rel[]"));
dialog.setResizable(false);
createConfigPanel();
dialog.add(createControlPanel("Export"), "align r, span 3");
}
private void createConfigPanel() {
outputDirPath = new JTextField();
outputDirFileChooser = new JFileChooser();
outputDirFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
JButton setPathButton = new JButton("set path");
setPathButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
int returnVal = outputDirFileChooser.showOpenDialog(dialog);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = outputDirFileChooser.getSelectedFile();
outputDirPath.setText(file.getAbsolutePath());
}
}
});
dialog.add(new JLabel("Output folder path"));
dialog.add(outputDirPath, "w 400");
dialog.add(setPathButton, "wrap");
}
}