xworker.lang.MetaDescriptor3/@SwtObject/@SwtEditorExtends
事物 SWT编辑器输入扩充(SwtEditorExtends)点击打开事物点击浏览描述

父事物:
SWT编辑设置
描述者:
子事物
thing
继承:
Composite

SWT control to expand while the editor has inherited Composite, but the actual use only Composite sub-things.

字段摘要
           String BORDER
           
           String DOUBLE_BUFFERED
           
           String EMBEDDED
           
           String H_SCROLL
           
           String NO_BACKGROUND
           
           String NO_FOCUS
           
           String NO_MERGE_PAINTS
           
           String NO_RADIO_GROUP
           
           String NO_REDRAW_RESIZE
           
           String V_SCROLL
           
           String background
           Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.
           String backgroundImage
           Sets the receiver's background image to the image specified by the argument, or to the default system color for the control if the argument is null.
           String backgroundMode
           
           String bounds
           Sets the receiver's size and location to the rectangular area specified by the arguments.
           String capture
           If the argument is true, causes the receiver to have all mouse events delivered to it until the method is called with false as the argument.
           String cls
           样式名称。
           String cursor
           Sets the receiver's cursor to the cursor specified by the argument, or to the default cursor for that kind of control if the argument is null.
           String enabled
           Enables the receiver if the argument is true, and disables it otherwise.
           String font
           Sets the font that the receiver will use to paint textual information to the font specified by the argument, or to the default font for that kind of control if the argument is null.
           String foreground
           Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.
           String label(标签)
           当这个Composite显示在IDE的编辑栏时作为显示的标签。
           String layoutData
           Sets the layout data associated with the receiver to the argument.
           String location
           Sets the receiver's location to the point specified by the arguments which are relative to the receiver's parent (or its display if its parent is null), unless the receiver is a shell.
           String menu
           Sets the receiver's pop up menu to the argument.
           String name
           
           String parent
           Changes the parent of the widget to be the one provided if the underlying operating system supports this feature.
           String redraw
           If the argument is false, causes subsequent drawing operations in the receiver to be ignored.
           String region
           Sets the shape of the control to the region specified by the argument.
           String size
           Sets the receiver's size to the point specified by the arguments.
           String toolTipText
           Sets the receiver's tool tip text to the argument, which may be null indicating that no tool tip text should be shown.
           String varref(变量引用)
           引用上下文中的其他变量。
           String visible
           Marks the receiver as visible if the argument is true, and marks it invisible otherwise.
           String xw_cl_global(全局变量)
           如果是全局变量,那么它将会放入到动作上下文中的索引为0的变量范围中。
           String xw_cl_namespace(名字空间)
           如果指定了名字空间,那么放入到指定的名字空间中。
           String xw_cl_varName(变量名)
           放入到动作上下文中的变量名称,如果没有则不放入到变量上下文中。
 
方法摘要
           addObjectToContext
          
           create
          
           getStyles
          
           init
          
           runDesign
          
 
子事物摘要
           AnimationGif
          动画GIF,可绑定到父控件作为动画背景图,如果父控件已销毁那么动画GIF的相关资源也销毁。
           BREAK
          终止当前操作,循环或者SWITCH等可以终止BREAK,如果没有循环或SWITCH那么可能会直接调出方法的调用。
           Browser
          Instances of this class implement the browser user interface metaphor. It allows the user to visualize and navigate through HTML documents.
           Button
          
           CBanner
          Instances of this class implement a Composite that lays out its children and allows programmatic control of the layout. It draws a separator between the left and right children which can be dragged to resize the right control. CBanner is used in the workbench to layout the toolbar area and perspective switching toolbar.
           CCombo
          The CCombo class represents a selectable user interface object that combines a text field and a list and issues notification when an item is selected from the list.
           CONTINUE
          调到循环的开头继续执行循环,当前循环内部剩余的跳过。
           CTabFolder
          Instances of this class implement the notebook user interface metaphor. It allows the user to select a notebook page from set of pages.
           Canvas
          
           ChartComposite
          A SWT GUI composite for displaying a {@link JFreeChart} object.
           ChatText
          
           Code
          在创建SWT窗体时只执行一次的Groovy代码。
           CodeEditor
          可以对代码着色的编辑器,可以显示列数和行数。创建后返回的是StyleText。
           Combo
          
           Composite
          Instances of this class are controls which are capable of containing other controls.
           ControlEditor
          
           ControlListener
          Classes which implement this interface provide methods that deal with the events that are generated by moving and resizing controls.
           CoolBar
          
           Cursor
          Cursor创建后需要显式的dispose。
           DO
          循环控制语句。语法是:
           DataObjectEditCompoiste
          一个有查询和表格的数据对象编辑面板。
           DataObjectForm
          数据对象表单,和事物表单类似,参看事物表单。
           DataStore
          
           DataStores
          各种DataStore的注册地。
           DataTable
          DataTable已经很少用了,使用Table和DataStore代替。
           DataTree
          使用Tree和TreeModel代替。
           DateChooser
          
           DateChooserCombo
          
           DatePickerCombo
          日期输入和选择控件,本事物创建后返回Text框,变量保存的也是Text框。
           DateTime
          
           DisposeListener
          Classes which implement this interface provide a method that deals with the event that is generated when a widget is disposed.
           DragDetectListener
          
