0

目前正在处理一个简单的组件,我需要下拉菜单的显示名称为:

一、三、五

但是,我需要该值实际上等于这些显示名称的整数值。一 = (int) 1,三 = (int) 3,五 = (int) 5。

package com.authx.components;

import org.hippoecm.hst.core.parameters.DropDownList;
import org.hippoecm.hst.core.parameters.Parameter;

public interface PressEventComponentInfo {

    @Parameter(name = "number", required = true, displayName = "Release Number",       defaultValue="three")
    @DropDownList({"one", "three", "five"})
    String getNumber();
}
4

1 回答 1

1

您可以通过将 i18n 用于属性值来执行此操作。

对于下拉字段,您可以使用参数名称后跟斜杠,然后再次使用参数值作为键(例如,在您的示例中,'number/1=One')。

+ site
    + src
        + main
            + java
            |   +com.authx.components.PressEventComponentInfo
            + resources
                +com.authx.components
                    - PressEventComponentInfo.properties

您可以在HST 组件参数文档页面通道信息页面上找到有关此主题的更多信息和一些示例。

并添加以下属性:

number/1=One
number/3=Three
number/5=Five
于 2015-07-31T14:23:24.490 回答