当前位置: 首页>>代码示例>>Java>>正文


Java Scripting.loadClass方法代码示例

本文整理汇总了Java中com.haulmont.cuba.core.global.Scripting.loadClass方法的典型用法代码示例。如果您正苦于以下问题:Java Scripting.loadClass方法的具体用法?Java Scripting.loadClass怎么用?Java Scripting.loadClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.haulmont.cuba.core.global.Scripting的用法示例。


在下文中一共展示了Scripting.loadClass方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getScreenClass

import com.haulmont.cuba.core.global.Scripting; //导入方法依赖的package包/类
/**
 * Screen class as set in <code>screens.xml</code>
 */
@Nullable
public Class getScreenClass() {
    if (screenClass == null) {
        String className = descriptor.attributeValue("class");
        if (className != null) {
            Scripting scripting = AppBeans.get(Scripting.NAME);
            screenClass = scripting.loadClass(className);
        }
    }

    return screenClass;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:16,代码来源:WindowInfo.java

示例2: getJavaClass

import com.haulmont.cuba.core.global.Scripting; //导入方法依赖的package包/类
@Override
public Class getJavaClass() {
    String className = element.attributeValue("paramClass");
    if (className == null) {
        className = element.attributeValue("class");
    }

    if (className == null) {
        return null;
    } else {
        Scripting scripting = AppBeans.get(Scripting.NAME);
        return scripting.loadClass(element.attributeValue("paramClass"));
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:15,代码来源:CustomConditionDescriptor.java

示例3: generateField

import com.haulmont.cuba.core.global.Scripting; //导入方法依赖的package包/类
@Override
public Component generateField(Datasource datasource, String propertyId) {
    ComponentsFactory componentsFactory = AppBeans.get(ComponentsFactory.class);
    ListEditor listEditor = componentsFactory.createComponent(ListEditor.class);

    MetaPropertyPath metaPropertyPath = DynamicAttributesUtils.getMetaPropertyPath(datasource.getMetaClass(), propertyId);
    if (metaPropertyPath == null) {
        log.error("MetaPropertyPath for dynamic attribute {} not found", propertyId);
        return null;
    }
    CategoryAttribute categoryAttribute = DynamicAttributesUtils.getCategoryAttribute(metaPropertyPath.getMetaProperty());
    if (categoryAttribute == null) {
        log.error("Dynamic attribute {} not found", propertyId);
        return null;
    }

    listEditor.setEntityJoinClause(categoryAttribute.getJoinClause());
    listEditor.setEntityWhereClause(categoryAttribute.getWhereClause());

    ListEditor.ItemType itemType = listEditorItemTypeFromDynamicAttrType(categoryAttribute.getDataType());
    listEditor.setItemType(itemType);

    Metadata metadata = AppBeans.get(Metadata.class);
    Scripting scripting = AppBeans.get(Scripting.class);
    if (!Strings.isNullOrEmpty(categoryAttribute.getEntityClass())) {
        Class<?> clazz = scripting.loadClass(categoryAttribute.getEntityClass());
        if (clazz == null) {
            log.error("Unable to find class of entity {} for dynamic attribute {}",
                    categoryAttribute.getEntityClass(), categoryAttribute.getCode());
            return null;
        }

        MetaClass metaClass = metadata.getClassNN(clazz);
        listEditor.setEntityName(metaClass.getName());
        listEditor.setUseLookupField(BooleanUtils.isTrue(categoryAttribute.getLookup()));
    }

    //noinspection unchecked
    datasource.addStateChangeListener(e -> {
        if (e.getState() == Datasource.State.VALID) {
            Object value = datasource.getItem().getValue(propertyId);
            if (value != null && value instanceof Collection) {
                listEditor.setValue(value);
            }
        }
    });

    listEditor.addValueChangeListener(e -> {
        datasource.getItem().setValue(propertyId, e.getValue());
    });
    listEditor.setWidthFull();
    return listEditor;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:54,代码来源:DynamicAttributeCustomFieldGenerator.java

示例4: resolveParam

import com.haulmont.cuba.core.global.Scripting; //导入方法依赖的package包/类
protected void resolveParam(Element element) {
    Scripting scripting = AppBeans.get(Scripting.NAME);
    String aclass = element.attributeValue("class");
    if (!isBlank(aclass)) {
        javaClass = scripting.loadClass(aclass);
    }

    String operatorName = element.attributeValue("operatorType", null);
    if (operatorName != null) {
        operator = Op.valueOf(operatorName);
    }

    List<Element> paramElements = Dom4j.elements(element, "param");
    if (!paramElements.isEmpty()) {
        Element paramElem = paramElements.iterator().next();

        if (BooleanUtils.toBoolean(paramElem.attributeValue("hidden", "false"), "true", "false")) {
            paramElem = paramElements.iterator().next();
        }
        paramName = paramElem.attributeValue("name");

        if (!isBlank(paramElem.attributeValue("javaClass"))) {
            paramClass = scripting.loadClass(paramElem.attributeValue("javaClass"));
        }

        ConditionParamBuilder paramBuilder = AppBeans.get(ConditionParamBuilder.class);
        if (Strings.isNullOrEmpty(paramName)) {
            paramName = paramBuilder.createParamName(this);
        }

        param = paramBuilder.createParam(this);
        param.setDateInterval(BooleanUtils.toBoolean(paramElem.attributeValue("isDateInterval", "false"), "true", "false"));
        param.parseValue(paramElem.getText());
        param.setDefaultValue(param.getValue());
    }

    if ("EMPTY".equals(operatorName)) {
        //for backward compatibility with old filters that still use EMPTY operator
        operatorName = "NOT_EMPTY";
        if (BooleanUtils.isTrue((Boolean) param.getValue()))
            param.setValue(false);
        param.setDefaultValue(false);
        operator = Op.valueOf(operatorName);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:46,代码来源:AbstractCondition.java


注:本文中的com.haulmont.cuba.core.global.Scripting.loadClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。