void dragDetected(DragDetectEvent e)
           DragMove
          向父控件天价MouseListener和MouseMoveListener,实现监听拖拽。
           DragSource
          DragSource defines the source object for a drag and drop transfer.
           DropTarget
          Class DropTarget defines the target object for a drag and drop transfer.
           EditableTable
          已不再使用,使用Table+DataStore的方式实现。
           EventFilter
          
           ExpandBar
          
           ExtendWidget
          可以继承其他组件,比如继承一个已编辑好的界面等,等价于调用被继承的界面的create方法。
           FillLayout
          
           FocusListener
          
           FormData
          
           FormLayout
          
           FormattedText
          
           GridData
          
           GridLayout
          
           Group
          
           HelpListener
          
           HtmlEditor
          HTML编辑器,使用FCKEditor编辑HTML。
           IF
          IF条件,条件使用Ognl表达式。
           ITERATOR
          迭代器,使用Java中的Iterator,只能对集合有效。
           IconSelector
          图标选择器,用于选择图片。
           Image
          Image的生存周期是和parent控件绑定在一起的,由于资源是共享的所以可以有多个parent,当所有的父控件失效后图片移除。
           JavaAction
          在创建SWT窗体时只执行一次的Java代码。
           KeyListener
          
           Label
          
           LightweightSystem
          The LightweightSystem is the link between SWT and Draw2d. It is the component that provides the ability for Figures to be hosted on an SWT Canvas.
           Link
          
           List
          Instances of this class represent a selectable user interface object that displays a list of strings and issues notification when a string is selected. A list may be single or multi select.
           Listeners
          SWT通用事件监听。
           ListenersPrepared
          创建时不注册到控件的事件监听,通常用于多个控件都需要注册的事件监听,可以在创建后由控件增加监听时引用。
           Menu
          
           MenuDetectListener
          
           MenuFromText
          
           Model
          校验表单中的数据。
           Models
          Model的集合,只是方便创建Model。
           MouseListener
          
           MouseMoveListener
          
           MouseTrackListener
          
           MouseWheelListener
          
           ObjectViewer
          对象查看器
           OleClientSite
          OleClientSite provides a site to manage an embedded OLE Document within a container.
           OleControlSite
          
           OleFrame
          OleFrame is an OLE Container's top level frame.
           PagingToolbar
          
           PaintListener
          
           ProgressBar
          
           RETURN
          结束方法调用,返回返回值。
           Region
          Instances of this class represent areas of an x-y coordinate system that are aggregates of the areas covered by a number of polygons.
           Resource
          集中创建SWT的各种资源。
           RowData
          Each control controlled by a RowLayout can have its initial width and height specified by setting a RowData object into the control.
           RowLayout
          Instances of this class determine the size and position of the children of a Composite by placing them either in horizontal rows or vertical columns within the parent Composite.
           SWITCH
          Switch条件判断语句。
           Sash
          
           SashForm
          The SashForm is a composite control that lays out its children in a row or column arrangement (as specified by the orientation) and places a Sash between each child. One child may be maximized to occupy the entire size of the SashForm. The relative sizes of the children may be specified using weights.
           Scale
          
           ScrolledComposite
          A ScrolledComposite provides scrollbars and will scroll its content when the user uses the scrollbars.
           Shell
          Instances of this class represent the "windows" which the desktop or "window manager" is managing. Instances that do not have a parent (that is, they are built using the constructor, which takes a Display as the argument) are described as top level shells. Instances that do have a parent are described as secondary or dialog shells.
           Slider
          Instances of this class are selectable user interface objects that represent a range of positive, numeric values.
           Spinner
          Instances of this class are selectable user interface objects that allow the user to enter and modify numeric values.
           SplitButton
          
           StackLayout
          
           StyleSet
          样式管理,在ActionContext里建一个名为StyleManager的Map,保存Style,每一个Style是Control的基本属性集合。
           StyledText
          A StyledText is an editable user interface object that displays lines of text.
           SwtThingTemplate
          SWT事物模板。
           TRY
          类似Java的try{}catch(){}finally语句。
           TabFolder
          Instances of this class implement the notebook user interface metaphor. It allows the user to select a notebook page from set of pages.
           Table
          
           TableViewer
          
           TaskMonitor
          任务监控器
           Text
          Instances of this class are selectable user interface objects that allow the user to enter and modify text.
           ThingDescBrowser
          浏览事物描述的浏览器。
           ThingDescritporForm
          已不再使用,可以用ThingForm代替。
           ThingEditor
          事物编辑器。
           ThingForm
          事物表单
           ThingRegistSelector
          可以选择注册的事物的控件,比如选择注册的子事物、模板、特征、笔记、分类等。
           ThingViewer
          事物查看组件,用于查看事物。
           ToolBar
          
           Tracker
          Instances of this class implement rubber banding rectangles that are drawn onto a parent Composite or Display. These rectangles can be specified to respond to mouse and key events by either moving or resizing themselves accordingly. Trackers are typically used to represent window geometries in a lightweight manner.
           TraverseListener
          
           TrayItem
          Instances of this class represent icons that can be placed on the system tray or task bar status area.
           Tree
          Instances of this class provide a selectable user interface object that displays a hierarchy of items and issues notification when an item in the hierarchy is selected.
           TriggerField
          一个输入框和按钮组成的类似于Combo效果的输入界面。
           ViewForm
          Instances of this class implement a Composite that positions and sizes children and allows programmatic control of layout and border parameters. ViewForm is used in the workbench to lay out a view's label/menu/toolbar local bar.
           WHILE
          循环控制语句。语法是:
           actions(Actions)
          动作的容器(ActionContainer),可以定义一些动作在运行后期被调用。
 
