summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortspitzer2013-09-04 15:31:41 +0200
committertspitzer2013-09-04 15:31:41 +0200
commit4294c84358d487624060cc1ef7edfd439871c717 (patch)
tree1f1fe64068c305336cdc7abda2d4c07e547d6866
parentLogin mit Funktionalität versehen (diff)
downloadtutor-module-4294c84358d487624060cc1ef7edfd439871c717.tar.gz
tutor-module-4294c84358d487624060cc1ef7edfd439871c717.tar.xz
tutor-module-4294c84358d487624060cc1ef7edfd439871c717.zip
neue features
- Erstes Wizard Fenster mit Rohlingsauswahl - Erste Version des Downloaders ohne Progressbar
-rw-r--r--Dozentenmodul/.classpath6
-rw-r--r--Dozentenmodul/bin/GUI/ActionChooser$1.classbin0 -> 728 bytes
-rw-r--r--Dozentenmodul/bin/GUI/ActionChooser$2.classbin0 -> 632 bytes
-rw-r--r--Dozentenmodul/bin/GUI/ActionChooser$3.classbin0 -> 632 bytes
-rw-r--r--Dozentenmodul/bin/GUI/ActionChooser$4.classbin0 -> 632 bytes
-rw-r--r--Dozentenmodul/bin/GUI/ActionChooser$5.classbin0 -> 1466 bytes
-rw-r--r--Dozentenmodul/bin/GUI/ActionChooser$6.classbin0 -> 1138 bytes
-rw-r--r--Dozentenmodul/bin/GUI/ActionChooser.classbin0 -> 6101 bytes
-rw-r--r--Dozentenmodul/bin/GUI/Downloader$1.classbin0 -> 1133 bytes
-rw-r--r--Dozentenmodul/bin/GUI/Downloader$2.classbin0 -> 1106 bytes
-rw-r--r--Dozentenmodul/bin/GUI/Downloader.classbin0 -> 3257 bytes
-rw-r--r--Dozentenmodul/bin/GUI/LoginWindow$1.classbin0 -> 718 bytes
-rw-r--r--Dozentenmodul/bin/GUI/LoginWindow$2.classbin0 -> 1308 bytes
-rw-r--r--Dozentenmodul/bin/GUI/LoginWindow.classbin3198 -> 3352 bytes
-rw-r--r--Dozentenmodul/bin/Wizard/newVLRohlingWizard.classbin0 -> 651 bytes
-rw-r--r--Dozentenmodul/bin/Wizard/searchRohlingPage$1.classbin0 -> 1120 bytes
-rw-r--r--Dozentenmodul/bin/Wizard/searchRohlingPage$2.classbin0 -> 1690 bytes
-rw-r--r--Dozentenmodul/bin/Wizard/searchRohlingPage.classbin0 -> 2679 bytes
-rw-r--r--Dozentenmodul/bin/auth/Ldap.classbin0 -> 2031 bytes
-rw-r--r--Dozentenmodul/bin/ftp/ftp.classbin0 -> 2632 bytes
-rw-r--r--Dozentenmodul/bin/org/eclipse/wb/swt/SWTResourceManager.classbin0 -> 11070 bytes
-rw-r--r--Dozentenmodul/src/GUI/ActionChooser.java231
-rw-r--r--Dozentenmodul/src/GUI/Downloader.java117
-rw-r--r--Dozentenmodul/src/GUI/LoginWindow.java50
-rw-r--r--Dozentenmodul/src/Wizard/newVLRohlingWizard.java21
-rw-r--r--Dozentenmodul/src/Wizard/searchRohlingPage.java111
-rw-r--r--Dozentenmodul/src/auth/Ldap.java44
-rw-r--r--Dozentenmodul/src/ftp/ftp.java102
-rw-r--r--Dozentenmodul/src/org/eclipse/wb/swt/SWTResourceManager.java447
-rw-r--r--Dozentenmodul/swing2swt.jarbin0 -> 33198 bytes
30 files changed, 1119 insertions, 10 deletions
diff --git a/Dozentenmodul/.classpath b/Dozentenmodul/.classpath
index 91ee9a52..541f3b73 100644
--- a/Dozentenmodul/.classpath
+++ b/Dozentenmodul/.classpath
@@ -2,5 +2,11 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="lib" path="C:/Users/tspitzer/Downloads/org.eclipse.jface.jar/org.eclipse.jface.jar"/>
+ <classpathentry kind="lib" path="swing2swt.jar"/>
+ <classpathentry kind="lib" path="C:/Users/tspitzer/Downloads/commons-net-3.3-bin(1)/commons-net-3.3/commons-net-3.3.jar"/>
+ <classpathentry kind="lib" path="C:/Users/tspitzer/Downloads/org.eclipse.equinox.common_3.3.0.v20070426.jar"/>
+ <classpathentry kind="lib" path="C:/Users/tspitzer/Downloads/swt-3.6.1-win32-win32-x86_64/swt.jar"/>
+ <classpathentry kind="lib" path="C:/Users/tspitzer/Downloads/org.eclipse.core.commands.jar/org.eclipse.core.commands.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/Dozentenmodul/bin/GUI/ActionChooser$1.class b/Dozentenmodul/bin/GUI/ActionChooser$1.class
new file mode 100644
index 00000000..1cd29f88
--- /dev/null
+++ b/Dozentenmodul/bin/GUI/ActionChooser$1.class
Binary files differ
diff --git a/Dozentenmodul/bin/GUI/ActionChooser$2.class b/Dozentenmodul/bin/GUI/ActionChooser$2.class
new file mode 100644
index 00000000..d3a41875
--- /dev/null
+++ b/Dozentenmodul/bin/GUI/ActionChooser$2.class
Binary files differ
diff --git a/Dozentenmodul/bin/GUI/ActionChooser$3.class b/Dozentenmodul/bin/GUI/ActionChooser$3.class
new file mode 100644
index 00000000..7fc9492d
--- /dev/null
+++ b/Dozentenmodul/bin/GUI/ActionChooser$3.class
Binary files differ
diff --git a/Dozentenmodul/bin/GUI/ActionChooser$4.class b/Dozentenmodul/bin/GUI/ActionChooser$4.class
new file mode 100644
index 00000000..e5b185f3
--- /dev/null
+++ b/Dozentenmodul/bin/GUI/ActionChooser$4.class
Binary files differ
diff --git a/Dozentenmodul/bin/GUI/ActionChooser$5.class b/Dozentenmodul/bin/GUI/ActionChooser$5.class
new file mode 100644
index 00000000..b6bc1233
--- /dev/null
+++ b/Dozentenmodul/bin/GUI/ActionChooser$5.class
Binary files differ
diff --git a/Dozentenmodul/bin/GUI/ActionChooser$6.class b/Dozentenmodul/bin/GUI/ActionChooser$6.class
new file mode 100644
index 00000000..ac3c008e
--- /dev/null
+++ b/Dozentenmodul/bin/GUI/ActionChooser$6.class
Binary files differ
diff --git a/Dozentenmodul/bin/GUI/ActionChooser.class b/Dozentenmodul/bin/GUI/ActionChooser.class
new file mode 100644
index 00000000..aa822d81
--- /dev/null
+++ b/Dozentenmodul/bin/GUI/ActionChooser.class
Binary files differ
diff --git a/Dozentenmodul/bin/GUI/Downloader$1.class b/Dozentenmodul/bin/GUI/Downloader$1.class
new file mode 100644
index 00000000..34be7f9e
--- /dev/null
+++ b/Dozentenmodul/bin/GUI/Downloader$1.class
Binary files differ
diff --git a/Dozentenmodul/bin/GUI/Downloader$2.class b/Dozentenmodul/bin/GUI/Downloader$2.class
new file mode 100644
index 00000000..a98dcef1
--- /dev/null
+++ b/Dozentenmodul/bin/GUI/Downloader$2.class
Binary files differ
diff --git a/Dozentenmodul/bin/GUI/Downloader.class b/Dozentenmodul/bin/GUI/Downloader.class
new file mode 100644
index 00000000..6978c32f
--- /dev/null
+++ b/Dozentenmodul/bin/GUI/Downloader.class
Binary files differ
diff --git a/Dozentenmodul/bin/GUI/LoginWindow$1.class b/Dozentenmodul/bin/GUI/LoginWindow$1.class
new file mode 100644
index 00000000..a6974007
--- /dev/null
+++ b/Dozentenmodul/bin/GUI/LoginWindow$1.class
Binary files differ
diff --git a/Dozentenmodul/bin/GUI/LoginWindow$2.class b/Dozentenmodul/bin/GUI/LoginWindow$2.class
new file mode 100644
index 00000000..cd7a76bf
--- /dev/null
+++ b/Dozentenmodul/bin/GUI/LoginWindow$2.class
Binary files differ
diff --git a/Dozentenmodul/bin/GUI/LoginWindow.class b/Dozentenmodul/bin/GUI/LoginWindow.class
index 66d08de8..299d7f9b 100644
--- a/Dozentenmodul/bin/GUI/LoginWindow.class
+++ b/Dozentenmodul/bin/GUI/LoginWindow.class
Binary files differ
diff --git a/Dozentenmodul/bin/Wizard/newVLRohlingWizard.class b/Dozentenmodul/bin/Wizard/newVLRohlingWizard.class
new file mode 100644
index 00000000..23e79afd
--- /dev/null
+++ b/Dozentenmodul/bin/Wizard/newVLRohlingWizard.class
Binary files differ
diff --git a/Dozentenmodul/bin/Wizard/searchRohlingPage$1.class b/Dozentenmodul/bin/Wizard/searchRohlingPage$1.class
new file mode 100644
index 00000000..d9efce5f
--- /dev/null
+++ b/Dozentenmodul/bin/Wizard/searchRohlingPage$1.class
Binary files differ
diff --git a/Dozentenmodul/bin/Wizard/searchRohlingPage$2.class b/Dozentenmodul/bin/Wizard/searchRohlingPage$2.class
new file mode 100644
index 00000000..914962cb
--- /dev/null
+++ b/Dozentenmodul/bin/Wizard/searchRohlingPage$2.class
Binary files differ
diff --git a/Dozentenmodul/bin/Wizard/searchRohlingPage.class b/Dozentenmodul/bin/Wizard/searchRohlingPage.class
new file mode 100644
index 00000000..978c4620
--- /dev/null
+++ b/Dozentenmodul/bin/Wizard/searchRohlingPage.class
Binary files differ
diff --git a/Dozentenmodul/bin/auth/Ldap.class b/Dozentenmodul/bin/auth/Ldap.class
new file mode 100644
index 00000000..fead9855
--- /dev/null
+++ b/Dozentenmodul/bin/auth/Ldap.class
Binary files differ
diff --git a/Dozentenmodul/bin/ftp/ftp.class b/Dozentenmodul/bin/ftp/ftp.class
new file mode 100644
index 00000000..25a8280a
--- /dev/null
+++ b/Dozentenmodul/bin/ftp/ftp.class
Binary files differ
diff --git a/Dozentenmodul/bin/org/eclipse/wb/swt/SWTResourceManager.class b/Dozentenmodul/bin/org/eclipse/wb/swt/SWTResourceManager.class
new file mode 100644
index 00000000..32758ea9
--- /dev/null
+++ b/Dozentenmodul/bin/org/eclipse/wb/swt/SWTResourceManager.class
Binary files differ
diff --git a/Dozentenmodul/src/GUI/ActionChooser.java b/Dozentenmodul/src/GUI/ActionChooser.java
new file mode 100644
index 00000000..75fa232b
--- /dev/null
+++ b/Dozentenmodul/src/GUI/ActionChooser.java
@@ -0,0 +1,231 @@
+package GUI;
+
+
+import java.awt.EventQueue;
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+import javax.swing.JMenuBar;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+import java.awt.Color;
+import javax.swing.JLabel;
+import javax.swing.SwingConstants;
+import java.awt.Font;
+import javax.swing.JRadioButton;
+import javax.swing.GroupLayout;
+import javax.swing.GroupLayout.Alignment;
+import javax.swing.LayoutStyle.ComponentPlacement;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+
+
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Display;
+
+import Wizard.newVLRohlingWizard;
+
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+import java.awt.Desktop;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+@SuppressWarnings("serial")
+public class ActionChooser extends JFrame {
+
+ private JPanel contentPane;
+ private final ButtonGroup buttonGroup = new ButtonGroup();
+
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+ EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ try {
+ ActionChooser frame = new ActionChooser();
+ frame.setVisible(true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+
+ /**
+ * Create the frame.
+ */
+ public ActionChooser() {
+
+ //Setzt das Look and Feel auf System
+ try {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ } catch (ClassNotFoundException | InstantiationException
+ | IllegalAccessException | UnsupportedLookAndFeelException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ setTitle("Dozentenmodul");
+ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ setBounds(100, 100, 450, 300);
+
+ JMenuBar menuBar = new JMenuBar();
+ setJMenuBar(menuBar);
+
+ JMenu mnSuche = new JMenu("Suche");
+ menuBar.add(mnSuche);
+
+ JMenuItem mntmVlSuchen = new JMenuItem("VL suchen");
+ mntmVlSuchen.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ //tod
+ }
+ });
+
+ mnSuche.add(mntmVlSuchen);
+
+ JMenu mnHilfe = new JMenu("Hilfe");
+ menuBar.add(mnHilfe);
+
+ JMenuItem mntmNeuigkeiten = new JMenuItem("Neuigkeiten");
+ mntmNeuigkeiten.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ //todo
+ }
+ });
+ mnHilfe.add(mntmNeuigkeiten);
+
+ JMenuItem mntmFaq = new JMenuItem("FAQ");
+ mntmFaq.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ //todo
+ }
+ });
+ mnHilfe.add(mntmFaq);
+
+ JMenuItem mntmTicketErstellen = new JMenuItem("Ticket erstellen");
+ mntmTicketErstellen.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if(Desktop.isDesktopSupported()){
+ Desktop desk=Desktop.getDesktop();
+ if(desk.isSupported(Desktop.Action.BROWSE)){
+ try {
+ URI uri=new URI("https://otrs.rz.hs-offenburg.de/otrs/customer.pl");
+ try {
+ desk.browse(uri);
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ } catch (URISyntaxException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ }
+ }
+ }
+ });
+ mnHilfe.add(mntmTicketErstellen);
+ contentPane = new JPanel();
+ contentPane.setBackground(Color.WHITE);
+ contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
+ setContentPane(contentPane);
+
+ JLabel labelChoose = new JLabel("Bitte w\u00E4hlen Sie Ihre durchzuf\u00FChrende Aktion aus");
+ labelChoose.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ labelChoose.setHorizontalAlignment(SwingConstants.CENTER);
+
+ JRadioButton rdbtnNew = new JRadioButton("Erstellen einer neuen VL");
+ rdbtnNew.setHorizontalAlignment(SwingConstants.CENTER);
+ rdbtnNew.setBackground(Color.WHITE);
+ buttonGroup.add(rdbtnNew);
+
+ JRadioButton rdbtnNewRohling = new JRadioButton("Erstellen einer neuen VL auf Basis einer VL Rohling");
+ rdbtnNewRohling.setBackground(Color.WHITE);
+ buttonGroup.add(rdbtnNewRohling);
+
+ JRadioButton rdbtnCopyExisiting = new JRadioButton("Kopieren einer bestehenden VL");
+ rdbtnCopyExisiting.setBackground(Color.WHITE);
+ buttonGroup.add(rdbtnCopyExisiting);
+
+ JRadioButton rdbtnLinkExisting = new JRadioButton("Verlinken einer bestehenden VL");
+ rdbtnLinkExisting.setBackground(Color.WHITE);
+ buttonGroup.add(rdbtnLinkExisting);
+
+ JButton btnWeiter = new JButton("Weiter");
+ btnWeiter.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+
+ WizardDialog wizardDialog = new WizardDialog(Display.getDefault().getActiveShell(),new newVLRohlingWizard());
+ wizardDialog.create();
+ dispose();
+ wizardDialog.open();
+
+
+ }
+ });
+
+ JRadioButton rdbtnEditVL = new JRadioButton("Bearbeiten einer bestehenden VL");
+ buttonGroup.add(rdbtnEditVL);
+ rdbtnEditVL.setBackground(Color.WHITE);
+ GroupLayout gl_contentPane = new GroupLayout(contentPane);
+ gl_contentPane.setHorizontalGroup(
+ gl_contentPane.createParallelGroup(Alignment.LEADING)
+ .addGroup(Alignment.TRAILING, gl_contentPane.createSequentialGroup()
+ .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(labelChoose, GroupLayout.PREFERRED_SIZE, 424, GroupLayout.PREFERRED_SIZE)
+ .addContainerGap())
+ .addGroup(gl_contentPane.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(btnWeiter)
+ .addContainerGap(359, Short.MAX_VALUE))
+ .addGroup(gl_contentPane.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(rdbtnLinkExisting)
+ .addContainerGap(253, Short.MAX_VALUE))
+ .addGroup(gl_contentPane.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(rdbtnCopyExisiting)
+ .addContainerGap(253, Short.MAX_VALUE))
+ .addGroup(gl_contentPane.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(rdbtnEditVL)
+ .addContainerGap(319, Short.MAX_VALUE))
+ .addGroup(gl_contentPane.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(rdbtnNewRohling)
+ .addContainerGap(163, Short.MAX_VALUE))
+ .addGroup(gl_contentPane.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(rdbtnNew)
+ .addContainerGap(287, Short.MAX_VALUE))
+ );
+ gl_contentPane.setVerticalGroup(
+ gl_contentPane.createParallelGroup(Alignment.LEADING)
+ .addGroup(gl_contentPane.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(labelChoose)
+ .addGap(33)
+ .addComponent(rdbtnNew)
+ .addPreferredGap(ComponentPlacement.RELATED)
+ .addComponent(rdbtnNewRohling)
+ .addPreferredGap(ComponentPlacement.RELATED)
+ .addComponent(rdbtnEditVL)
+ .addPreferredGap(ComponentPlacement.RELATED)
+ .addComponent(rdbtnCopyExisiting)
+ .addPreferredGap(ComponentPlacement.UNRELATED)
+ .addComponent(rdbtnLinkExisting)
+ .addGap(18)
+ .addComponent(btnWeiter)
+ .addContainerGap())
+ );
+ contentPane.setLayout(gl_contentPane);
+
+ }
+}
diff --git a/Dozentenmodul/src/GUI/Downloader.java b/Dozentenmodul/src/GUI/Downloader.java
new file mode 100644
index 00000000..8a44c38b
--- /dev/null
+++ b/Dozentenmodul/src/GUI/Downloader.java
@@ -0,0 +1,117 @@
+package GUI;
+
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFileChooser;
+import javax.swing.JPanel;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+import javax.swing.border.EmptyBorder;
+import java.awt.Color;
+import javax.swing.SwingConstants;
+import javax.swing.JLabel;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import javax.swing.JProgressBar;
+
+import ftp.ftp;
+
+public class Downloader extends JDialog {
+
+ private final JPanel contentPanel = new JPanel();
+ JLabel lblNewLabel;
+ JProgressBar progressBar;
+ ftp f=new ftp();
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+ try {
+ Downloader dialog = new Downloader();
+ dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+ dialog.setVisible(true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Create the dialog.
+ */
+ public Downloader() {
+ try {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ } catch (ClassNotFoundException | InstantiationException
+ | IllegalAccessException | UnsupportedLookAndFeelException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ setBackground(Color.WHITE);
+ setTitle("Downloader");
+ setBounds(100, 100, 450, 218);
+ getContentPane().setLayout(new BorderLayout());
+ contentPanel.setBackground(Color.WHITE);
+ contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
+ getContentPane().add(contentPanel, BorderLayout.CENTER);
+ contentPanel.setLayout(null);
+ {
+ JButton btnSpeicherortAuswhlen = new JButton("Speicherort ausw\u00E4hlen");
+ btnSpeicherortAuswhlen.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent arg0) {
+ JFileChooser fc=new JFileChooser();
+ fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+
+ fc.showOpenDialog(getParent());
+ File dir=fc.getSelectedFile();
+ lblNewLabel.setText(dir.getAbsolutePath());
+ }
+ });
+ btnSpeicherortAuswhlen.setBounds(10, 11, 141, 23);
+ btnSpeicherortAuswhlen.setVerticalAlignment(SwingConstants.TOP);
+ btnSpeicherortAuswhlen.setHorizontalAlignment(SwingConstants.LEFT);
+ contentPanel.add(btnSpeicherortAuswhlen);
+ }
+
+ lblNewLabel = new JLabel("C:\\");
+ lblNewLabel.setBounds(169, 11, 255, 23);
+ contentPanel.add(lblNewLabel);
+
+ JButton btnDownloadStarten = new JButton("Download starten");
+ btnDownloadStarten.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ progressBar.setValue(0);
+ long fsize=f.getFileSize("BESCHREIBUNG.xml");
+ f.getFile("BESCHREIBUNG.xml", lblNewLabel.getText().toString());
+ }
+ });
+ btnDownloadStarten.setBounds(10, 106, 141, 23);
+ contentPanel.add(btnDownloadStarten);
+
+ progressBar = new JProgressBar(0,100);
+ progressBar.setBounds(10, 45, 414, 30);
+ contentPanel.add(progressBar);
+ {
+ JPanel buttonPane = new JPanel();
+ buttonPane.setBackground(Color.WHITE);
+ buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
+ getContentPane().add(buttonPane, BorderLayout.SOUTH);
+ {
+ JButton okButton = new JButton("OK");
+ okButton.setActionCommand("OK");
+ buttonPane.add(okButton);
+ getRootPane().setDefaultButton(okButton);
+ }
+ {
+ JButton cancelButton = new JButton("Zur\u00FCck");
+ cancelButton.setActionCommand("Cancel");
+ buttonPane.add(cancelButton);
+ }
+ }
+ }
+}
diff --git a/Dozentenmodul/src/GUI/LoginWindow.java b/Dozentenmodul/src/GUI/LoginWindow.java
index e272ac2b..0ebea43d 100644
--- a/Dozentenmodul/src/GUI/LoginWindow.java
+++ b/Dozentenmodul/src/GUI/LoginWindow.java
@@ -1,6 +1,6 @@
package GUI;
-import java.awt.BorderLayout;
+
import java.awt.EventQueue;
import java.awt.Image;
@@ -19,7 +19,9 @@ import auth.Ldap;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JPasswordField;
+import java.awt.Color;
+@SuppressWarnings("serial")
public class LoginWindow extends JFrame {
private JPanel contentPane;
@@ -33,6 +35,7 @@ public class LoginWindow extends JFrame {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
+ //Aufruf und Anzeige des Login Fensters
LoginWindow frame = new LoginWindow();
frame.setVisible(true);
} catch (Exception e) {
@@ -46,54 +49,81 @@ public class LoginWindow extends JFrame {
* Create the frame.
*/
public LoginWindow() {
+
+ //Fenster darf nicht vergrößert werden
+ setResizable(false);
try {
- //System.out.println(UIManager.getSystemLookAndFeelClassName().toString());
+ //Setzt das Look and Feel auf System
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException
| IllegalAccessException | UnsupportedLookAndFeelException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
- setTitle("Dozentenmodul Login");
+ //Titel des Fensters setzen
+ setTitle("Dozentenmodul");
+ //Aktion die beim Schließen durchgeführt werden soll
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setBounds(100, 100, 450, 300);
+ //Größe des Fensters definieren
+ setBounds(100, 100, 300, 300);
+ //Erzeugen eines Panels
contentPane = new JPanel();
+ //Hintergrund Farbe des Panels setzen
+ contentPane.setBackground(Color.WHITE);
+ //Rahmen des Fensters setzen
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
+ //Layout setzen
contentPane.setLayout(null);
-
+ //Label für das Logo erzeugen
JLabel imgLabel = new JLabel();
-
- imgLabel.setBounds(10, 11, 350, 64);
-
+ //Größe und Position des Logos festelegen
+ imgLabel.setBounds(10, 11, 270, 64);
+ //Pfadangabe des Logos
ImageIcon icon = new ImageIcon("img/Logo_bwLehrpool.png","Logo");
- Image scaled=icon.getImage().getScaledInstance(350, 64, 0);
+ //Skalierung des Logos
+ Image scaled=icon.getImage().getScaledInstance(270, 64, 0);
imgLabel.setIcon(new ImageIcon(scaled));
+ //Hinzufügen des Logos in das Fenster
contentPane.add(imgLabel);
+ //Erzeugen und Hinzufügen des Labels
JLabel LabelUser = new JLabel("bwIDM-Benutzername:");
LabelUser.setBounds(10, 86, 134, 20);
contentPane.add(LabelUser);
+ //Erzeugen und Hinzufügen des Textfeldes
username = new JTextField();
username.setBounds(154, 86, 125, 20);
contentPane.add(username);
username.setColumns(10);
+ //Erzeugen und Hinzufügen des Labels
JLabel LabelPass = new JLabel("bwIDM-Passwort:");
LabelPass.setBounds(10, 117, 134, 20);
contentPane.add(LabelPass);
+ //Erzeugen, Hinzufügen und definierung der Aktion des Buttons
JButton BtnLogin = new JButton("Login");
BtnLogin.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
+ //Aufruf der Ldap Klasse, welche die Ldap überprüfung vornimmt
Ldap check=new Ldap();
- check.LdapAuth(username.getText(), new String(pass.getPassword()));
+ boolean login=check.LdapAuth(username.getText(), new String(pass.getPassword()));
+ if(login==true)
+ {
+ //Erstellen einer Instanz der Aktionsauswahl
+ ActionChooser ac=new ActionChooser();
+ ac.setVisible(true);
+ //Schließen des Fensters nach erfolgreichen Login
+ dispose();
+ }
}
});
BtnLogin.setBounds(10, 179, 134, 23);
contentPane.add(BtnLogin);
+ //Erzeugen und Hinzufügen des Passwortfeldes
pass = new JPasswordField();
pass.setBounds(154, 117, 125, 20);
contentPane.add(pass);
diff --git a/Dozentenmodul/src/Wizard/newVLRohlingWizard.java b/Dozentenmodul/src/Wizard/newVLRohlingWizard.java
new file mode 100644
index 00000000..8ddd1bf9
--- /dev/null
+++ b/Dozentenmodul/src/Wizard/newVLRohlingWizard.java
@@ -0,0 +1,21 @@
+package Wizard;
+
+import org.eclipse.jface.wizard.Wizard;
+
+public class newVLRohlingWizard extends Wizard {
+
+ public newVLRohlingWizard() {
+ setWindowTitle("New Wizard");
+ }
+
+ @Override
+ public void addPages() {
+ addPage(new searchRohlingPage());
+ }
+
+ @Override
+ public boolean performFinish() {
+ return false;
+ }
+
+}
diff --git a/Dozentenmodul/src/Wizard/searchRohlingPage.java b/Dozentenmodul/src/Wizard/searchRohlingPage.java
new file mode 100644
index 00000000..5f574814
--- /dev/null
+++ b/Dozentenmodul/src/Wizard/searchRohlingPage.java
@@ -0,0 +1,111 @@
+package Wizard;
+
+import java.io.IOException;
+import java.net.SocketException;
+import java.util.Collections;
+
+import org.apache.commons.net.ftp.FTPClient;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.jface.fieldassist.ControlDecoration;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wb.swt.SWTResourceManager;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+
+import ftp.ftp;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+
+public class searchRohlingPage extends WizardPage {
+ private Text txtLivesuche;
+ String[] result;
+ List list;
+ ftp f=new ftp();
+ /**
+ * Create the wizard.
+ */
+ public searchRohlingPage() {
+ super("Wizard");
+ setTitle("Rohling ausw\u00E4hlen (Schritt 1 von ..)");
+ setDescription("W\u00E4hlen Sie bitte Ihr Rohling aus welches Sie bearbeiten m\u00F6chten");
+ }
+
+ /**
+ * Create contents of the wizard.
+ * @param parent
+ */
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+
+ setControl(container);
+
+ list = new List(container, SWT.BORDER);
+ list.setBounds(0, 34, 574, 276);
+
+ Button btnDownload = new Button(container, SWT.NONE);
+ btnDownload.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseDown(MouseEvent arg0) {
+
+ System.out.println(list.getItem(list.getSelectionIndex()).toString());
+ }
+ });
+ btnDownload.setBounds(489, 316, 75, 25);
+ btnDownload.setText("Download");
+
+ txtLivesuche = new Text(container, SWT.BORDER);
+ txtLivesuche.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyReleased(KeyEvent arg0) {
+
+ try {
+ System.out.println(txtLivesuche.getText().toString());
+ result=f.getAllRohling(txtLivesuche.getText().toString());
+ list.removeAll();
+ for(int i=0;i<result.length;i++)
+ {
+ if(result[i]!=null)
+ list.add(result[i]);
+ }
+ } catch (SocketException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+ }
+ });
+ txtLivesuche.setForeground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));
+ txtLivesuche.setText("Livesuche");
+ txtLivesuche.setText("");
+ txtLivesuche.setBounds(0, 0, 201, 25);
+
+ try {
+
+ result=f.getAllRohling(txtLivesuche.getText().toString());
+ list.removeAll();
+ for(int i=0;i<result.length;i++)
+ {
+
+ list.add(result[i]);
+ }
+ } catch (SocketException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+
+}
diff --git a/Dozentenmodul/src/auth/Ldap.java b/Dozentenmodul/src/auth/Ldap.java
new file mode 100644
index 00000000..3bf74440
--- /dev/null
+++ b/Dozentenmodul/src/auth/Ldap.java
@@ -0,0 +1,44 @@
+package auth;
+
+import java.util.Hashtable;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.InitialDirContext;
+
+public class Ldap {
+
+ public boolean LdapAuth(String user, String pass)
+ {
+ String base = "ou=hrz,o=fho";
+ String dn = "cn="+user + "," + base;
+ String ldapURL = "ldaps://fs3.rz.hs-offenburg.de";
+ boolean userok=false;
+
+ Hashtable<String, String> environment = new Hashtable<String, String>();
+ environment.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
+ environment.put(Context.PROVIDER_URL, ldapURL);
+ environment.put(Context.SECURITY_AUTHENTICATION, "simple");
+ environment.put(Context.SECURITY_PRINCIPAL, dn);
+ environment.put(Context.SECURITY_CREDENTIALS, pass);
+
+ try {
+ DirContext authContext = new InitialDirContext(environment);
+ // user is authenticated
+
+ userok=true;
+
+ } catch (NamingException ex) {
+ userok=false;
+ //user hat keine Zugriffsrechte
+
+ Logger.getLogger(Ldap.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ return userok;
+
+ }
+
+}
diff --git a/Dozentenmodul/src/ftp/ftp.java b/Dozentenmodul/src/ftp/ftp.java
new file mode 100644
index 00000000..08ff65f1
--- /dev/null
+++ b/Dozentenmodul/src/ftp/ftp.java
@@ -0,0 +1,102 @@
+package ftp;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.SocketException;
+
+import org.apache.commons.net.ftp.FTPClient;
+import org.apache.commons.net.ftp.FTPFile;
+
+public class ftp {
+
+ /**
+ * @param args
+ */
+ public String[] getAllRohling(String SearchString) throws SocketException
+ {
+ FTPClient ftp=new FTPClient();
+ String[] filenamelist;
+
+ try {
+ ftp.connect("openslx-nfs.rz.hs-offenburg.de", 21);
+ ftp.login("tspitzer", "21071989");
+ ftp.changeWorkingDirectory("_vorlagen");
+
+ filenamelist=ftp.listNames();
+ String[] search=new String[filenamelist.length];
+ for(int i=0;i<filenamelist.length;i++)
+ {
+ if(filenamelist[i].startsWith(SearchString)==true)
+ {
+ search[i]=filenamelist[i];
+ }
+ }
+ return search;
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+
+ return null;
+ }
+
+ public boolean getFile(String name, String location){
+ FTPClient ftp=new FTPClient();
+
+
+ try {
+ ftp.connect("openslx-nfs.rz.hs-offenburg.de", 21);
+ ftp.login("tspitzer", "21071989");
+ ftp.changeWorkingDirectory("_vorlagen");
+ FileOutputStream os=new FileOutputStream(location+"\\"+name);
+ System.out.println("Start");
+ System.out.println(location+name);
+
+ ftp.retrieveFile(name, os);
+ System.out.println("Ende");
+
+
+
+
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+
+ return false;
+ }
+
+
+ public long getFileSize(String name){
+ FTPClient ftp=new FTPClient();
+
+
+ try {
+ ftp.connect("openslx-nfs.rz.hs-offenburg.de", 21);
+ ftp.login("tspitzer", "21071989");
+ ftp.changeWorkingDirectory("_vorlagen");
+ FTPFile[] file=new FTPFile[2];
+ file=ftp.listFiles(name);
+ System.out.println(file[0].getSize());
+ return file[0].getSize();
+
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+
+ return 0;
+ }
+
+
+
+
+}
diff --git a/Dozentenmodul/src/org/eclipse/wb/swt/SWTResourceManager.java b/Dozentenmodul/src/org/eclipse/wb/swt/SWTResourceManager.java
new file mode 100644
index 00000000..8b6d4cc3
--- /dev/null
+++ b/Dozentenmodul/src/org/eclipse/wb/swt/SWTResourceManager.java
@@ -0,0 +1,447 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Google, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Google, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wb.swt;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc.
+ * <p>
+ * !!! IMPORTANT !!! Application code must explicitly invoke the <code>dispose()</code> method to release the
+ * operating system resources managed by cached objects when those objects and OS resources are no longer
+ * needed (e.g. on application shutdown)
+ * <p>
+ * This class may be freely distributed as part of any application or plugin.
+ * <p>
+ * @author scheglov_ke
+ * @author Dan Rubel
+ */
+public class SWTResourceManager {
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Color
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ private static Map<RGB, Color> m_colorMap = new HashMap<RGB, Color>();
+ /**
+ * Returns the system {@link Color} matching the specific ID.
+ *
+ * @param systemColorID
+ * the ID value for the color
+ * @return the system {@link Color} matching the specific ID
+ */
+ public static Color getColor(int systemColorID) {
+ Display display = Display.getCurrent();
+ return display.getSystemColor(systemColorID);
+ }
+ /**
+ * Returns a {@link Color} given its red, green and blue component values.
+ *
+ * @param r
+ * the red component of the color
+ * @param g
+ * the green component of the color
+ * @param b
+ * the blue component of the color
+ * @return the {@link Color} matching the given red, green and blue component values
+ */
+ public static Color getColor(int r, int g, int b) {
+ return getColor(new RGB(r, g, b));
+ }
+ /**
+ * Returns a {@link Color} given its RGB value.
+ *
+ * @param rgb
+ * the {@link RGB} value of the color
+ * @return the {@link Color} matching the RGB value
+ */
+ public static Color getColor(RGB rgb) {
+ Color color = m_colorMap.get(rgb);
+ if (color == null) {
+ Display display = Display.getCurrent();
+ color = new Color(display, rgb);
+ m_colorMap.put(rgb, color);
+ }
+ return color;
+ }
+ /**
+ * Dispose of all the cached {@link Color}'s.
+ */
+ public static void disposeColors() {
+ for (Color color : m_colorMap.values()) {
+ color.dispose();
+ }
+ m_colorMap.clear();
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Image
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Maps image paths to images.
+ */
+ private static Map<String, Image> m_imageMap = new HashMap<String, Image>();
+ /**
+ * Returns an {@link Image} encoded by the specified {@link InputStream}.
+ *
+ * @param stream
+ * the {@link InputStream} encoding the image data
+ * @return the {@link Image} encoded by the specified input stream
+ */
+ protected static Image getImage(InputStream stream) throws IOException {
+ try {
+ Display display = Display.getCurrent();
+ ImageData data = new ImageData(stream);
+ if (data.transparentPixel > 0) {
+ return new Image(display, data, data.getTransparencyMask());
+ }
+ return new Image(display, data);
+ } finally {
+ stream.close();
+ }
+ }
+ /**
+ * Returns an {@link Image} stored in the file at the specified path.
+ *
+ * @param path
+ * the path to the image file
+ * @return the {@link Image} stored in the file at the specified path
+ */
+ public static Image getImage(String path) {
+ Image image = m_imageMap.get(path);
+ if (image == null) {
+ try {
+ image = getImage(new FileInputStream(path));
+ m_imageMap.put(path, image);
+ } catch (Exception e) {
+ image = getMissingImage();
+ m_imageMap.put(path, image);
+ }
+ }
+ return image;
+ }
+ /**
+ * Returns an {@link Image} stored in the file at the specified path relative to the specified class.
+ *
+ * @param clazz
+ * the {@link Class} relative to which to find the image
+ * @param path
+ * the path to the image file, if starts with <code>'/'</code>
+ * @return the {@link Image} stored in the file at the specified path
+ */
+ public static Image getImage(Class<?> clazz, String path) {
+ String key = clazz.getName() + '|' + path;
+ Image image = m_imageMap.get(key);
+ if (image == null) {
+ try {
+ image = getImage(clazz.getResourceAsStream(path));
+ m_imageMap.put(key, image);
+ } catch (Exception e) {
+ image = getMissingImage();
+ m_imageMap.put(key, image);
+ }
+ }
+ return image;
+ }
+ private static final int MISSING_IMAGE_SIZE = 10;
+ /**
+ * @return the small {@link Image} that can be used as placeholder for missing image.
+ */
+ private static Image getMissingImage() {
+ Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
+ //
+ GC gc = new GC(image);
+ gc.setBackground(getColor(SWT.COLOR_RED));
+ gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
+ gc.dispose();
+ //
+ return image;
+ }
+ /**
+ * Style constant for placing decorator image in top left corner of base image.
+ */
+ public static final int TOP_LEFT = 1;
+ /**
+ * Style constant for placing decorator image in top right corner of base image.
+ */
+ public static final int TOP_RIGHT = 2;
+ /**
+ * Style constant for placing decorator image in bottom left corner of base image.
+ */
+ public static final int BOTTOM_LEFT = 3;
+ /**
+ * Style constant for placing decorator image in bottom right corner of base image.
+ */
+ public static final int BOTTOM_RIGHT = 4;
+ /**
+ * Internal value.
+ */
+ protected static final int LAST_CORNER_KEY = 5;
+ /**
+ * Maps images to decorated images.
+ */
+ @SuppressWarnings("unchecked")
+ private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY];
+ /**
+ * Returns an {@link Image} composed of a base image decorated by another image.
+ *
+ * @param baseImage
+ * the base {@link Image} that should be decorated
+ * @param decorator
+ * the {@link Image} to decorate the base image
+ * @return {@link Image} The resulting decorated image
+ */
+ public static Image decorateImage(Image baseImage, Image decorator) {
+ return decorateImage(baseImage, decorator, BOTTOM_RIGHT);
+ }
+ /**
+ * Returns an {@link Image} composed of a base image decorated by another image.
+ *
+ * @param baseImage
+ * the base {@link Image} that should be decorated
+ * @param decorator
+ * the {@link Image} to decorate the base image
+ * @param corner
+ * the corner to place decorator image
+ * @return the resulting decorated {@link Image}
+ */
+ public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) {
+ if (corner <= 0 || corner >= LAST_CORNER_KEY) {
+ throw new IllegalArgumentException("Wrong decorate corner");
+ }
+ Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner];
+ if (cornerDecoratedImageMap == null) {
+ cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>();
+ m_decoratedImageMap[corner] = cornerDecoratedImageMap;
+ }
+ Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage);
+ if (decoratedMap == null) {
+ decoratedMap = new HashMap<Image, Image>();
+ cornerDecoratedImageMap.put(baseImage, decoratedMap);
+ }
+ //
+ Image result = decoratedMap.get(decorator);
+ if (result == null) {
+ Rectangle bib = baseImage.getBounds();
+ Rectangle dib = decorator.getBounds();
+ //
+ result = new Image(Display.getCurrent(), bib.width, bib.height);
+ //
+ GC gc = new GC(result);
+ gc.drawImage(baseImage, 0, 0);
+ if (corner == TOP_LEFT) {
+ gc.drawImage(decorator, 0, 0);
+ } else if (corner == TOP_RIGHT) {
+ gc.drawImage(decorator, bib.width - dib.width, 0);
+ } else if (corner == BOTTOM_LEFT) {
+ gc.drawImage(decorator, 0, bib.height - dib.height);
+ } else if (corner == BOTTOM_RIGHT) {
+ gc.drawImage(decorator, bib.width - dib.width, bib.height - dib.height);
+ }
+ gc.dispose();
+ //
+ decoratedMap.put(decorator, result);
+ }
+ return result;
+ }
+ /**
+ * Dispose all of the cached {@link Image}'s.
+ */
+ public static void disposeImages() {
+ // dispose loaded images
+ {
+ for (Image image : m_imageMap.values()) {
+ image.dispose();
+ }
+ m_imageMap.clear();
+ }
+ // dispose decorated images
+ for (int i = 0; i < m_decoratedImageMap.length; i++) {
+ Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i];
+ if (cornerDecoratedImageMap != null) {
+ for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) {
+ for (Image image : decoratedMap.values()) {
+ image.dispose();
+ }
+ decoratedMap.clear();
+ }
+ cornerDecoratedImageMap.clear();
+ }
+ }
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Font
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Maps font names to fonts.
+ */
+ private static Map<String, Font> m_fontMap = new HashMap<String, Font>();
+ /**
+ * Maps fonts to their bold versions.
+ */
+ private static Map<Font, Font> m_fontToBoldFontMap = new HashMap<Font, Font>();
+ /**
+ * Returns a {@link Font} based on its name, height and style.
+ *
+ * @param name
+ * the name of the font
+ * @param height
+ * the height of the font
+ * @param style
+ * the style of the font
+ * @return {@link Font} The font matching the name, height and style
+ */
+ public static Font getFont(String name, int height, int style) {
+ return getFont(name, height, style, false, false);
+ }
+ /**
+ * Returns a {@link Font} based on its name, height and style. Windows-specific strikeout and underline
+ * flags are also supported.
+ *
+ * @param name
+ * the name of the font
+ * @param size
+ * the size of the font
+ * @param style
+ * the style of the font
+ * @param strikeout
+ * the strikeout flag (warning: Windows only)
+ * @param underline
+ * the underline flag (warning: Windows only)
+ * @return {@link Font} The font matching the name, height, style, strikeout and underline
+ */
+ public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) {
+ String fontName = name + '|' + size + '|' + style + '|' + strikeout + '|' + underline;
+ Font font = m_fontMap.get(fontName);
+ if (font == null) {
+ FontData fontData = new FontData(name, size, style);
+ if (strikeout || underline) {
+ try {
+ Class<?> logFontClass = Class.forName("org.eclipse.swt.internal.win32.LOGFONT"); //$NON-NLS-1$
+ Object logFont = FontData.class.getField("data").get(fontData); //$NON-NLS-1$
+ if (logFont != null && logFontClass != null) {
+ if (strikeout) {
+ logFontClass.getField("lfStrikeOut").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$
+ }
+ if (underline) {
+ logFontClass.getField("lfUnderline").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$
+ }
+ }
+ } catch (Throwable e) {
+ System.err.println("Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ font = new Font(Display.getCurrent(), fontData);
+ m_fontMap.put(fontName, font);
+ }
+ return font;
+ }
+ /**
+ * Returns a bold version of the given {@link Font}.
+ *
+ * @param baseFont
+ * the {@link Font} for which a bold version is desired
+ * @return the bold version of the given {@link Font}
+ */
+ public static Font getBoldFont(Font baseFont) {
+ Font font = m_fontToBoldFontMap.get(baseFont);
+ if (font == null) {
+ FontData fontDatas[] = baseFont.getFontData();
+ FontData data = fontDatas[0];
+ font = new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD);
+ m_fontToBoldFontMap.put(baseFont, font);
+ }
+ return font;
+ }
+ /**
+ * Dispose all of the cached {@link Font}'s.
+ */
+ public static void disposeFonts() {
+ // clear fonts
+ for (Font font : m_fontMap.values()) {
+ font.dispose();
+ }
+ m_fontMap.clear();
+ // clear bold fonts
+ for (Font font : m_fontToBoldFontMap.values()) {
+ font.dispose();
+ }
+ m_fontToBoldFontMap.clear();
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Cursor
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Maps IDs to cursors.
+ */
+ private static Map<Integer, Cursor> m_idToCursorMap = new HashMap<Integer, Cursor>();
+ /**
+ * Returns the system cursor matching the specific ID.
+ *
+ * @param id
+ * int The ID value for the cursor
+ * @return Cursor The system cursor matching the specific ID
+ */
+ public static Cursor getCursor(int id) {
+ Integer key = Integer.valueOf(id);
+ Cursor cursor = m_idToCursorMap.get(key);
+ if (cursor == null) {
+ cursor = new Cursor(Display.getDefault(), id);
+ m_idToCursorMap.put(key, cursor);
+ }
+ return cursor;
+ }
+ /**
+ * Dispose all of the cached cursors.
+ */
+ public static void disposeCursors() {
+ for (Cursor cursor : m_idToCursorMap.values()) {
+ cursor.dispose();
+ }
+ m_idToCursorMap.clear();
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // General
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Dispose of cached objects and their underlying OS resources. This should only be called when the cached
+ * objects are no longer needed (e.g. on application shutdown).
+ */
+ public static void dispose() {
+ disposeColors();
+ disposeImages();
+ disposeFonts();
+ disposeCursors();
+ }
+} \ No newline at end of file
diff --git a/Dozentenmodul/swing2swt.jar b/Dozentenmodul/swing2swt.jar
new file mode 100644
index 00000000..43885e66
--- /dev/null
+++ b/Dozentenmodul/swing2swt.jar
Binary files differ