diff options
author | Stephan Schwaer | 2015-07-16 16:19:07 +0200 |
---|---|---|
committer | Stephan Schwaer | 2015-07-16 16:19:07 +0200 |
commit | 83ec934d4b1734006488bf203e21dcc5ddb8071d (patch) | |
tree | 21bc54d1ad85a90f62a465242d8c7702e193231c /dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java | |
parent | [client] Resolve user ids to names in image list window. (diff) | |
download | tutor-module-83ec934d4b1734006488bf203e21dcc5ddb8071d.tar.gz tutor-module-83ec934d4b1734006488bf203e21dcc5ddb8071d.tar.xz tutor-module-83ec934d4b1734006488bf203e21dcc5ddb8071d.zip |
[client] Added lecture list window with table, sorting and filter. Added back button for lecture and image window.
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureListWindowLayout.java | 172 |
1 files changed, 172 insertions, 0 deletions
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; + } + +} |