字段详细信息

BORDER点击打开事物


DOUBLE_BUFFERED点击打开事物


EMBEDDED点击打开事物


H_SCROLL点击打开事物


NO_BACKGROUND点击打开事物


NO_FOCUS点击打开事物


NO_MERGE_PAINTS点击打开事物


NO_RADIO_GROUP点击打开事物


NO_REDRAW_RESIZE点击打开事物


V_SCROLL点击打开事物


background点击打开事物

Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.


backgroundImage点击打开事物

Sets the receiver's background image to the image specified by the argument, or to the default system color for the control if the argument is null.


backgroundMode点击打开事物


bounds点击打开事物

Sets the receiver's size and location to the rectangular area specified by the arguments.


capture点击打开事物

If the argument is true, causes the receiver to have all mouse events delivered to it until the method is called with false as the argument.


cls点击打开事物

样式名称。

目前的样式只是Control的公共属性的集合,可以设置Control的属性,功能仅限SWT的Control。

样式定义在StyleManager下,样式的目的类似HTML中的样式单,即在一个地方定义样式其他地方可以通过引用的方式实现样式的效果。


cursor点击打开事物

Sets the receiver's cursor to the cursor specified by the argument, or to the default cursor for that kind of control if the argument is null.


enabled点击打开事物

Enables the receiver if the argument is true, and disables it otherwise.


font点击打开事物

Sets the font that the receiver will use to paint textual information to the font specified by the argument, or to the default font for that kind of control if the argument is null.


foreground点击打开事物

Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.


label(标签)点击打开事物

当这个Composite显示在IDE的编辑栏时作为显示的标签。


layoutData点击打开事物

Sets the layout data associated with the receiver to the argument.


location点击打开事物

Sets the receiver's location to the point specified by the arguments which are relative to the receiver's parent (or its display if its parent is null), unless the receiver is a shell.


menu点击打开事物

Sets the receiver's pop up menu to the argument.


name点击打开事物


parent点击打开事物

Changes the parent of the widget to be the one provided if the underlying operating system supports this feature.


redraw点击打开事物

If the argument is false, causes subsequent drawing operations in the receiver to be ignored.


region点击打开事物

Sets the shape of the control to the region specified by the argument.


size点击打开事物

Sets the receiver's size to the point specified by the arguments.


toolTipText点击打开事物

Sets the receiver's tool tip text to the argument, which may be null indicating that no tool tip text should be shown.


varref(变量引用)点击打开事物

引用上下文中的其他变量。


visible点击打开事物

Marks the receiver as visible if the argument is true, and marks it invisible otherwise.


