
Home
.. Links
.. Search
.. Plugins
.. Help
.. Irc Faq
Projects
.. Platform/Faq
.. JDT/Faq/Plan
.. PDE/Faq
.. SWT/Faq
.. RCP/Faq
Tools Projects
.. CDT/Faq
.. GEF/Faq
.. EMF/Faq
Wiki Tutorials
Hosted Projects
.. MTJ
.. Google Summer Of Code 2007
.. Update Manager 2.0
.. EasyEclipse
.. Stylebase for Eclipse
Archives
| |
This class is a read-only text control that is capable of rendering wrapped text. Text can be rendered as-is or by parsing the formatting XML tags. Independently, words that start with http:// can be converted into hyperlinks on the fly. When configured to use formatting XML, the control requires the root element form to be used. The following tags can be children of the form element: - p - for defining paragraphs. The following attributes are allowed:
- vspace - if set to 'false', no vertical space will be added (default is 'true')
- li - for defining list items. The following attributes are allowed:
- vspace - the same as with the p tag
- style - could be 'bullet' (default), 'text' and 'image'
- value - not used for 'bullet'. For text, it is the value of the text to rendered as a bullet. For image, it is the href of the image to be rendered as a bullet.
- indent - the number of pixels to indent the text in the list item
- bindent - the number of pixels to indent the bullet itself
Text in paragraphs and list items will be wrapped according to the width of the control. The following tags can appear as children of either p or li elements: - img - to render an image. Element accepts attribute 'href' that is a key to the Image set using 'setImage' method.
- a - to render a hyperlink. Element accepts attribute 'href' that will be provided to the hyperlink listeners via HyperlinkEvent object. The element also accepts 'nowrap' attribute (default is false). When set to 'true', the hyperlink will not be wrapped.
- b - the enclosed text will use bold font.
- br - forced line break (no attributes).
- span - the enclosed text will have the color and font specified in the element attributes. Color is provided using 'color' attribute and is a key to the Color object set by 'setColor' method. Font is provided using 'font' attribute and is a key to the Font object set by 'setFont' method.
None of the elements can nest. For example, you cannot have b inside a span . This was done to keep everything simple and transparent. Care should be taken when using this control. Form text is not an HTML browser and should not be treated as such. If you need complex formatting capabilities, use Browser widget. If you need editing capabilities and font/color styles of text segments is all you need, use StyleText widget. Finally, if all you need is to wrap text, use SWT Label widget and create it with SWT.WRAP style. You should be careful not to ask the control to render large quantities of text. It does not have advanced support for dirty regions and will repaint fully each time. Instead, combine the control in a composite with other controls and let SWT take care of the dirty regions. Although the class is not marked final,
Last Modified 6/14/06 3:47 PM
| Hide Tools
|