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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations