summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuersat Akmaz2020-11-30 22:14:07 +0100
committerKuersat Akmaz2020-11-30 22:14:07 +0100
commit2176ce2893fc40284aaa70978324aebc5ba19e50 (patch)
treea23c5042a651914e1637b5911392f43d880b7ecc
parent[client] added fixed htmleditor to imagedetailswindow (diff)
downloadtutor-module-2176ce2893fc40284aaa70978324aebc5ba19e50.tar.gz
tutor-module-2176ce2893fc40284aaa70978324aebc5ba19e50.tar.xz
tutor-module-2176ce2893fc40284aaa70978324aebc5ba19e50.zip
[client] fixed htmleditor in LectureDetailsWindown
Issue : #3732
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java12
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java251
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageDetailsWindowLayout.java2
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureDetailsWindowLayout.java56
4 files changed, 240 insertions, 81 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java
index fc68c708..115864c9 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/ImageDetailsWindow.java
@@ -290,10 +290,22 @@ public class ImageDetailsWindow extends ImageDetailsWindowLayout implements UiFe
if(ImagePerms.canEdit(image) || ImagePerms.canAdmin(image)) {
btnSaveChanges.setEnabled(true);
}
+
+ btnBold.setEnabled(false);
+ btnUnderline.setEnabled(false);
+ btnItalic.setEnabled(false);
+ cbTxtColor.setEnabled(false);
+ cbTxtSize.setEnabled(false);
} else {
txtDescription.setContentType("text/html");
txtDescription.setText(tmp);
btnWysiwyg.setText("Html");
+
+ btnBold.setEnabled(true);
+ btnUnderline.setEnabled(true);
+ btnItalic.setEnabled(true);
+ cbTxtColor.setEnabled(true);
+ cbTxtSize.setEnabled(true);
}
}
});
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java
index 19e30fff..bd45f6f1 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureDetailsWindow.java
@@ -1,5 +1,6 @@
package org.openslx.dozmod.gui.window;
+import java.awt.Color;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -7,6 +8,9 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
+import java.io.IOException;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
@@ -16,11 +20,18 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import javax.swing.Action;
import javax.swing.DefaultComboBoxModel;
+import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.StyledEditorKit;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.HTMLDocument;
+import org.apache.commons.codec.language.ColognePhonetic;
import org.apache.log4j.Logger;
import org.apache.thrift.TException;
import org.openslx.bwlp.thrift.iface.ImageDetailsRead;
@@ -98,7 +109,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
* Image, that the lecture is linked to.
*/
private ImageDetailsRead image = null;
-
+
/**
* Per-User permissions of this lecture
*/
@@ -113,11 +124,11 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
private final AbstractControlWrapper<?> changeListenerPermissions;
- /**
+ /**
* Constructor
*
* @param modalParent parent of this popup window
- * @param callback function to be called when a lecture update occured
+ * @param callback function to be called when a lecture update occured
*/
public LectureDetailsWindow(Frame modalParent, LectureUpdatedCallback callback) {
super(modalParent);
@@ -126,7 +137,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
this.callback = callback;
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
-
+
// Set up change monitor
changeMonitor = new DialogChangeMonitor(new DialogChangeMonitor.Callback() {
@Override
@@ -135,6 +146,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
btnSaveChanges.setEnabled(changeMonitor.isValid() && changeMonitor.wasEverModified());
LOGGER.info("Valid: " + changeMonitor.isValid());
}
+
@Override
public void modificationChanged() {
btnSaveChanges.setEnabled(changeMonitor.isValid() && changeMonitor.wasEverModified());
@@ -144,8 +156,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
// Add controls to change monitor
changeMonitor.addFixedCombo(cboVersions, Comparators.imageVersionDetails)
- .addConstraint(
- new DialogChangeMonitor.ValidationConstraint<ImageVersionDetails>() {
+ .addConstraint(new DialogChangeMonitor.ValidationConstraint<ImageVersionDetails>() {
public String checkStateValid(ImageVersionDetails userInput) {
if (userInput != null && userInput.isValid)
return null;
@@ -175,19 +186,23 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
changeMonitor.add(chkIsActive);
changeMonitor.add(chkCustomPermAdmin);
changeMonitor.add(chkCustomPermEdit);
- changeMonitor.add(txtTitle).addConstraint(new TextNotEmptyConstraint("Veranstaltungsname darf nicht leer sein"));
- changeMonitor.add(txtDescription).addConstraint(new TextNotEmptyConstraint("Beschreibung darf nicht leer sein"));
+ changeMonitor.add(txtTitle)
+ .addConstraint(new TextNotEmptyConstraint("Veranstaltungsname darf nicht leer sein"));
+ changeMonitor.add(txtDescription)
+ .addConstraint(new TextNotEmptyConstraint("Beschreibung darf nicht leer sein"));
changeMonitor.add(dtpEndDate).addConstraint(dateRangeValidator);
changeMonitor.add(dtpStartDate).addConstraint(dateRangeValidator);
changeMonitor.add(spnEndTime).addConstraint(dateRangeValidator);
changeMonitor.add(spnStartTime).addConstraint(dateRangeValidator);
- changeMonitor.add(ctlNetrulesConfigurator).addConstraint(new NotNullConstraint<StateWrapper>("Fehlerhafte Netzwerkregeln"));
+ changeMonitor.add(ctlNetrulesConfigurator)
+ .addConstraint(new NotNullConstraint<StateWrapper>("Fehlerhafte Netzwerkregeln"));
changeListenerPermissions = changeMonitor.add(ctlPermissionManager);
ctlLocationSelector.addToChangeMonitor(changeMonitor);
ctlRunscriptConfigurator.addToChangeMonitor(changeMonitor);
ctlNetshareConfigurator.addToChangeMonitor(changeMonitor);
ctlLdapFilterConfigurator.addToChangeMonitor(changeMonitor);
- // TODO: LDAP/NetShare: Having uncommitted changes in the input fields should be handled too
+ // TODO: LDAP/NetShare: Having uncommitted changes in the input fields should be
+ // handled too
// End change monitor
addWindowListener(new WindowAdapter() {
@@ -252,16 +267,120 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
@Override
public void userAdded(UserInfo user, UserListWindow window) {
window.dispose();
- if (Gui.showMessageBox(me, "Sind Sie sicher, dass sie die Besitzerrechte an "
- + "einen anderen Account übertragen wollen?", MessageType.QUESTION_YESNO,
- LOGGER, null))
+ if (Gui.showMessageBox(me,
+ "Sind Sie sicher, dass sie die Besitzerrechte an "
+ + "einen anderen Account übertragen wollen?",
+ MessageType.QUESTION_YESNO, LOGGER, null))
setLectureOwner(user);
}
}, "Besitzer festlegen", lecture.ownerId);
}
});
-
- // Update default permissions in the permission manager immediately, so it affects
+
+ cbTxtSize.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ int size = Integer.parseInt((String) cbTxtSize.getSelectedItem());
+ Action act = new StyledEditorKit.FontSizeAction(String.valueOf(size),size);
+ act.actionPerformed(new ActionEvent(act,ActionEvent.ACTION_PERFORMED,
+ (String)act.getValue(Action.ACTION_COMMAND_KEY)));
+ }
+ });
+
+ cbTxtColor.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ String color = (String) cbTxtColor.getSelectedItem();
+ Action act = null;
+
+ switch(color) {
+ case "Black":
+ act = new StyledEditorKit.ForegroundAction("Black", Color.black);
+ break;
+ case "Blue":
+ act = new StyledEditorKit.ForegroundAction("Blue", Color.blue);
+ break;
+ case "Yellow":
+ act = new StyledEditorKit.ForegroundAction("Yellow", Color.yellow);
+ break;
+ case "Red":
+ act = new StyledEditorKit.ForegroundAction("Red", Color.red);
+ break;
+ case "Green":
+ act = new StyledEditorKit.ForegroundAction("Green", Color.green);
+ break;
+ }
+
+ act.actionPerformed(new ActionEvent(act,ActionEvent.ACTION_PERFORMED,
+ (String)act.getValue(Action.ACTION_COMMAND_KEY)));
+ }
+ });
+
+
+ btnWysiwyg.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ String tmp = txtDescription.getText();
+ if (txtDescription.getContentType().equals("text/html")) {
+ txtDescription.setContentType("text/plain");
+ txtDescription.setText(tmp);
+ btnWysiwyg.setText("Wysiwyg");
+ if (ImagePerms.canEdit(image) || ImagePerms.canAdmin(image)) {
+ btnSaveChanges.setEnabled(true);
+ }
+
+ btnBold.setEnabled(false);
+ btnUnderline.setEnabled(false);
+ btnItalic.setEnabled(false);
+ cbTxtColor.setEnabled(false);
+ cbTxtSize.setEnabled(false);
+ } else {
+ txtDescription.setContentType("text/html");
+ txtDescription.setText(tmp);
+ btnWysiwyg.setText("Html");
+
+ btnBold.setEnabled(true);
+ btnUnderline.setEnabled(true);
+ btnItalic.setEnabled(true);
+ cbTxtColor.setEnabled(true);
+ cbTxtSize.setEnabled(true);
+ }
+ }
+ });
+
+ txtDescription.addKeyListener(new KeyListener() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ }
+
+ @Override
+ public void keyTyped(KeyEvent e) {
+ }
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER && txtDescription.getContentType().equals("text/html")) {
+ try {
+ kit.insertHTML((HTMLDocument) txtDescription.getDocument(), txtDescription.getCaretPosition(),
+ "<br>", 0, 0, HTML.Tag.BR);
+ txtDescription.setCaretPosition(txtDescription.getCaretPosition()); // This moves caret to next
+ // line
+ } catch (BadLocationException | IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+ });
+
+ btnBold.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ btnBold.setBackground(Color.YELLOW);
+ }
+ });
+
+ // Update default permissions in the permission manager immediately, so it
+ // affects
// newly added users
final ItemListener updateDefaultPermissionListener = new ItemListener() {
@Override
@@ -290,10 +409,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
}
/**
- * Sets the lecture to show the details of by setting the 'lecture' and
- * 'image'
- * members to its metadata. This method will fetch the information from the
- * sat
+ * Sets the lecture to show the details of by setting the 'lecture' and 'image'
+ * members to its metadata. This method will fetch the information from the sat
*
* @param lectureId the id of the lecture to be displayed
*/
@@ -307,8 +424,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
lecture = lectureDetails;
image = imageDetails;
if (lecture != null) {
- customPermissions = ThriftActions.getLecturePermissions(
- JOptionPane.getFrameForComponent(me), lecture.lectureId);
+ customPermissions = ThriftActions
+ .getLecturePermissions(JOptionPane.getFrameForComponent(me), lecture.lectureId);
}
fillDetails();
}
@@ -317,7 +434,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
}
/**
- * Internal callback function when we received the lecture's details from the server
+ * Internal callback function when we received the lecture's details from the
+ * server
*/
private void fillDetails() {
if (lecture == null) {
@@ -379,10 +497,9 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
Calendar endCal = Calendar.getInstance();
endCal.setTime(new Date(lecture.getEndTime() * 1000l));
- dtpEndDate.getModel().setDate(endCal.get(Calendar.YEAR), endCal.get(Calendar.MONTH),
- endCal.get(Calendar.DATE));
+ dtpEndDate.getModel().setDate(endCal.get(Calendar.YEAR), endCal.get(Calendar.MONTH), endCal.get(Calendar.DATE));
spnEndTime.getModel().setValue(endCal.getTime());
-
+
// now enable the tabs the user can see given its permissions
toggleEditable(true);
// and always switch to the "About" tab
@@ -392,8 +509,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
}
/**
- * Helper to fill the combobox with the versions of the image. The list will
- * be sorted by creation timestamp
+ * Helper to fill the combobox with the versions of the image. The list will be
+ * sorted by creation timestamp
*/
private void fillVersionsCombo() {
List<ImageVersionDetails> versions;
@@ -420,8 +537,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
cboVersions.setModel(new DefaultComboBoxModel<ImageVersionDetails>(
versions.toArray(new ImageVersionDetails[versions.size()])));
cboVersions.setSelectedIndex(-1); // To make the change monitor happy
- cboVersions.setSelectedItem(new ImageVersionDetails(lecture.getImageVersionId(), 0, 0, 0, null, true,
- true, true, null));
+ cboVersions.setSelectedItem(
+ new ImageVersionDetails(lecture.getImageVersionId(), 0, 0, 0, null, true, true, true, null));
}
/**
@@ -430,13 +547,12 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
* @param user UserInfo representation of the new owner
*/
private void setLectureOwner(final UserInfo user) {
- if (!ThriftActions.setLectureOwner(JOptionPane.getFrameForComponent(this), lecture.getLectureId(),
- user)) {
+ if (!ThriftActions.setLectureOwner(JOptionPane.getFrameForComponent(this), lecture.getLectureId(), user)) {
return;
}
// success
- Gui.showMessageBox(me, "Besitzrechte übertragen an " + FormatHelper.userName(user), MessageType.INFO,
- null, null);
+ Gui.showMessageBox(me, "Besitzrechte übertragen an " + FormatHelper.userName(user), MessageType.INFO, null,
+ null);
toggleEditable(false);
String lectureId = lecture.getLectureId();
synchronized (me) {
@@ -471,8 +587,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
null);
return;
}
- ThriftActions.initDownload(JOptionPane.getFrameForComponent(this), lecture.imageVersionId,
- image.imageName, image.virtId, image.osId, versionSize, new DownloadCallback() {
+ ThriftActions.initDownload(JOptionPane.getFrameForComponent(this), lecture.imageVersionId, image.imageName,
+ image.virtId, image.osId, versionSize, new DownloadCallback() {
@Override
public void downloadInitialized(boolean success) {
if (!success) {
@@ -488,8 +604,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
}
/**
- * Triggers the saving of the changes of this lecture
- * And inform the callback function about the outcome
+ * Triggers the saving of the changes of this lecture And inform the callback
+ * function about the outcome
*/
private void saveChanges() {
boolean saved = saveChangesInternal();
@@ -511,7 +627,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
long endTime = DateTimeHelper.getDateFrom(dtpEndDate, spnEndTime).getTime() / 1000L;
if (!isPeriodValid(startTime, endTime, true))
return false;
-
+
// check, whether autoupdate is selected and choose version accordingly
if (image != null) {
lecture.imageVersionId = chkAutoUpdate.isSelected() ? image.latestVersionId
@@ -529,11 +645,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
// first build the LectureWrite from the GUI fields
StartupSettings startupSettings = ctlRunscriptConfigurator.getState();
final LectureWrite metadata = new LectureWrite(txtTitle.getText(), txtDescription.getText(),
- lecture.getImageVersionId(), chkAutoUpdate.isSelected(), chkIsActive.isSelected(),
- startTime, endTime,
- startupSettings.serializeItems(), null,
- chkIsExam.isSelected(),
- chkHasInternetAccess.isSelected(),
+ lecture.getImageVersionId(), chkAutoUpdate.isSelected(), chkIsActive.isSelected(), startTime, endTime,
+ startupSettings.serializeItems(), null, chkIsExam.isSelected(), chkHasInternetAccess.isSelected(),
lecture.getDefaultPermissions(), ctlLocationSelector.getSelectedLocationsAsIds(),
ctlLocationSelector.getOnlyInSelection(),
// TODO limitOnlyToAllowedUsers, default to false for now
@@ -545,10 +658,9 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
metadata.setLdapFilters(ctlLdapFilterConfigurator.getState());
metadata.setPresetScriptIds(startupSettings.selectedScripts);
- // now trigger the actual action
+ // now trigger the actual action
try {
- ThriftManager.getSatClient().updateLecture(Session.getSatelliteToken(),
- lecture.getLectureId(), metadata);
+ ThriftManager.getSatClient().updateLecture(Session.getSatelliteToken(), lecture.getLectureId(), metadata);
LOGGER.info("Successfully saved new metadata");
} catch (TException e) {
ThriftError.showMessage(JOptionPane.getFrameForComponent(this), LOGGER, e,
@@ -572,8 +684,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
*/
private boolean saveCustomPermissions() {
try {
- ThriftManager.getSatClient().writeLecturePermissions(Session.getSatelliteToken(),
- lecture.lectureId, ctlPermissionManager.getPermissions());
+ ThriftManager.getSatClient().writeLecturePermissions(Session.getSatelliteToken(), lecture.lectureId,
+ ctlPermissionManager.getPermissions());
LOGGER.info("Successfully saved custom permissions");
return true;
} catch (TException e) {
@@ -584,13 +696,12 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
}
/**
- * Checks if the given start and end date represent a valid time period.
- * This is the case, if start < end and if current time < end
+ * Checks if the given start and end date represent a valid time period. This is
+ * the case, if start < end and if current time < end
*
- * @param start date of the period to check
- * @param end date of the period to check
- * @param feedback true if the user should be shown feedback, false
- * otherwise
+ * @param start date of the period to check
+ * @param end date of the period to check
+ * @param feedback true if the user should be shown feedback, false otherwise
* @return true if the period is valid, false otherwise
*/
private boolean isPeriodValid(long start, long end, boolean feedback) {
@@ -601,8 +712,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
return true;
String msg = "Start der Veranstaltung ist nach dem Enddatum!";
if (feedback) {
- Gui.showMessageBox(me, msg, MessageType.ERROR,
- LOGGER, null);
+ Gui.showMessageBox(me, msg, MessageType.ERROR, LOGGER, null);
}
lblError.setText(msg);
return false;
@@ -611,8 +721,9 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
/**
* Enables/Disables the tabs based on the given flag 'editable'.
*
- * @param editable when true, will enable the tabs if the user is allowed to see them.
- * If false, this will disable all tabs but the first tab "About".
+ * @param editable when true, will enable the tabs if the user is allowed to see
+ * them. If false, this will disable all tabs but the first tab
+ * "About".
*/
protected void toggleEditable(boolean editable) {
// if we don't have a lecture and an image set, just disable
@@ -620,7 +731,8 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
// enable the standard tabs that are always enabled
setTabEnabled(pnlTabGeneral, editable);
setTabEnabled(pnlTabPermissions, editable && LecturePerms.canAdmin(lecture));
- // enable the other tabs that might have been added to the panel (depends on API version)
+ // enable the other tabs that might have been added to the panel (depends on API
+ // version)
setTabEnabled(pnlTabRestrictions, editable);
setTabEnabled(pnlTabLocations, editable);
setTabEnabled(pnlTabRunscript, editable);
@@ -630,7 +742,7 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
btnChangeOwner.setEnabled(LecturePerms.canAdmin(lecture));
btnDownloadImage.setEnabled(ImagePerms.canDownload(image));
}
-
+
private void setTabEnabled(JPanel tab, boolean editable) {
int index = pnlTabs.indexOfComponent(tab);
if (index == -1) // Check if tab exists -- we don't add some, depending on server version
@@ -639,11 +751,11 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
}
/**
- * Opens a new LectureDetailsWindow showing the details of the
- * lecture with ID = lectureId
+ * Opens a new LectureDetailsWindow showing the details of the lecture with ID =
+ * lectureId
*
* @param modalParent parent of this window
- * @param lectureId id of the lecture to set the details of
+ * @param lectureId id of the lecture to set the details of
*/
public static void open(Frame modalParent, String lectureId, LectureUpdatedCallback callback) {
LectureDetailsWindow win = new LectureDetailsWindow(modalParent, callback);
@@ -661,9 +773,11 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
super.show();
}
- /* *******************************************************************************
+ /*
+ * *****************************************************************************
+ * **
*
- * UIFeedback implementation
+ * UIFeedback implementation
*
********************************************************************************/
@Override
@@ -682,11 +796,10 @@ public class LectureDetailsWindow extends LectureDetailsWindowLayout implements
* confirmation if so
*/
private void safeClose() {
- if (changeMonitor.isCurrentlyModified()
- && !Gui.showMessageBox(me, "Änderungen werden verworfen, wollen Sie wirklich schließen?",
- MessageType.QUESTION_YESNO, null, null))
+ if (changeMonitor.isCurrentlyModified() && !Gui.showMessageBox(me,
+ "Änderungen werden verworfen, wollen Sie wirklich schließen?", MessageType.QUESTION_YESNO, null, null))
return;
- synchronized(me) {
+ synchronized (me) {
lecture = null;
image = null;
}
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageDetailsWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageDetailsWindowLayout.java
index 0d5cfd0f..31332cf4 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageDetailsWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/ImageDetailsWindowLayout.java
@@ -83,7 +83,7 @@ public abstract class ImageDetailsWindowLayout extends JDialog {
protected final JButton btnItalic;
protected final JButton btnUnderline;
protected final JButton btnWysiwyg;
-
+
protected final JComboBox cbTxtSize;
protected final JComboBox cbTxtColor;
protected final HTMLEditorKit kit;
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureDetailsWindowLayout.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureDetailsWindowLayout.java
index 0f01fd61..113502d8 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureDetailsWindowLayout.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/layout/LectureDetailsWindowLayout.java
@@ -2,12 +2,14 @@ package org.openslx.dozmod.gui.window.layout;
import java.awt.BorderLayout;
import java.awt.Color;
+import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.util.Calendar;
import java.awt.GridLayout;
+import java.awt.FlowLayout;
import javax.swing.BorderFactory;
import javax.swing.Box;
@@ -15,6 +17,7 @@ import javax.swing.BoxLayout;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
@@ -27,6 +30,7 @@ import javax.swing.JTextField;
import javax.swing.SpinnerDateModel;
import javax.swing.text.DateFormatter;
import javax.swing.text.StyledEditorKit;
+import javax.swing.text.html.HTMLEditorKit;
import org.jdatepicker.JDatePicker;
import org.openslx.bwlp.thrift.iface.ImageVersionDetails;
@@ -113,6 +117,11 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
protected final JButton btnBold;
protected final JButton btnItalic;
protected final JButton btnUnderline;
+ protected final JButton btnWysiwyg;
+
+ protected final JComboBox cbTxtSize;
+ protected final JComboBox cbTxtColor;
+ protected final HTMLEditorKit kit;
public LectureDetailsWindowLayout(Frame modalParent) {
@@ -185,27 +194,51 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
// buttons for text editing
JPanel editingPanel = new JPanel();
- editingPanel.setLayout(new GridLayout(1,3));
+
+ editingPanel.setLayout(new FlowLayout(FlowLayout.LEADING));
JPanel emptyPanel = new JPanel();
grdGeneral.add(emptyPanel);
- btnBold = new JButton( new StyledEditorKit.BoldAction());
- btnBold.setIcon(Gui.getScaledIconResource("/img/bold.png", "B", 24, this));
+ btnBold = new JButton(new StyledEditorKit.BoldAction());
+ btnBold.setIcon(Gui.getScaledIconResource("/img/bold.png", "B", 15, this));
btnBold.setText("");
- btnItalic = new JButton(new StyledEditorKit.ItalicAction() );
- btnItalic.setIcon(Gui.getScaledIconResource("/img/italic.png", "B", 24, this));
+ btnItalic = new JButton(new StyledEditorKit.ItalicAction());
+ btnItalic.setIcon(Gui.getScaledIconResource("/img/italic.png", "B", 15, this));
btnItalic.setText("");
- btnUnderline = new JButton(new StyledEditorKit.UnderlineAction() );
- btnUnderline.setIcon(Gui.getScaledIconResource("/img/underline.png", "B", 24, this));
+ btnUnderline = new JButton(new StyledEditorKit.UnderlineAction());
+ btnUnderline.setIcon(Gui.getScaledIconResource("/img/underline.png", "B", 15, this));
btnUnderline.setText("");
- grdGeneral.add(btnBold);
- grdGeneral.add(btnItalic);
- grdGeneral.add(btnUnderline);
+ editingPanel.add(btnBold);
+ editingPanel.add(btnItalic);
+ editingPanel.add(btnUnderline);
+
+ String[] textsizes = {"10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29"};
+ cbTxtSize = new JComboBox<>(textsizes);
+ cbTxtSize.setPreferredSize(new Dimension(65,25));
+ editingPanel.add(cbTxtSize);
+
+ Object[] colors = {"Black", "Blue", "Red", "Yellow", "Green"};
+ cbTxtColor = new JComboBox<>(colors);
+ cbTxtColor.setPreferredSize(new Dimension(100,25));
+ editingPanel.add(cbTxtColor);
+
grdGeneral.add(editingPanel);
-
+
+
+ emptyPanel.setLayout(new FlowLayout());
+ btnWysiwyg = new JButton("HTML");
+ btnWysiwyg.setPreferredSize(new Dimension(100,25));
+ emptyPanel.add(btnWysiwyg);
+
+ grdGeneral.add(emptyPanel);
+ grdGeneral.add(new JPanel());
+ grdGeneral.add(new JPanel());
+
grdGeneral.nextRow();
// description
txtDescription = new JEditorPane();
+ kit = new HTMLEditorKit();
+ txtDescription.setEditorKit(kit);
txtDescription.setContentType("text/html");
grdGeneral.add(new QLabel("Beschreibung")).anchor(GridBagConstraints.FIRST_LINE_START);
JScrollPane jsp = new JScrollPane(txtDescription, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
@@ -215,6 +248,7 @@ public abstract class LectureDetailsWindowLayout extends JDialog {
grdGeneral.add(jsp, 4).expand(true, true).fill(true, true);
grdGeneral.nextRow();
+
// ID. NOTE: currently disabled
txtId = new JTextField();
txtId.setEditable(false);