summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2015-07-16 16:59:48 +0200
committerJonathan Bauer2015-07-16 16:59:48 +0200
commit6b827cd9a83c7590235b87346fd47359ebf426e8 (patch)
tree75e8cb9a8424067503eb298f563b01da1e712278
parent[client] ImageListWindow refresh image list when wizard returns successfully (diff)
parentMerge branch 'v1.1' of git.openslx.org:openslx-ng/tutor-module into v1.1 (diff)
downloadtutor-module-6b827cd9a83c7590235b87346fd47359ebf426e8.tar.gz
tutor-module-6b827cd9a83c7590235b87346fd47359ebf426e8.tar.xz
tutor-module-6b827cd9a83c7590235b87346fd47359ebf426e8.zip
Merge branch 'v1.1' of git.openslx.org:openslx-ng/tutor-module into v1.1
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/App.java31
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java10
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/ImageListComparator.java9
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/ImageListFilter.java7
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/LectureListComparator.java70
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/LectureListFilter.java48
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/TableHelper.java146
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java18
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java173
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java6
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java3
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageListWindowLayout.java27
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java172
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/LectureCache.java40
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/ProxyConfigurator.java20
15 files changed, 683 insertions, 97 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/App.java b/dozentenmodul/src/main/java/org/openslx/dozmod/App.java
index 6666d747..b4814e5a 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/App.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/App.java
@@ -22,6 +22,8 @@ public class App {
// Logger
private final static Logger LOGGER = Logger.getLogger(App.class);
+ private static Thread proxyThread = null;
+
private static void setupLogger() {
// path to the log file
@@ -74,11 +76,8 @@ public class App {
String s = event.getRenderedMessage();
if (s.contains("uthorization")) {
Matcher m = re.matcher(s);
- if (!m.find()) {
- LOGGER.warn("Could not match pattern!");
- } else {
+ if (m.find()) {
s = m.replaceAll("Authorization: ***********");
- LOGGER.info("Patched log message");
}
}
ffa.append(new LoggingEvent(event.getFQNOfLoggerClass(), event.getLogger(),
@@ -104,11 +103,13 @@ public class App {
setupLogger();
// Initialize the proxy settings
- try {
- ProxyConfigurator.init();
- } catch (IOException e) {
- showAwtMessage("Could not detect proxy server automatically. No proxy server will be used", e);
- }
+ proxyThread = new Thread() {
+ @Override
+ public void run() {
+ ProxyConfigurator.init();
+ }
+ };
+ proxyThread.start();
// Check if we can load SWT by calling some library function
try {
@@ -121,7 +122,7 @@ public class App {
// setup global thrift connection error handler before anything else
// Set master server to use (TODO: make configurable via command line)
ThriftManager.setMasterServerAddress("bwlp-masterserver.ruf.uni-freiburg.de");
-
+
MainWindow.open();
// start the main window
@@ -135,4 +136,14 @@ public class App {
}
new AwtBox(null, message);
}
+
+ public static synchronized void waitForInit() {
+ if (proxyThread == null)
+ return;
+ try {
+ proxyThread.join();
+ } catch (InterruptedException e) {
+ }
+ proxyThread = null;
+ }
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java
index 2c50bc2e..e048a135 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/MainWindow.java
@@ -16,12 +16,14 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
+import org.openslx.dozmod.App;
import org.openslx.dozmod.Config;
import org.openslx.dozmod.gui.Gui.GuiCallable;
import org.openslx.dozmod.gui.helper.CompositePage;
import org.openslx.dozmod.gui.helper.MessageType;
import org.openslx.dozmod.gui.window.DisclaimerWindow;
import org.openslx.dozmod.gui.window.ImageListWindow;
+import org.openslx.dozmod.gui.window.LectureListWindow;
import org.openslx.dozmod.gui.window.LoginWindow;
import org.openslx.dozmod.gui.window.MainMenuWindow;
import org.openslx.dozmod.gui.window.VirtualizerNoticeWindow;
@@ -88,7 +90,6 @@ public abstract class MainWindow {
Shell dialogShell = Gui.newShell(mainShell, style);
// populate dialogShell
dialogShell.setLayout(new GridLayout(1, false));
- LOGGER.debug(clazz.getDeclaredClasses());
Constructor<?> con = null;
try {
con = clazz.getConstructor(Shell.class);
@@ -188,6 +189,7 @@ public abstract class MainWindow {
// register all pages of the main window
registerPage(new MainMenuWindow(mainShell));
registerPage(new ImageListWindow(mainShell));
+ registerPage(new LectureListWindow(mainShell));
// Show main menu by default
showPage(MainMenuWindow.class);
@@ -198,6 +200,12 @@ public abstract class MainWindow {
mainShell.open();
// here we can check for Session information
+ if (Session.getSatelliteToken() != null) {
+ // Wait for proxy server init
+ App.waitForInit();
+ // TODO: Try to resume session
+ }
+ // Session resume probably failed, show login window
if (Session.getSatelliteToken() == null) {
// User did not login, show the login mask
openPopup(LoginWindow.class, true, true);
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/ImageListComparator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/ImageListComparator.java
index 75031beb..b684b61f 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/ImageListComparator.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/ImageListComparator.java
@@ -6,11 +6,12 @@ import org.eclipse.swt.SWT;
import org.openslx.bwlp.thrift.iface.ImageSummaryRead;
import org.openslx.bwlp.thrift.iface.OperatingSystem;
import org.openslx.dozmod.thrift.MetaDataCache;
+import org.openslx.dozmod.thrift.UserCache;
public class ImageListComparator extends ViewerComparator{
private int tableColumn;
private static final int DESCENDING = 1;
-
+
// possible columns
private static final int IMAGENAME = 0;
private static final int OS = 1;
@@ -58,7 +59,9 @@ public class ImageListComparator extends ViewerComparator{
comparisonResult = os1.getOsName().compareTo(os2.getOsName());
break;
case OWNER:
- comparisonResult = i1.getOwnerId().compareTo(i2.getOwnerId());
+ String owner1 = UserCache.find(i1.getOwnerId()).getLastName() + ", " + UserCache.find(i1.getOwnerId()).getFirstName();
+ String owner2 = UserCache.find(i2.getOwnerId()).getLastName() + ", " + UserCache.find(i2.getOwnerId()).getFirstName();
+ comparisonResult = owner1.compareTo(owner2);
break;
case UPDATETIME:
comparisonResult = Long.compare(i1.getUpdateTime(),i2.getUpdateTime());
@@ -72,7 +75,7 @@ public class ImageListComparator extends ViewerComparator{
} catch (Exception e) {
// Don't order if something went wrong (field not set)
- return -100;
+ return 0;
}
// If descending order, flip the direction
if (direction == DESCENDING) {
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/ImageListFilter.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/ImageListFilter.java
index 2e3860cb..c98fc791 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/ImageListFilter.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/ImageListFilter.java
@@ -4,7 +4,9 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.openslx.bwlp.thrift.iface.ImageSummaryRead;
import org.openslx.bwlp.thrift.iface.OperatingSystem;
+import org.openslx.bwlp.thrift.iface.UserInfo;
import org.openslx.dozmod.thrift.MetaDataCache;
+import org.openslx.dozmod.thrift.UserCache;
/**
@@ -31,8 +33,9 @@ public class ImageListFilter extends ViewerFilter {
return true;
}
- // TODO fix when resolving owner id in table
- if (i.getOwnerId().toLowerCase().matches(searchString.toLowerCase())) {
+ UserInfo user = UserCache.find(i.getOwnerId());
+ if (user.getFirstName().toLowerCase().matches(searchString.toLowerCase())
+ || user.getLastName().toLowerCase().matches(searchString.toLowerCase())) {
return true;
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/LectureListComparator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/LectureListComparator.java
new file mode 100644
index 00000000..170bcac4
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/LectureListComparator.java
@@ -0,0 +1,70 @@
+package org.openslx.dozmod.gui.helper;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.swt.SWT;
+import org.openslx.bwlp.thrift.iface.LectureSummary;
+import org.openslx.dozmod.thrift.UserCache;
+
+public class LectureListComparator extends ViewerComparator{
+ private int tableColumn;
+ private static final int DESCENDING = 1;
+
+ // possible columns
+ private static final int LECTURENAME = 0;
+ private static final int OWNER = 1;
+
+ private int direction;
+
+ public LectureListComparator() {
+ this.tableColumn = 0;
+ this.direction = DESCENDING;
+ }
+
+ public int getDirection() {
+ return direction == 1 ? SWT.DOWN : SWT.UP;
+ }
+
+ public void setColumn(int column) {
+ if (column == this.tableColumn) {
+ // Same column as last sort; toggle the direction
+ direction = 1 - direction;
+ } else {
+ // New column; do an ascending sort
+ this.tableColumn = column;
+ direction = DESCENDING;
+ }
+ }
+
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ LectureSummary l1 = (LectureSummary) e1;
+ LectureSummary l2 = (LectureSummary) e2;
+
+ int comparisonResult = 0;
+ try {
+ // Decide how to compare depending on the column index
+ switch (tableColumn) {
+ case LECTURENAME:
+ comparisonResult = l1.getLectureName().compareTo(l2.getLectureName());
+ break;
+ case OWNER:
+ String owner1 = UserCache.find(l1.getOwnerId()).getLastName() + ", " + UserCache.find(l1.getOwnerId()).getFirstName();
+ String owner2 = UserCache.find(l2.getOwnerId()).getLastName() + ", " + UserCache.find(l2.getOwnerId()).getFirstName();
+ comparisonResult = owner1.compareTo(owner2);
+ break;
+ default:
+ comparisonResult = 0;
+ }
+
+ } catch (Exception e) {
+ // Don't order if something went wrong (field not set)
+ return 0;
+ }
+ // If descending order, flip the direction
+ if (direction == DESCENDING) {
+ comparisonResult = -comparisonResult;
+ }
+ return comparisonResult;
+ }
+}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/LectureListFilter.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/LectureListFilter.java
new file mode 100644
index 00000000..025d2744
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/LectureListFilter.java
@@ -0,0 +1,48 @@
+package org.openslx.dozmod.gui.helper;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.openslx.bwlp.thrift.iface.LectureSummary;
+import org.openslx.bwlp.thrift.iface.UserInfo;
+import org.openslx.dozmod.thrift.UserCache;
+
+
+/**
+ * Filter for the lecture list
+ */
+public class LectureListFilter extends ViewerFilter {
+
+ private String searchString;
+
+ public void setSearchText(String s) {
+ // ensure that the value can be used for matching
+ this.searchString = ".*" + s + ".*";
+ }
+
+ // Determine whether to select the element depending on search string
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ try {
+ if (searchString == null || searchString.length() == 0) {
+ return true;
+ }
+ LectureSummary i = (LectureSummary) element;
+ if (i.getLectureName().toLowerCase().matches(searchString.toLowerCase())) {
+ return true;
+ }
+
+ UserInfo user = UserCache.find(i.getOwnerId());
+ if (user.getFirstName().toLowerCase().matches(searchString.toLowerCase())
+ || user.getLastName().toLowerCase().matches(searchString.toLowerCase())) {
+ return true;
+ }
+
+ } catch (Exception e) {
+ // Don't show if something went wrong -> field probably not set
+ return false;
+ }
+ return false;
+ }
+}
+
+
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/TableHelper.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/TableHelper.java
index 0e0af351..96bc18dc 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/TableHelper.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/TableHelper.java
@@ -11,62 +11,43 @@ import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.openslx.bwlp.thrift.iface.ImageSummaryRead;
+import org.openslx.bwlp.thrift.iface.LectureSummary;
import org.openslx.bwlp.thrift.iface.OperatingSystem;
import org.openslx.bwlp.thrift.iface.UserInfo;
import org.openslx.dozmod.thrift.MetaDataCache;
+import org.openslx.dozmod.thrift.UserCache;
public final class TableHelper {
private TableHelper() {
}
/**
- * Create a column with the ability to be sorted
- *
- * @param tableViewer
- * @param colName
- * @param width column width
- * @param colNumber index of the column
- * @param provider the column label provider
- */
- private static void createSortedColumn(TableViewer tableViewer, String colName, int width, int colNumber,
- ColumnLabelProvider provider) {
- TableViewerColumn col = new TableViewerColumn(tableViewer, SWT.NONE);
- col.getColumn().setWidth(width);
- col.getColumn().setText(colName);
- col.setLabelProvider(provider);
- // for column sorting
- col.getColumn().addSelectionListener(getSelectionAdapter(col, colNumber, tableViewer));
- }
-
- /**
- * Create a column for the given table viewer without sorting functionality
- * @param tableViewer
- * @param colName
- * @param width
- * @param provider
+ * Create the columns for the table in the lecture main window.
+ * Comparator has to be set beforehand.
+ * @param table the tableViewer
*/
- private static void createUnsortedColumn(TableViewer tableViewer, String colName, int width, ColumnLabelProvider provider) {
- TableViewerColumn col = new TableViewerColumn(tableViewer, SWT.NONE);
- col.getColumn().setWidth(width);
- col.getColumn().setText(colName);
- col.setLabelProvider(provider);
- }
+ public static void createLectureTableColumns(TableViewer table) {
+ createSortedColumn(table, "Name", 150, 0, new ColumnLabelProvider() {
+ @Override
+ public String getText(Object element) {
+ LectureSummary lecture = (LectureSummary) element;
+ return lecture.getLectureName();
+ }
+ });
- // selection listener for column sorting
- private static SelectionListener getSelectionAdapter(final TableViewerColumn col,
- final int colNumber, final TableViewer table) {
- SelectionAdapter selectionAdapter = new SelectionAdapter() {
+ createSortedColumn(table, "Verantwortlicher", 130, 1, new ColumnLabelProvider() {
@Override
- public void widgetSelected(SelectionEvent e) {
- ImageListComparator comparator = (ImageListComparator) table.getComparator();
- comparator.setColumn(colNumber);
- int dir = comparator.getDirection();
- table.getTable().setSortDirection(dir);
- table.getTable().setSortColumn(col.getColumn());
- table.refresh();
+ public String getText(Object element) {
+ LectureSummary lecture = (LectureSummary) element;
+ String ownerId = lecture.getOwnerId();
+ UserInfo user = UserCache.find(ownerId);
+ if (user == null){
+ return "Unknown";
+ }else {
+ return user.getLastName() + ", " + user.getFirstName();
+ }
}
- };
- return selectionAdapter;
+ });
}
/**
@@ -84,12 +65,12 @@ public final class TableHelper {
}
});
- createSortedColumn(table, "OS", 130, 1, new ColumnLabelProvider() {
+ createSortedColumn(table, "OS", 150, 1, new ColumnLabelProvider() {
@Override
public String getText(Object element) {
ImageSummaryRead image = (ImageSummaryRead) element;
OperatingSystem os = MetaDataCache.getOsById(image.getOsId());
-
+
if (os == null) {
return "Unknown";
} else {
@@ -102,7 +83,13 @@ public final class TableHelper {
@Override
public String getText(Object element) {
ImageSummaryRead image = (ImageSummaryRead) element;
- return image.getOwnerId();
+ String ownerId = image.getOwnerId();
+ UserInfo user = UserCache.find(ownerId);
+ if (user == null){
+ return "Unknown";
+ }else {
+ return user.getLastName() + ", " + user.getFirstName();
+ }
}
});
@@ -141,7 +128,7 @@ public final class TableHelper {
return user.firstName + " " + user.lastName;
}
});
-
+
createUnsortedColumn(permissionTableViewer, "Link", 90, new ColumnLabelProvider() {
@Override
public String getText(Object element) {
@@ -149,7 +136,7 @@ public final class TableHelper {
return " ";
}
});
-
+
createUnsortedColumn(permissionTableViewer, "Download", 90, new ColumnLabelProvider() {
@Override
public String getText(Object element) {
@@ -157,7 +144,7 @@ public final class TableHelper {
return " ";
}
});
-
+
createUnsortedColumn(permissionTableViewer, "Edit", 90, new ColumnLabelProvider() {
@Override
public String getText(Object element) {
@@ -165,7 +152,7 @@ public final class TableHelper {
return " ";
}
});
-
+
createUnsortedColumn(permissionTableViewer, "Admin", 90, new ColumnLabelProvider() {
@Override
public String getText(Object element) {
@@ -173,6 +160,63 @@ public final class TableHelper {
return " ";
}
});
-
+
};
+
+ /**
+ * Create a column with the ability to be sorted
+ *
+ * @param tableViewer
+ * @param colName
+ * @param width column width
+ * @param colNumber index of the column
+ * @param provider the column label provider
+ */
+ private static void createSortedColumn(TableViewer tableViewer, String colName, int width, int colNumber,
+ ColumnLabelProvider provider) {
+ TableViewerColumn col = new TableViewerColumn(tableViewer, SWT.NONE);
+ col.getColumn().setWidth(width);
+ col.getColumn().setText(colName);
+ col.setLabelProvider(provider);
+ // for column sorting
+ col.getColumn().addSelectionListener(getSelectionAdapter(col, colNumber, tableViewer));
+ }
+
+ /**
+ * Create a column for the given table viewer without sorting functionality
+ * @param tableViewer
+ * @param colName
+ * @param width
+ * @param provider
+ */
+ private static void createUnsortedColumn(TableViewer tableViewer, String colName, int width, ColumnLabelProvider provider) {
+ TableViewerColumn col = new TableViewerColumn(tableViewer, SWT.NONE);
+ col.getColumn().setWidth(width);
+ col.getColumn().setText(colName);
+ col.setLabelProvider(provider);
+ }
+
+ // selection listener for column sorting
+ private static SelectionListener getSelectionAdapter(final TableViewerColumn col,
+ final int colNumber, final TableViewer table) {
+ SelectionAdapter selectionAdapter = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ int dir = 0;
+ if (table.getComparator() instanceof ImageListComparator) {
+ ImageListComparator comparator = (ImageListComparator) table.getComparator();
+ comparator.setColumn(colNumber);
+ dir = comparator.getDirection();
+ } else if (table.getComparator() instanceof LectureListComparator) {
+ LectureListComparator comparator = (LectureListComparator) table.getComparator();
+ comparator.setColumn(colNumber);
+ dir = comparator.getDirection();
+ }
+ table.getTable().setSortDirection(dir);
+ table.getTable().setSortColumn(col.getColumn());
+ table.refresh();
+ }
+ };
+ return selectionAdapter;
+ }
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java
index 9c0eead1..a75117c9 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageListWindow.java
@@ -18,6 +18,7 @@ import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Shell;
import org.openslx.bwlp.thrift.iface.ImagePermissions;
import org.openslx.bwlp.thrift.iface.ImageSummaryRead;
+import org.openslx.bwlp.thrift.iface.UserInfo;
import org.openslx.dozmod.gui.Gui;
import org.openslx.dozmod.gui.MainWindow;
import org.openslx.dozmod.gui.helper.ImageListComparator;
@@ -28,6 +29,7 @@ import org.openslx.dozmod.gui.window.layout.ImageListWindowLayout;
import org.openslx.dozmod.gui.wizard.ImageWizard;
import org.openslx.dozmod.thrift.ImageCache;
import org.openslx.dozmod.thrift.Session;
+import org.openslx.dozmod.thrift.UserCache;
import org.openslx.thrifthelper.ThriftManager;
import org.openslx.util.QuickTimer;
import org.openslx.util.QuickTimer.Task;
@@ -115,8 +117,9 @@ public class ImageListWindow extends ImageListWindowLayout {
// the owner id of the selected image
String ownerId = selectedElement.getOwnerId();
- if (ownerId != null) {
- ownerInfo.setText(ownerId);
+ UserInfo user = UserCache.find(ownerId);
+ if (user != null) {
+ ownerInfo.setText(user.getLastName() + ", " + user.getFirstName());
} else {
ownerInfo.setText("Unknown");
}
@@ -148,6 +151,7 @@ public class ImageListWindow extends ImageListWindowLayout {
refreshList(wd.open() == Window.OK);
}
});
+
//deleteImageVersion
deleteButton.addSelectionListener(new SelectionAdapter() {
@Override
@@ -184,6 +188,14 @@ public class ImageListWindow extends ImageListWindowLayout {
});
}
});
+
+ // return to mainMenu
+ backButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ MainWindow.showPage(MainMenuWindow.class);
+ }
+ });
}
private boolean refreshList(boolean forceRefresh) {
@@ -211,7 +223,7 @@ public class ImageListWindow extends ImageListWindowLayout {
Gui.showMessageBox(getShell(), "Failed to delete image!", MessageType.ERROR, LOGGER, t);
}
}
-
+
public ImageSummaryRead getCurrentImageSummaryRead() {
IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
return (ImageSummaryRead) selection.getFirstElement();
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java
new file mode 100644
index 00000000..2f3aa76b
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java
@@ -0,0 +1,173 @@
+package org.openslx.dozmod.gui.window;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Shell;
+import org.openslx.bwlp.thrift.iface.LectureSummary;
+import org.openslx.bwlp.thrift.iface.UserInfo;
+import org.openslx.dozmod.gui.MainWindow;
+import org.openslx.dozmod.gui.helper.LectureListComparator;
+import org.openslx.dozmod.gui.helper.LectureListFilter;
+import org.openslx.dozmod.gui.helper.TableHelper;
+import org.openslx.dozmod.gui.window.layout.LectureListWindowLayout;
+import org.openslx.dozmod.thrift.LectureCache;
+import org.openslx.dozmod.thrift.UserCache;
+
+public class LectureListWindow extends LectureListWindowLayout {
+
+ private final static Logger LOGGER = Logger.getLogger(LectureListWindow.class);
+
+ public final LectureListWindow me = this;
+
+ public LectureListWindow(final Shell mainShell) {
+ super(mainShell);
+
+ // Comparator for column sorting
+ LectureListComparator comparator = new LectureListComparator();
+ tableViewer.setComparator(comparator);
+ // creating the columns with sorting functionality through comparator
+ TableHelper.createLectureTableColumns(tableViewer);
+
+ // filter the objects in the table depending on the search field
+ searchTextField.addKeyListener(new KeyAdapter() {
+ public void keyReleased(KeyEvent ke) {
+ filter.setSearchText(searchTextField.getText());
+ tableViewer.refresh();
+ }
+ });
+
+ // apply object filtering
+ filter = new LectureListFilter();
+ tableViewer.addFilter(filter);
+
+ // the listeners to set the detailed info of the selected lecture
+ tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
+ LectureSummary lecture = (LectureSummary) selection.getFirstElement();
+ if (lecture == null) return;
+ String leName = lecture.getLectureName();
+ if (leName == null) {
+ lectureName.setText("Unknown");
+ } else {
+ lectureName.setText(leName);
+ }
+
+
+ // id of the lecture
+ String lectureBaseId = lecture.getLectureId();
+ if (lectureBaseId == null) {
+ idInfo.setText("Unknown");
+ } else {
+ idInfo.setText(lectureBaseId);
+ }
+
+ // id of the image linked to the lecture
+ String baseId = lecture.getImageBaseId();
+ if (baseId == null) {
+ imageBaseId.setText("Unknown");
+ } else {
+ imageBaseId.setText(baseId);
+ }
+
+ // set the time, the lecture has last been used
+ long lastUsedTimestamp = lecture.getLastUsed();
+ if (lastUsedTimestamp == 0) {
+ lastusedInfo.setText("Unknown");
+ } else {
+ Date date = new Date(lastUsedTimestamp * 1000L);
+ SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
+ String formattedDate = sdf.format(date);
+ lastusedInfo.setText(formattedDate);
+ }
+
+ // set the start time of the lecture
+ long startTimestamp = lecture.getStartTime();
+ if (startTimestamp == 0) {
+ startTime.setText("Unknown");
+ } else {
+ Date date = new Date(startTimestamp * 1000L);
+ SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
+ String formattedDate = sdf.format(date);
+ startTime.setText(formattedDate);
+ }
+
+ // set the end time of the lecture
+ long endTimestamp = lecture.getEndTime();
+ if (endTimestamp == 0) {
+ endTime.setText("Unknown");
+ } else {
+ Date date = new Date(endTimestamp * 1000L);
+ SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
+ String formattedDate = sdf.format(date);
+ endTime.setText(formattedDate);
+ }
+
+ // the owner id of the selected lecture
+ String ownerId = lecture.getOwnerId();
+ UserInfo user = UserCache.find(ownerId);
+ if (user != null) {
+ ownerInfo.setText(user.getLastName() + ", " + user.getFirstName());
+ } else {
+ ownerInfo.setText("Unknown");
+ }
+
+ }
+ });
+
+ newButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ }
+ });
+
+ editButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+
+ }
+ });
+
+ // delete lecture
+ deleteButton.addSelectionListener(new SelectionAdapter() {
+ });
+
+ // return to mainMenu
+ backButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ MainWindow.showPage(MainMenuWindow.class);
+ }
+ });
+ }
+
+ private boolean refreshList() {
+ List<LectureSummary> lectureList = LectureCache.get(false);
+
+ tableViewer.setInput(lectureList);
+ tableViewer.refresh();
+ return true;
+ }
+
+ @Override
+ public boolean hide() {
+ return true;
+ }
+
+ @Override
+ public void show() {
+ refreshList();
+ }
+
+}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java
index c4a702d6..bbed4109 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LoginWindow.java
@@ -12,6 +12,7 @@ import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Shell;
import org.openslx.bwlp.thrift.iface.Organization;
+import org.openslx.dozmod.App;
import org.openslx.dozmod.Config;
import org.openslx.dozmod.authentication.Authenticator;
import org.openslx.dozmod.authentication.Authenticator.AuthenticatorCallback;
@@ -59,12 +60,15 @@ public class LoginWindow extends LoginWindowLayout {
idpCombo.add("Initialisiere...");
idpCombo.select(0);
idpCombo.setEnabled(false);
+ loginButton.setEnabled(false);
QuickTimer.scheduleOnce(new Task() {
List<Organization> orgs = null;
@Override
public void fire() {
try {
+ // Wait for proxy server init
+ App.waitForInit();
orgs = OrganizationCache.getAll();
} catch (Exception e) {
LoginWindow.LOGGER.error("Error during execution: ", e);
@@ -75,6 +79,7 @@ public class LoginWindow extends LoginWindowLayout {
@Override
public void run() {
populateIdpCombo(orgs);
+ loginButton.setEnabled(true);
}
});
}
@@ -200,7 +205,6 @@ public class LoginWindow extends LoginWindowLayout {
for (Organization o : orgs) {
if (o.getEcpUrl() == null | o.getEcpUrl().isEmpty())
continue;
- LOGGER.debug("Adding: " + o.toString());
idpCombo.add(o.displayName);
idpCombo.setData(o.displayName, o);
if (savedOrganizationId != null && !savedOrganizationId.isEmpty()
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java
index 7b2fa94b..f36b85e2 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/MainMenuWindow.java
@@ -22,8 +22,7 @@ public class MainMenuWindow extends MainMenuWindowLayout {
lecturesButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- //
- }
+ MainWindow.showPage(LectureListWindow.class); }
});
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageListWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageListWindowLayout.java
index aa50a425..be0f74ca 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageListWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageListWindowLayout.java
@@ -25,6 +25,7 @@ public abstract class ImageListWindowLayout extends CompositePage {
protected String editButtonLabel = "Bearbeiten";
protected String deleteButtonLabel = "Löschen";
protected String downloadButtonLabel = "Download";
+ protected String backButtonLabel = "Zurück";
protected String tableGroupLabel = "Images";
protected String vmInfoGroupLabel = "Detailinformationen";
protected String filterGroupLabel = "Filter";
@@ -34,7 +35,8 @@ public abstract class ImageListWindowLayout extends CompositePage {
protected Button deleteButton;
protected Button editButton;
protected Button downloadButton;
-
+ protected Button backButton;
+
// imageDetail texts
protected Text imageSelectedNameLabel;
@@ -44,7 +46,7 @@ public abstract class ImageListWindowLayout extends CompositePage {
protected Text permissionInfo;
protected Text ownerInfo;
protected Text templateInfo;
-
+
protected final Text searchTextField;
protected final TableViewer tableViewer;
@@ -79,7 +81,7 @@ public abstract class ImageListWindowLayout extends CompositePage {
infoText.setText(infoTextString);
// -- end group of title --
-
+
// -- group for the table --
Group tableGroup = new Group(this, SWT.BORDER);
tableGroup.setText(tableGroupLabel);
@@ -88,7 +90,7 @@ public abstract class ImageListWindowLayout extends CompositePage {
tgLayoutData.widthHint = 800;
tableGroup.setLayoutData(tgLayoutData);
tableGroup.setLayout(new GridLayout());
-
+
// -- group for the filter --
Group filterGroup = new Group(tableGroup, SWT.BORDER);
filterGroup.setText(filterGroupLabel);
@@ -98,12 +100,12 @@ public abstract class ImageListWindowLayout extends CompositePage {
fgGridData.horizontalSpan = 2;
filterGroup.setLayoutData(fgGridData);
filterGroup.setLayout(new GridLayout());
-
+
// filter text field
searchTextField = new Text(filterGroup, SWT.BORDER);
searchTextField.setMessage("Name, Verantwortlicher, OS");
// -- end group of filter --
-
+
// table
Table vmTable = new Table(tableGroup, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
GridData tableGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
@@ -114,8 +116,8 @@ public abstract class ImageListWindowLayout extends CompositePage {
// TableViewer on the table
tableViewer = new TableViewer(vmTable);
tableViewer.setContentProvider(ArrayContentProvider.getInstance());
-
-
+
+
// create, modify, download and delete buttons
Composite buttonComposite = new Composite(tableGroup, SWT.NONE);
@@ -135,6 +137,9 @@ public abstract class ImageListWindowLayout extends CompositePage {
downloadButton = new Button(buttonComposite, SWT.PUSH);
downloadButton.setText(downloadButtonLabel);
+
+ backButton = new Button(buttonComposite, SWT.PUSH);
+ backButton.setText(backButtonLabel);
// -- end group for table --
// -- group for details of selected image --
@@ -148,12 +153,14 @@ public abstract class ImageListWindowLayout extends CompositePage {
// image name info
imageSelectedNameLabel = createCaptionAndTextfield("Image Name:", vmInfoGroup);
idInfo = createCaptionAndTextfield("ID:", vmInfoGroup);
- versionInfo = createCaptionAndTextfield("Version", vmInfoGroup);
+ versionInfo = createCaptionAndTextfield("Version:", vmInfoGroup);
lastUpdateInfo = createCaptionAndTextfield("Letztes Update:", vmInfoGroup);
permissionInfo = createCaptionAndTextfield("Berechtigungen:", vmInfoGroup);
- ownerInfo = createCaptionAndTextfield("Besitzer ID", vmInfoGroup);
+ ownerInfo = createCaptionAndTextfield("Besitzer:", vmInfoGroup);
templateInfo = createCaptionAndTextfield("Vorlage:", vmInfoGroup);
// -- end group of details --
+
+
}
public Text createCaptionAndTextfield(String captionString, Group group) {
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java
new file mode 100644
index 00000000..9bfbe3ee
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java
@@ -0,0 +1,172 @@
+package org.openslx.dozmod.gui.window.layout;
+
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Text;
+import org.openslx.dozmod.gui.Gui;
+import org.openslx.dozmod.gui.helper.CompositePage;
+import org.openslx.dozmod.gui.helper.LectureListFilter;
+
+public abstract class LectureListWindowLayout extends CompositePage {
+
+ protected String infoTitleString = "Übersicht Veranstaltungen";
+ protected String newButtonLabel = "Neu";
+ protected String editButtonLabel = "Bearbeiten";
+ protected String deleteButtonLabel = "Löschen";
+ protected String backButtonLabel = "Zurück";
+ protected String tableGroupLabel = "Veranstaltungen";
+ protected String vmInfoGroupLabel = "Detailinformationen";
+ protected String filterGroupLabel = "Filter";
+
+ // buttons
+ protected Button newButton;
+ protected Button deleteButton;
+ protected Button editButton;
+ protected Button backButton;
+
+
+ // imageDetail texts
+ protected Text lectureName;
+ protected Text idInfo;
+ protected Text imageBaseId;
+ protected Text lastusedInfo;
+ protected Text permissionInfo;
+ protected Text ownerInfo;
+ protected Text startTime;
+ protected Text endTime;
+
+ protected final Text searchTextField;
+
+ protected final TableViewer tableViewer;
+ protected LectureListFilter filter;
+
+ protected String infoTextString = "Hier können Sie Veranstaltungen anlegen, bearbeiten und löschen.";
+
+ public LectureListWindowLayout(final Composite mainShell) {
+ super(mainShell, SWT.NONE);
+
+ // the layout and layoutData of the LectureListWindow
+ this.setLayout(new GridLayout(2, false));
+ this.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ // -- info group with title and text --
+ Composite infoComposite = new Composite(this, SWT.BORDER);
+ GridData infoGridData = new GridData(SWT.FILL, SWT.FILL, true, false);
+ infoGridData.horizontalSpan = 2;
+ infoComposite.setLayoutData(infoGridData);
+ // layout for the items of the group
+ infoComposite.setLayout(new GridLayout(1, false));
+
+ // title of the info group in bold
+ Label infoTitle = new Label(infoComposite, SWT.NONE);
+ infoTitle.setText(infoTitleString);
+ // set the fond
+ FontData fontData = infoTitle.getFont().getFontData()[0];
+ Font font = new Font(Gui.display, new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD));
+ infoTitle.setFont(font);
+ // the infotext
+ Label infoText = new Label(infoComposite, SWT.NONE);
+ infoText.setText(infoTextString);
+ // -- end group of title --
+
+
+ // -- group for the table --
+ Group tableGroup = new Group(this, SWT.BORDER);
+ tableGroup.setText(tableGroupLabel);
+ GridData tgLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ tgLayoutData.minimumWidth = 400;
+ tgLayoutData.widthHint = 800;
+ tableGroup.setLayoutData(tgLayoutData);
+ tableGroup.setLayout(new GridLayout());
+
+ // -- group for the filter --
+ Group filterGroup = new Group(tableGroup, SWT.BORDER);
+ filterGroup.setText(filterGroupLabel);
+ GridData fgGridData = new GridData(SWT.FILL, SWT.TOP, true, false);
+ fgGridData.minimumWidth = 400;
+ fgGridData.widthHint = 800;
+ fgGridData.horizontalSpan = 2;
+ filterGroup.setLayoutData(fgGridData);
+ filterGroup.setLayout(new GridLayout());
+
+ // filter text field
+ searchTextField = new Text(filterGroup, SWT.BORDER);
+ searchTextField.setMessage("Name, Verantwortlicher");
+ // -- end group of filter --
+
+ // table
+ Table vmTable = new Table(tableGroup, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ GridData tableGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ vmTable.setLayoutData(tableGridData);
+ vmTable.setHeaderVisible(true);
+ vmTable.setLinesVisible(true);
+
+ // TableViewer on the table
+ tableViewer = new TableViewer(vmTable);
+ tableViewer.setContentProvider(ArrayContentProvider.getInstance());
+
+
+
+ // create, modify and delete buttons
+ Composite buttonComposite = new Composite(tableGroup, SWT.NONE);
+ GridData buttonCompositeGridData = new GridData(SWT.FILL, SWT.FILL, true, false);
+ buttonCompositeGridData.minimumWidth = 200;
+ buttonComposite.setLayoutData(buttonCompositeGridData);
+ buttonComposite.setLayout(new RowLayout());
+
+ newButton = new Button(buttonComposite, SWT.PUSH);
+ newButton.setText(newButtonLabel);
+
+ editButton = new Button(buttonComposite, SWT.PUSH);
+ editButton.setText(editButtonLabel);
+
+ deleteButton = new Button(buttonComposite, SWT.PUSH);
+ deleteButton.setText(deleteButtonLabel);
+
+ backButton = new Button(buttonComposite, SWT.PUSH);
+ backButton.setText(backButtonLabel);
+ // -- end group for table --
+
+ // -- group for details of selected lecture --
+ final Group vmInfoGroup = new Group(this, SWT.BORDER);
+ vmInfoGroup.setText(vmInfoGroupLabel);
+ final GridData igGridData = new GridData(SWT.FILL, SWT.FILL, true, false);
+ igGridData.widthHint = 300;
+ vmInfoGroup.setLayoutData(igGridData);
+ vmInfoGroup.setLayout(new GridLayout(2, false));
+
+ // image name info
+ lectureName = createCaptionAndTextfield("Name:", vmInfoGroup);
+ idInfo = createCaptionAndTextfield("Id:", vmInfoGroup);
+ imageBaseId = createCaptionAndTextfield("Image Id:", vmInfoGroup);
+ lastusedInfo = createCaptionAndTextfield("Zuletzt genutzt:", vmInfoGroup);
+ permissionInfo = createCaptionAndTextfield("Berechtigungen:", vmInfoGroup);
+ startTime = createCaptionAndTextfield("Startzeit:", vmInfoGroup);
+ endTime = createCaptionAndTextfield("Endzeit:", vmInfoGroup);
+ ownerInfo = createCaptionAndTextfield("Besitzer:", vmInfoGroup);
+ // -- end group of details --
+ }
+
+ public Text createCaptionAndTextfield(String captionString, Group group) {
+ Label caption = new Label(group, SWT.NONE);
+ Text textField = new Text(group, SWT.READ_ONLY);
+ caption.setText(captionString);
+ caption.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
+ gridData.minimumWidth = 180;
+ textField.setLayoutData(gridData);
+ return textField;
+ }
+
+}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/LectureCache.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/LectureCache.java
new file mode 100644
index 00000000..eb80b61e
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/LectureCache.java
@@ -0,0 +1,40 @@
+package org.openslx.dozmod.thrift;
+
+import java.util.List;
+
+import org.apache.thrift.TException;
+import org.openslx.bwlp.thrift.iface.LectureSummary;
+import org.openslx.bwlp.thrift.iface.TAuthorizationException;
+import org.openslx.bwlp.thrift.iface.TInternalServerError;
+import org.openslx.thrifthelper.ThriftManager;
+import org.openslx.util.GenericDataCache;
+import org.openslx.util.GenericDataCache.CacheMode;
+
+public class LectureCache {
+
+ private static final int CACHE_TIME_LIST_MS = 2 * 60 * 1000;
+
+ private static final GenericDataCache<List<LectureSummary>> listCache = new GenericDataCache<List<LectureSummary>>(CACHE_TIME_LIST_MS) {
+ @Override
+ protected List<LectureSummary> update() throws TAuthorizationException, TInternalServerError, TException {
+ List<LectureSummary> result = null;
+ int pageSize = ThriftManager.getSatClient().getPageSize();
+ for (int i = 0;; ++i) {
+ List<LectureSummary> page = ThriftManager.getSatClient().getLectureList(Session.getSatelliteToken(), i);
+ if (result == null) {
+ result = page;
+ } else {
+ result.addAll(page);
+ }
+ if (page.size() < pageSize)
+ break;
+ }
+ return result;
+ }
+ };
+
+ public static List<LectureSummary> get(boolean forceRefresh) {
+ return listCache.get(forceRefresh ? CacheMode.NEVER_CACHED : CacheMode.DEFAULT);
+ }
+
+}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ProxyConfigurator.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ProxyConfigurator.java
index 7ece2088..9a97181b 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ProxyConfigurator.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ProxyConfigurator.java
@@ -1,6 +1,5 @@
package org.openslx.dozmod.util;
-import java.io.IOException;
import java.net.ProxySelector;
import java.text.MessageFormat;
@@ -10,7 +9,6 @@ import org.apache.log4j.Priority;
import com.btr.proxy.search.ProxySearch;
import com.btr.proxy.search.wpad.WpadProxySearchStrategy;
-import com.btr.proxy.util.ProxyException;
import com.btr.proxy.util.Logger.LogBackEnd;
import com.btr.proxy.util.Logger.LogLevel;
@@ -30,26 +28,24 @@ public class ProxyConfigurator {
/**
* Initialization method.
*/
- public static void init() throws IOException {
+ public static void init() {
// first setup the logger of proxy_vole
com.btr.proxy.util.Logger.setBackend(new LogBackEnd() {
- @SuppressWarnings("deprecation")
- public void log(Class<?> clazz, LogLevel loglevel, String msg,
- Object... params) {
+ public void log(Class<?> clazz, LogLevel loglevel, String msg, Object... params) {
Priority priority;
switch (loglevel) {
case ERROR:
priority = Level.ERROR;
break;
case WARNING:
- priority = Priority.WARN;
+ priority = Level.WARN;
break;
case INFO:
- priority = Priority.INFO;
+ priority = Level.INFO;
break;
default:
- priority = Priority.DEBUG;
+ priority = Level.DEBUG;
}
Logger.getLogger(clazz).log(priority, MessageFormat.format(msg, params));
}
@@ -67,11 +63,7 @@ public class ProxyConfigurator {
// didn't work, try WPAD detection
LOGGER.error("No suitable proxy settings found, trying WPAD...");
WpadProxySearchStrategy ss = new WpadProxySearchStrategy();
- try {
- myProxySelector = ss.getProxySelector();
- } catch (ProxyException e) {
- LOGGER.error("WPAD proxy error, see trace: ", e);
- }
+ myProxySelector = ss.getProxySelector();
}
// final check to see if WPAD actually worked
if (myProxySelector != null) {