Skip to content

Commit 47510e6

Browse files
committed
Fixed redraw of QR Code light-box
1 parent 5d2f0a6 commit 47510e6

File tree

7 files changed

+57
-24
lines changed

7 files changed

+57
-24
lines changed

logicaldoc-core/build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<unzip src="@{webroot}/WEB-INF/lib/${pom.artifactId}-${pom.version}-plugin.jar.skip" dest="@{webroot}/WEB-INF/lib/tmp" />
2626
<delete>
2727
<fileset dir="@{webroot}/WEB-INF/lib/tmp">
28-
<include name="com/logicaldoc/core/security/dao/HibernateTenant*" />
28+
<include name="com/logicaldoc/core/security/HibernateTenant*" />
2929
<include name="com/logicaldoc/core/security/authentication/AuthenticationChain*" />
3030
</fileset>
3131
</delete>

logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/util/GridUtil.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static void scrollGrid(ListGrid listGrid, EndScrollListener listener) {
4343
/*
4444
* With a timer we scroll the grid in order to fetch all the data
4545
*/
46-
final Timer timer = new Timer() {
46+
new Timer() {
4747
public void run() {
4848
Integer[] visibleRows = listGrid.getVisibleRows();
4949
if (visibleRows[1] >= listGrid.getTotalRows() - 1) {
@@ -59,8 +59,7 @@ public void run() {
5959
schedule(100);
6060
}
6161
}
62-
};
63-
timer.schedule(100);
62+
}.schedule(100);
6463
}
6564
}
6665

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.logicaldoc.gui.common.client.widgets;
2+
3+
import com.google.gwt.user.client.Timer;
4+
import com.smartgwt.client.widgets.Window;
5+
6+
/**
7+
* A window with utility method to force a delayed redraw of the content
8+
*
9+
* @author Marco Meschieri - LogicalDOC
10+
* @since 9.1.1
11+
*/
12+
public abstract class DelayedRedrawWindow extends Window {
13+
14+
/**
15+
* Forces the redraw after waiting some milliseconds
16+
*/
17+
protected void delayedRedraw() {
18+
new Timer() {
19+
public void run() {
20+
redraw();
21+
}
22+
}.schedule(200);
23+
}
24+
}

logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/QRLightbox.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import com.smartgwt.client.types.ImageStyle;
1010
import com.smartgwt.client.types.TitleOrientation;
1111
import com.smartgwt.client.widgets.Img;
12-
import com.smartgwt.client.widgets.Window;
1312
import com.smartgwt.client.widgets.form.DynamicForm;
1413
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
1514

