Tile - greipadmin/greip GitHub Wiki

Introduction

Tile is a powerful widget with many formatted text sections in combination with a graphical decorator.

Constructor

  • Tile(Composite parent, int style)
    • parent the parent Composite
    • style reserved for future use, only SWT.NONE allowed

Methods

Decorator methods

  • void setDecorator(IDecorator decorator) sets the decorator (see Decorators)
  • IDecorator getDecorator() gets the current decorator
  • void setDecoratorAlignment(int alignment) sets the alignment of the decorator
  • int getDecoratorAlignment() returns the decorator alignment
  • void setDecoratorCursor(Cursor cursor) sets the used cursor when mouse hovers the decorator
  • Cursor getDecoratorCursor() gets the defined cursor
  • void setDecoratorSpacing(int decoratorSpacing) defines the distance between decorator and text sections
  • int getDecoratorSpacing() gets the defined distance between decorator and text sections

Text section methods

  • void addSection(TextSection section) add a new text section
  • void removeSections(TextSection... sections) removes text sections
  • void addSelectionListener(SelectionListener listener) adds a listener that is called by clicking links
  • void removeSelectionListener(SelectionListener listener) removes the listener
  • void setTextSpacing(int textSpacing) sets the spacing between two text sections
  • int getTextSpacing() gets the defined text spacing t line wrapping is enabled

Other methods

  • void setBorderColor(Color borderColor) sets the controls border color
  • Color getBorderColor() gets the defined border color
  • void setBorderWidth(int borderWith) sets the witdh of the border
  • int getBorderWidth() returns the border width
  • void setCornerRadius(int radius) sets the radius of rounded corners
  • int getCornerRadius() returns the defined radius
  • void setHighlight(boolean highlight) enables or disables highlighting on mouse over
  • boolean isHighlight() returns whether or not highlighting is enabled
  • void setMargins(int marginWidth, int marginHeight) defines the controls margin width and height
  • Point getMargins() returns the margins

Class TextSection

Constructors

  • TextSection(String text)
  • TextSection(String text, int alignment)
  • TextSection(String text, int alignment, Font font, Color foreground, boolean wrap)

Methods

  • TextSection setAlignment(int alignment) change the alignment of the text section
  • int getAlignment() gets the text sections alignment
  • TextSection setFont(Font font) sets the font of the text section
  • Font getFont() returns the text sections font
  • TextSection setForeground(Color foreground) sets the text sections text color
  • Color getForeground() returns the text sections text color
  • TextSection setMargins(int left, int right, int top, int bottom) sets the margins around the text section
  • int[] getMargins() returns the margins around the text section
  • TextSection setText(String text) change the textual content of the text section
  • String getText() gets the textual content
  • TextSection setWrap(boolean wrap) enables or disables line wrapping
  • boolean isWrap() returns whether or no

Text formatting

The text can contains some pseudo-HTML tags for formatting:

  • <a href="{id}"> to define a link. The attribute href is optional and accessible from selection listeners.
  • <b> to render text in bold
  • <br/> for adding a line break (platform dependent line breaks are also supported)
  • <i> to render text in italic
  • <s> to render strikeout text
  • <style fg="{color}" bg="{color}" size="{size}" font="{name}"> to define text foreground and background color as HTML color code (e.g. #FFAABB) the font size in pixels and the font name. All attributes are optional.
  • <sub> to render subscript text
  • <sup> to render superscript text
  • <u> to render text in underline
⚠️ **GitHub.com Fallback** ⚠️