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


Java GuiDevelopmentException类代码示例

本文整理汇总了Java中com.haulmont.cuba.gui.GuiDevelopmentException的典型用法代码示例。如果您正苦于以下问题:Java GuiDevelopmentException类的具体用法?Java GuiDevelopmentException怎么用?Java GuiDevelopmentException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: apply

import com.haulmont.cuba.gui.GuiDevelopmentException; //导入依赖的package包/类
public void apply() {
    if (timeEntriesHandler != null) {
        try {
            List<TimeEntry> timeEntries =
                    commandLineService.createTimeEntriesForTheCommandLine(commandLine.getValue());
            if (CollectionUtils.isEmpty(timeEntries)) {
                showNotification(getMessage("notification.emptyCommandResult"), NotificationType.HUMANIZED);
            }
            timeEntriesHandler.handle(timeEntries != null ? timeEntries : Collections.emptyList());
        } catch (Exception e) {
            showNotification(getMessage("error.commandLine"), NotificationType.WARNING);
        }
    } else {
        throw new GuiDevelopmentException("ResultTimeEntriesHandler is not set for CommandLineFrameController", getFrame().getId());
    }
}
 
开发者ID:cuba-platform,项目名称:sample-timesheets,代码行数:17,代码来源:CommandLineFrameController.java

示例2: getLoader

import com.haulmont.cuba.gui.GuiDevelopmentException; //导入依赖的package包/类
protected ComponentLoader getLoader(Element element) {
    Class<? extends ComponentLoader> loaderClass = config.getLoader(element.getName());
    if (loaderClass == null) {
        throw new GuiDevelopmentException("Unknown component: " + element.getName(), context.getFullFrameId());
    }

    ComponentLoader loader;
    try {
        Constructor<? extends ComponentLoader> constructor = loaderClass.getConstructor();
        loader = constructor.newInstance();

        loader.setLocale(locale);
        loader.setMessagesPack(messagesPack);
        loader.setContext(context);
        loader.setLayoutLoaderConfig(config);
        loader.setFactory(factory);
        loader.setElement(element);
    } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException | InstantiationException e) {
        throw new GuiDevelopmentException("Loader instantiation error: " + e, context.getFullFrameId());
    }

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

示例3: loadColumns