@@ -19,10 +18,10 @@
1918
*
2019
* @author Marco Meschieri - LogicalDOC
2120
* @since 9.1.1
22-
*
2321
*/
24-
public class QRLightbox extends Window {
22+
public class QRLightbox extends DelayedRedrawWindow {
2523
private static final String QRCODE = "qrcode";
24+
2625
private static final int QR_SIZE = 150;
2726

2827
public QRLightbox(String content) {
@@ -70,6 +69,8 @@ public QRLightbox(String content) {
7069
form.setTitleOrientation(TitleOrientation.LEFT);
7170
form.setItems(qr1Item, qr2Item);
7271
addItem(form);
72+
73+
delayedRedraw();
7374
});
7475
} else {
7576
// We are accessing from the declared server.url so just display the

logicaldoc-gui/src/main/java/com/logicaldoc/gui/common/client/widgets/StickyWindow.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66
import com.logicaldoc.gui.common.client.i18n.I18N;
77
import com.smartgwt.client.types.HeaderControls;
88
import com.smartgwt.client.widgets.HeaderControl;
9-
import com.smartgwt.client.widgets.Window;
109

11-
public abstract class StickyWindow extends Window {
10+
/**
11+
* A Window that remembers its dimensions
12+
*
13+
* @author Marco Meschieri - LogicalDOC
14+
* @since 8.8
15+
*/
16+
public abstract class StickyWindow extends DelayedRedrawWindow {
1217

1318
/**
1419
* The key is a class name while the value is it's descriptor
@@ -70,7 +75,7 @@ protected WindowStatus getWindowStatus() {
7075
}
7176

7277
protected void restoreCurrentStatus() {
73-
if(mustCenter())
78+
if (mustCenter())
7479
centerInPage();
7580
WindowStatus status = getWindowStatus();
7681
if (status != null) {

logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/document/PermaLinkDisplay.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
import com.logicaldoc.gui.common.client.i18n.I18N;
77
import com.logicaldoc.gui.common.client.util.ItemFactory;
88
import com.logicaldoc.gui.common.client.util.Util;
9+
import com.logicaldoc.gui.common.client.widgets.DelayedRedrawWindow;
910
import com.smartgwt.client.types.HeaderControls;
1011
import com.smartgwt.client.types.TitleOrientation;
11-
import com.smartgwt.client.widgets.Window;
1212
import com.smartgwt.client.widgets.form.DynamicForm;
1313
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
1414

@@ -18,7 +18,7 @@
1818
* @author Marco Meschieri - LogicalDOC
1919
* @since 9.1.1
2020
*/
21-
public class PermaLinkDisplay extends Window {
21+
public class PermaLinkDisplay extends DelayedRedrawWindow {
2222

2323
private static final int QR_SIZE = 100;
2424

@@ -35,25 +35,25 @@ public PermaLinkDisplay(long docId) {
3535
if (!urlBase.endsWith("/"))
3636
urlBase += "/";
3737

38-
String downloadUrl = Util.downloadURL(docId);
38+
String downloadUrl1 = Util.downloadURL(docId);
3939
String downloadUrl2 = urlBase + "download?docId=" + docId;
4040

41-
String displayUrl = Util.displayURL(docId, null);
41+
String displayUrl1 = Util.displayURL(docId, null);
4242
String displayUrl2 = urlBase + "display?docId=" + docId;
4343

44-
ImageLoader.loadImages(new String[] { Util.qrURL(downloadUrl, QR_SIZE), Util.qrURL(downloadUrl2, QR_SIZE),
45-
Util.qrURL(displayUrl, QR_SIZE), Util.qrURL(displayUrl2, QR_SIZE) }, imageElements -> {
46-
StaticTextItem downloadUrlItem = prepareBarcodeAndLink("download1", "download", downloadUrl);
44+
ImageLoader.loadImages(new String[] { Util.qrURL(downloadUrl1, QR_SIZE), Util.qrURL(downloadUrl2, QR_SIZE),
45+
Util.qrURL(displayUrl1, QR_SIZE), Util.qrURL(displayUrl2, QR_SIZE) }, imageElements -> {
46+
StaticTextItem downloadUrlItem = prepareBarcodeAndLink("download1", "download", downloadUrl1);
4747
downloadUrlItem.setShowTitle(true);
4848
StaticTextItem downloadUrlItem2 = prepareBarcodeAndLink("download2", "download", downloadUrl2);
4949
downloadUrlItem2.setShowTitle(false);
50-
downloadUrlItem2.setVisible(!downloadUrl.equals(downloadUrl2));
50+
downloadUrlItem2.setVisible(!downloadUrl1.equals(downloadUrl2));
5151

52-
StaticTextItem displayUrlItem = prepareBarcodeAndLink("displayUrl1", "details", displayUrl);
52+
StaticTextItem displayUrlItem = prepareBarcodeAndLink("displayUrl1", "details", displayUrl1);
5353
displayUrlItem.setShowTitle(true);
5454
StaticTextItem displayUrlItem2 = prepareBarcodeAndLink("displayUrl2", "details", displayUrl2);
5555
displayUrlItem2.setShowTitle(false);
56-
displayUrlItem2.setVisible(!displayUrl.equals(displayUrl2));
56+
displayUrlItem2.setVisible(!displayUrl1.equals(displayUrl2));
5757

5858
DynamicForm form = new DynamicForm();
5959
form.setNumCols(1);
@@ -62,6 +62,11 @@ public PermaLinkDisplay(long docId) {
6262
form.setItems(downloadUrlItem, downloadUrlItem2, displayUrlItem, displayUrlItem2);
6363

6464
addItem(form);
65+
66+
/*
67+
* With a timer we force the redraw
68+
*/
69+
delayedRedraw();
6570
});
6671
}
6772

logicaldoc-gui/war/header.jsp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,20 +145,19 @@ body {
145145
146146
let windowContent = '<!DOCTYPE html> ';
147147
windowContent += '<html> ';
148-
windowContent += '<head><title>' + title + '</title> ';
148+
149+
windowContent += '<head><title>' + title + '</title> ';
149150
windowContent += '\u003Cstyle> ';
150151
windowContent += '.cell, .cellDarkAltCol, .cellDark{white-space: nowrap;} ';
151152
windowContent += '.printHeader{white-space: nowrap; font-weight: bold; border:0px solid white;} ';
152153
windowContent += '\u003C/style> ';
153-
154-
windowContent += "<link REL='STYLESHEET' HREF='<%=MODULE%>/sc/skins/<%=SKIN%>/style.css' TYPE='text/css' /> ";
155154
156155
windowContent += "\u003Cscript type='text/javascript'> ";
157156
windowContent += " function printPage(){document.getElementById('printPanel').style.display='none'; window.print(); window.close();} ";
158157
windowContent += "\u003C/script> ";
159158
160159
windowContent += '</head> ';
161-
160+
162161
windowContent += '<body> ';
163162
164163
windowContent += "<div id='printPanel' class='printPanel default'><ul><li><a href='javascript:printPage();' id='printButton'> ";

0 commit comments

Comments
 (0)