Search in sources :

Example 1 with MenuSeparator

use of org.eclipse.scout.rt.client.ui.action.menu.MenuSeparator in project scout.rt by eclipse.

the class AbstractBookmarkMenu method addBookmarkTreeInternal.

protected void addBookmarkTreeInternal(BookmarkFolder folder, List<IMenu> actionList) {
    for (BookmarkFolder f : folder.getFolders()) {
        IMenu group = new MenuSeparator();
        group.setSeparator(false);
        group.setText(f.getTitle());
        group.setIconId(f.getIconId());
        List<IMenu> childActionList = new ArrayList<IMenu>();
        addBookmarkTreeInternal(f, childActionList);
        group.setChildActions(childActionList);
        actionList.add(group);
    }
    List<IMenu> newActions = new ArrayList<>();
    for (Bookmark b : folder.getBookmarks()) {
        newActions.add(new ActivateBookmarkMenu(b));
    }
    ActionUtility.initActions(newActions);
    actionList.addAll(newActions);
}
Also used : IMenu(org.eclipse.scout.rt.client.ui.action.menu.IMenu) Bookmark(org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark) BookmarkFolder(org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder) ArrayList(java.util.ArrayList) AbstractMenuSeparator(org.eclipse.scout.rt.client.ui.action.menu.AbstractMenuSeparator) MenuSeparator(org.eclipse.scout.rt.client.ui.action.menu.MenuSeparator)

Example 2 with MenuSeparator

use of org.eclipse.scout.rt.client.ui.action.menu.MenuSeparator in project scout.rt by eclipse.

the class AbstractBookmarkMenu method handleBookmarksChanged.

protected void handleBookmarksChanged() {
    IBookmarkService service = BEANS.get(IBookmarkService.class);
    List<IMenu> oldList = getChildActions();
    List<IMenu> newList = new ArrayList<IMenu>();
    for (IMenu m : oldList) {
        if (m.getClass() == AddUserBookmarkMenu.class) {
            newList.add(m);
        } else if (m.getClass() == AddGlobalBookmarkMenu.class) {
            newList.add(m);
        } else if (m.getClass() == ManageBookmarksMenu.class) {
            newList.add(m);
        } else if (m.getClass() == StartBookmarkMenu.class) {
            newList.add(m);
        } else if (m.getClass() == Separator1Menu.class) {
            newList.add(m);
        } else {
            // ignore the rest
            break;
        }
    }
    // add global bookmarks
    newList.add(new MenuSeparator());
    addBookmarkTreeInternal(service.getBookmarkData().getGlobalBookmarks(), newList);
    // add user bookmarks
    newList.add(new MenuSeparator());
    addBookmarkTreeInternal(service.getBookmarkData().getUserBookmarks(), newList);
    setChildActions(newList);
}
Also used : IMenu(org.eclipse.scout.rt.client.ui.action.menu.IMenu) ArrayList(java.util.ArrayList) AbstractMenuSeparator(org.eclipse.scout.rt.client.ui.action.menu.AbstractMenuSeparator) MenuSeparator(org.eclipse.scout.rt.client.ui.action.menu.MenuSeparator) IBookmarkService(org.eclipse.scout.rt.client.services.common.bookmark.IBookmarkService)

Aggregations

ArrayList (java.util.ArrayList)2 AbstractMenuSeparator (org.eclipse.scout.rt.client.ui.action.menu.AbstractMenuSeparator)2 IMenu (org.eclipse.scout.rt.client.ui.action.menu.IMenu)2 MenuSeparator (org.eclipse.scout.rt.client.ui.action.menu.MenuSeparator)2 IBookmarkService (org.eclipse.scout.rt.client.services.common.bookmark.IBookmarkService)1 Bookmark (org.eclipse.scout.rt.shared.services.common.bookmark.Bookmark)1 BookmarkFolder (org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder)1