Search in sources :

Example 1 with RelatedAction

use of com.haulmont.cuba.gui.components.actions.RelatedAction in project cuba by cuba-platform.

the class DesktopRelatedEntities method addNavigationAction.

protected void addNavigationAction(MetaClass metaClass, MetaProperty metaProperty) {
    // check if browse screen available
    PropertyOption propertyOption = propertyOptions.get(metaProperty.getName());
    WindowInfo defaultScreen = screensHelper.getDefaultBrowseScreen(metaProperty.getRange().asClass());
    if (defaultScreen != null || (propertyOption != null && StringUtils.isNotEmpty(propertyOption.getScreen()))) {
        RelatedAction relatedAction = RelatedAction.create("related" + actionList.size(), listComponent, metaClass, metaProperty);
        relatedAction.setOpenType(openType);
        if (defaultScreen != null) {
            relatedAction.setScreen(defaultScreen.getId());
        }
        if (propertyOption != null) {
            if (StringUtils.isNotEmpty(propertyOption.getCaption())) {
                relatedAction.setCaption(propertyOption.getCaption());
            }
            if (StringUtils.isNotEmpty(propertyOption.getFilterCaption())) {
                relatedAction.setFilterCaption(propertyOption.getFilterCaption());
            }
            if (StringUtils.isNotEmpty(propertyOption.getScreen())) {
                relatedAction.setScreen(propertyOption.getScreen());
            }
        }
        addAction(relatedAction);
    }
}
Also used : RelatedAction(com.haulmont.cuba.gui.components.actions.RelatedAction) WindowInfo(com.haulmont.cuba.gui.config.WindowInfo)

Example 2 with RelatedAction

use of com.haulmont.cuba.gui.components.actions.RelatedAction in project cuba by cuba-platform.

the class DesktopRelatedEntities method setOpenType.

@Override
public void setOpenType(WindowManager.OpenType openType) {
    checkNotNullArgument(openType);
    this.openType = openType;
    for (Action action : getActions()) {
        if (action instanceof RelatedAction) {
            ((RelatedAction) action).setOpenType(openType);
        }
    }
}
Also used : RelatedAction(com.haulmont.cuba.gui.components.actions.RelatedAction) RelatedAction(com.haulmont.cuba.gui.components.actions.RelatedAction)

Example 3 with RelatedAction

use of com.haulmont.cuba.gui.components.actions.RelatedAction in project cuba by cuba-platform.

the class WebRelatedEntities method addNavigationAction.

protected void addNavigationAction(MetaClass metaClass, MetaProperty metaProperty) {
    // check if browse screen available
    PropertyOption propertyOption = propertyOptions.get(metaProperty.getName());
    WindowInfo defaultScreen = screensHelper.getDefaultBrowseScreen(metaProperty.getRange().asClass());
    if (defaultScreen != null || (propertyOption != null && StringUtils.isNotEmpty(propertyOption.getScreen()))) {
        RelatedAction relatedAction = RelatedAction.create("related" + actionOrder.size(), listComponent, metaClass, metaProperty);
        relatedAction.setOpenType(openType);
        if (defaultScreen != null) {
            relatedAction.setScreen(defaultScreen.getId());
        }
        if (propertyOption != null) {
            if (StringUtils.isNotEmpty(propertyOption.getCaption())) {
                relatedAction.setCaption(propertyOption.getCaption());
            }
            if (StringUtils.isNotEmpty(propertyOption.getFilterCaption())) {
                relatedAction.setFilterCaption(propertyOption.getFilterCaption());
            }
            if (StringUtils.isNotEmpty(propertyOption.getScreen())) {
                relatedAction.setScreen(propertyOption.getScreen());
            }
        }
        addAction(relatedAction);
    }
}
Also used : RelatedAction(com.haulmont.cuba.gui.components.actions.RelatedAction) WindowInfo(com.haulmont.cuba.gui.config.WindowInfo)

Example 4 with RelatedAction

use of com.haulmont.cuba.gui.components.actions.RelatedAction in project cuba by cuba-platform.

the class WebRelatedEntities method setOpenType.

@Override
public void setOpenType(WindowManager.OpenType openType) {
    checkNotNullArgument(openType);
    this.openType = openType;
    for (Action action : getActions()) {
        if (action instanceof RelatedAction) {
            ((RelatedAction) action).setOpenType(openType);
        }
    }
}
Also used : RelatedAction(com.haulmont.cuba.gui.components.actions.RelatedAction) Action(com.haulmont.cuba.gui.components.Action) RelatedAction(com.haulmont.cuba.gui.components.actions.RelatedAction)

Aggregations

RelatedAction (com.haulmont.cuba.gui.components.actions.RelatedAction)4 WindowInfo (com.haulmont.cuba.gui.config.WindowInfo)2 Action (com.haulmont.cuba.gui.components.Action)1