xw_cl_global(全局变量)点击打开事物

如果是全局变量,那么它将会放入到动作上下文中的索引为0的变量范围中。


xw_cl_namespace(名字空间)点击打开事物

如果指定了名字空间,那么放入到指定的名字空间中。

名字空间是放到动作上下文中的全局变量中的,每一个名字空间是一个Map,名字空间可以嵌套,如XWorker.util.file等。注意:需要自行处理名字空间中的变量生命周期。

有一个特殊变量空间是xw_objects,xw_objects的结构是根据创建变量的顺序而产生的树形结构,每一个节点的构成如下:
{
    name: //名字
    id:       //标识
    value: //值,注意这里是软引用,系统垃圾回收后值的内容会消失
    thingEntry: //创建该变量的事物引用实体
    childs:      //下一级子事物列表
}

动作上下文是公用的,本事物的名字前缀是xw_cl_,请注意不要重复。


xw_cl_varName(变量名)点击打开事物

放入到动作上下文中的变量名称,如果没有则不放入到变量上下文中。


 
方法详细信息

addObjectToContext


create


getStyles


init


runDesign


 
子事物详细信息

AnimationGif点击打开事物

动画GIF,可绑定到父控件作为动画背景图,如果父控件已销毁那么动画GIF的相关资源也销毁。


BREAK点击打开事物

终止当前操作,循环或者SWITCH等可以终止BREAK,如果没有循环或SWITCH那么可能会直接调出方法的调用。


Browser点击打开事物

Instances of this class implement the browser user interface metaphor. It allows the user to visualize and navigate through HTML documents.

Note that although this class is a subclass of Composite, it does not make sense to set a layout on it.


Button点击打开事物


CBanner点击打开事物

Instances of this class implement a Composite that lays out its children and allows programmatic control of the layout. It draws a separator between the left and right children which can be dragged to resize the right control. CBanner is used in the workbench to layout the toolbar area and perspective switching toolbar.

Note that although this class is a subclass of Composite, it does not make sense to set a layout on it.


CCombo点击打开事物

The CCombo class represents a selectable user interface object that combines a text field and a list and issues notification when an item is selected from the list.

CCombo was written to work around certain limitations in the native combo box. Specifically, on win32, the height of a CCombo can be set; attempts to set the height of a Combo are ignored. CCombo can be used anywhere that having the increased flexibility is more important than getting native L&F, but the decision should not be taken lightly. There is no is no strict requirement that CCombo look or behave the same as the native combo box.

Note that although this class is a subclass of Composite, it does not make sense to add children to it, or set a layout on it.


CONTINUE点击打开事物

调到循环的开头继续执行循环,当前循环内部剩余的跳过。


CTabFolder点击打开事物

Instances of this class implement the notebook user interface metaphor. It allows the user to select a notebook page from set of pages.

The item children that may be added to instances of this class must be of type CTabItem. Control children are created and then set into a tab item using CTabItem#setControl.

Note that although this class is a subclass of Composite, it does not make sense to set a layout on it.


Canvas点击打开事物


ChartComposite点击打开事物

A SWT GUI composite for displaying a {@link JFreeChart} object.


ChatText点击打开事物


Code点击打开事物

在创建SWT窗体时只执行一次的Groovy代码。

可以执行一些目前SWT事物还不能完成的事情,比如使用XWorker还未定义的SWT控件或手工创建和处理SWT控件等。

可以添加Widgets子节点。


CodeEditor点击打开事物

可以对代码着色的编辑器,可以显示列数和行数。创建后返回的是StyleText。

和CodeText不同的是CodeEditor包装在ViewForm下,可以显示列数和行数。查看示例


Combo点击打开事物


Composite点击打开事物

Instances of this class are controls which are capable of containing other controls.

Styles:
NO_BACKGROUND, NO_FOCUS, NO_MERGE_PAINTS, NO_REDRAW_RESIZE, NO_RADIO_GROUP, EMBEDDED, DOUBLE_BUFFERED
Events:
(none)

Note: The NO_BACKGROUND, NO_FOCUS, NO_MERGE_PAINTS, and NO_REDRAW_RESIZE styles are intended for use with Canvas. They can be used with Composite if you are drawing your own, but their behavior is undefined if they are used with subclasses of Composite other than Canvas.

Note: The CENTER style, although undefined for composites, has the same value as EMBEDDED (which is used to embed widgets from other widget toolkits into SWT). On some operating systems (GTK, Motif), this may cause the children of this composite to be obscured. The EMBEDDED style is for use by other widget toolkits and should normally never be used.


