Sferyx JSyndrome HTMLEditor Family
Eclipse / SWT Integration Manual
 

 

1. How can I integrate the editor in an Eclipse / SWT Application?

 Place the jar file in the designer's build classpath and it will be loaded by the Eclipse environment. You can add this as follows:

Your project --> Build Path --> Configure Build path --> add HTMLEditorPro.jar

and make sure to import all the necessary packages including org.eclipse.swt.awt.SWT_AWT which is the SWT_AWT bridge.

2. How to instantiate and load the class?

 We have provided a special wrapper class sferyx.administration.HTMLEditorSWTBean class which provides instant integration with just a few lines of code as follows:

Composite composite = new Composite(shell, SWT.NO_BACKGROUND | SWT.EMBEDDED);
Frame frame = SWT_AWT.new_Frame(composite);
HTMLEditorSWTBean htmlEditorSWTBean=new HTMLEditorSWTBean();
frame.add(htmlEditorSWTBean);
shell.open();

In HTMLEditor distribution in the folder "examples/eclipse-swt integration examples" you can find sample application illustrating the SWT integration in details.

3. How to set / get the content of the editor?

 You can use the methods available directly into the HTMLEditorSWTBean  class such as setContent(String content), getContent() etc, or by accessing directly the HTMLEditor class you can use the entire editor's API like this :

HTMLEditor htmlEditor=htmlEditorSWTBean.getHTMLEditorInstance();

 

4. Available methods accessible directly from the sferyx.administration.editors.HTMLEditorSWTBean :

public void setContent(String htmlContent) - sets the content of the editor

public void insertContent(String htmlContent)
- inserts new content into the editor at the caret position

public void insertPlainText(String htmlContent)
- inserts new plain text into the editor at the caret position

public void setRemovedToolbarItems(String itemList)
-allows customization of the toolbars

public void setRemovedMenuItems(String itemList)
-allows customization of the menu items

public void setRemovedMenus(String itemList)
- allows customization of the menus

public void setStatusBarVisible(boolean visible)
-sets the state of the status bar.

public void setPopupMenuVisible(boolean visible) -sets the state of the popup menu.
 
public String getContent()
-gets the content of the editor.

public String getPlainText()
-gets the content of the editor as plain text.

public void setToolBarVisible(boolean visible)
-sets the state of the toolbar bar.

public String getBodyContent() 
-gets the body contentof the editor - no html and head tags will be generated

public void insertImage(String imageURL)
- inserts image at the caret position

public void insertLink(String linkURL) 
- inserts link over the selected text

public void setDefaultCharset(String encoding)
 
public void openLocation(String location)
- opens the given location inside the editor

public void setExternalDictionary(String externalDictionary)
- loads external dictionary

public void setPreviewModeOnly(boolean previewModeOnly)
- sets the preview mode only

public void openContentBuffer()
- opens a content buffer for loading large content

public void appendContentToContentBuffer(String content)
- appends new content to a content buffer for loading large content

public void closeBufferAndInsert()
- closes the buffer and inserts the content into the editor

public int getBodyContentLenght()
- returns a length limit set previously for the editor

public int getContentLenght()
- returns a length of the content.

public String getBodyContentPortion(int offset, int length)
- returns a portion of the body content.

public String getContentPortion(int offset, int length)
- returns a portion of the content.

public void setSourceEditorVisible(boolean visible)
-sets the state of the source editor.

public void setPreviewVisible(boolean visible) 
-sets the state of the preview.

public void setAsYouTypeSpellcheckingEnabled(boolean enabled)
- sets the state of spellchecker

public boolean isDocumentEdited()
- returns whether the document has been edited or not.

public void setPreferredPasteOperation(int preferredPasteOperation)
- sets the preferred paste operation

public int getPreferredPasteOperation()
- gets the preferred paste operation

public void loadExternalStyleSheet(String externalStyleSheetLocation)
-loads external CSS file

public String getBodyUnicodeContent()
 - returns the unicode content

public void setSourceCodeModeOnly(boolean sourceCodeModeOnly)
 - sets the source mode only

public void setShowBodyContentOnlyInSource(java.lang.String _showBodyContentOnlyInSource) -
This method will cause the editor to show only the body content when switching to the HTML source editor.

public String getExternalStyleSheetLocation() -
Returns the URL as string of the external style sheet loaded and used to apply style classes to the document elements

public void loadExternalStyleSheet(javax.swing.text.html.StyleSheet styleSheet, java.lang.String styleSheetURL) -
Loads external style sheet specified by the given URL and adds its content to the existing style classes.

public void setExternalStyleSheetLocation(java.lang.String externalStyleSheetLocation) -
Sets the external style sheet to be loaded and used for rendering and editing of the document.

public void loadStyleSheetRules(java.lang.String styleSheet) -
Allows to load some style rules dynamically like for example body{background-color:red} etc.

public void setDefaultInitialFont(String initialFont)
- sets the default font family to be used by the editor.

public void setDefaultInitialFontSize(String fontSize)
- sets the default font size to be used by the editor.

public String getContentAccessibleForScreenReaders()
- gets accessible content intended for screen readers - this will generate tags which are understood by the screen readers.

public String getBodyContentAccessibleForScreenReaders()
- gets accessible cbody ontent intended for screen readers - this will generate tags which are understood by the screen readers.

public HTMLEditor getHTMLEditorInstance() - you can use this method to get a direct reference to the HTMLEditor instance and use all the available API as you whish. This allows full customization and access to all the available features of the HTMLEditor class.

 

 

Our Services and assistance

All Sferyx products are assured with continuous e-mail support. With the retail products is included in the price 30 days startup support. Additionally, you can purchase annual support subscription tickets from our web store.

Sferyx offers also a wide range of customization services for its products in order to satisfy any customer requirement. We can adapt our products to fit the customer needs and any kind of integration requirements. We execute also express developments, customization under request, development of new features on demand. You can request a quote at sales@sferyx.com or support@sferyx.com indicating your requirements and the terms of delivery.

 

 


Copyright © 2002 Sferyx Srl. All rights reserved. Sferyx and the Sferyx logo are registered trademarks of Sferyx Srl. http://www.sferyx.com