import com.haulmont.cuba.gui.GuiDevelopmentException; //导入依赖的package包/类
@Override
protected List<Table.Column> loadColumns(final Table component, Element columnsElement, CollectionDatasource ds) {
    List<Table.Column> columns = new ArrayList<>();

    Element groupElement = columnsElement.element("group");
    if (groupElement != null) {
        columns.addAll(super.loadColumns(component, groupElement, ds));
        final List<Object> groupProperties = new ArrayList<>(columns.size());
        for (Table.Column column : columns) {
            if (column.isCollapsed()) {
                String msg = String.format("Can't group by collapsed column: %s", column.getId());
                throw new GuiDevelopmentException(msg, context.getFullFrameId());
            }

            if (column.isGroupAllowed()) {
                groupProperties.add(column.getId());
            }
        }
        context.addPostInitTask((context1, window) -> ((GroupTable) component).groupBy(groupProperties.toArray()));
    }

    columns.addAll(super.loadColumns(component, columnsElement, ds));

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

示例4: loadScrollBars

import com.haulmont.cuba.gui.GuiDevelopmentException; //导入依赖的package包/类
protected void loadScrollBars(ScrollBoxLayout component, Element element) {
    String scrollBars = element.attributeValue("scrollBars");
    if (scrollBars == null)
        return;

    if ("horizontal".equalsIgnoreCase(scrollBars)) {
        component.setScrollBarPolicy(ScrollBoxLayout.ScrollBarPolicy.HORIZONTAL);
    } else if ("vertical".equalsIgnoreCase(scrollBars)) {
        component.setScrollBarPolicy(ScrollBoxLayout.ScrollBarPolicy.VERTICAL);
    } else if ("both".equalsIgnoreCase(scrollBars)) {
        component.setScrollBarPolicy(ScrollBoxLayout.ScrollBarPolicy.BOTH);
    } else if ("none".equalsIgnoreCase(scrollBars)) {
        component.setScrollBarPolicy(ScrollBoxLayout.ScrollBarPolicy.NONE);
    } else {
        throw new GuiDevelopmentException("Invalid scrollbox 'scrollBars' value: " + scrollBars, context.getFullFrameId());
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:18,代码来源:ScrollBoxLayoutLoader.java

示例5: loadActionOpenType

import com.haulmont.cuba.gui.GuiDevelopmentException; //导入依赖的package包/类
protected void loadActionOpenType(Action action, Element element) {
    if (action instanceof Action.HasOpenType) {
        String openTypeString = element.attributeValue("openType");
        if (StringUtils.isNotEmpty(openTypeString)) {
            WindowManager.OpenType openType;
            try {
                openType = WindowManager.OpenType.valueOf(openTypeString);
            } catch (IllegalArgumentException e) {
                throw new GuiDevelopmentException(
                        String.format("Unknown open type: '%s' for action: '%s'", openTypeString, action.getId()),
                        context.getFullFrameId());
            }

            ((Action.HasOpenType) action).setOpenType(openType);
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:18,代码来源:ActionsHolderLoader.java

示例6: loadDatasource

import com.haulmont.cuba.gui.GuiDevelopmentException; //导入依赖的package包/类
protected void loadDatasource(DatasourceComponent component, Element element) {
    final String datasource = element.attributeValue("datasource");
    if (!StringUtils.isEmpty(datasource)) {
        Datasource ds = context.getDsContext().get(datasource);
        if (ds == null) {
            throw new GuiDevelopmentException(String.format("Datasource '%s' is not defined", datasource),
                    getContext().getFullFrameId(), "Component ID", component.getId());
        }
        String property = element.attributeValue("property");
        if (StringUtils.isEmpty(property)) {
            throw new GuiDevelopmentException(
                    String.format("Can't set datasource '%s' for component '%s' because 'property' " +
                            "attribute is not defined", datasource, component.getId()),
                    context.getFullFrameId());
        }

        component.setDatasource(ds, property);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:20,代码来源:AbstractDatasourceComponentLoader.java

示例7: loadWidth

import com.haulmont.cuba.gui.GuiDevelopmentException; //导入依赖的package包/类
@Nullable
protected Integer loadWidth(Element element, String propertyName) {
    String width = loadThemeString(element.attributeValue(propertyName));
    if (!StringUtils.isBlank(width)) {
        if (StringUtils.endsWith(width, "px")) {
            width = StringUtils.substring(width, 0, width.length() - 2);
        }
        try {
            // Only integer allowed in XML
            return Integer.parseInt(width);
        } catch (NumberFormatException e) {
            throw new GuiDevelopmentException("Property '" + propertyName + "' must contain only numeric value",
                    context.getCurrentFrameId(), propertyName, element.attributeValue("width"));
        }
    }
    return null;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:18,代码来源:DataGridLoader.java

示例8: loadOrientation

import com.haulmont.cuba.gui.GuiDevelopmentException; //导入依赖的package包/类
protected void loadOrientation(OptionsGroup component, Element element) {
    String orientation = element.attributeValue("orientation");

    if (orientation == null) {
        return;
    }

    if ("horizontal".equalsIgnoreCase(orientation)) {
        component.setOrientation(OptionsGroup.Orientation.HORIZONTAL);
    } else if ("vertical".equalsIgnoreCase(orientation)) {
        component.setOrientation(OptionsGroup.Orientation.VERTICAL);
    } else {
        throw new GuiDevelopmentException("Invalid orientation value for option group: " +
                orientation, context.getFullFrameId(), "OptionsGroup ID", component.getId());
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:17,代码来源:OptionsGroupLoader.java

示例9: loadFields

import com.haulmont.cuba.gui.GuiDevelopmentException; //导入依赖的package包/类
protected List<FieldGroup.FieldConfig> loadFields(FieldGroup resultComponent, List<Element> elements, Datasource ds,
                                                  @Nullable String columnWidth) {
    List<FieldGroup.FieldConfig> fields = new ArrayList<>(elements.size());
    List<String> ids = new ArrayList<>();
    for (Element fieldElement : elements) {
        FieldGroup.FieldConfig field = loadField(fieldElement, ds, columnWidth);
        if (ids.contains(field.getId())) {
            Map<String, Object> params = new HashMap<>();
            String fieldGroupId = resultComponent.getId();
            if (StringUtils.isNotEmpty(fieldGroupId)) {
                params.put("FieldGroup ID", fieldGroupId);
            }

            throw new GuiDevelopmentException(
                    String.format("FieldGroup column contains duplicate fields '%s'.", field.getId()),
                    context.getFullFrameId(), params);
        }
        fields.add(field);
        ids.add(field.getId());
    }
    return fields;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:23,代码来源:FieldGroupLoader.java

示例10: loadSubComponentsAndExpand

import com.haulmont.cuba.gui.GuiDevelopmentException; //导入依赖的package包/类
protected void loadSubComponentsAndExpand(ExpandingLayout layout, Element element) {
    loadSubComponents();

    String expand = element.attributeValue("expand");
    if (!StringUtils.isEmpty(expand)) {
        String[] parts = expand.split(";");
        String targetId = parts[0];
        Component componentToExpand = layout.getOwnComponent(targetId);

        if (componentToExpand != null) {
            String height = find(parts, "height");
            String width = find(parts, "width");
            layout.expand(componentToExpand, height, width);
        } else {
            throw new GuiDevelopmentException(
                    "Illegal expand target '" + targetId + "' for container",
                    context.getFullFrameId(), "component", targetId);
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:21,代码来源:ContainerLoader.java

示例11: loadDatasource

import com.haulmont.cuba.gui.GuiDevelopmentException; //导入依赖的package包/类
protected void loadDatasource(Image component, Element element) {
    final String datasource = element.attributeValue("datasource");
    if (!StringUtils.isEmpty(datasource)) {
        Datasource ds = context.getDsContext().get(datasource);
        if (ds == null) {
            throw new GuiDevelopmentException(String.format("Datasource '%s' is not defined", datasource),
                    getContext().getFullFrameId(), "Component ID", component.getId());
        }
        String property = element.attributeValue("property");
        if (StringUtils.isEmpty(property)) {
            throw new GuiDevelopmentException(
                    String.format("Can't set datasource '%s' for component '%s' because 'property' " +
                            "attribute is not defined", datasource, component.getId()),
                    context.getFullFrameId());
        }

        component.setDatasource(ds, property);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:20,代码来源:ImageLoader.java

示例12: parseMarginInfo

import com.haulmont.cuba.gui.GuiDevelopmentException; //导入依赖的package包/类
protected MarginInfo parseMarginInfo(String margin) {
    if (margin.contains(";") || margin.contains(",")) {
        final String[] margins = margin.split("[;,]");
        if (margins.length != 4) {
            throw new GuiDevelopmentException(
                    "Margin attribute must contain 1 or 4 boolean values separated by ',' or ';", context.getFullFrameId());
        }

        return new MarginInfo(
                Boolean.parseBoolean(StringUtils.trimToEmpty(margins[0])),
                Boolean.parseBoolean(StringUtils.trimToEmpty(margins[1])),
                Boolean.parseBoolean(StringUtils.trimToEmpty(margins[2])),
                Boolean.parseBoolean(StringUtils.trimToEmpty(margins[3]))
        );
    } else {
        return new MarginInfo(Boolean.parseBoolean(margin));
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:19,代码来源:AbstractComponentLoader.java

示例13: getLoader

import com.haulmont.cuba.gui.GuiDevelopmentException; //导入依赖的package包/类
protected ComponentLoader getLoader(Element element, Class<? extends ComponentLoader> loaderClass) {
    ComponentLoader loader;
    try {
        Constructor<? extends ComponentLoader> constructor = loaderClass.getConstructor();
        loader = constructor.newInstance();

        loader.setLocale(locale);
        loader.setMessagesPack(messagesPack);
        loader.setContext(context);
        loader.setLayoutLoaderConfig(layoutLoaderConfig);
        loader.setFactory(factory);
        loader.setElement(element);
    } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException | InstantiationException e) {
        throw new GuiDevelopmentException("Loader instatiation error: " + e, context.getFullFrameId());
    }

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

示例14: loadRelativePathResource

import com.haulmont.cuba.gui.GuiDevelopmentException; //导入依赖的package包/类
protected boolean loadRelativePathResource(ResourceView resultComponent, Element element) {
    Element relativePath = element.element("relativePath");
    if (relativePath == null)
        return false;

    String path = relativePath.attributeValue("path");
    if (StringUtils.isEmpty(path)) {
        throw new GuiDevelopmentException("No path provided for the RelativePathResource", context.getFullFrameId());
    }

    RelativePathResource resource = resultComponent.createResource(RelativePathResource.class);

    resource.setPath(path);

    loadMimeType(resource, relativePath);

    resultComponent.setSource(resource);

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

示例15: loadUrlResource

import com.haulmont.cuba.gui.GuiDevelopmentException; //导入依赖的package包/类
protected void loadUrlResource(ResourceView resultComponent, Element element) {
    Element urlResource = element.element("url");
    if (urlResource == null)
        return;

    String url = urlResource.attributeValue("url");
    if (StringUtils.isEmpty(url)) {
        throw new GuiDevelopmentException("No url provided for the UrlResource", context.getFullFrameId());
    }

    UrlResource resource = resultComponent.createResource(UrlResource.class);
    try {
        resource.setUrl(new URL(url));

        loadMimeType(resource, urlResource);

        resultComponent.setSource(resource);
    } catch (MalformedURLException e) {
        String msg = String.format("An error occurred while creating UrlResource with the given url: %s", url);
        throw new GuiDevelopmentException(msg, context.getFullFrameId());
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:23,代码来源:AbstractResourceViewLoader.java


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