GUI improvements
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>BelegScanner</groupId>
|
||||
<artifactId>BelegScanner</artifactId>
|
||||
<version>0.0.8</version>
|
||||
<version>0.0.9</version>
|
||||
|
||||
<name>BelegScanner</name>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -41,6 +41,7 @@ public class DocTable extends JPanel{
|
||||
private JLabel pathLabel;
|
||||
private JPanel buttons;
|
||||
private String path;
|
||||
private JButton joinButton;
|
||||
|
||||
public Row(String path) {
|
||||
this.path = path;
|
||||
@@ -58,7 +59,7 @@ public class DocTable extends JPanel{
|
||||
folderButton.addActionListener(ev -> openFolder(path));
|
||||
buttons.add(folderButton);
|
||||
|
||||
JButton joinButton = new JButton("Zusammenfügen");
|
||||
joinButton = new JButton("Zusammenfügen");
|
||||
joinButton.addActionListener(ev -> joinDocs(path));
|
||||
buttons.add(joinButton);
|
||||
|
||||
@@ -87,6 +88,10 @@ public class DocTable extends JPanel{
|
||||
this.status.setText(status);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void removeJoinButton() {
|
||||
buttons.remove(joinButton);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -121,8 +126,8 @@ public class DocTable extends JPanel{
|
||||
}
|
||||
|
||||
public void joinDocs(String path) {
|
||||
|
||||
LOG.debug("joinFiles({})",path);
|
||||
rows.get(path).removeJoinButton();
|
||||
File folder = new File(path);
|
||||
if (!folder.exists()) return;
|
||||
|
||||
@@ -149,7 +154,8 @@ 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,"Zusammengefügt.");
|
||||
preview(path);
|
||||
}
|
||||
|
||||
public void openFolder(String path) {
|
||||
|
||||
@@ -180,7 +180,6 @@ public class MainFrame extends JFrame {
|
||||
}
|
||||
|
||||
Path.of(path, raw).toFile().delete();
|
||||
docTable.preview(path);
|
||||
|
||||
String ocr = "page."+timestamp+".ocr.pdf";
|
||||
|
||||
@@ -232,6 +231,7 @@ public class MainFrame extends JFrame {
|
||||
pdfViewer.openDocument(file);
|
||||
//pdfViewer.setToolBarVisible(false);
|
||||
pdfViewer.setPageFitMode(DocumentViewController.PAGE_FIT_WINDOW_WIDTH, false);
|
||||
statusBar.setFile(file);
|
||||
}
|
||||
|
||||
private void scan(ActionEvent ev) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package de.srsoftware.belegscanner.gui;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
@@ -13,12 +15,14 @@ public class StatusBar extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 8102800846089594705L;
|
||||
private JLabel path;
|
||||
private JLabel file;
|
||||
|
||||
//private JLabel action;
|
||||
|
||||
public StatusBar() {
|
||||
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
|
||||
//add(action = new JLabel("Bereit."));
|
||||
add(file = new JLabel());
|
||||
add(path = new JLabel("Kein Pfad gewält."));
|
||||
}
|
||||
|
||||
@@ -27,4 +31,11 @@ public class StatusBar extends JPanel {
|
||||
this.path.setText(path);
|
||||
return this;
|
||||
}
|
||||
|
||||
public StatusBar setFile(String path) {
|
||||
File file = new File(path);
|
||||
String dir = file.getParentFile().getName();
|
||||
this.file.setText(dir + File.separator + file.getName());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user