From e4d03898f1cf6e7804a272e6a82a4a390c944b06 Mon Sep 17 00:00:00 2001 From: Kuersat Akmaz Date: Fri, 16 Oct 2020 23:58:46 +0200 Subject: [client] added small html editor in LectureDescriptonWindow Issue : #3732 --- .../window/layout/LectureDetailsWindowLayout.java | 37 ++++++++++++++++++--- dozentenmodul/src/main/resources/img/bold.png | Bin 0 -> 11833 bytes dozentenmodul/src/main/resources/img/italic.png | Bin 0 -> 4482 bytes dozentenmodul/src/main/resources/img/underline.png | Bin 0 -> 5621 bytes 4 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 dozentenmodul/src/main/resources/img/bold.png create mode 100644 dozentenmodul/src/main/resources/img/italic.png create mode 100644 dozentenmodul/src/main/resources/img/underline.png 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 0dc3cee2..0f01fd61 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 @@ -7,13 +7,16 @@ import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.Insets; import java.util.Calendar; +import java.awt.GridLayout; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; +import javax.swing.GroupLayout; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JDialog; +import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; @@ -23,6 +26,7 @@ import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.SpinnerDateModel; import javax.swing.text.DateFormatter; +import javax.swing.text.StyledEditorKit; import org.jdatepicker.JDatePicker; import org.openslx.bwlp.thrift.iface.ImageVersionDetails; @@ -53,7 +57,7 @@ public abstract class LectureDetailsWindowLayout extends JDialog { // stuff ending in '...Info' are supposed to be the read-only labels for the information tab protected final QLabel lblTitleInfo; protected final JTextField txtTitle; - protected final JTextArea txtDescription; + protected final JEditorPane txtDescription; protected final QLabel lblImageNameInfo; protected final QLabel txtImageName; protected final JButton btnLinkImage; @@ -106,6 +110,11 @@ public abstract class LectureDetailsWindowLayout extends JDialog { protected final JPanel pnlTabNetshare; protected final JPanel pnlTabLdapFilter; + protected final JButton btnBold; + protected final JButton btnItalic; + protected final JButton btnUnderline; + + public LectureDetailsWindowLayout(Frame modalParent) { super(modalParent, "Veranstaltungsdetails", ModalityType.APPLICATION_MODAL); setResizable(true); @@ -174,10 +183,30 @@ public abstract class LectureDetailsWindowLayout extends JDialog { grdGeneral.add(txtTitle, 4).expand(true, false).fill(true, false); grdGeneral.nextRow(); + // buttons for text editing + JPanel editingPanel = new JPanel(); + editingPanel.setLayout(new GridLayout(1,3)); + JPanel emptyPanel = new JPanel(); + grdGeneral.add(emptyPanel); + btnBold = new JButton( new StyledEditorKit.BoldAction()); + btnBold.setIcon(Gui.getScaledIconResource("/img/bold.png", "B", 24, this)); + btnBold.setText(""); + btnItalic = new JButton(new StyledEditorKit.ItalicAction() ); + btnItalic.setIcon(Gui.getScaledIconResource("/img/italic.png", "B", 24, this)); + btnItalic.setText(""); + btnUnderline = new JButton(new StyledEditorKit.UnderlineAction() ); + btnUnderline.setIcon(Gui.getScaledIconResource("/img/underline.png", "B", 24, this)); + btnUnderline.setText(""); + grdGeneral.add(btnBold); + grdGeneral.add(btnItalic); + grdGeneral.add(btnUnderline); + grdGeneral.add(editingPanel); + + grdGeneral.nextRow(); + // description - txtDescription = new JTextArea(); - txtDescription.setLineWrap(true); - txtDescription.setWrapStyleWord(true); + txtDescription = new JEditorPane(); + txtDescription.setContentType("text/html"); grdGeneral.add(new QLabel("Beschreibung")).anchor(GridBagConstraints.FIRST_LINE_START); JScrollPane jsp = new JScrollPane(txtDescription, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); diff --git a/dozentenmodul/src/main/resources/img/bold.png b/dozentenmodul/src/main/resources/img/bold.png new file mode 100644 index 00000000..30baeaa7 Binary files /dev/null and b/dozentenmodul/src/main/resources/img/bold.png differ diff --git a/dozentenmodul/src/main/resources/img/italic.png b/dozentenmodul/src/main/resources/img/italic.png new file mode 100644 index 00000000..c7d6393d Binary files /dev/null and b/dozentenmodul/src/main/resources/img/italic.png differ diff --git a/dozentenmodul/src/main/resources/img/underline.png b/dozentenmodul/src/main/resources/img/underline.png new file mode 100644 index 00000000..b049a9ad Binary files /dev/null and b/dozentenmodul/src/main/resources/img/underline.png differ -- cgit v1.2.3-55-g7522