ControlEditor点击打开事物


ControlListener点击打开事物

Classes which implement this interface provide methods that deal with the events that are generated by moving and resizing controls.

After creating an instance of a class that implements this interface it can be added to a control using the addControlListener method and removed using the removeControlListener method. When a control is moved or resized, the appropriate method will be invoked.


CoolBar点击打开事物


Cursor点击打开事物

Cursor创建后需要显式的dispose。

DO点击打开事物

循环控制语句。语法是:
do{

}while(condition)。先执行do括号中的内容,如果条件成立那么继续重复执行。


DataObjectEditCompoiste点击打开事物

一个有查询和表格的数据对象编辑面板。

会产生的变量有:dataTable,dataStore,queryFrom, buttonComposite,pageingToolbar等。


DataObjectForm点击打开事物

数据对象表单,和事物表单类似,参看事物表单。


DataStore点击打开事物


DataStores点击打开事物

各种DataStore的注册地。


DataTable点击打开事物

DataTable已经很少用了,使用Table和DataStore代替。


DataTree点击打开事物

使用Tree和TreeModel代替。


DateChooser点击打开事物


DateChooserCombo点击打开事物


DatePickerCombo点击打开事物

日期输入和选择控件,本事物创建后返回Text框,变量保存的也是Text框。

返回的SWT控件

    保存到全局变量中的SWT控件是Text,变量名是当前控件的名称。

查看示例


DateTime点击打开事物


DisposeListener点击打开事物

Classes which implement this interface provide a method that deals with the event that is generated when a widget is disposed.

After creating an instance of a class that implements this interface it can be added to a widget using the addDisposeListener method and removed using the removeDisposeListener method. When a widget is disposed, the widgetDisposed method will be invoked.

see: DisposeListener


DragDetectListener点击打开事物

void dragDetected(DragDetectEvent e)
          Sent when a drag gesture is detected.


DragMove点击打开事物

向父控件天价MouseListener和MouseMoveListener,实现监听拖拽。

事件:

  • dragMoveStarted
    按下鼠标左键通知本事物的dragMoveStarted方法,参数dragMove。
     
  • dragMoveMoved
    如果在拖拽中通知本事物的dragMoveMoved方法,参数dragMove。
     
  • dragMoveFinished
    如果鼠标键抬起通知本事物的dragMoveFinished方法,参数dragMove。

DragMove的属性:

  • x:当前的x坐标。
  • y:当前的y坐标。
  • oldx:起始的x坐标。
  • oldy:起始的y坐标。

DragSource点击打开事物

DragSource defines the source object for a drag and drop transfer.


DropTarget点击打开事物

Class DropTarget defines the target object for a drag and drop transfer.


EditableTable点击打开事物

已不再使用,使用Table+DataStore的方式实现。


EventFilter点击打开事物


ExpandBar点击打开事物


ExtendWidget点击打开事物

可以继承其他组件,比如继承一个已编辑好的界面等,等价于调用被继承的界面的create方法。


FillLayout点击打开事物


FocusListener点击打开事物


FormData点击打开事物


FormLayout点击打开事物


FormattedText点击打开事物


GridData点击打开事物


GridLayout点击打开事物


Group点击打开事物


HelpListener点击打开事物


HtmlEditor点击打开事物

HTML编辑器,使用FCKEditor编辑HTML。

一般用户属性编辑,如要在一般界面使用HtmlEditor,可以参看HtmlEditor的示例


IF点击打开事物

IF条件,条件使用Ognl表达式。


ITERATOR点击打开事物

迭代器,使用Java中的Iterator,只能对集合有效。

每次遍历会有<varName>,<varName>_index(当前位置int),<varName>_hasNext(是否有下一个记录)三个临时变量。


IconSelector点击打开事物

图标选择器,用于选择图片。

接受事件SWT.Selection和SWT.DefaultSelection。


Image点击打开事物

Image的生存周期是和parent控件绑定在一起的,由于资源是共享的所以可以有多个parent,当所有的父控件失效后图片移除。


JavaAction点击打开事物

在创建SWT窗体时只执行一次的Java代码。

可以执行一些目前SWT事物还不能完成的事情,比如使用XWorker还未定义的SWT控件或手工创建和处理SWT控件等。

可以添加Widgets子节点。


KeyListener点击打开事物


Label点击打开事物


LightweightSystem点击打开事物

The LightweightSystem is the link between SWT and Draw2d. It is the component that provides the ability for Figures to be hosted on an SWT Canvas.

