centerSouthButtonPanel.setLayout(new GridLayout(2, 4));
centerSouthButtonPanel.add(new JPanel());
centerSouthButtonPanel.add(new JPanel());
centerSouthButtonPanel.add(new JPanel());
centerSouthButtonPanel.add(new JPanel());
JButton butTest = new HelpedButton(Translator.getTranslation("Test only"),
"testonly", "import", view);
butTest.addActionListener(
new java.awt.event.ActionListener() {
//{{{ +actionPerformed(java.awt.event.ActionEvent) : void
public void actionPerformed(java.awt.event.ActionEvent evt) {
CompId = ((Integer) options.cc.comboBox.getSelectedItemsKey()).intValue();
NumToName = new Hashtable();
NameToNum = new Hashtable();
AccNums = new ArrayList();
AccountForm.FillHashTablesWithAccountTypes(NumToName,
null, NameToNum, AccNums, CompId);
fromDate = options.fromDateTextField.getSQLDateValue();
toDate = options.toDateTextField.getSQLDateValue();
StringBuffer errMess = TestSetup();
if (errMess.length() == 0) {
JOptionPane.showMessageDialog(null,
Translator.getTranslation("Successful"),
"",
JOptionPane.PLAIN_MESSAGE);
} else {
ErrorDialog showErrors = new ErrorDialog(errMess, false, null);
}
}//}}}
}
);
centerSouthButtonPanel.add(butTest);
JButton butImport = new HelpedButton(Translator.getTranslation("Import"),
"importbutton", "import", view);
butImport.addActionListener(
new java.awt.event.ActionListener() {
//{{{ +actionPerformed(java.awt.event.ActionEvent) : void
public void actionPerformed(java.awt.event.ActionEvent evt) {
CompId = ((Integer) options.cc.comboBox.getSelectedItemsKey()).intValue();
NumToName = new Hashtable();
NameToNum = new Hashtable();
AccNums = new ArrayList();
AccountForm.FillHashTablesWithAccountTypes(NumToName,
null, NameToNum, AccNums, CompId);
fromDate = options.fromDateTextField.getSQLDateValue();
toDate = options.toDateTextField.getSQLDateValue();
StringBuffer errMess = TestSetup();
boolean doImport = false;
if (errMess.length() == 0) {
doImport = true;
} else {
ErrorDialog showErrors = new ErrorDialog(errMess, true, null);
doImport = showErrors.isImport;
}
if (doImport) {
ImportFile();
}
EditBus.send(new AccountListChanged(null, "no parameters"));
EditBus.send(new CustomerListChanged(null, "no parameters"));
EditBus.send(new AccountTypeListChanged(null, "no parameters"));
}//}}}
}
);
centerSouthButtonPanel.add(butImport);
JButton butHelp = new HelpedButton(Translator.getTranslation("Help"),
"help", "import", view);
butHelp.addActionListener(
new java.awt.event.ActionListener() {
//{{{ +actionPerformed(java.awt.event.ActionEvent) : void
public void actionPerformed(java.awt.event.ActionEvent evt) {
}//}}}
}
);
centerSouthButtonPanel.add(butHelp);
JButton butExit = new HelpedButton(Translator.getTranslation("Exit"),
"exit", "import", view);
butExit.addActionListener(
new java.awt.event.ActionListener() {
//{{{ +actionPerformed(java.awt.event.ActionEvent) : void
public void actionPerformed(java.awt.event.ActionEvent evt) {
Exit();
}//}}}
}
);
centerSouthButtonPanel.add(butExit);
centerMainPanel.add(centerSouthButtonPanel, BorderLayout.SOUTH);
matchPanel.add(centerMainPanel, BorderLayout.CENTER);
//WEST
JPanel westMainPanel = new JPanel();
westMainPanel.setLayout(new BorderLayout());
JPanel westwestPanel = new JPanel();
westwestPanel.setLayout(new BorderLayout());
listFields = new StringBuffer[TABLE_ROWS];
for (int i = 0; i < TABLE_ROWS; i++) {
listFields[i] = new StringBuffer();
}
listData = new CsvListModel();
dataList = new JTable(listData);
MouseListener l3 =
new MouseListener() {
//{{{ +mouseClicked(MouseEvent) : void
public void mouseClicked(MouseEvent e) { }//}}}
//{{{ +mouseEntered(MouseEvent) : void
public void mouseEntered(MouseEvent e) {
Lazy8Ledger.ShowContextHelp(view, "import", "csvfields");
}//}}}
//{{{ +mouseExited(MouseEvent) : void
public void mouseExited(MouseEvent e) { }//}}}
//{{{ +mousePressed(MouseEvent) : void
public void mousePressed(MouseEvent e) { }//}}}
//{{{ +mouseReleased(MouseEvent) : void
public void mouseReleased(MouseEvent e) { }//}}}
};
dataList.addMouseListener(l3);
column = dataList.getColumn(listData.getColumnName(0));
column.setPreferredWidth(5);
column = dataList.getColumn(listData.getColumnName(1));
column.setPreferredWidth(100);
dataList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
lastUsedCsvFileRow = 1;
JScrollPane inFieldListScrollPane = new JScrollPane();
inFieldListScrollPane.getViewport().setView(dataList);
inFieldListScrollPane.setPreferredSize(new Dimension(70, 70));
westwestPanel.add(inFieldListScrollPane, BorderLayout.CENTER);
westwestPanel.add(new HelpedLabel(Translator.getTranslation("Fields from the csv file"),
"csvfields", "import", view), BorderLayout.NORTH);
westMainPanel.add(westwestPanel, BorderLayout.WEST);
JPanel westSouthButtonPanel = new JPanel();
westSouthButtonPanel.setLayout(new GridLayout(2, 2));
westSouthButtonPanel.add(new JPanel());
westSouthButtonPanel.add(new JPanel());
JButton butPrevious = new HelpedButton(Translator.getTranslation("Previous"),
"previous", "import", view);
butPrevious.addActionListener(
new java.awt.event.ActionListener() {
//{{{ +actionPerformed(java.awt.event.ActionEvent) : void
public void actionPerformed(java.awt.event.ActionEvent evt) {
lastUsedCsvFileRow--;
if (lastUsedCsvFileRow <= 0) {
lastUsedCsvFileRow = 1;
}
if (!LoadList(lastUsedCsvFileRow)) {
lastUsedCsvFileRow = 1;
}
}//}}}
}
);
westSouthButtonPanel.add(butPrevious);
JButton butNext = new HelpedButton(Translator.getTranslation("Next"),
"next", "import", view);
butNext.addActionListener(
new java.awt.event.ActionListener() {
//{{{ +actionPerformed(java.awt.event.ActionEvent) : void
public void actionPerformed(java.awt.event.ActionEvent evt) {
lastUsedCsvFileRow++;
if (!LoadList(lastUsedCsvFileRow)) {
lastUsedCsvFileRow--;
}
}//}}}
}
);
westSouthButtonPanel.add(butNext);
westwestPanel.add(westSouthButtonPanel, BorderLayout.SOUTH);
matchPanel.add(westMainPanel, BorderLayout.WEST);
//WEST-CENTER
JPanel westCenterVisualButtonPanel = new JPanel();
westCenterVisualButtonPanel.setLayout(new GridLayout(3, 1));
JButton butMatch = new HelpedButton(Translator.getTranslation("Match"),
"match", "import", view);
butMatch.addActionListener(
new java.awt.event.ActionListener() {
//{{{ +actionPerformed(java.awt.event.ActionEvent) : void
public void actionPerformed(java.awt.event.ActionEvent evt) {
AttemptToMatch();
}//}}}
}
);
westCenterVisualButtonPanel.add(butMatch);
westCenterVisualButtonPanel.add(new JLabel(""));
JButton butUnmatch = new HelpedButton(Translator.getTranslation("Unmatch"),
"unmatch", "import", view);
butUnmatch.addActionListener(
new java.awt.event.ActionListener() {
//{{{ +actionPerformed(java.awt.event.ActionEvent) : void
public void actionPerformed(java.awt.event.ActionEvent evt) {
if (tableView.getSelectedRow() >= 0) {
tableMatchedFields[tableView.getSelectedRow()]