Skip to content

Commit

Permalink
additional repaint logic. close #2570
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Oct 1, 2024
1 parent 6847d89 commit d3f2246
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
Binary file modified j-lawyer-client/lib/j-lawyer-cloud/j-lawyer-cloud.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,7 @@
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.logging.Level;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
Expand Down Expand Up @@ -1265,6 +1266,9 @@ private synchronized void renderContent(int currentIndex, int fromPageIndex, int
pnlPage.setBorder(new EmptyBorder(0, 0, 10, 0));
pnlPage.setPage(iIndex, new ImageIcon(scaledImage));
pnlPages.add(pnlPage);
pnlPages.invalidate();
pnlPages.revalidate();
pnlPages.repaint();

});

Expand All @@ -1288,6 +1292,7 @@ private synchronized void renderContent(int currentIndex, int fromPageIndex, int
try {
SwingUtilities.invokeAndWait(() -> {
pnlPages.invalidate();
pnlPages.revalidate();
pnlPages.repaint();
});
} catch (Throwable t) {
Expand Down Expand Up @@ -1358,7 +1363,7 @@ public void showContent(String documentId, byte[] content) {

this.tabs.setEnabledAt(1, false);
this.tabs.setEnabledAt(2, false);
long start=System.currentTimeMillis();
long start = System.currentTimeMillis();
try {
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter(new ByteArrayInputStream(content));
if (zii.canParse()) {
Expand Down Expand Up @@ -1407,7 +1412,25 @@ public void showContent(String documentId, byte[] content) {
} catch (Exception ex) {
log.error("Error rendering e-invoice", ex);
}
log.debug("invoice checking / rendering took " + (System.currentTimeMillis()-start));
log.debug("invoice checking / rendering took " + (System.currentTimeMillis() - start));

// new Thread(() -> {
// try {
// Thread.sleep(200);
// } catch (InterruptedException ex) {
// log.error(ex);
// }
// if (getParent() != null) {
// // component has been added to a container
// SwingUtilities.invokeLater(() -> {
// getParent().revalidate();
// getParent().repaint();
// });
//
// } else {
// log.info("not added to parent yet");
// }
// }).start();

}

Expand Down Expand Up @@ -1537,7 +1560,7 @@ private static BufferedImage rotateImage(BufferedImage originalImage, double deg

return rotatedImage;
}

public void removePages(int[] pageIndexes) {

try {
Expand Down Expand Up @@ -1574,5 +1597,4 @@ public void removePages(int[] pageIndexes) {

}


}

0 comments on commit d3f2246

Please sign in to comment.