Normal procedure for using a LightweightSystem:

  1. Create an SWT Canvas.
  2. Create a LightweightSystem passing it that Canvas.
  3. Create a Draw2d Figure and call setContents(IFigure). This Figure will be the top-level Figure of the Draw2d application.

 


Link点击打开事物


List点击打开事物

Instances of this class represent a selectable user interface object that displays a list of strings and issues notification when a string is selected. A list may be single or multi select.


Listeners点击打开事物

SWT通用事件监听。

通过指定事件的类型调用控件的addListener(int, Listener)方法注册事件监听。

SWT还有另一种事件监听是通过控件的addXXListener(XXLitener)方法注册的,此方法是那种方法不兼容,互相引用无效。


ListenersPrepared点击打开事物

创建时不注册到控件的事件监听,通常用于多个控件都需要注册的事件监听,可以在创建后由控件增加监听时引用。


Menu点击打开事物


MenuDetectListener点击打开事物


MenuFromText点击打开事物


Model点击打开事物

校验表单中的数据。


Models点击打开事物

Model的集合,只是方便创建Model。

Model用于对控件赋值、取值和校验数据。


MouseListener点击打开事物


MouseMoveListener点击打开事物


MouseTrackListener点击打开事物


MouseWheelListener点击打开事物


ObjectViewer点击打开事物

对象查看器

对象查看器,相当于eclipse中调试时的查看变量控件。

对象查看器主要方法

  • setObject
    设置新的要查看的对象。
     

 


OleClientSite点击打开事物

OleClientSite provides a site to manage an embedded OLE Document within a container.

The OleClientSite provides the following capabilities:

  • creates the in-place editor for a blank document or opening an existing OLE Document
  • lays the editor out
  • provides a mechanism for activating and deactivating the Document
  • provides a mechanism for saving changes made to the document

This object implements the OLE Interfaces IUnknown, IOleClientSite, IAdviseSink, IOleInPlaceSite

Note that although this class is a subclass of Composite, it does not make sense to add Control children to it, or set a layout on it.


OleControlSite点击打开事物


OleFrame点击打开事物

OleFrame is an OLE Container's top level frame.

This object implements the OLE Interfaces IUnknown and IOleInPlaceFrame

OleFrame allows the container to do the following:

  • position and size the ActiveX Control or OLE Document within the application
  • insert menu items from the application into the OLE Document's menu
  • activate and deactivate the OLE Document's menus
  • position the OLE Document's menu in the application
  • translate accelerator keystrokes intended for the container's frame

PagingToolbar点击打开事物


PaintListener点击打开事物


ProgressBar点击打开事物


RETURN点击打开事物

结束方法调用,返回返回值。

return控制语句,返回常量、变量或者表达式变量。


Region点击打开事物

Instances of this class represent areas of an x-y coordinate system that are aggregates of the areas covered by a number of polygons.

Application code must explicitly invoke the Region.dispose() method to release the operating system resources managed by each instance when those instances are no longer required.


Resource点击打开事物

集中创建SWT的各种资源。

这里的资源和父控件绑定,当父控件销毁时自动销毁,简化资源管理。


RowData点击打开事物

Each control controlled by a RowLayout can have its initial width and height specified by setting a RowData object into the control.

RowLayout点击打开事物

Instances of this class determine the size and position of the children of a Composite by placing them either in horizontal rows or vertical columns within the parent Composite.

SWITCH点击打开事物

Switch条件判断语句。

使用Ognl表达式来判断是否符合条件。


Sash点击打开事物


SashForm点击打开事物

The SashForm is a composite control that lays out its children in a row or column arrangement (as specified by the orientation) and places a Sash between each child. One child may be maximized to occupy the entire size of the SashForm. The relative sizes of the children may be specified using weights.


Scale点击打开事物


ScrolledComposite点击打开事物

A ScrolledComposite provides scrollbars and will scroll its content when the user uses the scrollbars.


Shell点击打开事物

Instances of this class represent the "windows" which the desktop or "window manager" is managing. Instances that do not have a parent (that is, they are built using the constructor, which takes a Display as the argument) are described as top level shells. Instances that do have a parent are described as secondary or dialog shells.


Slider点击打开事物

Instances of this class are selectable user interface objects that represent a range of positive, numeric values.

At any given moment, a given slider will have a single 'selection' that is considered to be its value, which is constrained to be within the range of values the slider represents (that is, between its minimum and maximum values).

