diff options
| author | Stephan Schwaer | 2015-06-30 12:36:54 +0200 |
|---|---|---|
| committer | Stephan Schwaer | 2015-06-30 12:36:54 +0200 |
| commit | bfce79c05fc0ed5a315655d5809a4b0685610154 (patch) | |
| tree | 7334ed5ce535810b29be0f832c6b390036198f8e /dozentenmodul/src/main/java/gui | |
| parent | Merge branch 'v1.1' of git.openslx.org:openslx-ng/tutor-module into v1.1 (diff) | |
| download | tutor-module-bfce79c05fc0ed5a315655d5809a4b0685610154.tar.gz tutor-module-bfce79c05fc0ed5a315655d5809a4b0685610154.tar.xz tutor-module-bfce79c05fc0ed5a315655d5809a4b0685610154.zip | |
Fixed some comments and variable names
Diffstat (limited to 'dozentenmodul/src/main/java/gui')
5 files changed, 82 insertions, 66 deletions
diff --git a/dozentenmodul/src/main/java/gui/GuiManager.java b/dozentenmodul/src/main/java/gui/GuiManager.java index a802cb0b..ae1c2038 100644 --- a/dozentenmodul/src/main/java/gui/GuiManager.java +++ b/dozentenmodul/src/main/java/gui/GuiManager.java @@ -76,6 +76,8 @@ public abstract class GuiManager { mainShell.setText("Dozmod"); mainShell.setMenuBar(menuBar); + + // Set layout for the mainshell, items added to the shell should get a gridData mainShell.setLayout(new GridLayout(1, true)); addContent(new gui.core.LoginComposite(mainShell)); diff --git a/dozentenmodul/src/main/java/gui/core/DisclaimerComposite.java b/dozentenmodul/src/main/java/gui/core/DisclaimerComposite.java index 8bccef1d..2c268353 100644 --- a/dozentenmodul/src/main/java/gui/core/DisclaimerComposite.java +++ b/dozentenmodul/src/main/java/gui/core/DisclaimerComposite.java @@ -16,7 +16,7 @@ import org.eclipse.swt.widgets.Text; public class DisclaimerComposite extends Composite { - String _notice = "Bitte lesen und bestätigen Sie folgende rechtliche Hinweise"; + String notice = "Bitte lesen und bestätigen Sie folgende rechtliche Hinweise"; String _disclaimer = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. \n\n" + "Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. \n\n" + "Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.\n\n" @@ -37,25 +37,22 @@ public class DisclaimerComposite extends Composite { mainShell.setText("bwLehrpool Suite"); + // layout of this composite this.setLayout(new GridLayout(1, true)); - + // information to read the disclaimer at the beginning of the window. Group noticeGroup = new Group(this, SWT.NONE); - noticeGroup.setLayout(new GridLayout()); GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false); - noticeGroup.setLayoutData(gridData); - noticeGroup.setText("Hinweis"); - Label noticeLabel = new Label(noticeGroup, SWT.NONE); - noticeLabel.setText(_notice); - + 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); gridData = new GridData(GridData.FILL, GridData.FILL, true, true); gridData.widthHint = 900; @@ -64,16 +61,17 @@ public class DisclaimerComposite extends Composite { disclaimerText.setText(_disclaimer); - Composite _checkboxComposite = new Composite(this, SWT.BORDER); - - _checkboxComposite.setLayout(new GridLayout()); + // checkbox for acknowledging the disclaimer + Composite checkboxComposite = new Composite(this, SWT.BORDER); + checkboxComposite.setLayout(new GridLayout()); gridData = new GridData(GridData.FILL, GridData.CENTER, true, false); - _checkboxComposite.setLayoutData(gridData); + checkboxComposite.setLayoutData(gridData); - Button agreeBox = new Button(_checkboxComposite, SWT.CHECK); + Button agreeBox = new Button(checkboxComposite, SWT.CHECK); agreeBox.setText(_checkboxText); + final Button continueButton = new Button(this, SWT.PUSH); continueButton.setText("Weiter"); continueButton.setEnabled(false); diff --git a/dozentenmodul/src/main/java/gui/core/LoginComposite.java b/dozentenmodul/src/main/java/gui/core/LoginComposite.java index 8ba76803..8f74bf3c 100644 --- a/dozentenmodul/src/main/java/gui/core/LoginComposite.java +++ b/dozentenmodul/src/main/java/gui/core/LoginComposite.java @@ -2,8 +2,7 @@ package gui.core; import gui.GuiManager; -import javax.swing.ImageIcon; - +import org.apache.thrift.TException; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -18,15 +17,19 @@ import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; - -import util.ResourceLoader; +import org.openslx.bwlp.thrift.iface.Organization; +import org.openslx.thrifthelper.ThriftManager; public class LoginComposite extends Composite { - private Image _titleImage; - private Text _usernameText; - private Text _passwordText; + private Image titleImage; + + // textfield of the username + private Text usernameText; + + // textfield of the password + private Text passwordText; /** * Create a new login composite * @param mainShell The shell it should be added to @@ -34,6 +37,8 @@ public class LoginComposite extends Composite { */ public LoginComposite(final Shell mainShell) { super(mainShell, SWT.NO_BACKGROUND); + + // title for composite mainShell.setText("Dozmod - Login"); // left authentication selection and right loginmask @@ -44,13 +49,14 @@ public class LoginComposite extends Composite { loadImage(); Label titlePicture = new Label(this, SWT.NONE); - titlePicture.setImage(_titleImage); + titlePicture.setImage(titleImage); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); gridData.horizontalSpan = 2; 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); authGroup.setText("Authentifizierungsart"); gridLayout = new GridLayout(); @@ -60,7 +66,7 @@ public class LoginComposite extends Composite { gridData.heightHint = 150; authGroup.setLayoutData(gridData); - // add the radio buttons + // add the authentication method selection buttons Button[] authButtons = new Button[3]; authButtons[0] = new Button(authGroup, SWT.RADIO); @@ -91,29 +97,32 @@ public class LoginComposite extends Composite { loginGroup.setLayoutData(gridData); - final Label IdPText = new Label(loginGroup, SWT.NONE); - IdPText.setText("IdP:"); - + final Label idpText = new Label(loginGroup, SWT.NONE); + idpText.setText("IdP:"); - final Combo IdPCombo = new Combo(loginGroup, SWT.DROP_DOWN | SWT.READ_ONLY); - IdPCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + final Combo idpCombo = new Combo(loginGroup, SWT.DROP_DOWN | SWT.READ_ONLY); + idpCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - IdPCombo.add("Ubuntu"); - IdPCombo.add("Fedora"); - IdPCombo.add("Mandriva"); - IdPCombo.add("Red Hat"); - IdPCombo.add("Mint"); + // entries in the combo + try { + for (Organization o : ThriftManager.getMasterClient().getOrganizations()) { + idpCombo.add(o.displayName); + } + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } 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 = new Text(loginGroup, SWT.SINGLE | SWT.BORDER); + 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); - _passwordText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); + passwordText = new Text(loginGroup, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD); + passwordText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); Button loginButton = new Button(loginGroup, SWT.PUSH); loginButton.setText("Login"); Button saveUsernameCheck = new Button(loginGroup, SWT.CHECK); @@ -142,8 +151,8 @@ public class LoginComposite extends Composite { authButtons[0].addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - IdPText.setVisible(true); - IdPCombo.setVisible(true); + idpText.setVisible(true); + idpCombo.setVisible(true); } }); @@ -151,8 +160,8 @@ public class LoginComposite extends Composite { authButtons[1].addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - IdPText.setVisible(false); - IdPCombo.setVisible(false); + idpText.setVisible(false); + idpCombo.setVisible(false); } }); @@ -162,8 +171,8 @@ public class LoginComposite extends Composite { authButtons[2].addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - IdPText.setVisible(false); - IdPCombo.setVisible(false); + idpText.setVisible(false); + idpCombo.setVisible(false); } }); } @@ -172,10 +181,10 @@ public class LoginComposite extends Composite { private void loadImage(){ try { - _titleImage = new Image(GuiManager.getDisplay(), getClass().getResourceAsStream("/img/Logo_bwLehrpool.png")); - ImageData imgData = _titleImage.getImageData(); + titleImage = new Image(GuiManager.getDisplay(), getClass().getResourceAsStream("/img/Logo_bwLehrpool.png")); + ImageData imgData = titleImage.getImageData(); imgData = imgData.scaledTo(imgData.width/5, imgData.height/5); - _titleImage = new Image(GuiManager.getDisplay(), imgData); + titleImage = new Image(GuiManager.getDisplay(), imgData); } catch (Exception e) { System.out.println("Cannot load image"); System.out.println(e.getMessage()); diff --git a/dozentenmodul/src/main/java/gui/core/MainWindowComposite.java b/dozentenmodul/src/main/java/gui/core/MainWindowComposite.java index 50b8107c..49132751 100644 --- a/dozentenmodul/src/main/java/gui/core/MainWindowComposite.java +++ b/dozentenmodul/src/main/java/gui/core/MainWindowComposite.java @@ -15,14 +15,18 @@ import org.eclipse.swt.widgets.Shell; public class MainWindowComposite extends Composite { - String _vmInfo = "Infotext VMs."; - String _lecturesInfo = "Infotext Veranstaltungen."; + // text for info for the vms selection + String vmInfo = "Infotext VMs."; + + // text for the info for the lecture selection + String lecturesInfo = "Infotext Veranstaltungen."; public MainWindowComposite(final Shell mainShell) { super(mainShell, SWT.NO_BACKGROUND); this.setLayout(new GridLayout(2, true)); + // group for the vm selection Group vmGroup = new Group(this, SWT.NONE); vmGroup.setLayout(new GridLayout()); vmGroup.setText("VMs"); @@ -34,12 +38,14 @@ public class MainWindowComposite extends Composite { gridData = new GridData(SWT.CENTER, SWT.CENTER, true, true); vmButton.setLayoutData(gridData); - Label vmInfo = new Label(vmGroup, SWT.NONE); - vmInfo.setText(_vmInfo); + + Label vmInfoLabel = new Label(vmGroup, SWT.NONE); + vmInfoLabel.setText(vmInfo); gridData = new GridData(SWT.FILL, SWT.FILL, true, true); - vmInfo.setLayoutData(gridData); + vmInfoLabel.setLayoutData(gridData); + //g group for the lecture selection Group lecturesGroup = new Group(this, SWT.NONE); lecturesGroup.setLayout(new GridLayout()); lecturesGroup.setText("Veranstaltungen"); @@ -53,10 +59,10 @@ public class MainWindowComposite extends Composite { gridData = new GridData(SWT.CENTER, SWT.CENTER, true, true); lecturesButton.setLayoutData(gridData); - Label lecturesInfo = new Label(lecturesGroup, SWT.NONE); - lecturesInfo.setText(_lecturesInfo); + Label lecturesInfoLabel = new Label(lecturesGroup, SWT.NONE); + lecturesInfoLabel.setText(lecturesInfo); gridData = new GridData(SWT.FILL, SWT.FILL, true, true); - lecturesInfo.setLayoutData(gridData); + lecturesInfoLabel.setLayoutData(gridData); // function for vmButton diff --git a/dozentenmodul/src/main/java/gui/core/VMWareInfoComposite.java b/dozentenmodul/src/main/java/gui/core/VMWareInfoComposite.java index aec2c970..3737817f 100644 --- a/dozentenmodul/src/main/java/gui/core/VMWareInfoComposite.java +++ b/dozentenmodul/src/main/java/gui/core/VMWareInfoComposite.java @@ -16,38 +16,39 @@ import org.eclipse.swt.widgets.Shell; public class VMWareInfoComposite extends Composite { - String _title = "Hinweis VMWare Player"; - String _infoText = "Für die Arbeit mit der bwLehrpool Suite wird zwingend ein VMWare Player benötigt. " + String title = "Hinweis VMWare Player"; + String infoText = "Für die Arbeit mit der bwLehrpool Suite wird zwingend ein VMWare Player benötigt. " + "Diesen können Sie sich unter folgendem Link kostenfrei downloaden. " + "Wenn Sie bereits den VMWare Player oder die VMWare Workstation installiert haben, können Sie diesen Hinweis ignorieren."; - String _checkboxText = "Ja, ich aktzeptiere die Vereinbarung. Benachrichtigung nicht mehr anzeigen."; + String checkboxText = "Ja, ich aktzeptiere die Vereinbarung. Benachrichtigung nicht mehr anzeigen."; public VMWareInfoComposite(final Shell mainShell) { super(mainShell, SWT.NO_BACKGROUND); - // Set the title of the bar. + // set the title of the bar. mainShell.setText("bwLehrpool Suite"); - // Layout for this composite + // layout for this composite this.setLayout(new GridLayout(1, false)); - // Bold title at start. + // bold title at start. Label titleLabel = new Label(this, SWT.NONE); - titleLabel.setText(_title); + titleLabel.setText(title); FontData fontData = titleLabel.getFont().getFontData()[0]; Font font = new Font(GuiManager.getDisplay(), new FontData(fontData.getName(), fontData .getHeight(), SWT.BOLD)); titleLabel.setFont(font); - // TODO Dispose of font? + // TODO dispose of font? - // Infotext + // infotext Label infoLabel = new Label(this, SWT.NONE | SWT.WRAP); - infoLabel.setText(_infoText); + infoLabel.setText(infoText); GridData gridData = new GridData(GridData.FILL, GridData.BEGINNING, true, false); infoLabel.setLayoutData(gridData); + // composite for the windows vmware-download button Composite windowsComposite = new Composite(this, SWT.NONE); windowsComposite.setLayout(new GridLayout()); gridData = new GridData(GridData.FILL, GridData.BEGINNING, true, false); @@ -58,7 +59,7 @@ public class VMWareInfoComposite extends Composite { windowsDLButton.setText("VMWare Player Herunterladen"); - + // composite for the linux vmware-download button Composite linuxComposite = new Composite(this, SWT.NONE); linuxComposite.setLayout(new GridLayout()); gridData = new GridData(GridData.FILL, GridData.BEGINNING, true, false); @@ -80,9 +81,9 @@ public class VMWareInfoComposite extends Composite { gridData = new GridData(GridData.BEGINNING, GridData.END, false, false); continuteButton.setLayoutData(gridData); - // TODO finish + // TODO still looks very ugly - // Function for agreement checkbox + // function for agreement checkbox continuteButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { |
