public void setView(Displayable view) {
view.addCommand(new NavigationCommand("quit", "${quit}", Command.SCREEN, 9));
//#ifdef FILE_API
view.addCommand(new ActionCommand("${export}", Command.SCREEN, 8) {
public Navigation execute(Displayable d) throws Exception {
Exporter exporter = new Exporter();
javax.microedition.io.file.FileConnection fc =
(javax.microedition.io.file.FileConnection) Connector.open(CSV_PATH, Connector.READ_WRITE);
try {
if (fc.exists())
fc.delete();
fc.create();
exporter.exportToCSV(fc.openOutputStream(), controler);
} finally {
fc.close();
}
return null;
}
});
view.addCommand(new ActionCommand("${import}", Command.SCREEN, 8) {
public Navigation execute(Displayable d) throws Exception {
Exporter exporter = new Exporter();
javax.microedition.io.file.FileConnection fc =
(javax.microedition.io.file.FileConnection) Connector.open(CSV_PATH,
Connector.READ);
try {
exporter.importFromCSV(fc.openDataInputStream(), fc.fileSize(), controler);
} finally {
fc.close();
}
return null;
}