|
IBM Rational Performance Tester SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.rational.ttt.common.protocols.ui.utils.GraphicsUtil
com.ibm.rational.common.test.editor.framework.EditorUiUtil
public final class EditorUiUtil
Some methods that can be used to create standard-looking UI components.
Nested Class Summary | |
---|---|
static interface |
EditorUiUtil.IOptionDescription
|
Field Summary | |
---|---|
static String |
KEY_BUTTON
Key used to access buttonassociated with combobox. |
static String |
KEY_COMBO
Key used to access combo box associated with toggle button. |
static String |
SEARCH_MATCH_RESULTS_KEY
|
Constructor Summary | |
---|---|
EditorUiUtil()
|
Method Summary | |
---|---|
static StyledString |
applyStandardStyles(StyledString sst,
int delimiter,
StyledString.Styler styler)
|
static Point |
calculateLocation(Menu mnu,
Rectangle size,
Point location,
int extraOffsetToRight)
|
static int[] |
computePolyline(Point left,
Point right,
int baseline,
int lineHeight)
|
static Control |
createChoiceCombo(Composite parent,
String[] contents,
int defaultSelection,
boolean sort,
SelectionListener selectionListener)
Creates a combobox for options or
options with toggle |
static ContentAssistCommandAdapter |
createContentAssistForSearchWidget(Control textOrCombo,
boolean enabled,
boolean makeRoomForDecoration)
Sets up a content assist for fields that accept user input for search term. |
static ControlDecoration |
createErrorControlDecorator(Control ctrl,
boolean visible)
|
static Control[] |
createOptions(Composite parent,
String prompt,
String[] contents,
int defaultSelection,
boolean sort,
SelectionListener selectionListener)
Creates options UI. |
static Control[] |
createOptionsAsRadioButtons(Composite parent,
String prompt,
String[] contents,
int defaultSelection,
SelectionListener selectionListener)
This is a shortcut that calls createOptionsAsRadioButtons(parent, prompt, contents, defaultSelection, selectionListener, null ) |
static Control[] |
createOptionsAsRadioButtons(Composite parent,
String prompt,
String[] contents,
int defaultSelection,
SelectionListener selectionListener,
EditorUiUtil.IOptionDescription optionDescription)
Displays options as a set of radiobuttons. |
static Control[] |
createOptionsWithToggle(Composite parent,
String prompt,
boolean enabled,
String[] contents,
int defaultSelection,
boolean sort,
SelectionListener selectionListener)
Creates toggle options UI. |
static void |
disableControl(Control ctrl,
boolean enabled)
|
static void |
enableComposite(Composite group,
boolean enable,
boolean redraw)
|
static void |
enableHyperlink(Hyperlink hyperLink,
boolean enable)
|
static Color |
getThemeColor(String _key,
boolean _register)
|
static ImageDescriptor |
loadImageDescriptor(IConfigurationElement element,
String name)
This class is not intended to be used by client code. |
static void |
setButtonLayoutData(Button button)
|
static Class |
setComboType(Class comboType)
Indicator that tells what type of combo box to create. |
static boolean |
setFlat(boolean flat)
Sets presentation mode. |
static Class |
setLabelType(Class labelType)
Indicator that tells what type of label to create. |
static String |
shortenText(String text,
boolean isTooltip)
Shortens (trims) given text accordings to the follwoing rules: If the length is shorter than 100, the text is unmodified. |
static String |
trimMenuText(String mtext)
Trims long text that is about to be used as a menu item. |
Methods inherited from class com.ibm.rational.ttt.common.protocols.ui.utils.GraphicsUtil |
---|
drawZeroLengthHighlight |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String KEY_COMBO
Widget.getData(String)
,
Constant Field Valuespublic static final String KEY_BUTTON
Widget.getData(String)
,
Constant Field Valuespublic static final String SEARCH_MATCH_RESULTS_KEY
Constructor Detail |
---|
public EditorUiUtil()
Method Detail |
---|
public static Control[] createOptions(Composite parent, String prompt, String[] contents, int defaultSelection, boolean sort, SelectionListener selectionListener)
parent
- A parent composite (or derivative)prompt
- Text to be displayed in the label prompt.contents
- Strings to be displayed in the combobox. The combobox is
non-modifiable.defaultSelection
- Index of the content string to select. If the index is beyond
the range of the content array, the first string will be
selected.sort
- indicates whether the content strings need to be sorted.
Sorting is done using String.compareTo(String)
method. If the defaultSelection is given, that string
will be selected after the array is sorted.selectionListener
- SelectionListener to be attached to the combobox or
null
.
EditorUiUtil.setComboType(Class)
,
EditorUiUtil.createOptionsWithToggle(Composite, String, boolean,
String[], int, boolean, SelectionListener)
public static Control[] createOptionsWithToggle(Composite parent, String prompt, boolean enabled, String[] contents, int defaultSelection, boolean sort, SelectionListener selectionListener)
parent
- A parent composite (or derivative)prompt
- Text to be displayed in the checkbox prompt.contents
- Strings to be displayed in the combobox. The combobox is
non-modifiable.defaultSelection
- Index of the content string to select. If the index is beyond
the range of the content array, the first string will be
selected.sort
- indicates whether the content strings need to be sorted.
Sorting is done using String.compareTo(String)
method. If the defaultSelection is given, that string
will be selected after the array is sorted.selectionListener
- SelectionListener to be attached to the combobox or
null
.
EditorUiUtil.createOptions(Composite, String, String[], int,
boolean, SelectionListener)
public static Control[] createOptionsAsRadioButtons(Composite parent, String prompt, String[] contents, int defaultSelection, SelectionListener selectionListener)
createOptionsAsRadioButtons(parent, prompt, contents, defaultSelection, selectionListener, null )
parent
- Composite.prompt
- String. If not null
, creates a Label
or CLabel
before any radio-buttons.contents
- String[]. Labels for radio-buttons options. Must not be null
and be non-empty.defaultSelection
- int. -1 or zero-based index of the option (radio-button) that should be selected.selectionListener
- SelectionListener. Optional SelectionListener
. If not null
, will be added to every radio-button.
Label
ot CLabel
(if prompt
argument was not null
). The rest of the elements in the array are radio-buttons.EditorUiUtil.createOptionsAsRadioButtons(Composite, String, String[], int, SelectionListener, com.ibm.rational.common.test.editor.framework.EditorUiUtil.IOptionDescription)
public static Control[] createOptionsAsRadioButtons(Composite parent, String prompt, String[] contents, int defaultSelection, SelectionListener selectionListener, EditorUiUtil.IOptionDescription optionDescription)
parent
- Composite.prompt
- String. If not null
, creates a Label
or CLabel
before any radio-buttons.contents
- String[]. Labels for radio-buttons options. Must not be null
and be non-empty.defaultSelection
- int. -1 or zero-based index of the option (radio-button) that should be selected.selectionListener
- SelectionListener. Optional SelectionListener
. If not null
, will be added to every radio-button.optionDescription
- IOptionDescription. If not null
, EditorUiUtil.IOptionDescription.draw(int, Composite, Button)
will be called after each button is created. This allows for any widgets to be added between radio-buttons.
Label
ot CLabel
(if prompt
argument was not null
). The rest of the elements in the array are radio-buttons.public static Control createChoiceCombo(Composite parent, String[] contents, int defaultSelection, boolean sort, SelectionListener selectionListener)
options
or
options with toggle
parent
- A parent composite (or derivative)contents
- Strings to be displayed in the combobox. The combobox is
non-modifiable.defaultSelection
- Index of the content string to select. If the index is beyond
the range of the content array, the first string will be
selected.sort
- indicates whether the content strings need to be sorted.
Sorting is done using String.compareTo(String)
method. If the defaultSelection is given, that string
will be selected after the array is sorted.selectionListener
- SelectionListener to be attached to the combobox or
null
.
EditorUiUtil.createChoiceCombo(Composite, String[], int, boolean,
SelectionListener)
,
EditorUiUtil.createOptionsWithToggle(Composite, String, boolean,
String[], int, boolean, SelectionListener)
public static ImageDescriptor loadImageDescriptor(IConfigurationElement element, String name)
element
- IConfigurationElementname
- String
public static Class setComboType(Class comboType)
comboType
- The comboType to set. CCombo.class
- the CCombo will be created.
Combo.class
- the Combo widget will be
created.
The main difference is that Combo widget does not support FLAT look-and-feel, while CCombo does.
Combo
,
CCombo
public static Class setLabelType(Class labelType)
public static String trimMenuText(String mtext)
mtext
- String
Dialog.ELLIPSIS
public static String shortenText(String text, boolean isTooltip)
tooltip
is false
, or the length is less than 310, the first 100 characters are taken and Dialog.ELLIPSIS
is appended.
tooltip
is true
, the text is broken into three lines of 100 each, and and Dialog.ELLIPSIS
is appended.
text
- String.isTooltip
- boolean.
text
public static boolean setFlat(boolean flat)
flat
- boolean. true
is used for displaying UI in the Test Editor details. false
is used for displaying UI where flat mode is undesirable (dialogs, preferences etc.)
public static void enableComposite(Composite group, boolean enable, boolean redraw)
public static StyledString applyStandardStyles(StyledString sst, int delimiter, StyledString.Styler styler)
public static void enableHyperlink(Hyperlink hyperLink, boolean enable)
public static Point calculateLocation(Menu mnu, Rectangle size, Point location, int extraOffsetToRight)
public static int[] computePolyline(Point left, Point right, int baseline, int lineHeight)
public static ContentAssistCommandAdapter createContentAssistForSearchWidget(Control textOrCombo, boolean enabled, boolean makeRoomForDecoration) throws IllegalArgumentException
ContentAssistCommandAdapter.setEnabled(boolean)
.
textOrCombo
- Widget for which the content assist needs to be set. Can only be Text
or Combo
.enabled
- boolean. The initial state of content assist.makeRoomForDecoration
- boolean. If true
attempts to adjust layout data object of textOrCombo
so that there is enough room to display the decoration. This argument will only have an effect if the existing layout data is of
type GridData
or null
.
ContentAssistCommandAdapter
. Client code can customize further as needed.
IllegalArgumentException
- if the first argument is of non-supported type.TestEditor.getRegexSearchValue()
public static void setButtonLayoutData(Button button)
public static void disableControl(Control ctrl, boolean enabled)
public static ControlDecoration createErrorControlDecorator(Control ctrl, boolean visible)
public static Color getThemeColor(String _key, boolean _register)
_key
- String Color keyregister
- boolean. If true
, the color will be managed by the ColorRegistry and the 'dispose'
method must not be called. If false
, the caller is responsible for disposing of the color when
no longer needed.
key
and declared in "org.eclipse.ui.themes"
extension point.
|
IBM Rational Performance Tester SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |