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


Java ComponentsHelper.walkComponents方法代码示例

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


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

示例1: initEditComponents

import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
private void initEditComponents(boolean enabled) {
    ComponentsHelper.walkComponents(tabSheet, (component, name) -> {
        if (component instanceof FieldGroup) {
            ((FieldGroup) component).setEditable(enabled);
        } else if (component instanceof Table) {
            ((Table) component).getActions().stream().forEach(action -> action.setEnabled(enabled));
        }
    });
    actionsPane.setVisible(enabled);
    lookupBox.setEnabled(!enabled);

    /**
     * Enabling/disabling file upload control, depending if the screen is in editing mode or not
     */
    imageUpload.setVisible(enabled);
}
 
开发者ID:aleksey-stukalov,项目名称:cuba-vision-clinic,代码行数:17,代码来源:ProductBrowse.java

示例2: initDebugIds

import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
@Override
public void initDebugIds(final Frame frame) {
    if (ui.isTestMode()) {
        ComponentsHelper.walkComponents(frame, (component, name) -> {
            if (component.getDebugId() == null) {
                Frame componentFrame = null;
                if (component instanceof BelongToFrame) {
                    componentFrame = ((BelongToFrame) component).getFrame();
                }
                if (componentFrame == null) {
                    log.warn("Frame for component {} is not assigned", component.getClass());
                } else {
                    if (component instanceof WebAbstractComponent) {
                        WebAbstractComponent webComponent = (WebAbstractComponent) component;
                        webComponent.assignAutoDebugId();
                    }
                }
            }
        });
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:22,代码来源:WebWindowManager.java

示例3: afterLookupWindowOpened

import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
@Override
protected void afterLookupWindowOpened(Window lookupWindow) {
    boolean found = ComponentsHelper.walkComponents(lookupWindow, screenComponent -> {
        if (!(screenComponent instanceof Filter)) {
            return false;
        } else {
            MetaClass actualMetaClass = ((Filter) screenComponent).getDatasource().getMetaClass();
            MetaClass propertyMetaClass = extendedEntities.getEffectiveMetaClass(pickerField.getMetaClass());
            if (Objects.equals(actualMetaClass, propertyMetaClass)) {
                applyFilter(((Filter) screenComponent));
                return true;
            }
            return false;
        }
    });
    if (!found) {
        target.getFrame().showNotification(messages.getMainMessage("dynamicAttributes.entity.filter.filterNotFound"), Frame.NotificationType.WARNING);
    }
    ((DsContextImplementation) lookupWindow.getDsContext()).resumeSuspended();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:21,代码来源:FilteringLookupAction.java

示例4: initEditComponents

import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
/**
 * Initializes edit controls, depending on if they should be enabled or disabled.
 * @param enabled if true - enables edit controls and disables controls on the left side of the splitter
 *                if false - vice versa
 */
protected void initEditComponents(boolean enabled) {
    TabSheet tabSheet = getTabSheet();
    if (tabSheet != null) {
        ComponentsHelper.walkComponents(tabSheet, (component, name) -> {
            if (component instanceof FieldGroup) {
                ((FieldGroup) component).setEditable(enabled);
            } else if (component instanceof Table) {
                ((Table) component).getActions().forEach(action -> action.setEnabled(enabled));
            } else if (!(component instanceof Component.Container)) {
                component.setEnabled(enabled);
            }
        });
    } else {
        getFieldGroup().setEditable(enabled);
    }
    getActionsPane().setVisible(enabled);
    getLookupBox().setEnabled(!enabled);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:24,代码来源:EntityCombinedScreen.java

示例5: applySettings

import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
public void applySettings(Settings settings) {
    this.settings = settings;
    ComponentsHelper.walkComponents(
            window,
            (component, name) -> {
                if (component.getId() != null
                        && component instanceof Component.HasSettings) {
                    log.trace("Applying settings for : {} : {} ", name, component);

                    Element e = WindowDelegate.this.settings.get(name);
                    ((Component.HasSettings) component).applySettings(e);

                    if (component instanceof Component.HasPresentations
                            && e.attributeValue("presentation") != null) {
                        final String def = e.attributeValue("presentation");
                        if (!StringUtils.isEmpty(def)) {
                            UUID defaultId = UUID.fromString(def);
                            ((Component.HasPresentations) component).applyPresentationAsDefault(defaultId);
                        }
                    }
                }
            }
    );
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:25,代码来源:WindowDelegate.java

示例6: initEditComponents

import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
private void initEditComponents(boolean enabled) {
    ComponentsHelper.walkComponents(tabSheet, (component, name) -> {
        if (component instanceof FieldGroup) {
            ((FieldGroup) component).setEditable(enabled);
        } else if (component instanceof Table) {
            ((Table) component).getActions().stream().forEach(action -> action.setEnabled(enabled));
        }
    });
    actionsPane.setVisible(enabled);
    lookupBox.setEnabled(!enabled);
}
 
开发者ID:aleksey-stukalov,项目名称:cuba-vision-clinic,代码行数:12,代码来源:InvoicesBrowse.java

示例7: saveSettings

import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
public void saveSettings() {
    if (settings != null) {
        ComponentsHelper.walkComponents(
                window,
                (component, name) -> {
                    if (component.getId() != null
                            && component instanceof Component.HasSettings) {
                        log.trace("Saving settings for : {} : {}", name, component);

                        Element e = WindowDelegate.this.settings.get(name);
                        boolean modified = ((Component.HasSettings) component).saveSettings(e);

                        if (component instanceof Component.HasPresentations
                                && ((Component.HasPresentations) component).isUsePresentations()) {
                            Object def = ((Component.HasPresentations) component).getDefaultPresentationId();
                            e.addAttribute("presentation", def != null ? def.toString() : "");
                            Presentations presentations = ((Component.HasPresentations) component).getPresentations();
                            if (presentations != null) {
                                presentations.commit();
                            }
                        }
                        WindowDelegate.this.settings.setModified(modified);
                    }
                }
        );
        settings.commit();
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:29,代码来源:WindowDelegate.java

示例8: disposeComponents

import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
public void disposeComponents() {
    ComponentsHelper.walkComponents(
            window,
            (component, name) -> {
                if (component instanceof Component.Disposable) {
                    ((Component.Disposable) component).dispose();
                }
            }
    );
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:11,代码来源:WindowDelegate.java

示例9: createTopLevelWindow

import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
public void createTopLevelWindow(WindowInfo windowInfo) {
    ui.beforeTopLevelWindowInit();

    String template = windowInfo.getTemplate();

    Window.TopLevelWindow topLevelWindow;

    Map<String, Object> params = Collections.emptyMap();
    if (template != null) {
        //noinspection unchecked
        topLevelWindow = (Window.TopLevelWindow) createWindow(windowInfo, OpenType.NEW_TAB, params,
                LayoutLoaderConfig.getWindowLoaders(), true);
    } else {
        Class screenClass = windowInfo.getScreenClass();
        if (screenClass != null) {
            //noinspection unchecked
            topLevelWindow = (Window.TopLevelWindow) createWindowByScreenClass(windowInfo, params);
        } else {
            throw new DevelopmentException("Unable to load top level window");
        }
    }

    // detect work area
    Window windowImpl = ((Window.Wrapper) topLevelWindow).getWrappedWindow();

    if (topLevelWindow instanceof AbstractMainWindow) {
        AbstractMainWindow mainWindow = (AbstractMainWindow) topLevelWindow;

        // bind system UI components to AbstractMainWindow
        ComponentsHelper.walkComponents(windowImpl, component -> {
            if (component instanceof AppWorkArea) {
                mainWindow.setWorkArea((AppWorkArea) component);
            } else if (component instanceof UserIndicator) {
                mainWindow.setUserIndicator((UserIndicator) component);
            } else if (component instanceof FoldersPane) {
                mainWindow.setFoldersPane((FoldersPane) component);
            }

            return false;
        });
    }

    ui.setTopLevelWindow(topLevelWindow);

    // load menu
    ComponentsHelper.walkComponents(windowImpl, component -> {
        if (component instanceof TopLevelWindowAttachListener) {
            ((TopLevelWindowAttachListener) component).topLevelWindowAttached(topLevelWindow);
        }

        return false;
    });

    if (topLevelWindow instanceof Window.HasWorkArea) {
        AppWorkArea workArea = ((Window.HasWorkArea) topLevelWindow).getWorkArea();
        if (workArea != null) {
            workArea.addStateChangeListener(new AppWorkArea.StateChangeListener() {
                @Override
                public void stateChanged(AppWorkArea.State newState) {
                    if (newState == AppWorkArea.State.WINDOW_CONTAINER) {
                        initTabShortcuts();

                        // listener used only once
                        getConfiguredWorkArea(createWorkAreaContext(topLevelWindow)).removeStateChangeListener(this);
                    }
                }
            });
        }
    }

    afterShowWindow(topLevelWindow);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:73,代码来源:WebWindowManager.java

示例10: initLazyTab

import com.haulmont.cuba.gui.ComponentsHelper; //导入方法依赖的package包/类
protected void initLazyTab(JComponent tab) {
    LazyTabInfo lti = null;
    for (LazyTabInfo lazyTabInfo : lazyTabs) {
        if (lazyTabInfo.getTabComponent() == tab) {
            lti = lazyTabInfo;
            break;
        }
    }

    if (lti == null) { // already initialized
        return;
    }

    if (!lti.getTab().isEnabled()) {
        return;
    }

    lazyTabs.remove(lti);

    lti.loader.createComponent();

    Component lazyContent = lti.loader.getResultComponent();

    lazyContent.setWidth("100%");
    lti.tabContent.add(lazyContent);
    lti.tabContent.expand(lazyContent, "", "");
    lazyContent.setParent(this);

    lti.loader.loadComponent();

    if (lazyContent instanceof DesktopAbstractComponent && !isEnabledWithParent()) {
        ((DesktopAbstractComponent) lazyContent).setParentEnabled(false);
    }

    final Window window = ComponentsHelper.getWindow(DesktopTabSheet.this);
    if (window != null) {
        ComponentsHelper.walkComponents(
                lti.tabContent,
                (component, name) -> {
                    if (component instanceof HasSettings) {
                        Settings settings = window.getSettings();
                        if (settings != null) {
                            Element e = settings.get(name);
                            ((HasSettings) component).applySettings(e);
                        }
                    }
                }
        );

        lti.getTab().setLazyInitialized(true);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:53,代码来源:DesktopTabSheet.java


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