net.sourceforge.rssowl.util.shop
Class WidgetShop

java.lang.Object
  extended bynet.sourceforge.rssowl.util.shop.WidgetShop

public class WidgetShop
extends Object

Factory class to tweak Widgets in RSSOwl

Version:
1.1.3
Author:
Benjamin Pasero

Field Summary
static int openDialogsCount
          Global counter for all opened non-modal Dialogs.
 
Constructor Summary
private WidgetShop()
          This utility class constructor is hidden
 
Method Summary
static Vector calculateStyleRanges(org.eclipse.swt.custom.StyledText textField, Vector words, org.eclipse.swt.graphics.Color foreground, org.eclipse.swt.graphics.Color background, int fontstyle, boolean caseSensitive, boolean underline)
          From the given Vector of words calculate all StyleRanges using the Color and Font Style that is given.
static void createWildCardMenu(org.eclipse.swt.widgets.Text text, String[] wildcards)
          Apply a wildcard popup menu to the text.
static void highlightText(org.eclipse.swt.custom.StyledText textField, Vector styleRanges)
          Set the given StyleRanges from the Vector to the StyledText
static void highlightText(org.eclipse.swt.custom.StyledText textField, Vector words, org.eclipse.swt.graphics.Color foreground, org.eclipse.swt.graphics.Color background, int fontstyle, boolean caseSensitive, boolean underline)
          Change fontstyle / background / foreground of the given words adding a StyleRange to the given TextField.
static void initMnemonics(org.eclipse.swt.widgets.Button[] buttons)
          Set Mnemonics to the given Array of Buttons.
static void initMnemonics(org.eclipse.swt.widgets.ToolItem[] items)
          Set Mnemonics to the given Array of ToolItems.
static boolean isset(org.eclipse.swt.widgets.Widget widget)
          Check the given widget for being NULL or disposed.
static boolean isWidget(Object obj)
          Check the given Object for being a valid Widget
static void setupDropSupport(org.eclipse.swt.widgets.Text text, Runnable runOnDrop)
          Setup Drop Support for the given Text Widget.
static void tweakTextWidget(org.eclipse.swt.widgets.Text text)
          Tweak the Text widget with adding listeners to call the selectAll() Method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

openDialogsCount

public static int openDialogsCount
Global counter for all opened non-modal Dialogs. These are Feed-Search, Feed-Discovery and Feed-Validator Dialogs in RSSOwl. The number is used to control the position of the next opening Dialog such as it will not overlap over an existing Dialog.

Constructor Detail

WidgetShop

private WidgetShop()
This utility class constructor is hidden

Method Detail

calculateStyleRanges

public static Vector calculateStyleRanges(org.eclipse.swt.custom.StyledText textField,
                                          Vector words,
                                          org.eclipse.swt.graphics.Color foreground,
                                          org.eclipse.swt.graphics.Color background,
                                          int fontstyle,
                                          boolean caseSensitive,
                                          boolean underline)
From the given Vector of words calculate all StyleRanges using the Color and Font Style that is given.

Parameters:
textField - Textfield where the text is in
words - Words to be highlighted
foreground - Color of the text-foreground
background - Color of the text-background
fontstyle - Fontstyle for the highlighted words
caseSensitive - FALSE if the case of the word to highlight should be ignored
underline - If TRUE, underline the StyleRange
Returns:
Vector A Vector containing all calculated StyleRanges

createWildCardMenu

public static void createWildCardMenu(org.eclipse.swt.widgets.Text text,
                                      String[] wildcards)
Apply a wildcard popup menu to the text. Wildcards a displayed as "[TEXT]" and represent replaceable parameters.

Parameters:
text - The control to append the menu
wildcards - The wildcards to add to the menu

highlightText

public static void highlightText(org.eclipse.swt.custom.StyledText textField,
                                 Vector styleRanges)
Set the given StyleRanges from the Vector to the StyledText

Parameters:
textField - Textfield where the text is in
styleRanges - Vector containing StyleRanges

highlightText

public static void highlightText(org.eclipse.swt.custom.StyledText textField,
                                 Vector words,
                                 org.eclipse.swt.graphics.Color foreground,
                                 org.eclipse.swt.graphics.Color background,
                                 int fontstyle,
                                 boolean caseSensitive,
                                 boolean underline)
Change fontstyle / background / foreground of the given words adding a StyleRange to the given TextField.

Parameters:
textField - Textfield where the text is in
words - Words to be highlighted
foreground - Color of the text-foreground
background - Color of the text-background
fontstyle - Fontstyle for the highlighted words
caseSensitive - FALSE if the case of the word to highlight should be ignored
underline - If TRUE, underline the StyleRange

initMnemonics

public static void initMnemonics(org.eclipse.swt.widgets.Button[] buttons)
Set Mnemonics to the given Array of Buttons.

Parameters:
buttons - The Buttons

initMnemonics

public static void initMnemonics(org.eclipse.swt.widgets.ToolItem[] items)
Set Mnemonics to the given Array of ToolItems.

Parameters:
items - The ToolItems

isset

public static boolean isset(org.eclipse.swt.widgets.Widget widget)
Check the given widget for being NULL or disposed. Return false in that case.

Parameters:
widget - The widget to check
Returns:
boolean TRUE if the widget is alive

isWidget

public static boolean isWidget(Object obj)
Check the given Object for being a valid Widget

Parameters:
obj - The Object to check
Returns:
boolean TRUE if the Object is a widget and alive

setupDropSupport

public static void setupDropSupport(org.eclipse.swt.widgets.Text text,
                                    Runnable runOnDrop)
Setup Drop Support for the given Text Widget. This allows to drop Data via TextTransfer into the Widget. Some checks are made, before inserting the Text. If a Link is supplied, it will be preferred.

After successfull Drop, the Runnable will be started, if supplied.

Parameters:
text - The Text Widget to enable Drop Support.
runOnDrop - The Runnable to be run after successfull Drop, or NULL.

tweakTextWidget

public static void tweakTextWidget(org.eclipse.swt.widgets.Text text)
Tweak the Text widget with adding listeners to call the selectAll() Method. The Method is called on MouseDoubleClick and on CTRL+A / CMD+A pressed.

Parameters:
text - The Text widget to tweak


RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo