|
|
|
@ -29,6 +29,7 @@ import org.slf4j.Logger;
@@ -29,6 +29,7 @@ import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
|
|
|
import de.srsoftware.belegscanner.Constants; |
|
|
|
|
import static de.srsoftware.belegscanner.Application.*; |
|
|
|
|
|
|
|
|
|
public class DocTable extends JPanel{ |
|
|
|
|
|
|
|
|
@ -62,10 +63,10 @@ public class DocTable extends JPanel{
@@ -62,10 +63,10 @@ public class DocTable extends JPanel{
|
|
|
|
|
buttons = new JPanel(); |
|
|
|
|
buttons.setLayout(new FlowLayout()); |
|
|
|
|
|
|
|
|
|
buttons.add(button("🗀","Ordner öffnen",ev -> openFolder(path))); |
|
|
|
|
buttons.add(joinButton = button("⎗","PDFs zusammenführen",ev -> joinDocs(path))); |
|
|
|
|
buttons.add(button("🖻","Vorschau",ev -> preview(path))); |
|
|
|
|
buttons.add(button("✓","fertig",ev -> drop(this))); |
|
|
|
|
buttons.add(button("🗀",t("open folder"),ev -> openFolder(path))); |
|
|
|
|
buttons.add(joinButton = button("⎗",t("join PDFs"),ev -> joinDocs(path))); |
|
|
|
|
buttons.add(button("🖻",t("display preview"),ev -> preview(path))); |
|
|
|
|
buttons.add(button("✓",t("done"),ev -> drop(this))); |
|
|
|
|
|
|
|
|
|
constraints.gridx = 2; |
|
|
|
|
add(buttons,constraints); |
|
|
|
@ -107,15 +108,15 @@ public class DocTable extends JPanel{
@@ -107,15 +108,15 @@ public class DocTable extends JPanel{
|
|
|
|
|
constraints.gridy = 0; |
|
|
|
|
constraints.gridx = 0; |
|
|
|
|
MatteBorder border = BorderFactory.createMatteBorder(0, 0, 1, 0, Color.black); |
|
|
|
|
JLabel ordner = new JLabel("Ordner",SwingConstants.CENTER); |
|
|
|
|
JLabel ordner = new JLabel(t("Directory"),SwingConstants.CENTER); |
|
|
|
|
ordner.setBorder(border); |
|
|
|
|
add(ordner,constraints); |
|
|
|
|
constraints.gridx = 1; |
|
|
|
|
JLabel status = new JLabel("Status",SwingConstants.CENTER); |
|
|
|
|
JLabel status = new JLabel(t("State"),SwingConstants.CENTER); |
|
|
|
|
status.setBorder(border); |
|
|
|
|
add(status,constraints); |
|
|
|
|
constraints.gridx = 2; |
|
|
|
|
JLabel actions = new JLabel("Aktionen",SwingConstants.CENTER); |
|
|
|
|
JLabel actions = new JLabel(t("Actions"),SwingConstants.CENTER); |
|
|
|
|
actions.setBorder(border); |
|
|
|
|
add(actions,constraints); |
|
|
|
|
previewListeners = new HashSet<>(); |
|
|
|
@ -158,7 +159,7 @@ public class DocTable extends JPanel{
@@ -158,7 +159,7 @@ public class DocTable extends JPanel{
|
|
|
|
|
builder.directory(folder); |
|
|
|
|
try { |
|
|
|
|
Process process = builder.start(); |
|
|
|
|
setState(path,"Verbinde PDFs…"); |
|
|
|
|
setState(path,t("Joining PDFs…")); |
|
|
|
|
int errorCode = process.waitFor(); |
|
|
|
|
if (errorCode != 0) { |
|
|
|
|
LOG.error("error code: {} for {}",errorCode,cmd); |
|
|
|
@ -167,7 +168,7 @@ public class DocTable extends JPanel{
@@ -167,7 +168,7 @@ public class DocTable extends JPanel{
|
|
|
|
|
LOG.error("{} terminated: ",builder,e); |
|
|
|
|
} |
|
|
|
|
for (String page : pdfs) Path.of(path,page).toFile().delete(); |
|
|
|
|
setState(path,"Zusammengefügt."); |
|
|
|
|
setState(path,t("PDFs joined.")); |
|
|
|
|
preview(path); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -178,13 +179,13 @@ public class DocTable extends JPanel{
@@ -178,13 +179,13 @@ public class DocTable extends JPanel{
|
|
|
|
|
process.waitFor(); |
|
|
|
|
Thread.sleep(100); |
|
|
|
|
} catch (IOException | InterruptedException e) { |
|
|
|
|
LOG.error("{} terminated: ",process,e); |
|
|
|
|
LOG.error(t("{} terminated: "),process,e); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
process = new ProcessBuilder(List.of(Constants.FILE_BROWSER,path)).start(); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
LOG.error("{} terminated: ",process,e); |
|
|
|
|
LOG.error(t("{} terminated: "),process,e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|