Java Convenience API
Note: The Java Convenience API is only available in Squish for Java editions.
Supporting unusual object graphs/hierarchies.
The Java Extension API for Custom Widgets explains how extend Squish to support non-standard parent-child relationships in custom Java types.
Java Convenience API Functions
Activates a JFace Action object. | |
Activates a menu item. | |
Invokes the platform's native color chooser dialog. | |
Invokes the platform's native directory chooser dialog. | |
Invokes the platform's native file chooser dialog. | |
Clicks a button. | |
Clicks on an item in a View. | |
Clicks on a named tab in a tab widget. | |
Expand/Collapse a node in a tree view (Swing or SWT). | |
Closes a message box dialog. | |
Closes a window. | |
Collapse a tree item (Swing or SWT). | |
Performs a mouse double-click. | |
Performs a double-click on an item in a view widget. | |
Performs a drag and drop operation. | |
Performs a drag operation. | |
Performs a drop after a call to startDrag. | |
Expand a tree item (Swing or SWT). | |
Plays a gesture. | |
Installs a global event handler. | |
Clicks the mouse on a specified widget/position. | |
Performs a mouse drag operation. | |
Moves the mouse scroll wheel. | |
Clicks the mouse at a specific position (AWT/Swing). | |
Returns a GestureBuilder object after reading data from a gesture file. | |
Sets the value of a slider or scrollbar. | |
Initiates a drag operation on a specified widget. | |
Types text into an input widget. |
Java Convenience API Classes/Objects
Object for storing touch stroke information. | |
Native Java Array | |
An object containing properties about the last SWT dialog. |
Java Convenience Function Parameters
Some of the Java convenience functions can take a modifierState
argument which indicates which special keys are pressed at the time of a mouse click. And some of the functions can also take a button
argument which indicates which mouse button was clicked.
The modifierState
values are different for AWT/Swing/JavaFX and for SWT. The modifier states don't have an enumeration so you must use the values from the following table that are relevant to the GUI toolkit.
Modifier | AWT/Swing/JavaFX | Value | SWT | Value |
---|---|---|---|---|
No modifier | 0 | 0 | ||
Shift | java.awt.Event.SHIFT_MASK | 1 | org.eclipse.swt.SWT.SHIFT | 131072 |
Control | java.awt.Event.CTRL_MASK | 2 | org.eclipse.swt.SWT.CTRL | 262144 |
Meta | java.awt.Event.META_MASK | 4 | ||
Alt | java.awt.Event.ALT_MASK | 8 | org.eclipse.swt.SWT.ALT | 65536 |
Command | org.eclipse.swt.SWT.COMMAND | 4194304 |
If more than one is used they must be OR
-d together, for example, for Shift and Control use 1|2
for AWT/Swing/JavaFX, and 131072|262144
for SWT.
The button
can be any one of the following:
Button Specifier | Information |
---|---|
Button.NoButton | Usually: Make target visible and move mouse, but do not click. |
Button.Button1 | Left mouse button |
Button.Button2 | Middle mouse button |
Button.Button3 | Right mouse button |
The form shown above works for Python and JavaScript. For Perl use this: Button::Button1
, etc. For Ruby use this: Button::BUTTON1
, etc. For Tcl use this: enum Button Button1
, etc.
Java Synthetic Properties
In addition to the public Java class fields, and synthetic properties generated from get*
and is*
functions, Squish provides some additional Synthetic Properties to make it easier to identify objects. (See Defining Property Sets for more details.)
These properties can only be used with the object name. And are not visible in the object properties list.
Property | Type | Description |
---|---|---|
aboveWidget | Object | Holds the object above this widget in the same logical parent Container or Composite . This should be used for objects that don't have a caption but often come with an accompanying widget. For example, edit boxes have no caption but might have a label above them. |
arrowDirection | String | Holds the direction of SWT buttons that have the arrow style enabled. |
buttonType | String | Holds the type of SWT buttons. This property is useful for identifying buttons with arrows. |
caption | String | Holds the object's title, caption, or text, if this object typically has such text to display. |
container | Object | Holds the parent Container or Composite that contains this object. These are typically tab pages or the menu bar. |
firstItemText | String | Holds the first text to be found for child SWT ToolItem objects. If no text is found, then the tooltip text is used. This property's value could be the empty string if no text is found and no tooltip text is set. |
firstTabCaption | String | Holds the caption of the first CTabItem of a CTabFolder . This property's value could be the empty string if no text is found. |
leftWidget | Object | Holds the object to the left of this widget in the same logical parent Container or Composite . This should be used for objects that don't have a caption but often come with an accompanying widget. For example, edit boxes have no caption but often have a label on their left. |
menuStyle | String | Holds the style of SWT menu—this indicates whether the menu is a menu bar, a popup menu, or a pull-down menu. |
type | String | Holds the object's class name—but with any periods in the name replaced with underscores. |
window | Object | Holds the top-level window that contains this object. |
© 2024 The Qt Company Ltd.
Documentation contributions included herein are the copyrights of
their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners.