summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2015-09-14 15:39:35 +0200
committerJonathan Bauer2015-09-14 15:39:35 +0200
commit75797b6737f7a9efbe5fbf97452c756ef7ca58f0 (patch)
treecb716907160bbd22d02ef677a8c9eccac73ffd26
parent[client] Version: fix manifest path (diff)
downloadtutor-module-75797b6737f7a9efbe5fbf97452c756ef7ca58f0.tar.gz
tutor-module-75797b6737f7a9efbe5fbf97452c756ef7ca58f0.tar.xz
tutor-module-75797b6737f7a9efbe5fbf97452c756ef7ca58f0.zip
[client] ClientVersion: changelog support. The JSON must now have a 'changelog' element
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/CheckUpdateWindow.java1
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/CheckUpdateWindowLayout.java20
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/ClientVersion.java17
3 files changed, 27 insertions, 11 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 38dc618b..457cb4a8 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
@@ -39,6 +39,7 @@ public class CheckUpdateWindow extends CheckUpdateWindowLayout implements UiFeed
+ " (" + FormatHelper.longDate(ClientVersion.getLocalRevTimestamp()) + ")");
lblRemoteVersion.setText(ClientVersion.getRemoteRevision()
+ " (" + FormatHelper.longDate(ClientVersion.getRemoteRevTimestamp()) + ")");
+ txtChangelog.setText(ClientVersion.getChangelog());
}
@Override
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 0ea71c6a..6b36192a 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
@@ -24,16 +24,17 @@ public abstract class CheckUpdateWindowLayout extends JDialog {
private final static String noticeLabel = "Update";
private final static String closeButtonLabel = "Schließen";
- protected static String changelogText = "-";
protected static JButton btnLink;
protected static JButton btnClose;
- protected JScrollPane disclaimerPanel;
- protected static JLabel newVersion;
+
protected JLabel lblLocalVersion = new JLabel("-");
protected JLabel lblRemoteVersion = new JLabel("-");
protected JLabel lblLocalVersionTime = new JLabel("-");
protected JLabel lblRemoteVersionTime = new JLabel("-");
+ protected JScrollPane changelogPanel;
+ protected JTextArea txtChangelog;
+
public CheckUpdateWindowLayout(Frame modalParent) {
super(modalParent, title, modalParent != null ? ModalityType.APPLICATION_MODAL : ModalityType.MODELESS);
setLayout(new BorderLayout());
@@ -59,13 +60,12 @@ public abstract class CheckUpdateWindowLayout extends JDialog {
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);
- disclaimerText.setWrapStyleWord(true);
- disclaimerPanel = new JScrollPane(disclaimerText, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ txtChangelog = new JTextArea("-", 30, 20);
+ txtChangelog.setLineWrap(true);
+ txtChangelog.setWrapStyleWord(true);
+ changelogPanel = new JScrollPane(txtChangelog, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
- disclaimerPanel.setBorder(BorderFactory.createTitledBorder("Changelog"));
+ changelogPanel.setBorder(BorderFactory.createTitledBorder("Changelog"));
// checkbox for acknowledging the disclaimer
@@ -82,7 +82,7 @@ public abstract class CheckUpdateWindowLayout extends JDialog {
GridManager grid = new GridManager(borderPanel, 1);
grid.add(infoPanel).fill(true, false).expand(true, false);
grid.nextRow();
- grid.add(disclaimerPanel).fill(true, true).expand(true, true);
+ grid.add(changelogPanel).fill(true, true).expand(true, true);
grid.finish(false);
add(buttonPanel, BorderLayout.PAGE_END);
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 d6d35cd4..8818d558 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ClientVersion.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ClientVersion.java
@@ -19,6 +19,7 @@ public class ClientVersion {
private static long remoteRevisionTime = 0;
private static String localRevision = null;
private static String remoteRevision = null;
+ private static String changelog = null;
private static void init() {
if (localRevision == null) {
@@ -33,6 +34,9 @@ public class ClientVersion {
if (remoteRevision == null) {
remoteRevision = "???";
}
+ if (changelog == null) {
+ changelog = "???";
+ }
}
/**
@@ -74,6 +78,16 @@ public class ClientVersion {
}
/**
+ * Gets the changelog
+ *
+ * @return log as String
+ */
+ public static String getChangelog() {
+ init();
+ return changelog;
+ }
+
+ /**
* Checks if we are running latest bwSuite version
*
* @return true if there is no newer version, false otherwise
@@ -165,6 +179,7 @@ public class ClientVersion {
remoteRevision = query.revision;
// seconds timestamp here...
remoteRevisionTime = query.timestamp;
+ changelog = query.changelog;
}
/**
@@ -173,6 +188,6 @@ public class ClientVersion {
static class VersionQuery {
long timestamp;
String revision;
-// String changelog;
+ String changelog;
}
}