diff options
author | Simon Rettberg | 2015-07-10 17:02:23 +0200 |
---|---|---|
committer | Simon Rettberg | 2015-07-10 17:02:23 +0200 |
commit | e500a8530d8ba8a79413e6476005f628ed36c35b (patch) | |
tree | 36610e6203467187d8a0e1e3c7dcf81b98653400 /dozentenmodul/src/main | |
parent | [client] fix missing setControl in ImageMetaDataPageLayout (diff) | |
download | tutor-module-e500a8530d8ba8a79413e6476005f628ed36c35b.tar.gz tutor-module-e500a8530d8ba8a79413e6476005f628ed36c35b.tar.xz tutor-module-e500a8530d8ba8a79413e6476005f628ed36c35b.zip |
[client] Fix indentation
Diffstat (limited to 'dozentenmodul/src/main')
9 files changed, 86 insertions, 103 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/DisclaimerWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/DisclaimerWindow.java index 32a0c83e..0f02bedb 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/DisclaimerWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/DisclaimerWindow.java @@ -7,8 +7,8 @@ import org.eclipse.swt.widgets.Shell; import org.openslx.dozmod.Config; import org.openslx.dozmod.gui.window.layout.DisclaimerWindowLayout; -public class DisclaimerWindow extends DisclaimerWindowLayout{ - +public class DisclaimerWindow extends DisclaimerWindowLayout { + private final static Logger LOGGER = Logger.getLogger(DisclaimerWindow.class); public DisclaimerWindow(final Shell mainShell) { @@ -29,7 +29,8 @@ public class DisclaimerWindow extends DisclaimerWindowLayout{ public void widgetSelected(SelectionEvent e) { // save the agreement to config if (!Config.setDisclaimerAgreement(true)) - LOGGER.error("Could not set the agreement to the disclaimer in '" + Config.getPath() + "'!"); + LOGGER.error("Could not set the agreement to the disclaimer in '" + Config.getPath() + + "'!"); Config.store(); me.getShell().dispose(); } 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 be26e541..4075adf0 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 @@ -28,8 +28,7 @@ public class ImageListWindow extends ImageListWindowLayout { tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { - IStructuredSelection selection = (IStructuredSelection) - tableViewer.getSelection(); + IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection(); ImageSummaryRead selectedElement = (ImageSummaryRead) selection.getFirstElement(); String imageName = selectedElement.getImageName(); @@ -60,15 +59,15 @@ public class ImageListWindow extends ImageListWindowLayout { if (unixTimestamp == 0) { lastUpdateInfo.setText("Unknown"); } else { - Date date = new Date(unixTimestamp*1000L); + Date date = new Date(unixTimestamp * 1000L); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String formattedDate = sdf.format(date); lastUpdateInfo.setText(formattedDate); } // info about the image permissions - ImagePermissions p =selectedElement.getUserPermissions(); - if (p != null){ + ImagePermissions p = selectedElement.getUserPermissions(); + if (p != null) { String s = p.toString(); if (s == null) { permissionInfo.setText("Unknown"); @@ -96,7 +95,6 @@ public class ImageListWindow extends ImageListWindowLayout { } }); - newButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { 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 0ae01702..ee928b5b 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 @@ -60,22 +60,23 @@ public class LoginWindow extends LoginWindowLayout { idpCombo.setEnabled(false); new Thread() { List<Organization> orgs = null; - public void run() { - try { - Thread.sleep(2000); - orgs = OrganizationCache.getAll(); - } catch (Exception e) { - LoginWindow.LOGGER.error("Error during execution: ", e); - } - // now send the organisations back to the LoginWindow - // through populateIdpCombo() - Gui.display.asyncExec(new Runnable() { - public void run() { - populateIdpCombo(orgs); - } - }); - } - }.start(); + + public void run() { + try { + Thread.sleep(2000); + orgs = OrganizationCache.getAll(); + } catch (Exception e) { + LoginWindow.LOGGER.error("Error during execution: ", e); + } + // now send the organisations back to the LoginWindow + // through populateIdpCombo() + Gui.display.asyncExec(new Runnable() { + public void run() { + populateIdpCombo(orgs); + } + }); + } + }.start(); // check if we had saved an authentication method String savedAuthMethod = Config.getAuthenticationMethod(); @@ -175,15 +176,16 @@ public class LoginWindow extends LoginWindowLayout { }); } - public void populateIdpCombo(List<Organization> orgs) { + public void populateIdpCombo(List<Organization> orgs) { + + // safety check to see if the login window still exists + // when this function gets called by the other thread + if (this.isDisposed()) + return; + // always clearup the list first + idpCombo.removeAll(); - // safety check to see if the login window still exists - // when this function gets called by the other thread - if (this.isDisposed()) return; - // always clearup the list first - idpCombo.removeAll(); - - // sanity checks on orgs + // sanity checks on orgs if (orgs == null) { LOGGER.error("No organizations received from the cache."); idpCombo.add("No entries"); @@ -216,9 +218,10 @@ public class LoginWindow extends LoginWindowLayout { if (idpCombo.getSelectionIndex() == -1) idpCombo.select(0); // finally re-enable it - if (idpCombo.isVisible()) idpCombo.setEnabled(true); - } - + if (idpCombo.isVisible()) + idpCombo.setEnabled(true); + } + /** * Saves various user choices to the config file. * This gets triggered when the login button is activated. @@ -288,8 +291,9 @@ public class LoginWindow extends LoginWindowLayout { public void postLogin(ReturnCode returnCode, UserInfo user, Throwable t) { // TODO finish this if (user == null) { - MainWindow.showMessageBox(me.getShell(), "User information received from the masterserver is corrupt!", - MessageType.ERROR, LOGGER, null); + MainWindow.showMessageBox(me.getShell(), + "User information received from the masterserver is corrupt!", MessageType.ERROR, + LOGGER, null); return; } switch (returnCode) { @@ -302,13 +306,15 @@ public class LoginWindow extends LoginWindowLayout { case SERVICE_PROVIDER_ERROR: // here if we have t != null then we have not received a token // if we have t, then the token is invalid. - MainWindow.showMessageBox(me.getShell(), "Invalid token from the service provider!", MessageType.ERROR, - LOGGER, t); + MainWindow.showMessageBox(me.getShell(), "Invalid token from the service provider!", + MessageType.ERROR, LOGGER, t); break; case UNREGISTERED_ERROR: - MainWindow.showMessageBox(me.getShell(), "You are not registered to bwLehrpool. Please visit " - + ShibbolethEcp.getRegistrationUrl() + " and register first.", MessageType.ERROR, - LOGGER, t); + MainWindow.showMessageBox( + me.getShell(), + "You are not registered to bwLehrpool. Please visit " + + ShibbolethEcp.getRegistrationUrl() + " and register first.", + MessageType.ERROR, LOGGER, t); break; default: MainWindow.showMessageBox(me.getShell(), "Internal error!", MessageType.ERROR, null, null); @@ -350,7 +356,7 @@ public class LoginWindow extends LoginWindowLayout { */ private void postSuccessfulLogin() { LOGGER.info(loginType.getTag() + " succeeded."); - + // TODO HACK HACK ThriftManager.setSatelliteAddress("132.230.8.113"); diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtualizerNoticeWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtualizerNoticeWindow.java index d94ed01a..4043bb31 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtualizerNoticeWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/VirtualizerNoticeWindow.java @@ -10,18 +10,18 @@ import org.openslx.dozmod.gui.window.layout.VirtualizerNoticeWindowLayout; public class VirtualizerNoticeWindow extends VirtualizerNoticeWindowLayout { private final static Logger LOGGER = Logger.getLogger(VirtualizerNoticeWindow.class); - + public VirtualizerNoticeWindow(final Shell mainShell) { super(mainShell); - + final VirtualizerNoticeWindow me = this; - + // function for agreement checkbox continueButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (!Config.setVmwareLicenseAgreement(readCheck.getSelection())) - LOGGER.error("Could not set the agreement to the vmware license in '" + Config.getPath() + "'!"); + LOGGER.error("Could not set the agreement to the vmware license in '" + Config.getPath()); Config.store(); me.getShell().dispose(); } @@ -50,7 +50,7 @@ public class VirtualizerNoticeWindow extends VirtualizerNoticeWindowLayout { //clickedReadCheckButton(); } }); - + } } diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/DisclaimerWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/DisclaimerWindowLayout.java index be64badd..0f17451d 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/DisclaimerWindowLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/DisclaimerWindowLayout.java @@ -10,7 +10,6 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; - public abstract class DisclaimerWindowLayout extends Composite { protected String notice = "Bitte lesen und bestätigen Sie folgende rechtliche Hinweise"; @@ -54,16 +53,14 @@ public abstract class DisclaimerWindowLayout extends Composite { Label noticeLabel = new Label(noticeGroup, SWT.NONE); noticeLabel.setText(notice); - // the disclaimer text box with scrolling functionality - Text disclaimerText = new Text(this, SWT.READ_ONLY | SWT.WRAP| SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); + Text disclaimerText = new Text(this, SWT.READ_ONLY | SWT.WRAP | SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); GridData disclaimerLayoutData = new GridData(GridData.FILL, GridData.FILL, true, true); disclaimerLayoutData.widthHint = 900; disclaimerLayoutData.heightHint = 600; disclaimerText.setLayoutData(disclaimerLayoutData); disclaimerText.setText(disclaimer); - // checkbox for acknowledging the disclaimer Composite checkboxComposite = new Composite(this, SWT.BORDER); checkboxComposite.setLayout(new GridLayout()); 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 4c66c996..96bf48a9 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 @@ -1,6 +1,5 @@ package org.openslx.dozmod.gui.window.layout; - import org.eclipse.jface.viewers.ArrayContentProvider; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; @@ -28,14 +27,12 @@ public abstract class ImageListWindowLayout extends Composite { protected String tableGroupLabel = "Images"; protected String vmInfoGroupLabel = "Detailinformationen"; - // buttons protected Button newButton; protected Button deleteButton; protected Button editButton; protected Button downloadButton; - // imageDetail texts protected Text imageSelectedNameLabel; protected Text idInfo; @@ -47,7 +44,6 @@ public abstract class ImageListWindowLayout extends Composite { protected final TableViewer tableViewer; - protected String infoTextString = "Hier können Sie images erstellen, bearbeiten und löschen."; public ImageListWindowLayout(final Composite mainShell) { @@ -70,15 +66,12 @@ public abstract class ImageListWindowLayout extends Composite { 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)); + 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); - - // group for the table Group tableGroup = new Group(this, SWT.BORDER); tableGroup.setText(tableGroupLabel); @@ -86,14 +79,13 @@ public abstract class ImageListWindowLayout extends Composite { tableGroup.setLayout(new GridLayout(3, true)); // jface tableviewer on swt table - Table vmTable = new Table(tableGroup, SWT.BORDER | SWT.V_SCROLL - | SWT.H_SCROLL); + Table vmTable = new Table(tableGroup, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); GridData tableGridData = new GridData(SWT.FILL, SWT.FILL, true, true); tableGridData.horizontalSpan = 3; tableGridData.minimumWidth = 200; vmTable.setLayoutData(tableGridData); vmTable.setHeaderVisible(true); - vmTable.setLinesVisible(true); + vmTable.setLinesVisible(true); // TableViewer on the table tableViewer = new TableViewer(vmTable); @@ -121,7 +113,6 @@ public abstract class ImageListWindowLayout extends Composite { downloadButton = new Button(buttonComposite, SWT.PUSH); downloadButton.setText(downloadButtonLabel); - // group for the info of the selected image in the tableViewer Group vmInfoGroup = new Group(this, SWT.BORDER); vmInfoGroup.setText(vmInfoGroupLabel); @@ -130,28 +121,20 @@ public abstract class ImageListWindowLayout extends Composite { vmInfoGroup.setLayoutData(buttonCompositeGridData); vmInfoGroup.setLayout(new GridLayout(2, false)); - // image name info imageSelectedNameLabel = createCaptionAndTextfield("Image Name:", vmInfoGroup); - - // id info idInfo = createCaptionAndTextfield("ID:", vmInfoGroup); versionInfo = createCaptionAndTextfield("Version", vmInfoGroup); lastUpdateInfo = createCaptionAndTextfield("Letztes Update:", vmInfoGroup); permissionInfo = createCaptionAndTextfield("Berechtigungen:", vmInfoGroup); - ownerInfo= createCaptionAndTextfield("Besitzer ID", vmInfoGroup); + ownerInfo = createCaptionAndTextfield("Besitzer ID", vmInfoGroup); templateInfo = createCaptionAndTextfield("Vorlage:", vmInfoGroup); - - - - } - - public Text createCaptionAndTextfield(String captionString, Group group){ + 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); @@ -161,5 +144,4 @@ public abstract class ImageListWindowLayout extends Composite { return textField; } - } diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java index 48ae60d2..683780c9 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LoginWindowLayout.java @@ -24,28 +24,39 @@ public abstract class LoginWindowLayout extends Composite { private final int id; private final String tag; + private LOGIN_TYPE(final int id, final String tag) { this.id = id; this.tag = tag; } - public int getId() { return this.id; } - public String getTag() { return this.tag; } + + public int getId() { + return this.id; + } + + public String getTag() { + return this.tag; + } public static LOGIN_TYPE getEnum(String tag) { - switch(tag) { - case "bwidm": return LOGIN_TYPE.BWIDM; - case "bwlp": return LOGIN_TYPE.BWLP; - case "sat": return LOGIN_TYPE.SAT; - default: return null; + switch (tag) { + case "bwidm": + return LOGIN_TYPE.BWIDM; + case "bwlp": + return LOGIN_TYPE.BWLP; + case "sat": + return LOGIN_TYPE.SAT; + default: + return null; } } } + // authentication method to use for login attempts protected LOGIN_TYPE loginType = null; private Image titleImage; - // textfields for the username/password protected Text usernameText; protected Text passwordText; @@ -64,9 +75,9 @@ public abstract class LoginWindowLayout extends Composite { /** * Create a new login composite - * + * * @param mainShell - * The shell it should be added to + * The shell it should be added to */ public LoginWindowLayout(final Shell mainShell) { super(mainShell, SWT.NONE); @@ -88,7 +99,6 @@ public abstract class LoginWindowLayout extends Composite { gridData.horizontalAlignment = SWT.CENTER; titlePicture.setLayoutData(gridData); - // group for the authentication method. // groups have borders and a title Group authGroup = new Group(this, SWT.NONE); @@ -131,18 +141,15 @@ public abstract class LoginWindowLayout extends Composite { idpText.setText("IdP:"); idpCombo = new Combo(loginGroup, SWT.DROP_DOWN | SWT.READ_ONLY); - idpCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, - false)); + idpCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); new Label(loginGroup, SWT.NONE).setText("Benutzername:"); usernameText = new Text(loginGroup, SWT.SINGLE | SWT.BORDER); - usernameText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, - true, false)); + usernameText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); new Label(loginGroup, SWT.NONE).setText("Passwort:"); passwordText = new Text(loginGroup, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD); - passwordText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, - true, false)); + passwordText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); // login button loginButton = new Button(loginGroup, SWT.PUSH); loginButton.setText("Login"); @@ -157,8 +164,7 @@ public abstract class LoginWindowLayout extends Composite { // this way, we can be sure to get an image // (since the ResourceLoader always returns an image, // even if it cannot load the specified one). - titleImage = new Image(Gui.display, getClass() - .getResourceAsStream("/img/Logo_bwLehrpool.png")); + titleImage = new Image(Gui.display, getClass().getResourceAsStream("/img/Logo_bwLehrpool.png")); ImageData imgData = titleImage.getImageData(); imgData = imgData.scaledTo(imgData.width / 5, imgData.height / 5); titleImage = new Image(Gui.display, imgData); diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/MainMenuWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/MainMenuWindowLayout.java index ffb71f70..b8519a4f 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/MainMenuWindowLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/MainMenuWindowLayout.java @@ -1,7 +1,5 @@ package org.openslx.dozmod.gui.window.layout; - - import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -65,13 +63,11 @@ public abstract class MainMenuWindowLayout extends Composite { gridData = new GridData(SWT.CENTER, SWT.CENTER, true, true); vmButton.setLayoutData(gridData); - Label vmInfoLabel = new Label(vmGroup, SWT.NONE); vmInfoLabel.setText(vmInfo); gridData = new GridData(SWT.FILL, SWT.FILL, true, true); vmInfoLabel.setLayoutData(gridData); - //g group for the lecture selection Group lecturesGroup = new Group(this, SWT.NONE); lecturesGroup.setLayout(new GridLayout()); @@ -79,8 +75,6 @@ public abstract class MainMenuWindowLayout extends Composite { gridData = new GridData(SWT.FILL, SWT.FILL, true, true); lecturesGroup.setLayoutData(gridData); - - lecturesButton = new Button(lecturesGroup, SWT.PUSH); lecturesButton.setText("Veranstanstaltungen"); gridData = new GridData(SWT.CENTER, SWT.CENTER, true, true); diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtualizerNoticeWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtualizerNoticeWindowLayout.java index 37b50817..7d2a1aa6 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtualizerNoticeWindowLayout.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/VirtualizerNoticeWindowLayout.java @@ -37,8 +37,7 @@ public abstract class VirtualizerNoticeWindowLayout extends Composite { Label titleLabel = new Label(this, SWT.NONE); titleLabel.setText(infoTitle); FontData fontData = titleLabel.getFont().getFontData()[0]; - Font font = new Font(Gui.display, new FontData(fontData.getName(), fontData.getHeight(), - SWT.BOLD)); + Font font = new Font(Gui.display, new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD)); titleLabel.setFont(font); // TODO dispose of font? |