Flowable 6.6.0 Eclipse设计器 - 5.扩展Flowable设计器 - 5.1定制调色板(5)

Flowable 6.6.0 用户指南相关文档下载

有关Flowable文档的其他资料,参见:

《Flowable文档大全》


《Flowable 6.6.0 Eclipse设计器》

1 安装(Installation
2 Flowable 设计器编辑器特性(Flowable Designer editor features)
3 Flowable设计器BPMN 特性(Flowable Designer BPMN features)
4 Flowable设计器部署特性(Flowable Designer deployment features)
5 扩展Flowable设计器(Extending Flowable Designer)

5 扩展Flowable设计器(Extending Flowable Designer)

5.1 定制调色板(Customizing the palette)

5.1.5 属性类型(Property types)

This section describes the property types you can use for a CustomServiceTask by setting its type to a PropertyType value.

本节介绍属性类型,通过将其类型设置为一个PropertyType值,可以将属性类型用于CustomServiceTask。

PropertyType.TEXT

Creates a single-line text field as shown below. Can be a required field and shows validation messages as a tooltip. Validation failures are displayed by changing the background of the field to a light red color.

创建单行文本字段,如下所示。可以是必填字段,并将验证消息显示为工具提示(tooltip)。通过将字段背景更改为浅红色来显示验证失败。
在这里插入图片描述

PropertyType.MULTILINE_TEXT

Creates a multiline text field as shown below (height is fixed at 80 pixels). Can be a required field and shows validation messages as a tooltip. Validation failures are displayed by changing the background of the field to a light red color.

创建多行文本字段,如下所示(高度固定为80像素)。可以是必填字段,并将验证消息显示为工具提示。通过将字段背景更改为浅红色来显示验证失败。

在这里插入图片描述

PropertyType.PERIOD

Creates a structured editor for specifying a period of time by editing amounts of each unit with a spinner control. The result is shown below. Can be a required field (which is interpreted such that not all values can be 0, so at least 1 part of the period must have a non-zero value) and shows validation messages as a tooltip. Validation failures are displayed by changing the background of the entire field to a light red color. The value of the field is stored as a string of the form 1y 2mo 3w 4d 5h 6m 7s, which represents 1 year, 2 months, 3 weeks, 4 days, 6 minutes and 7 seconds. The entire string is always stored, even if parts are 0.

通过使用微调器控件(spinner control)编辑每个单位的数量,创建用于指定时间段的结构化编辑器。结果如下所示。可以是必需字段(它的解释方式是,并非所有值都可以为0,因此period(时间段)至少有一部分必须具有非零值),并将验证消息显示为工具提示。通过将整个字段的背景更改为浅红色来显示验证失败。该字段的值存储为1y 2mo 3w 4d 5h 6m 7s的字符串,表示1年2月3周4天6分7秒。始终存储整个字符串,即使部分为0。
在这里插入图片描述

PropertyType.BOOLEAN_CHOICE

Creates a single checkbox control for boolean or toggle choices. Note that you can specify the required attribute on the Property annotation, but it will not be evaluated because that would leave the user without a choice whether to check the box or not. The value stored in the diagram is java.lang.Boolean.toString(boolean), which results in “true” or “false”.

为布尔或切换选项创建一个复选框控件。请注意,您可以在属性注解上指定所需的属性,但不会对其求值,因为这将使用户无法选择是否选中该框。图中存储的值是java.lang.Boolean.toString(boolean),结果为“true”或“false”。
在这里插入图片描述

PropertyType.RADIO_CHOICE

Creates a group of radio buttons as shown below. Selection of any of the radio buttons is mutually exclusive with selection of any of the others (in other words, only one selection allowed). Can be a required field and shows validation messages as a tooltip. Validation failures are displayed by changing the background of the group to a light red color.

创建一组单选按钮,如下所示。单选按钮的选择与任何其他单选按钮的选择是互斥的(换句话说,只允许一个选择)。可以是必填字段,并将验证消息显示为工具提示。通过将组的背景更改为浅红色来显示验证失败。

This property type expects the class member you have annotated to also have an accompanying @PropertyItems annotation (for an example, see below). Using this additional annotation, you can specify the list of items that should be offered in an array of Strings. Specify the items by adding two array entries for each item: first, the label to be shown; second, the value to be stored.

此属性类型要求您注解的类成员也有一个附带的@PropertyItems注解(例如,请参见下面的示例)。使用此附加注解,可以指定应在字符串数组中提供的项的列表。通过为每个项添加两个数组项来指定项:第一个是要显示的标签;第二个是要存储的值。

@Property(type = PropertyType.RADIO_CHOICE, displayName = "Withdrawal limit", required = true)
@Help(displayHelpShort = "The maximum daily withdrawal amount ",
    displayHelpLong = "Choose the maximum daily amount that can be withdrawn from the account.")
@PropertyItems({ LIMIT_LOW_LABEL, LIMIT_LOW_VALUE, LIMIT_MEDIUM_LABEL, LIMIT_MEDIUM_VALUE,
    LIMIT_HIGH_LABEL, LIMIT_HIGH_VALUE })
private String withdrawalLimit;

在这里插入图片描述
在这里插入图片描述

PropertyType.COMBOBOX_CHOICE

Creates a combobox with fixed options as shown below. Can be a required field and shows validation messages as a tooltip. Validation failures are displayed by changing the background of the combobox to a light red color.

创建具有固定选项的组合框,如下所示。可以是必填字段,并将验证消息显示为工具提示。通过将组合框的背景更改为浅红色来显示验证失败。

This property type expects the class member you have annotated to also have an accompanying @PropertyItems annotation (for an example, see below). Using this additional annotation, you can specify the list of items that should be offered in an array of Strings. Specify the items by adding two array entries for each item: first, the label to be shown; second, the value to be stored.

此属性类型要求您注解的类成员也有一个附带的@PropertyItems注解(例如,请参见下面的示例)。使用此附加注解,可以指定应在字符串数组中提供的项的列表。通过为每个项添加两个数组项来指定项:第一个是要显示的标签;第二个是要存储的值。

@Property(type = PropertyType.COMBOBOX_CHOICE, displayName = "Account type", required = true)
@Help(displayHelpShort = "The type of account",
    displayHelpLong = "Choose a type of account from the list of options")
@PropertyItems({ ACCOUNT_TYPE_SAVINGS_LABEL, ACCOUNT_TYPE_SAVINGS_VALUE, ACCOUNT_TYPE_JUNIOR_LABEL,
    ACCOUNT_TYPE_JUNIOR_VALUE, ACCOUNT_TYPE_JOINT_LABEL, ACCOUNT_TYPE_JOINT_VALUE,
    ACCOUNT_TYPE_TRANSACTIONAL_LABEL, ACCOUNT_TYPE_TRANSACTIONAL_VALUE, ACCOUNT_TYPE_STUDENT_LABEL,
    ACCOUNT_TYPE_STUDENT_VALUE, ACCOUNT_TYPE_SENIOR_LABEL, ACCOUNT_TYPE_SENIOR_VALUE })
private String accountType;

在这里插入图片描述
在这里插入图片描述

PropertyType.DATE_PICKER

Creates a date selection control as shown below. Can be a required field and shows validation messages as a tooltip (note, that the control used will auto-set the selection to the date on the system, so the value is seldom empty). Validation failures are displayed by changing the background of the control to a light red color.

创建日期选择控件,如下所示。可以是必需字段,并将验证消息显示为工具提示(请注意,使用的控件自动将选择设置为系统日期,因此值很少为空)。通过将控件的背景更改为浅红色来显示验证失败。

This property type expects the class member you have annotated to also have an accompanying @DatePickerProperty annotation (for an example, see below). Using this additional annotation, you can specify the date time pattern to be used to store dates in the diagram and the type of datepicker you would like to be shown. Both attributes are optional and have default values that will be used if you don’t specify them (these are static variables in the DatePickerProperty annotation). The dateTimePattern attribute should be used to supply a pattern to the SimpleDateFormat class. When using the swtStyle attribute, you should specify an integer value that is supported by SWT’s DateTime control, because this is the control that is used to render this type of property.

此属性类型要求已注解的类成员也具有附带的@DatePickerProperty注解(有关示例,请参见下文)。使用此附加注解,可以指定用于在图中存储日期的日期时间模式,以及要显示的日期选择器类型。这两个属性都是可选的,并且具有默认值,如果不指定它们(这些是DatePickerProperty注解中的静态变量),则将使用这些值。dateTimePattern属性应用于向SimpleDateFormat类提供模式。使用swtStyle属性时,应指定SWT的DateTime控件支持的整数值,因为这是用于呈现此类属性的控件。

@Property(type = PropertyType.DATE_PICKER, displayName = "Expiry date", required = true)
@Help(displayHelpShort = "The date the account expires.",
    displayHelpLong = "Choose the date when the account will expire if not extended before the date.")
@DatePickerProperty(dateTimePattern = "MM-dd-yyyy", swtStyle = 32)
private String expiryDate;

在这里插入图片描述

PropertyType.DATA_GRID

Creates a data grid control as shown below. A data grid can be used to allow the user to enter an arbitrary amount of rows of data and enter values for a fixed set of columns in each of those rows (each individual combination of row and column is referred to as a cell). Rows can be added and removed as the user sees fit.

This property type expects the class member you have annotated to also have an accompanying @DataGridProperty annotation (for an example, see below). Using this additional annotation, you can specify some specific attributes of the data grid. You are required to reference a different class to determine which columns go into the grid with the itemClass attribute. Flowable Designer expects the member type to be a List. By convention, you can use the class of the itemClass attribute as its generic type. If, for example, you have a grocery list that you edit in the grid, you would define the columns of the grid in the GroceryListItem class. From your CustomServiceTask, you would refer to it like this:

创建数据网格控件,如下所示。数据网格可用于允许用户输入任意数量的数据行,并在每一行中为固定的一组列输入值(行和列的每个单独组合称为一个单元)。可以根据用户的需要添加和删除行。

此属性类型要求已注解的类成员也有一个附带的@DataGridProperty注解(例如,请参见下文)。使用此附加注解,可以指定数据网格的某些特定属性。您需要引用其他类来确定哪些列使用itemClass属性输入网格。Flowable设计器要求成员类型为List。按照惯例,可以使用itemClass属性的类作为其泛型类型。例如,如果您有一个在网格中编辑的杂货清单(grocery list,那么您将在GroceryListItem类中定义网格的列。在CustomServiceTask中,您可以这样引用它:

@Property(type = PropertyType.DATA_GRID, displayName = "Grocery List")
@DataGridProperty(itemClass = GroceryListItem.class)
private List<GroceryListItem> groceryList;

The “itemClass” class uses the same annotations you would otherwise use to specify fields of a CustomServiceTask (with the exception of a data grid). Specifically, TEXT, MULTILINE_TEXT and PERIOD are currently supported. You’ll notice the grid will create single line text controls for each field, regardless of the PropertyType. This is done on purpose to keep the grid graphically appealing and readable. If you consider the regular display mode for a PERIOD PropertyType for instance, you can imagine it would never properly fit in a grid cell without cluttering the screen. For MULTILINE_TEXT and PERIOD, a double-click mechanism is added to each field which pops up a larger editor for the PropertyType. The value is stored to the field after the user clicks OK and is therefore readable within the grid.

“itemClass”类使用的注解与您在其他情况下用于指定CustomServiceTask字段的注解相同(数据网格除外)。具体来说,目前支持TEXT, MULTILINE_TEXT and PERIOD(文本、多行文本和时间间隔)。您会注意到网格将为每个字段创建单行文本控件,而不管PropertyType是什么。这样做是为了保持网格在图形上的美观性和可读性。例如,如果您考虑PERIOD PropertyType的常规显示模式,您可以想象它在不扰乱屏幕的情况下永远无法正确地适应网格单元。对于MULTILINE_TEXT and PERIOD(多行文本和时间间隔),每个字段都添加了一个双击机制,该机制会弹出一个更大的PropertyType编辑器。在用户单击“OK” ( “确定”)后,该值将存储到字段中,因此在网格中是可读的。

Required attributes are handled in a similar manner to regular fields of type TEXT and the entire grid is validated as soon as any field loses focus. The background color of the text control in a specific cell of the data grid is changed to light red if there are validation failures.

所需属性的处理方式与文本(TEXT)类型的常规字段类似,一旦字段失去焦点,整个网格都将被验证。如果验证失败,数据网格中特定单元格中文本控件的背景色将更改为浅红色。

By default, the component allows the user to add rows, but not to determine the order of those rows. If you wish to allow this, you should set the orderable attribute to true, which enables buttons at the end of each row to move it up or down in the grid.

默认情况下,组件允许用户添加行,但不能确定这些行的顺序。如果您希望允许这样做(译者注:即排序),您应该将orderable属性设置为true,这将启用每行末尾的按钮,以在网格中上下移动行。

Note
At the moment, this property type is not correctly injected into your runtime class.
注意
目前,此属性类型未正确注入到运行时类中。
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

月满闲庭

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值