use of org.jowidgets.api.model.item.IMenuModel in project jo-client-platform by jo-source.
the class BeanTableMenuFactoryImpl method filterCellMenu.
@Override
public IMenuModel filterCellMenu(final IBeanTable<BEAN_TYPE> table, final int columnIndex) {
Assert.paramNotNull(table, "table");
IMenuModel menuModel = new BeanTableCellFilterMenuModel<BEAN_TYPE>(table, columnIndex, this);
for (final IBeanTableMenuInterceptor<BEAN_TYPE> interceptor : interceptors) {
if (menuModel != null) {
menuModel = interceptor.filterCellMenu(table, columnIndex, menuModel);
} else {
break;
}
}
return menuModel;
}
use of org.jowidgets.api.model.item.IMenuModel in project jo-client-platform by jo-source.
the class BeanTableMenuFactoryImpl method headerPopupMenu.
@Override
public IMenuModel headerPopupMenu(final IBeanTable<BEAN_TYPE> table, final int columnIndex) {
Assert.paramNotNull(table, "table");
IMenuModel menuModel = new BeanTableHeaderMenuModel<BEAN_TYPE>(table, columnIndex, this);
for (final IBeanTableMenuInterceptor<BEAN_TYPE> interceptor : interceptors) {
if (menuModel != null) {
menuModel = interceptor.headerPopupMenu(table, columnIndex, menuModel);
} else {
break;
}
}
return menuModel;
}
use of org.jowidgets.api.model.item.IMenuModel in project jo-client-platform by jo-source.
the class BeanRelationTreeImpl method createNodeMenus.
private IMenuModel createNodeMenus(final IBeanRelationNodeModel<Object, Object> relationNodeModel, final IMenuModel relationMenu, final IAction createAction) {
final IMenuModel result = new MenuModel();
boolean needSeparator = false;
final IAction copyAction = createCopyAction(relationNodeModel);
if (copyAction != null && createAction == null) {
result.addAction(copyAction);
needSeparator = true;
}
if (relationMenu.getChildren().size() > 0) {
for (final IMenuItemModel item : relationMenu.getChildren()) {
result.addItem(item);
if (copyAction != null && createAction != null && item instanceof IActionItemModel) {
final IAction action = ((IActionItemModel) item).getAction();
if (NullCompatibleEquivalence.equals(createAction, action)) {
result.addAction(copyAction);
}
}
}
needSeparator = true;
}
final IEntityService entityService = ServiceProvider.getService(IEntityService.ID);
if (entityService != null) {
final Object childEntityId = relationNodeModel.getChildEntityId();
if (relationNodeModel.getParentEntityId() != null && relationNodeModel.getParentBean() != null) {
final List<IEntityLinkDescriptor> links = entityService.getEntityLinks(relationNodeModel.getParentEntityId());
for (final IEntityLinkDescriptor link : links) {
if (childEntityId.equals(link.getLinkedEntityId())) {
final IAction linkDeleterAction = createLinkDeleterAction(relationNodeModel, link);
if (linkDeleterAction != null) {
if (needSeparator) {
result.addSeparator();
needSeparator = false;
}
result.addAction(linkDeleterAction);
}
}
}
}
final IAction deleterAction = createDeleterAction(relationNodeModel);
if (deleterAction != null) {
if (needSeparator) {
result.addSeparator();
needSeparator = false;
}
result.addAction(deleterAction);
}
}
if (menuInterceptor != null) {
return menuInterceptor.nodeMenu(relationNodeModel, result);
} else {
return result;
}
}
use of org.jowidgets.api.model.item.IMenuModel in project jo-client-platform by jo-source.
the class BeanTableImpl method addMenusFromPlugins.
@SuppressWarnings({ "rawtypes", "unchecked" })
private void addMenusFromPlugins(final Class<BEAN_TYPE> beanType, final Object entityId, final IMenuModel menuModel, final IMenuModel cellMenuModel, final IMenuModel headerMenuModel) {
final IPluginPropertiesBuilder propBuilder = PluginToolkit.pluginPropertiesBuilder();
propBuilder.add(IBeanTableMenuContributionPlugin.ENTITIY_ID_PROPERTY_KEY, entityId);
propBuilder.add(IBeanTableMenuContributionPlugin.BEAN_TYPE_PROPERTY_KEY, beanType);
final IPluginProperties properties = propBuilder.build();
final List<IBeanTableMenuContributionPlugin<?>> plugins = PluginProvider.getPlugins(IBeanTableMenuContributionPlugin.ID, properties);
if (plugins != null) {
for (final IBeanTableMenuContributionPlugin plugin : plugins) {
final IMenuModel menu = plugin.getTableMenu(properties, this);
if (menu != null) {
menuModel.addItemsOfModel(menu);
}
final IMenuModel cellMenu = plugin.getCellMenu(properties, this);
if (menu != null) {
cellMenuModel.addItemsOfModel(cellMenu);
}
final IMenuModel headerMenu = plugin.getHeaderMenu(properties, this);
if (menu != null) {
headerMenuModel.addItemsOfModel(headerMenu);
}
}
}
}
use of org.jowidgets.api.model.item.IMenuModel in project jo-client-platform by jo-source.
the class BeanTableImpl method createHeaderPopupMenuModelUndecorated.
private IMenuModel createHeaderPopupMenuModelUndecorated(final Integer index) {
final IMenuModel menuModel;
if (hasDefaultMenus) {
final IMenuModel headerPopupMenu = menuFactory.headerPopupMenu(this, index.intValue());
if (headerPopupMenu != null) {
menuModel = headerPopupMenu;
} else {
menuModel = new MenuModel();
}
} else {
menuModel = new MenuModel();
}
if (headerMenuInterceptor != null) {
headerMenuInterceptor.afterMenuCreated(this, menuModel, index.intValue());
}
addMenuModel(menuModel, headerPopupMenuModel);
addMenuModel(menuModel, pluggedHeaderPopupMenuModel);
return menuModel;
}
Aggregations