• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ComponentsFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: DesktopFileUploadField

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的package包/类
public DesktopFileUploadField() {
    fileUploading = AppBeans.get(FileUploadingAPI.NAME);
    messages = AppBeans.get(Messages.NAME);
    exportDisplay = AppBeans.get(ExportDisplay.NAME);

    ComponentsFactory componentsFactory = AppBeans.get(ComponentsFactory.NAME);
    uploadButton = (Button) componentsFactory.createComponent(Button.NAME);
    final JFileChooser fileChooser = new JFileChooser();
    uploadButton.setAction(new AbstractAction("") {
        @Override
        public void actionPerform(Component component) {
            if (fileChooser.showOpenDialog(uploadButton.unwrap(JButton.class)) == JFileChooser.APPROVE_OPTION) {
                uploadFile(fileChooser.getSelectedFile());
            }
        }
    });
    uploadButton.setCaption(messages.getMessage(getClass(), "export.selectFile"));

    initImpl();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:21,代码来源:DesktopFileUploadField.java


示例2: createComponent

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的package包/类
@Override
protected Component createComponent() {
    componentsFactory = AppBeans.get(ComponentsFactory.class);
    popupButton = componentsFactory.createComponent(PopupButton.class);

    OpManager opManager = AppBeans.get(OpManager.class);
    for (Op op : opManager.availableOps(condition.getJavaClass())) {
        OperatorChangeAction operatorChangeAction = new OperatorChangeAction(op);
        popupButton.addAction(operatorChangeAction);
    }

    popupButton.setCaption(condition.getOperator().getLocCaption());
    popupButton.setStyleName("condition-operation-button");

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


示例3: ParamEditor

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的package包/类
public ParamEditor(AbstractCondition condition, boolean removeButtonVisible, boolean operationEditable) {
    this.condition = condition;
    this.removeButtonVisible = removeButtonVisible;

    componentsFactory = AppBeans.get(ComponentsFactory.class);
    labelAndOperationLayout = componentsFactory.createComponent(HBoxLayout.class);
    labelAndOperationLayout.setSpacing(true);
    labelAndOperationLayout.setAlignment(Alignment.MIDDLE_RIGHT);

    captionLbl = componentsFactory.createComponent(Label.class);
    captionLbl.setAlignment(Alignment.MIDDLE_RIGHT);
    captionLbl.setValue(condition.getLocCaption());
    labelAndOperationLayout.add(captionLbl);

    operationEditor = condition.createOperationEditor().getComponent();
    operationEditor.setEnabled(operationEditable);
    labelAndOperationLayout.add(operationEditor);

    createParamEditLayout();

    condition.addListener(this);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:23,代码来源:ParamEditor.java


示例4: createFakeFilter

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的package包/类
public Filter createFakeFilter() {
    if (filter != null) {
        return filter;
    }

    final Filter fakeFilter = AppBeans.get(ComponentsFactory.NAME, ComponentsFactory.class).createComponent(Filter.class);
    fakeFilter.setXmlDescriptor(Dom4j.readDocument("<filter/>").getRootElement());
    CollectionDatasourceImpl fakeDatasource = new CollectionDatasourceImpl();
    DsContextImpl fakeDsContext = new DsContextImpl(frame.getDsContext().getDataSupplier());
    FrameContextImpl fakeFrameContext = new FrameContextImpl(frame, Collections.<String, Object>emptyMap());
    fakeDsContext.setFrameContext(fakeFrameContext);
    fakeDatasource.setDsContext(fakeDsContext);
    //Attention: this query should match the logic in com.haulmont.reports.wizard.ReportingWizardBean.createJpqlDataSet()
    fakeDatasource.setQuery("select queryEntity from " + metaClass.getName() + " queryEntity");
    fakeDatasource.setMetaClass(metaClass);
    fakeFilter.setDatasource(fakeDatasource);
    fakeFilter.setFrame(this.frame);
    return fakeFilter;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:20,代码来源:FakeFilterSupport.java


示例5: WebCurrencyField

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的package包/类
public WebCurrencyField() {
    textField = AppBeans.get(ComponentsFactory.class).createComponent(TextField.class);

    this.component = new CubaCurrencyField(textField.unwrap(CubaTextField.class));

    com.haulmont.cuba.web.toolkit.ui.CurrencyLabelPosition currencyLabelPosition =
            com.haulmont.cuba.web.toolkit.ui.CurrencyLabelPosition.valueOf(CurrencyLabelPosition.RIGHT.name());
    this.component.setCurrencyLabelPosition(currencyLabelPosition);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:10,代码来源:WebCurrencyField.java


示例6: createButton

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的package包/类
public static Button createButton(String icon) {
    ComponentsFactory cf = AppBeans.get(ComponentsFactory.NAME);
    com.haulmont.cuba.gui.components.Button button =
            cf.createComponent(com.haulmont.cuba.gui.components.Button.class);
    button.setIcon(icon);
    return (Button) unwrap(button);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:8,代码来源:WebComponentsHelper.java


示例7: WebFtsField

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的package包/类
public WebFtsField() {
    component = new CssLayout();
    component.setPrimaryStyleName(FTS_FIELD_STYLENAME);

    ComponentsFactory cf = AppBeans.get(ComponentsFactory.NAME);
    com.haulmont.cuba.gui.components.TextField searchFieldComponent =
            cf.createComponent(com.haulmont.cuba.gui.components.TextField.class);
    searchField = (TextField) WebComponentsHelper.unwrap(searchFieldComponent);
    searchField.setStyleName("c-ftsfield-text");

    AppUI ui = AppUI.getCurrent();
    if (ui.isTestMode()) {
        searchField.setCubaId("ftsField");
        searchField.setId(ui.getTestIdManager().reserveId("ftsField"));
    }
    searchField.addShortcutListener(new ShortcutListener("fts", com.vaadin.event.ShortcutAction.KeyCode.ENTER, null) {
        @Override
        public void handleAction(Object sender, Object target) {
            openSearchWindow();
        }
    });

    searchBtn = new CubaButton();
    searchBtn.setStyleName("c-ftsfield-button");
    searchBtn.setIcon(WebComponentsHelper.getIcon("app/images/fts-button.png"));
    searchBtn.addClickListener(
            (Button.ClickListener) event -> openSearchWindow()
    );

    component.addComponent(searchField);
    component.addComponent(searchBtn);

    adjustHeight();
    adjustWidth();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:36,代码来源:WebFtsField.java


示例8: WebAppWorkArea

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的package包/类
public WebAppWorkArea() {
    component = new CssLayout();
    component.setPrimaryStyleName(WORKAREA_STYLENAME);
    component.addStyleName(MODE_TABBED_STYLENAME);
    component.addStyleName(STATE_INITIAL_STYLENAME);

    ComponentsFactory cf = AppBeans.get(ComponentsFactory.NAME);
    setInitialLayout(cf.createComponent(VBoxLayout.class));

    tabbedContainer = createTabbedModeContainer();

    UserSettingsTools userSettingsTools = AppBeans.get(UserSettingsTools.NAME);
    setMode(userSettingsTools.loadAppWindowMode());
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:15,代码来源:WebAppWorkArea.java


示例9: createComponentsFactory

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的package包/类
@Override
protected ComponentsFactory createComponentsFactory() {
    return new WebComponentsFactory() {
        @Override
        public List<ComponentGenerationStrategy> getComponentGenerationStrategies() {
            DefaultComponentGenerationStrategy strategy = new DefaultComponentGenerationStrategy(messages);
            strategy.setComponentsFactory(this);
            return Collections.singletonList(strategy);
        }
    };
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:12,代码来源:WebFieldGroupTest.java


示例10: createComponentsFactory

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的package包/类
@Override
protected ComponentsFactory createComponentsFactory() {
    return new DesktopComponentsFactory() {
        @Override
        public List<ComponentGenerationStrategy> getComponentGenerationStrategies() {
            DefaultComponentGenerationStrategy strategy = new DefaultComponentGenerationStrategy(messages);
            strategy.setComponentsFactory(this);
            return Collections.singletonList(strategy);
        }
    };
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:12,代码来源:DesktopFieldGroupTest.java


示例11: initGeneratedColumn

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的package包/类
/**
 * Initializes a column for downloading files in a table displaying {@link FileDescriptor}s.
 *
 * @param table table that displays instances of the {@link FileDescriptor} entity
 */
public static void initGeneratedColumn(final Table table) {
    final ComponentsFactory componentsFactory = AppBeans.get(ComponentsFactory.NAME);
    final ExportDisplay exportDisplay = AppBeans.get(ExportDisplay.NAME);

    table.addGeneratedColumn("name", new Table.ColumnGenerator<FileDescriptor>() {
        @Override
        public Component generateCell(final FileDescriptor fd) {
            if (fd == null) {
                return componentsFactory.createComponent(Label.NAME);
            }

            if (PersistenceHelper.isNew(fd)) {
                Label label = componentsFactory.createComponent(Label.class);
                label.setValue(fd.getName());
                return label;
            } else {
                Button button = componentsFactory.createComponent(Button.class);
                button.setStyleName("link");
                button.setAction(new AbstractAction("download") {
                    @Override
                    public void actionPerform(Component component) {
                        exportDisplay.show(fd);
                    }

                    @Override
                    public String getCaption() {
                        return fd.getName();
                    }
                });
                return button;
            }
        }
    });
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:40,代码来源:FileDownloadHelper.java


示例12: loadTimers

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的package包/类
protected void loadTimers(ComponentsFactory factory, Window component, Element element) {
    Element timersElement = element.element("timers");
    if (timersElement != null) {
        final List timers = timersElement.elements("timer");
        for (final Object o : timers) {
            loadTimer(factory, component, (Element) o);
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:10,代码来源:WindowLoader.java


示例13: createComponent

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的package包/类
@Override
protected Component createComponent() {
    ComponentsFactory componentsFactory = AppBeans.get(ComponentsFactory.class);
    Label label = componentsFactory.createComponent(Label.class);
    label.setValue(condition.getOperationCaption());
    return label;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:8,代码来源:DynamicAttributesOperationEditor.java


示例14: addLazyTab

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的package包/类
@Override
public TabSheet.Tab addLazyTab(String name,
                               Element descriptor,
                               ComponentLoader loader) {
    ComponentsFactory cf = AppBeans.get(ComponentsFactory.NAME);
    BoxLayout tabContent = (BoxLayout) cf.createComponent(VBoxLayout.NAME);

    Layout layout = tabContent.unwrap(Layout.class);
    layout.setSizeFull();

    Tab tab = new Tab(name, tabContent);
    tabs.put(name, tab);

    com.vaadin.ui.Component tabComponent = WebComponentsHelper.getComposition(tabContent);
    tabComponent.setSizeFull();

    tabMapping.put(tabComponent, new ComponentDescriptor(name, tabContent));
    com.vaadin.ui.TabSheet.Tab tabControl = this.component.addTab(tabComponent);
    getLazyTabs().add(tabComponent);

    this.component.addSelectedTabChangeListener(new LazyTabChangeListener(tabContent, descriptor, loader));
    context = loader.getContext();

    if (!postInitTaskAdded) {
        context.addPostInitTask((context1, window) ->
                initComponentTabChangeListener()
        );
        postInitTaskAdded = true;
    }

    if (getDebugId() != null) {
        this.component.setTestId(tabControl,
                AppUI.getCurrent().getTestIdManager().getTestId(getDebugId() + "." + name));
    }
    if (AppUI.getCurrent().isTestMode()) {
        this.component.setCubaId(tabControl, name);
    }

    tabContent.setFrame(context.getFrame());

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


示例15: initColumn

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的package包/类
public static void initColumn(Table table, final String propertyName, final Handler handler) {

        final ComponentsFactory componentsFactory = AppBeans.get(ComponentsFactory.NAME);

        table.addGeneratedColumn(propertyName, new Table.ColumnGenerator() {
            @Override
            public Component generateCell(final Entity entity) {
//                    //process properties like building.house.room
                String[] props = propertyName.split("\\.");
                Instance nestedEntity = entity;
                for (int i = 0; i < props.length - 1; i++) {
                    nestedEntity = nestedEntity.getValue(props[i]);
                    if (nestedEntity == null) {
                        break;
                    }
                }
                final Object value = (nestedEntity == null) ? null : nestedEntity.getValue(props[props.length - 1]);
                if (value != null) {
                    Button button = componentsFactory.createComponent(Button.class);
                    button.setStyleName("link");
                    button.setAction(new AbstractAction("open") {
                        @Override
                        public void actionPerform(Component component) {
                            handler.onClick(entity);
                        }

                        @Override
                        public String getCaption() {
                            String str;
                            Datatype datatype = Datatypes.get(value.getClass());
                            if (datatype != null) {
                                UserSessionSource sessionSource = AppBeans.get(UserSessionSource.NAME);
                                str = datatype.format(value, sessionSource.getLocale());
                            } else {
                                str = value.toString();
                            }
                            return str;
                        }
                    });

                    button.setStyleName("link");
                    return button;
                }
                return null;
            }
        });
    }
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:48,代码来源:LinkColumnHelper.java


示例16: createComponent

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的package包/类
protected Window createComponent(ComponentsFactory factory) {
    return factory.createComponent(Window.class);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:4,代码来源:WindowLoader.java


示例17: loadTimer

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的package包/类
protected void loadTimer(ComponentsFactory factory, final Window component, Element element) {
    Timer timer = factory.createTimer();
    timer.setXmlDescriptor(element);
    timer.setId(element.attributeValue("id"));
    String delay = element.attributeValue("delay");
    if (StringUtils.isEmpty(delay)) {
        throw new GuiDevelopmentException("Timer 'delay' can't be empty", context.getCurrentFrameId(),
                "Timer ID", timer.getId());
    }

    int value;
    try {
        value = Integer.parseInt(delay);
    } catch (NumberFormatException e) {
        throw new GuiDevelopmentException("Timer 'delay' must be numeric", context.getFullFrameId(),
                ParamsMap.of(
                        "Timer delay", delay,
                        "Timer ID", timer.getId()
                ));
    }

    if (value <= 0) {
        throw new GuiDevelopmentException("Timer 'delay' must be greater than 0", context.getFullFrameId(),
                "Timer ID", timer.getId());
    }

    timer.setDelay(value);
    timer.setRepeating(Boolean.parseBoolean(element.attributeValue("repeating")));

    String onTimer = element.attributeValue("onTimer");
    if (StringUtils.isNotEmpty(onTimer)) {
        String timerMethodName = onTimer;
        if (StringUtils.startsWith(onTimer, "invoke:")) {
            timerMethodName = StringUtils.substring(onTimer, "invoke:".length());
        }
        timerMethodName = StringUtils.trim(timerMethodName);

        addInitTimerMethodTask(timer, timerMethodName);
    }

    String autostart = element.attributeValue("autostart");
    if (StringUtils.isNotEmpty(autostart)
            && Boolean.parseBoolean(autostart)) {
        addAutoStartTimerTask(timer);
    }

    timer.setFrame(context.getFrame());

    component.addTimer(timer);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:51,代码来源:WindowLoader.java


示例18: getFactory

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的package包/类
@Override
public ComponentsFactory getFactory() {
    return factory;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:5,代码来源:AbstractComponentLoader.java


示例19: setFactory

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的package包/类
@Override
public void setFactory(ComponentsFactory factory) {
    this.factory = factory;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:5,代码来源:AbstractComponentLoader.java


示例20: generateField

import com.haulmont.cuba.gui.xml.layout.ComponentsFactory; //导入依赖的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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CloseAction类代码示例发布时间:2022-05-23
下一篇:
Java ClusterChangedEvent类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap