[]
        
(Showing Draft Content)

动态隐藏属性

如果一个属性在设计器中是否显示,需要受到其他一个或几个属性影响,可以通过重写 getDesignerPropertyVisible方法实现。

public class MyPluginServerCommand extends Command implements ICommandExecutableInServerSide {

    private boolean enableCache;
    private int cacheTime;

    @Override
    public ExecuteResult execute(IServerCommandExecuteContext dataContext) {
        return new ExecuteResult();
    }

    @Override
    public boolean getDesignerPropertyVisible(String propertyName, CommandScope commandScope) {
        if ("cacheTime".equals(propertyName))
        {
            return enableCache;
        }
        return super.getDesignerPropertyVisible(propertyName, commandScope);
    }

    @Override
    public String toString() {
        return "我的服务端命令插件";
    }
}

设计器效果:

44fa188d-5458-4375-af44-4927f27df585