Search in sources :

Example 1 with IMenuModel

use of org.jowidgets.api.model.item.IMenuModel in project jo-client-platform by jo-source.

the class BeanTableImpl method createHeaderPopupMenuModel.

private IMenuModel createHeaderPopupMenuModel(final Integer index) {
    final IMenuModel menuModel = createHeaderPopupMenuModelUndecorated(index);
    menuModel.addDecorator(createDecorator(true));
    return menuModel;
}
Also used : IMenuModel(org.jowidgets.api.model.item.IMenuModel)

Example 2 with IMenuModel

use of org.jowidgets.api.model.item.IMenuModel in project jo-client-platform by jo-source.

the class BeanTableImpl method createCellPopupMenuModel.

private IMenuModel createCellPopupMenuModel(final Integer index) {
    final IMenuModel menuModel;
    if (hasDefaultMenus) {
        final IMenuModel headerPopupMenuModelUndecorated;
        if (!isColumnPopupDetectionSupported()) {
            headerPopupMenuModelUndecorated = createHeaderPopupMenuModelUndecorated(index);
        } else {
            headerPopupMenuModelUndecorated = null;
        }
        final IMenuModel cellPopupMenu = menuFactory.cellPopupMenu(this, headerPopupMenuModelUndecorated, index.intValue());
        if (cellPopupMenu != null) {
            menuModel = cellPopupMenu;
        } else {
            menuModel = new MenuModel();
        }
    } else {
        menuModel = new MenuModel();
    }
    boolean separatorNeeded = menuModel.getChildren().size() > 0;
    if (creatorAction != null) {
        if (separatorNeeded) {
            menuModel.addSeparator();
            separatorNeeded = false;
        }
        menuModel.addAction(creatorAction);
    }
    if (copyAction != null) {
        if (separatorNeeded) {
            menuModel.addSeparator();
            separatorNeeded = false;
        }
        menuModel.addAction(copyAction);
    }
    if (pasteAction != null) {
        if (separatorNeeded) {
            menuModel.addSeparator();
            separatorNeeded = false;
        }
        menuModel.addAction(pasteAction);
    }
    if (deleteAction != null) {
        if (separatorNeeded) {
            menuModel.addSeparator();
            separatorNeeded = false;
        }
        menuModel.addAction(deleteAction);
    }
    separatorNeeded = menuModel.getChildren().size() > 0;
    if (moveOrderedBeanUpAction != null && moveOrderedBeanDownAction != null) {
        if (separatorNeeded) {
            menuModel.addSeparator();
        }
        menuModel.addAction(moveOrderedBeanUpAction);
        menuModel.addAction(moveOrderedBeanDownAction);
    }
    if (cellMenuInterceptor != null) {
        cellMenuInterceptor.afterMenuCreated(this, menuModel, index.intValue());
    }
    addMenuModel(menuModel, cellPopupMenuModel);
    addMenuModel(menuModel, pluggedCellPopupMenuModel);
    menuModel.addDecorator(createDecorator(false));
    return menuModel;
}
Also used : IMenuModel(org.jowidgets.api.model.item.IMenuModel) IMenuModel(org.jowidgets.api.model.item.IMenuModel) MenuModel(org.jowidgets.tools.model.item.MenuModel)

Example 3 with IMenuModel

use of org.jowidgets.api.model.item.IMenuModel in project jo-client-platform by jo-source.

the class CapWorkbenchMenuFactoryImpl method menuBar.

@Override
public IMenuBarModel menuBar() {
    final MenuBarModel result = new MenuBarModel();
    final IMenuModel dataMenu = dataMenu();
    if (dataMenu != null) {
        result.addMenu(dataMenu);
    }
    return result;
}
Also used : IMenuModel(org.jowidgets.api.model.item.IMenuModel) IMenuBarModel(org.jowidgets.api.model.item.IMenuBarModel) MenuBarModel(org.jowidgets.tools.model.item.MenuBarModel)

Example 4 with IMenuModel

use of org.jowidgets.api.model.item.IMenuModel in project jo-client-platform by jo-source.

the class CapWorkbenchMenuFactoryImpl method dataMenu.

