简体   繁体   English

如何将动作/事件添加到 radSwitch [codenameone] java

[英]How to add an action/event to radSwitch [codenameone] java

The idea is triggering an accito everytime that a Switch change from OFF/OM or viceversa.这个想法是在每次开关从 OFF/OM 或反之亦然变化时触发 accito。 I added a bind-action but it does not work.我添加了一个绑定操作,但它不起作用。

<radSwitch height="0.7rem"
    bind-hidden="java:${Thing.additionalType}.bool" rad-transition="hidden 0.1s"
    tag="Person.sponsor">
    <bind-action category="PREFERREDSW"/>
</radSwitch> 

Thank you in advance (:先感谢您 (:

only worked for Button and MultiButton in CodeRAD < 2.0.5.仅适用于 CodeRAD < 2.0.5 中的 Button 和 MultiButton。 I've just released 2.0.5 which adds support for other components.我刚刚发布了 2.0.5,它增加了对其他组件的支持。 It should be available in maven central soon.它应该很快就会在 maven 中心可用。

You just need to update the CodeRad version in your pom.xml and common/pom.xml dependencies.您只需要更新 pom.xml 和 common/pom.xml 依赖项中的 CodeRad 版本。 You'll need to update two dependencies.您需要更新两个依赖项。

In the pom.xml file, look for在 pom.xml 文件中,查找

<dependency>
        <groupId>com.codenameone</groupId>
        <artifactId>coderad-annotation-processor</artifactId>
        <version>2.0.5</version>
        <scope>provided</scope>
    </dependency>

In the common/pom.xml file, look for在 common/pom.xml 文件中,查找

<dependency>
        <groupId>com.codenameone</groupId>
        <artifactId>coderad-lib</artifactId>
        <version>2.0.5</version>
        <type>pom</type>
    </dependency>

Once you've done this, you should either do a clean build of your project, or just make some changes in your view template to ensure that the view class gets regenerated by the annotation processor.完成此操作后,您应该干净地构建项目,或者只是在视图模板中进行一些更改以确保注释处理器重新生成视图 class。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM