Source Code Cross Referenced for HtmlEditor.java in  » Ajax » gwtext-2.01 » com » gwtext » client » widgets » form » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Ajax » gwtext 2.01 » com.gwtext.client.widgets.form 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * GWT-Ext Widget Library
003:         * Copyright(c) 2007-2008, GWT-Ext.
004:         * licensing@gwt-ext.com
005:         * 
006:         * http://www.gwt-ext.com/license
007:         */
008:
009:        package com.gwtext.client.widgets.form;
010:
011:        import com.google.gwt.core.client.JavaScriptObject;
012:        import com.gwtext.client.util.JavaScriptObjectHelper;
013:        import com.gwtext.client.widgets.Toolbar;
014:        import com.gwtext.client.widgets.form.event.HtmlEditorListener;
015:
016:        /**
017:         * Provides a lightweight HTML Editor component.
018:         * <p/>
019:         * Note: The focus/blur and validation marking functionality inherited from {@link Field} is NOT supported by this editor.
020:         * <br/><br/>
021:         * An Editor is a sensitive component that can't be used in all spots standard fields can be used. Putting an Editor within any element that has display set to 'none' can cause problems in Safari and Firefox.
022:         * <br/> <br/>
023:         * <p/>
024:         * There can only be one HtmlEditor on a page at a time.
025:         */
026:        public class HtmlEditor extends Field {
027:
028:            private static JavaScriptObject configPrototype;
029:
030:            static {
031:                init();
032:            }
033:
034:            private static native void init()/*-{
035:            		var c = new $wnd.Ext.form.HtmlEditor();
036:            		@com.gwtext.client.widgets.form.HtmlEditor::configPrototype = c.initialConfig;
037:            	}-*/;
038:
039:            protected JavaScriptObject getConfigPrototype() {
040:                return configPrototype;
041:            }
042:
043:            public String getXType() {
044:                return "htmleditor";
045:            }
046:
047:            public HtmlEditor(JavaScriptObject jsObj) {
048:                super (jsObj);
049:            }
050:
051:            public HtmlEditor() {
052:            }
053:
054:            public HtmlEditor(String fieldLabel) {
055:                super (fieldLabel);
056:            }
057:
058:            public HtmlEditor(String fieldLabel, String name) {
059:                super (fieldLabel, name);
060:            }
061:
062:            public HtmlEditor(String fieldLabel, String name, int width) {
063:                super (fieldLabel, name, width);
064:            }
065:
066:            protected native JavaScriptObject create(JavaScriptObject jsObj) /*-{
067:                   return new $wnd.Ext.form.HtmlEditor(jsObj);
068:               }-*/;
069:
070:            /**
071:             * Executes a Midas editor command directly on the editor document. For visual commands, you should use relayCmd instead. This should only be called after the editor is initialized.
072:             *
073:             * @param cmd   the Midas command
074:             * @param value the value to pass to the command
075:             */
076:            public native void execCmd(String cmd, String value) /*-{
077:                   var he = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
078:                   he.execCmd(cmd, value);
079:               }-*/;
080:
081:            /**
082:             * Returns the editor's toolbar. This is only available after the editor has been rendered.
083:             *
084:             * @return toolbar
085:             */
086:            public Toolbar getToolbar() {
087:                return new Toolbar(getToolbar(getOrCreateJsObj()));
088:            }
089:
090:            private native JavaScriptObject getToolbar(JavaScriptObject he) /*-{
091:                   return he.getToolbar();    
092:               }-*/;
093:
094:            /**
095:             * Inserts the passed text at the current cursor position. Note: the editor must be initialized and activated to insert text.
096:             *
097:             * @param text the text to insert
098:             */
099:            public native void insertAtCursor(String text) /*-{
100:                   var he = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
101:                   he.insertAtCursor(text);
102:               }-*/;
103:
104:            /**
105:             * Executes a Midas editor command on the editor document and performs necessary focus and toolbar updates. This should only be called after the editor is initialized.
106:             *
107:             * @param cmd   the Midas command
108:             * @param value the value to pass to the command
109:             */
110:            public native void relayCmd(String cmd, String value) /*-{
111:                   var he = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
112:                   he.relayCmd(cmd, value);
113:               }-*/;
114:
115:            /**
116:             * Toggles the editor between standard and source edit mode.
117:             *
118:             * @param sourceEdit true for source edit, false for standard
119:             */
120:            public native void toggleSourceEdit(boolean sourceEdit) /*-{
121:                   var he = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
122:                   he.toggleSourceEdit(sourceEdit);
123:               }-*/;
124:
125:            /**
126:             * Adds a HtmlEditor listener.
127:             *
128:             * @param listener the listener
129:             */
130:            public native void addListener(HtmlEditorListener listener) /*-{
131:                   this.@com.gwtext.client.widgets.form.Field::addListener(Lcom/gwtext/client/widgets/form/event/FieldListener;)(listener);
132:                   var fieldJ = this;
133:
134:                   this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('activate',
135:                           function(fld) {
136:                               return listener.@com.gwtext.client.widgets.form.event.HtmlEditorListener::onActivate(Lcom/gwtext/client/widgets/form/HtmlEditor;)(fieldJ);
137:                           }
138:                   );
139:
140:                   this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('beforepush',
141:                           function(fld, html) {
142:                               return listener.@com.gwtext.client.widgets.form.event.HtmlEditorListener::doBeforePush(Lcom/gwtext/client/widgets/form/HtmlEditor;Ljava/lang/String;)(fieldJ, html);
143:                           }
144:                   );
145:                   this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('beforesync',
146:                           function(fld, html) {
147:                               return listener.@com.gwtext.client.widgets.form.event.HtmlEditorListener::doBeforeSync(Lcom/gwtext/client/widgets/form/HtmlEditor;Ljava/lang/String;)(fieldJ, html);
148:                           }
149:                   );
150:
151:                   this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('editmodechange',
152:                           function(fld, sourceEdit) {
153:                               listener.@com.gwtext.client.widgets.form.event.HtmlEditorListener::onEditModeChange(Lcom/gwtext/client/widgets/form/HtmlEditor;Z)(fieldJ, sourceEdit);
154:                           }
155:                   );
156:
157:                   this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('initialize',
158:                          function(fld) {
159:                               return listener.@com.gwtext.client.widgets.form.event.HtmlEditorListener::onInitialize(Lcom/gwtext/client/widgets/form/HtmlEditor;)(fieldJ);
160:                           }
161:                   );
162:               
163:                   this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('push',
164:                         function(fld, html) {
165:                               listener.@com.gwtext.client.widgets.form.event.HtmlEditorListener::onPush(Lcom/gwtext/client/widgets/form/HtmlEditor;Ljava/lang/String;)(fieldJ, html);
166:                           }
167:                   );
168:
169:                   this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('sync',
170:                           function(fld, html) {
171:                               listener.@com.gwtext.client.widgets.form.event.HtmlEditorListener::onSync(Lcom/gwtext/client/widgets/form/HtmlEditor;Ljava/lang/String;)(fieldJ, html);
172:                           }
173:                   );
174:               
175:               }-*/;
176:
177:            // --- config properties ---
178:
179:            /**
180:             * The default text for the create link prompt.
181:             *
182:             * @param createLinkText link text
183:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
184:             */
185:            public void setCreateLinkText(String createLinkText)
186:                    throws IllegalStateException {
187:                setAttribute("createLinkText", createLinkText, true);
188:            }
189:
190:            /**
191:             * The default value for the create link prompt (defaults to http:/ /).
192:             *
193:             * @param defaultLinkValue link value
194:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
195:             */
196:            public void setDefaultLinkValue(String defaultLinkValue)
197:                    throws IllegalStateException {
198:                setAttribute("defaultLinkValue", defaultLinkValue, true);
199:            }
200:
201:            /**
202:             * Enable the left, center, right alignment buttons (defaults to true).
203:             *
204:             * @param enableAlignments true to enable alignments
205:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
206:             */
207:            public void setEnableAlignments(boolean enableAlignments)
208:                    throws IllegalStateException {
209:                setAttribute("enableAlignments", enableAlignments, true);
210:            }
211:
212:            /**
213:             * Enable the fore/highlight color buttons (defaults to true).
214:             *
215:             * @param enableColors true to enable colors
216:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
217:             */
218:            public void setEnableColors(boolean enableColors)
219:                    throws IllegalStateException {
220:                setAttribute("enableColors", enableColors, true);
221:            }
222:
223:            /**
224:             * Enable font selection. Not available in Safari. (defaults to true).
225:             *
226:             * @param enableFont true to enable fonr selection
227:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
228:             */
229:            public void setEnableFont(boolean enableFont)
230:                    throws IllegalStateException {
231:                setAttribute("enableFont", enableFont, true);
232:            }
233:
234:            /**
235:             * Enable the increase/decrease font size buttons (defaults to true).
236:             *
237:             * @param enableFontSize true to enable font size buttons
238:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
239:             */
240:            public void setEnableFontSize(boolean enableFontSize)
241:                    throws IllegalStateException {
242:                setAttribute("enableFontSize", enableFontSize, true);
243:            }
244:
245:            /**
246:             * Enable the create link button. Not available in Safari. (defaults to true).
247:             *
248:             * @param enableLinks true to enable links
249:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
250:             */
251:            public void setEnableLinks(boolean enableLinks)
252:                    throws IllegalStateException {
253:                setAttribute("enableLinks", enableLinks, true);
254:            }
255:
256:            /**
257:             * Enable the bullet and numbered list buttons. Not available in Safari. (defaults to true).
258:             *
259:             * @param enableLists true to enable lists
260:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
261:             */
262:            public void setEnableLists(boolean enableLists)
263:                    throws IllegalStateException {
264:                setAttribute("enableLists", enableLists, true);
265:            }
266:
267:            /**
268:             * Enable the switch to source edit button. Not available in Safari. (defaults to true)
269:             *
270:             * @param enableSourceEdit true to enable source edit
271:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
272:             */
273:            public void setEnableSourceEdit(boolean enableSourceEdit)
274:                    throws IllegalStateException {
275:                setAttribute("enableSourceEdit", enableSourceEdit, true);
276:            }
277:
278:            /**
279:             * An array of available font families.
280:             *
281:             * @param fontFamilies the font families
282:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
283:             */
284:            public void setFontFamilies(String[] fontFamilies)
285:                    throws IllegalStateException {
286:                setAttribute("fontFamilies", JavaScriptObjectHelper
287:                        .convertToJavaScriptArray(fontFamilies), true);
288:            }
289:
290:            /**
291:             * Set the height of the HtmlEditor.
292:             *
293:             * @param height the feild height
294:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
295:             */
296:            public void setHeight(int height) throws IllegalStateException {
297:                setAttribute("height", height, true);
298:            }
299:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.