@Override
public IMenuModel dataMenu() {
    IMenuModel result = new MenuModel(Messages.getString("CapWorkbenchMenuFactoryImpl.data"));
    final IDataModelAction loadAction = CapWorkbenchActionsProvider.loadAction();
    boolean separator = false;
    if (loadAction != null) {
        result.addAction(loadAction);
        separator = true;
    }
    final IDataModelAction cancelAction = CapWorkbenchActionsProvider.cancelAction();
    if (cancelAction != null) {
        result.addAction(cancelAction);
        separator = true;
    }
    if (separator) {
        result.addSeparator();
        separator = false;
    }
    final IDataModelAction undoAction = CapWorkbenchActionsProvider.undoAction();
    if (undoAction != null) {
        result.addAction(undoAction);
        separator = true;
    }
    final IDataModelAction saveAction = CapWorkbenchActionsProvider.saveAction();
    if (saveAction != null) {
        result.addAction(saveAction);
        separator = true;
    }
    if (separator) {
        result.addSeparator();
    }
    final IAction refreshLookUpsAction = CapWorkbenchActionsProvider.refreshLookUpsAction();
    if (refreshLookUpsAction != null) {
        result.addAction(refreshLookUpsAction);
    }
    final int size = result.getChildren().size();
    if (size > 0) {
        final IMenuItemModel itemModel = result.getChildren().get(size - 1);
        if (itemModel instanceof ISeparatorItemModel) {
            result.removeItem(itemModel);
        }
    }
    // Modify with plugins
    for (final IWorkbenchMenuInterceptorPlugin plugin : PluginProvider.getPlugins(IWorkbenchMenuInterceptorPlugin.ID)) {
        result = plugin.getMenuInterceptor().dataMenuModel(result);
        if (result == null) {
            break;
        }
    }
    return result;
}
Also used : IMenuModel(org.jowidgets.api.model.item.IMenuModel) IAction(org.jowidgets.api.command.IAction) ISeparatorItemModel(org.jowidgets.api.model.item.ISeparatorItemModel) IMenuModel(org.jowidgets.api.model.item.IMenuModel) MenuModel(org.jowidgets.tools.model.item.MenuModel) IMenuItemModel(org.jowidgets.api.model.item.IMenuItemModel) IWorkbenchMenuInterceptorPlugin(org.jowidgets.cap.ui.api.plugin.IWorkbenchMenuInterceptorPlugin) IDataModelAction(org.jowidgets.cap.ui.api.command.IDataModelAction)

Example 5 with IMenuModel

use of org.jowidgets.api.model.item.IMenuModel in project jo-client-platform by jo-source.

the class BeanTableMenuFactoryImpl method filterHeaderMenu.

@Override
public IMenuModel filterHeaderMenu(final IBeanTable<BEAN_TYPE> table, final int columnIndex) {
    Assert.paramNotNull(table, "table");
    IMenuModel menuModel = new BeanTableHeaderFilterMenuModel<BEAN_TYPE>(table, columnIndex, this);
    for (final IBeanTableMenuInterceptor<BEAN_TYPE> interceptor : interceptors) {
        if (menuModel != null) {
            menuModel = interceptor.filterHeaderMenu(table, columnIndex, menuModel);
        } else {
            break;
        }
    }
    return menuModel;
}
Also used : IMenuModel(org.jowidgets.api.model.item.IMenuModel)

Aggregations

IMenuModel (org.jowidgets.api.model.item.IMenuModel)17 IAction (org.jowidgets.api.command.IAction)4 MenuModel (org.jowidgets.tools.model.item.MenuModel)4 IMenuItemModel (org.jowidgets.api.model.item.IMenuItemModel)2 IToolBarModel (org.jowidgets.api.model.item.IToolBarModel)2 IActionItemModel (org.jowidgets.api.model.item.IActionItemModel)1 IMenuBarModel (org.jowidgets.api.model.item.IMenuBarModel)1 ISeparatorItemModel (org.jowidgets.api.model.item.ISeparatorItemModel)1 IEntityLinkDescriptor (org.jowidgets.cap.common.api.entity.IEntityLinkDescriptor)1 IEntityService (org.jowidgets.cap.common.api.service.IEntityService)1 IDataModelAction (org.jowidgets.cap.ui.api.command.IDataModelAction)1 IBeanTableMenuContributionPlugin (org.jowidgets.cap.ui.api.plugin.IBeanTableMenuContributionPlugin)1 IWorkbenchMenuInterceptorPlugin (org.jowidgets.cap.ui.api.plugin.IWorkbenchMenuInterceptorPlugin)1 IPluginProperties (org.jowidgets.plugin.api.IPluginProperties)1 IPluginPropertiesBuilder (org.jowidgets.plugin.api.IPluginPropertiesBuilder)1 MenuBarModel (org.jowidgets.tools.model.item.MenuBarModel)1