1 /**
2 * Copyright 2010 The Kuali Foundation Licensed under the
3 * Educational Community License, Version 2.0 (the "License"); you may
4 * not use this file except in compliance with the License. You may
5 * obtain a copy of the License at
6 *
7 * http://www.osedu.org/licenses/ECL-2.0
8 *
9 * Unless required by applicable law or agreed to in writing,
10 * software distributed under the License is distributed on an "AS IS"
11 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12 * or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15
16 package org.kuali.student.common.ui.client.widgets;
17
18
19
20 import org.kuali.student.common.ui.client.widgets.impl.KSRichEditorImpl;
21
22 import com.google.gwt.core.client.GWT;
23 import com.google.gwt.event.dom.client.BlurHandler;
24 import com.google.gwt.event.dom.client.FocusHandler;
25 import com.google.gwt.event.shared.HandlerRegistration;
26 import com.google.gwt.user.client.ui.HasText;
27 import com.google.gwt.user.client.ui.RichTextArea;
28
29 /**
30 * KSRichEditor is the KS default rich text editor. The editor provides a variety of text formatting options commonly
31 * found in traditional text editors. It also features a toolbar which only shows when the editor is in focus and a pop-out
32 * window which allows a user to have more space to work (and can be resized). Any changes made in the pop-out
33 * editor are reflected in the original editor when the user is finished.
34 *
35 * TODO implement i18n
36 */
37 @Deprecated
38 public class KSRichEditor extends KSRichEditorAbstract implements HasText{
39 private KSRichEditorAbstract richEditor = GWT.create(KSRichEditorImpl.class);
40
41 /**
42 * Creates a new KSRichEditor.
43 *
44 */
45 public KSRichEditor(){
46 initWidget(richEditor);
47 }
48
49 /**
50 * Gets the RichTextArea widget used for text input in this rich editor widget.
51 *
52 * @return the RichTextArea used in this editor
53 */
54 public RichTextArea getRichTextArea(){
55 return richEditor.getRichTextArea();
56 }
57
58 /**
59 * Get the HTML version of the text input (retains all formatting).
60 *
61 * @return the HTML version of the input text (with formatting)
62 */
63 public String getHTML() {
64 return richEditor.getHTML();
65 }
66
67 /**
68 * Get the plain text version of the text input (retains NO formatting).
69 *
70 * @return the plain text version of the input text (no formatting)
71 */
72 public String getText() {
73 return richEditor.getText();
74 }
75
76 /**
77 * Set the HTML of this rich text editor.
78 *
79 * @param html the HTML to set this editor to
80 */
81 public void setHTML(String html) {
82 richEditor.setHTML(html);
83 }
84
85 /**
86 * Set the text of this rich text editor (this is text with no formatting).
87 *
88 * @param the plain text to set this editor to
89 */
90 public void setText(String text) {
91 richEditor.setText(text);
92 }
93
94
95 @Override
96 public void setStyleName(String text) {
97 richEditor.setStyleName(text);
98 }
99
100
101 @Override
102 public HandlerRegistration addBlurHandler(BlurHandler handler) {
103 return richEditor.addBlurHandler(handler);
104 }
105
106
107 @Override
108 public HandlerRegistration addFocusHandler(FocusHandler handler) {
109 return richEditor.addFocusHandler(handler);
110 }
111
112 @Override
113 protected void init() {
114 richEditor.init();
115
116 }
117 }