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


Java ComponentsHelper类代码示例

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


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

import com.haulmont.cuba.gui.ComponentsHelper; //导入依赖的package包/类
protected void setupUpdateTimer() {
    int period = webConfig.getAppFoldersRefreshPeriodSec() * 1000;

    timer = new FoldersPaneTimer();
    timer.setRepeating(true);
    timer.setDelay(period);
    timer.addActionListener(createAppFolderUpdater());
    timer.start();

    if (this.isAttached()) {
        AppUI ui = AppUI.getCurrent();
        stopExistingFoldersPaneTimer(ui);
        ui.addTimer(timer);
    } else if (frame != null) {
        com.haulmont.cuba.gui.components.Window window = ComponentsHelper.getWindowImplementation(frame);
        if (window == null) {
            throw new IllegalStateException("Null window for CubaFoldersPane");
        }
        AbstractComponent topLevelFrame = window.unwrapComposition(AbstractComponent.class);
        timer.extend(topLevelFrame);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:23,代码来源:CubaFoldersPane.java

示例4: build

import com.haulmont.cuba.gui.ComponentsHelper; //导入依赖的package包/类
public void build(AppMenu appMenu) {
    this.appMenu = appMenu;

    Window window = ComponentsHelper.getWindowImplementation(appMenu);
    if (window == null) {
        throw new IllegalStateException("AppMenu is not belong to Window");
    }

    List<MenuItem> rootItems = menuConfig.getRootItems();
    for (MenuItem menuItem : rootItems) {
        if (menuItem.isPermitted(session)) {
            createMenuBarItem(window, menuItem);
        }
    }
    removeExtraSeparators();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:17,代码来源:MenuBuilder.java

示例5: validate

import com.haulmont.cuba.gui.ComponentsHelper; //导入依赖的package包/类
@Override
public boolean validate(List<Validatable> fields) {
    ValidationErrors errors = new ValidationErrors();

    for (Validatable field : fields) {
        try {
            field.validate();
        } catch (ValidationException e) {
            if (log.isTraceEnabled())
                log.trace("Validation failed", e);
            else if (log.isDebugEnabled())
                log.debug("Validation failed: " + e);

            ComponentsHelper.fillErrorMessages(field, e, errors);
        }
    }

    return handleValidationErrors(errors);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:20,代码来源:WebFrame.java

示例6: validateAll

import com.haulmont.cuba.gui.ComponentsHelper; //导入依赖的package包/类
@Override
public boolean validateAll() {
    ValidationErrors errors = new ValidationErrors();

    Collection<Component> components = ComponentsHelper.getComponents(this);
    for (Component component : components) {
        if (component instanceof Validatable) {
            Validatable validatable = (Validatable) component;
            if (validatable.isValidateOnCommit()) {
                try {
                    validatable.validate();
                } catch (ValidationException e) {
                    if (log.isTraceEnabled())
                        log.trace("Validation failed", e);
                    else if (log.isDebugEnabled())
                        log.debug("Validation failed: " + e);

                    ComponentsHelper.fillErrorMessages(validatable, e, errors);
                }
            }
        }
    }

    return handleValidationErrors(errors);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:26,代码来源:WebFrame.java

示例7: stateChanged

import com.haulmont.cuba.gui.ComponentsHelper; //导入依赖的package包/类
@Override
public void stateChanged(ChangeEvent e) {
    if (context != null) {
        context.executeInjectTasks();
        context.executePostWrapTasks();
        context.executeInitTasks();
    }

    // Fire GUI listener
    fireTabChanged();

    // Execute outstanding post init tasks after GUI listener.
    // We suppose that context.executePostInitTasks() executes a task once and then remove it from task list.
    if (context != null) {
        context.executePostInitTasks();
    }

    Window window = ComponentsHelper.getWindow(DesktopTabSheet.this);
    if (window != null) {
        ((DsContextImplementation) window.getDsContext()).resumeSuspended();
    } else {
        log.warn("Please specify Frame for TabSheet");
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:25,代码来源:DesktopTabSheet.java

示例8: getLoggingTag

import com.haulmont.cuba.gui.ComponentsHelper; //导入依赖的package包/类
protected String getLoggingTag(String prefix) {
    String windowId = "";
    if (dsContext != null) {
        FrameContext windowContext = dsContext.getFrameContext();
        if (windowContext != null) {
            Frame frame = windowContext.getFrame();
            if (frame != null) {
                windowId = ComponentsHelper.getFullFrameId(windowContext.getFrame());
            }
        }
    }
    String tag = prefix + " " + id;
    if (StringUtils.isNotBlank(windowId))
        tag = windowId + "@" + id;
    return tag;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:17,代码来源:AbstractCollectionDatasource.java

示例9: 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

示例10: detachCloseListener

import com.haulmont.cuba.gui.ComponentsHelper; //导入依赖的package包/类
private void detachCloseListener() {
    // force remove close listener
    Frame ownerFrame = getTask().getOwnerFrame();
    if (ownerFrame != null) {
        Window ownerWindow = ComponentsHelper.getWindowImplementation(ownerFrame);
        if (ownerWindow != null) {
            ownerWindow.removeCloseListener(closeListener);

            String windowClass = ownerFrame.getClass().getCanonicalName();
            log.trace("Resources were disposed. Task: {}. Frame: {}", taskExecutor.getTask(), windowClass);
        } else {
            log.trace("Empty ownerWindow. Resources were not disposed. Task: {}", taskExecutor.getTask());
        }
    } else {
        log.trace("Empty ownerFrame. Resources were not disposed. Task: {}", taskExecutor.getTask());
    }
    closeListener = null;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:19,代码来源:TaskHandlerImpl.java

示例11: 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

示例12: updateWindowCaption

import com.haulmont.cuba.gui.ComponentsHelper; //导入依赖的package包/类
protected void updateWindowCaption() {
    Window window = ComponentsHelper.getWindow(filter);
    String filterTitle;
    if (filterMode == FilterMode.GENERIC_MODE && filterEntity != null && filterEntity != adHocFilter) {
        filterTitle = getFilterCaption(filterEntity);
    } else {
        filterTitle = null;
    }
    window.setDescription(filterTitle);

    if (initialWindowCaption == null) {
        initialWindowCaption = window.getCaption();
    }

    windowManager.setWindowCaption(window, initialWindowCaption, filterTitle);

    groupBoxLayout.setCaption(Strings.isNullOrEmpty(filterTitle) ? caption : caption + ": " + filterTitle);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:19,代码来源:FilterDelegateImpl.java

示例13: actionPerform

import com.haulmont.cuba.gui.ComponentsHelper; //导入依赖的package包/类
@Override
public void actionPerform(Component component) {
    Set<Entity> ownerSelection = target.getSelected();

    if (!ownerSelection.isEmpty()) {
        String entityType = target.getDatasource().getMetaClass().getName();
        Map<String, Object> params = new HashMap<>();
        params.put("entityType", entityType);
        params.put("items", ownerSelection);
        params.put("componentPath", ComponentsHelper.getFilterComponentPath(filter));
        String[] strings = ValuePathHelper.parse(ComponentsHelper.getFilterComponentPath(filter));
        String componentId = ValuePathHelper.format(Arrays.copyOfRange(strings, 1, strings.length));
        params.put("componentId", componentId);
        params.put("foldersPane", filterHelper.getFoldersPane());
        params.put("entityClass", datasource.getMetaClass().getJavaClass().getName());
        params.put("query", datasource.getQuery());
        filter.getFrame().openWindow("saveSetInFolder",
                WindowManager.OpenType.DIALOG,
                params);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:22,代码来源:FilterDelegateImpl.java

示例14: 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

示例15: isValid

import com.haulmont.cuba.gui.ComponentsHelper; //导入依赖的package包/类
public boolean isValid() {
    Collection<Component> components = ComponentsHelper.getComponents(window);
    for (Component component : components) {
        if (component instanceof Component.Validatable) {
            Component.Validatable validatable = (Component.Validatable) component;
            if (validatable.isValidateOnCommit() && !validatable.isValid())
                return false;
        }
    }
    return true;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:12,代码来源:WindowDelegate.java


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