Typically, sliders will be made up of five areas:

  1. an arrow button for decrementing the value
  2. a page decrement area for decrementing the value by a larger amount
  3. a thumb for modifying the value by mouse dragging
  4. a page increment area for incrementing the value by a larger amount
  5. an arrow button for incrementing the value

Based on their style, sliders are either HORIZONTAL (which have a left facing button for decrementing the value and a right facing button for incrementing it) or VERTICAL (which have an upward facing button for decrementing the value and a downward facing buttons for incrementing it).

 

On some platforms, the size of the slider's thumb can be varied relative to the magnitude of the range of values it represents (that is, relative to the difference between its maximum and minimum values). Typically, this is used to indicate some proportional value such as the ratio of the visible area of a document to the total amount of space that it would take to display it. SWT supports setting the thumb size even if the underlying platform does not, but in this case the appearance of the slider will not change.


Spinner点击打开事物

Instances of this class are selectable user interface objects that allow the user to enter and modify numeric values.

Note that although this class is a subclass of Composite, it does not make sense to add children to it, or set a layout on it.


SplitButton点击打开事物


StackLayout点击打开事物


StyleSet点击打开事物

样式管理,在ActionContext里建一个名为StyleManager的Map,保存Style,每一个Style是Control的基本属性集合。

StyleManager应尽量提前初始化,应该放在界面定义的最上方。


StyledText点击打开事物

A StyledText is an editable user interface object that displays lines of text.


SwtThingTemplate点击打开事物

SWT事物模板。

调用事物模板创建SWT事物,然后在执行SWT事物的create方法创建界面。其中事物所用到的数据需要预先准备好。


TRY点击打开事物

类似Java的try{}catch(){}finally语句。

Catch的表达式应是类的全名,用此判断是否Catch相关抛除的对象。


TabFolder点击打开事物

Instances of this class implement the notebook user interface metaphor. It allows the user to select a notebook page from set of pages.

The item children that may be added to instances of this class must be of type TabItem. Control children are created and then set into a tab item using TabItem#setControl.

Note that although this class is a subclass of Composite, it does not make sense to set a layout on it.


Table点击打开事物


TableViewer点击打开事物


TaskMonitor点击打开事物

任务监控器

创建后启动一个线程执行任务列表,并把执行情况反映在进度条和标签上。

动态任务

如果动态任务=true,表示任务可以追加,此时忽略进度条,进度条最后设置成反复滚动的,否则会根据任务数量设置进度条的值。

create
创建后返回的是一个事物(Thing)副本。

注册任务

新的任务类型可以以子事物的方式注册到xworker.swt.util.Tasks下。


Text点击打开事物

Instances of this class are selectable user interface objects that allow the user to enter and modify text.


ThingDescBrowser点击打开事物

浏览事物描述的浏览器。

如果在运行期设置事物,使用<name>Action.doAction("setThing", ["thing":thing])设置,其中<name>为浏览器的名称。


ThingDescritporForm点击打开事物

已不再使用,可以用ThingForm代替。


ThingEditor点击打开事物

事物编辑器。

保存到变量上下文的是编辑器的自己的变量上下文,创建后返回的是变量上下文。

设置和读取事物的方法

  • 设置要编辑的事物
    <editorContext>. editorActions.doAction("setThing", ["thing":<thing>]);
     
  • 获取编辑的事物
    <editorContext>. editorActions.doAction("getThing");
     

ThingForm点击打开事物

事物表单

通过描述者创建输入表单,规则同XWorker编辑器表单以及DataObject的表单。

事物表单相关文档可参看事物表单,或XWorker网站

变量上下文和相关变量

事物表单会创建独立的变量上下文,表单中的属性控件都在新的变量上下文中,表单自身的变量上下文中的有哪些变量参看事物表单,或XWorker网站

事物表单创建完毕后返回的是主Composite,当前变量上下文中保存的变量为表单事物(Thing),可以通过表单事物(Thing)对表单进行操作。

事物表单保存的数据

Thing form = new Thing("xworker.swt.xworker.ThingForm"); 
form.setData("formThing", self);         //原始表单事物
form.setData("parent", composite);    //主Composite,表单的主容器
form.setData("actionContext", ac);     //新的变量上下文,表单自己的变量上下文

表单的主要方法

  • setDescriptor
    设置新的描述者并重新布局表单。
     
  • setThing
    设置新的要编辑的事物,根据事物自动生成表单以及对表单填充事物本身的数据。
     
  • setValues
    对表单赋值。
     
  • setPartialValues
    对表单的部分属性赋值,参数是Map<String, Object>类型。
     
  • getValues
    获取表单的值,返回类型是Map<String, Object>。
     
  • validate
    对表单进行校验,返回true/false。

 


