|
|
|
@ -21,6 +21,7 @@ import javax.swing.JPanel;
@@ -21,6 +21,7 @@ import javax.swing.JPanel;
|
|
|
|
|
import org.icepdf.ri.common.ComponentKeyBinding; |
|
|
|
|
import org.icepdf.ri.common.SwingController; |
|
|
|
|
import org.icepdf.ri.common.SwingViewBuilder; |
|
|
|
|
import org.icepdf.ri.common.views.DocumentViewController; |
|
|
|
|
import org.json.JSONArray; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
@ -92,7 +93,7 @@ public class MainFrame extends JFrame {
@@ -92,7 +93,7 @@ public class MainFrame extends JFrame {
|
|
|
|
|
.addPathListener(this::setPath) |
|
|
|
|
.addScanListener(this::scan); |
|
|
|
|
|
|
|
|
|
docTable.addPreviewListener(pdfViewer::openDocument); |
|
|
|
|
docTable.addPreviewListener(this::preview); |
|
|
|
|
|
|
|
|
|
int x = config.getOrCreate(APP_X, 20); |
|
|
|
|
int y = config.getOrCreate(APP_Y, 20); |
|
|
|
@ -103,20 +104,6 @@ public class MainFrame extends JFrame {
@@ -103,20 +104,6 @@ public class MainFrame extends JFrame {
|
|
|
|
|
setVisible(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel preview() { |
|
|
|
|
// https://stackoverflow.com/a/48248739/1285585
|
|
|
|
|
|
|
|
|
|
pdfViewer = new SwingController(); |
|
|
|
|
SwingViewBuilder factory = new SwingViewBuilder(pdfViewer); |
|
|
|
|
|
|
|
|
|
JPanel viewerComponentPanel = factory.buildViewerPanel(); |
|
|
|
|
|
|
|
|
|
ComponentKeyBinding.install(pdfViewer, viewerComponentPanel); |
|
|
|
|
// add interactive mouse link annotation support via callback
|
|
|
|
|
pdfViewer.getDocumentViewController().setAnnotationCallback(new org.icepdf.ri.common.MyAnnotationCallback(pdfViewer.getDocumentViewController())); |
|
|
|
|
return viewerComponentPanel; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void addFieldsFor(String path) { |
|
|
|
|
Vector<String> marks = new Vector<>(); |
|
|
|
|
Matcher matches = MARKEN.matcher(path); |
|
|
|
@ -219,6 +206,26 @@ public class MainFrame extends JFrame {
@@ -219,6 +206,26 @@ public class MainFrame extends JFrame {
|
|
|
|
|
docTable.preview(path); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private JPanel preview() { |
|
|
|
|
// https://stackoverflow.com/a/48248739/1285585
|
|
|
|
|
|
|
|
|
|
pdfViewer = new SwingController(); |
|
|
|
|
SwingViewBuilder factory = new SwingViewBuilder(pdfViewer); |
|
|
|
|
|
|
|
|
|
JPanel viewerComponentPanel = factory.buildViewerPanel(); |
|
|
|
|
|
|
|
|
|
ComponentKeyBinding.install(pdfViewer, viewerComponentPanel); |
|
|
|
|
// add interactive mouse link annotation support via callback
|
|
|
|
|
pdfViewer.getDocumentViewController().setAnnotationCallback(new org.icepdf.ri.common.MyAnnotationCallback(pdfViewer.getDocumentViewController())); |
|
|
|
|
return viewerComponentPanel; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void preview(String file) { |
|
|
|
|
pdfViewer.openDocument(file); |
|
|
|
|
//pdfViewer.setToolBarVisible(false);
|
|
|
|
|
pdfViewer.setPageFitMode(DocumentViewController.PAGE_FIT_WINDOW_WIDTH, false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void scan(ActionEvent ev) { |
|
|
|
|
updateConfig(); |
|
|
|
|
new Thread(() -> performScan(patchedPath,dimension)).start(); |
|
|
|
@ -253,6 +260,7 @@ public class MainFrame extends JFrame {
@@ -253,6 +260,7 @@ public class MainFrame extends JFrame {
|
|
|
|
|
updatePath(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void updateConfig() { |
|
|
|
|
|
|
|
|
|
String prefix = "app.categories."+category+"."; |
|
|
|
@ -298,5 +306,4 @@ public class MainFrame extends JFrame {
@@ -298,5 +306,4 @@ public class MainFrame extends JFrame {
|
|
|
|
|
for (Entry<String, String> entry : fields.entrySet()) patchedPath = patchedPath.replace("$"+entry.getKey(), entry.getValue()); |
|
|
|
|
statusBar.setPath(patchedPath); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|