use of org.jowidgets.api.model.item.IActionItemModel 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.IActionItemModel in project jo-client-platform by jo-source.
the class EntityComponent method getDataModelActions.
private List<IDataModelAction> getDataModelActions(final IComponentNodeModel componentNodeModel) {
final IToolBarModel toolBar = componentNodeModel.getApplication().getWorkbench().getToolBar();
final List<IDataModelAction> result = new LinkedList<IDataModelAction>();
for (final IToolBarItemModel item : toolBar.getItems()) {
if (item instanceof IActionItemModel) {
final IAction action = ((IActionItemModel) item).getAction();
if (action instanceof IDataModelAction) {
result.add((IDataModelAction) action);
}
}
}
return result;
}
Aggregations