ThingRegistSelector点击打开事物

可以选择注册的事物的控件,比如选择注册的子事物、模板、特征、笔记、分类等。

界面的样式

会根据不同的属性组合选择不同的控件。

事件,重写以下方法可以实现监听

  • selected
    当前事物的selected方法可以监听选择事件,其中参数是thing,如果不为null表示选中的一个事物节点,否则选中的group节点。
     
  • defaultSelected
    事物树双加的事件,其中参数是thing,如果不为null表示选中的一个事物节点,否则选中的group节点。

变量

保存到全局变量的是界面中的actions,actions有以下方法:

  • init(thing, type, keywords)
    初始化,thing注册到的事物,type注册类型,keywords关键字。
     
  • search
    执行查找,其中 keywords通过init传入。
     
  • getThing
    获取当前选中的事物,如果没有选择或选中的是group节点,那么返回null。
     
  • refresh
    刷新,如果查找是在缓存中进行的(searchCache=true),那么通过refresh可以重新刷新列表。

ThingViewer点击打开事物

事物查看组件,用于查看事物。


ToolBar点击打开事物


Tracker点击打开事物

Instances of this class implement rubber banding rectangles that are drawn onto a parent Composite or Display. These rectangles can be specified to respond to mouse and key events by either moving or resizing themselves accordingly. Trackers are typically used to represent window geometries in a lightweight manner.


TraverseListener点击打开事物


TrayItem点击打开事物

Instances of this class represent icons that can be placed on the system tray or task bar status area.


Tree点击打开事物

Instances of this class provide a selectable user interface object that displays a hierarchy of items and issues notification when an item in the hierarchy is selected.

The item children that may be added to instances of this class must be of type TreeItem.

Style VIRTUAL is used to create a Tree whose TreeItems are to be populated by the client on an on-demand basis instead of up-front. This can provide significant performance improvements for trees that are very large or for which TreeItem population is expensive (for example, retrieving values from an external source).

Here is an example of using a Tree with style VIRTUAL:

  final Tree tree = new Tree(parent, SWT.VIRTUAL | SWT.BORDER);
  tree.setItemCount(20);
  tree.addListener(SWT.SetData, new Listener() {
      public void handleEvent(Event event) {
          TreeItem item = (TreeItem)event.item;
          TreeItem parentItem = item.getParentItem();
          String text = null;
          if (parentItem == null) {
              text = "node " + tree.indexOf(item);
          } else {
              text = parentItem.getText() + " - " + parentItem.indexOf(item);
          }
          item.setText(text);
          System.out.println(text);
          item.setItemCount(10);
      }
  });
 

 

Note that although this class is a subclass of Composite, it does not normally make sense to add Control children to it, or set a layout on it, unless implementing something like a cell editor.

 

Styles:

SINGLE, MULTI, CHECK, FULL_SELECTION, VIRTUAL, NO_SCROLL

Events:

Selection, DefaultSelection, Collapse, Expand, SetData, MeasureItem, EraseItem, PaintItem

 

Note: Only one of the styles SINGLE and MULTI may be specified.


TriggerField点击打开事物

一个输入框和按钮组成的类似于Combo效果的输入界面。

使用者必须实现自己createShell方法,在弹出的Shell中的动作上下文中,设置result变量会返回结果,如actionContext.getScope(0).put("result", "ok")。


ViewForm点击打开事物

Instances of this class implement a Composite that positions and sizes children and allows programmatic control of layout and border parameters. ViewForm is used in the workbench to lay out a view's label/menu/toolbar local bar.

Note that although this class is a subclass of Composite, it does not make sense to set a layout on it.


WHILE点击打开事物

循环控制语句。语法是:
while(condiiton){
};先判断条件,如何成立则执行括号的内容,执行完括号的内容后再判断条件,如果程序那么继续执行括号中的内容。


actions(Actions)点击打开事物

动作的容器(ActionContainer),可以定义一些动作在运行后期被调用。

比如一个工作台(Workbentch)的界面通常需要提供打开视图、打开编辑器等功能,这些功能则可以定义在动作容器中。调用动作的方法是<动作容器名>.doAction(<name>, ....),如workbentchActions.doAction("openView", ["viewName":"outline"])。

动作容器的方法主要有:

  • public Object doAction(String name)
  • public Object doAction(String name, ActionContext context)
  • public Object doAction(String name, Map<String, Object> parameters)
  • public Object doAction(String name, ActionContext context, Map<String, Object> parameters)