summaryrefslogtreecommitdiffstats
path: root/dozentenmodul
diff options
context:
space:
mode:
authorJonathan Bauer2015-09-07 13:15:50 +0200
committerJonathan Bauer2015-09-07 13:15:50 +0200
commit409749c8df2aef48164a242cb150dd8bafb162ae (patch)
treee55f5e32523835310a2dbedd56cb30f6cec9c59b /dozentenmodul
parentMerge branch 'v1.1' of git.openslx.org:openslx-ng/tutor-module into v1.1 (diff)
downloadtutor-module-409749c8df2aef48164a242cb150dd8bafb162ae.tar.gz
tutor-module-409749c8df2aef48164a242cb150dd8bafb162ae.tar.xz
tutor-module-409749c8df2aef48164a242cb150dd8bafb162ae.zip
[client] better CheckUpdateWindow layout and format the dates
Diffstat (limited to 'dozentenmodul')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/CheckUpdateWindow.java30
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/CheckUpdateWindowLayout.java14
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/ClientVersion.java9
3 files changed, 33 insertions, 20 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/CheckUpdateWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/CheckUpdateWindow.java
index be5d87c9..38dc618b 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/CheckUpdateWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/CheckUpdateWindow.java
@@ -16,6 +16,7 @@ import org.openslx.dozmod.gui.helper.UiFeedback;
import org.openslx.dozmod.gui.window.layout.CheckUpdateWindowLayout;
import org.openslx.dozmod.gui.window.layout.DisclaimerWindowLayout;
import org.openslx.dozmod.util.ClientVersion;
+import org.openslx.dozmod.util.FormatHelper;
import org.openslx.dozmod.util.OpenLinks;
import org.openslx.dozmod.util.OpenLinks.Link;
@@ -23,25 +24,32 @@ import org.openslx.dozmod.util.OpenLinks.Link;
* Window for showing the disclaimer.
*/
@SuppressWarnings("serial")
-public class CheckUpdateWindow extends CheckUpdateWindowLayout implements UiFeedback {
+public class CheckUpdateWindow extends CheckUpdateWindowLayout implements UiFeedback, ActionListener {
private final static Logger LOGGER = Logger.getLogger(CheckUpdateWindow.class);
public CheckUpdateWindow(Frame modalParent) {
super(modalParent);
- lblLocalVersion.setText(ClientVersion.getLocalRevision() + " (" + ClientVersion.getLocalRevTimestamp() + ")");
- lblRemoteVersion.setText(ClientVersion.getRemoteRevision() + " (" + ClientVersion.getRemoteRevTimestamp() + ")");
- btnLink.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- OpenLinks.openWebpage(Link.DOZMOD);
- }
- });
+ btnClose.addActionListener(this);
+ btnLink.addActionListener(this);
btnLink.setEnabled(!ClientVersion.isNewest());
- pack();
- }
+ lblLocalVersion.setText(ClientVersion.getLocalRevision()
+ + " (" + FormatHelper.longDate(ClientVersion.getLocalRevTimestamp()) + ")");
+ lblRemoteVersion.setText(ClientVersion.getRemoteRevision()
+ + " (" + FormatHelper.longDate(ClientVersion.getRemoteRevTimestamp()) + ")");
+
+ }
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource() == btnLink) {
+ OpenLinks.openWebpage(Link.DOZMOD);
+ }
+ if (e.getSource() == btnClose) {
+ dispose();
+ }
+ }
public static void open(Frame modalParent) {
new CheckUpdateWindow(modalParent).setVisible(true);
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/CheckUpdateWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/CheckUpdateWindowLayout.java
index 6567e55e..4b69b801 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/CheckUpdateWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/CheckUpdateWindowLayout.java
@@ -34,20 +34,21 @@ public abstract class CheckUpdateWindowLayout extends JDialog {
protected static JButton btnClose;
protected JScrollPane disclaimerPanel;
protected static JLabel newVersion;
- protected JLabel lblLocalVersion;
- protected JLabel lblRemoteVersion;
+ protected JLabel lblLocalVersion = new JLabel("-");
+ protected JLabel lblRemoteVersion = new JLabel("-");
+ protected JLabel lblLocalVersionTime = new JLabel("-");
+ protected JLabel lblRemoteVersionTime = new JLabel("-");
public CheckUpdateWindowLayout(Frame modalParent) {
super(modalParent, title, modalParent != null ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS);
setLayout(new BorderLayout());
- setPreferredSize(new Dimension(600, 400));
+ setPreferredSize(new Dimension(680, 400));
// Panel used for creating border. We'll add everything into this.
JPanel borderPanel = new JPanel();
borderPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
add(borderPanel);
- lblLocalVersion = new JLabel("-");
- lblRemoteVersion = new JLabel("-");
+
// information before the disclaimer
JPanel infoPanel = new JPanel();
GridManager infoGrid = new GridManager(infoPanel, 4);
@@ -57,13 +58,12 @@ public abstract class CheckUpdateWindowLayout extends JDialog {
infoGrid.add(lblLocalVersion);
infoGrid.add(Box.createHorizontalGlue()).fill(true, false).expand(true, false);
infoGrid.nextRow();
- infoGrid.add(new JLabel("Neueste Version"));
+ infoGrid.add(new JLabel("Aktuelle Version"));
infoGrid.add(Box.createHorizontalStrut(10));
infoGrid.add(lblRemoteVersion);
infoGrid.add(Box.createHorizontalGlue()).fill(true, false).expand(true, false);
infoGrid.finish(false);
-
// the disclaimer text box with scrolling functionality
JTextArea disclaimerText = new JTextArea(changelogText, 30, 20);
disclaimerText.setLineWrap(true);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ClientVersion.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ClientVersion.java
index f7b75abf..beb96bb2 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ClientVersion.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ClientVersion.java
@@ -96,8 +96,11 @@ public class ClientVersion {
}
if (manifestRev != null)
localRevision = manifestRev;
- if (manifestRevTime != null)
+ if (manifestRevTime != null) {
localRevisionTime = Long.valueOf(manifestRevTime);
+ // hax since we get milliseconds not seconds
+ localRevisionTime = localRevisionTime / 1000L;
+ }
LOGGER.info("Local revision: " + localRevision);
LOGGER.info("Local revision timestamp: " + localRevisionTime);
@@ -130,8 +133,10 @@ public class ClientVersion {
VersionQuery query = gson.fromJson(json, VersionQuery.class);
if (query.revision != null)
remoteRevision = query.revision;
- if (query.timestamp != null)
+ if (query.timestamp != null) {
+ // seconds timestamp here...
remoteRevisionTime = query.timestamp;
+ }
LOGGER.debug("Remote revision: " + remoteRevision);
LOGGER.debug("Remote timestamp: " + remoteRevisionTime);
}