Search in sources :

Example 1 with RevealOverlayContentEvent

use of org.ovirt.engine.ui.webadmin.section.main.presenter.RevealOverlayContentEvent in project ovirt-engine by oVirt.

the class BookmarkPresenterWidget method updateBookmarks.

private void updateBookmarks() {
    BookmarkListModel model = bookmarkModelProvider.getModel();
    Collection<Bookmark> items = model.getItems();
    AbstractMainWithDetailsPresenter<?, ?, ?, ?> presenter = null;
    if (getCurrentPlaceWidget() instanceof AbstractMainWithDetailsPresenter) {
        presenter = (AbstractMainWithDetailsPresenter<?, ?, ?, ?>) getCurrentPlaceWidget();
    }
    final AbstractMainWithDetailsPresenter<?, ?, ?, ?> mainPresenter = presenter;
    getView().clearBookmarks();
    if (items != null && !items.isEmpty()) {
        for (Bookmark bookmark : items) {
            if (mainPresenter != null && isBookmarkForCurrentPlace(bookmark, mainPresenter)) {
                registerHandler(getView().addBookmark(bookmark, model, event -> {
                    mainPresenter.applySearchString(bookmark.getValue());
                    // Close the overlay.
                    RevealOverlayContentEvent.fire(this, new RevealOverlayContentEvent(null));
                    event.preventDefault();
                }));
            } else {
                getView().addBookmark(bookmark, model, null);
            }
        }
    }
}
Also used : BookmarkModelProvider(org.ovirt.engine.ui.webadmin.uicommon.model.BookmarkModelProvider) HandlerRegistration(com.google.web.bindery.event.shared.HandlerRegistration) AbstractOverlayPresenterWidget(org.ovirt.engine.ui.webadmin.section.main.presenter.AbstractOverlayPresenterWidget) SearchStringMapping(org.ovirt.engine.ui.uicommonweb.models.SearchStringMapping) Collection(java.util.Collection) Inject(com.google.inject.Inject) Bookmark(org.ovirt.engine.core.common.businessentities.Bookmark) AbstractMainWithDetailsPresenter(org.ovirt.engine.ui.webadmin.section.main.presenter.AbstractMainWithDetailsPresenter) EventBus(com.google.web.bindery.event.shared.EventBus) BookmarkListModel(org.ovirt.engine.ui.uicommonweb.models.bookmarks.BookmarkListModel) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) RevealOverlayContentEvent(org.ovirt.engine.ui.webadmin.section.main.presenter.RevealOverlayContentEvent) RevealOverlayContentEvent(org.ovirt.engine.ui.webadmin.section.main.presenter.RevealOverlayContentEvent) Bookmark(org.ovirt.engine.core.common.businessentities.Bookmark) BookmarkListModel(org.ovirt.engine.ui.uicommonweb.models.bookmarks.BookmarkListModel) AbstractMainWithDetailsPresenter(org.ovirt.engine.ui.webadmin.section.main.presenter.AbstractMainWithDetailsPresenter)

Aggregations

ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 Inject (com.google.inject.Inject)1 EventBus (com.google.web.bindery.event.shared.EventBus)1 HandlerRegistration (com.google.web.bindery.event.shared.HandlerRegistration)1 Collection (java.util.Collection)1 Bookmark (org.ovirt.engine.core.common.businessentities.Bookmark)1 SearchStringMapping (org.ovirt.engine.ui.uicommonweb.models.SearchStringMapping)1 BookmarkListModel (org.ovirt.engine.ui.uicommonweb.models.bookmarks.BookmarkListModel)1 AbstractMainWithDetailsPresenter (org.ovirt.engine.ui.webadmin.section.main.presenter.AbstractMainWithDetailsPresenter)1 AbstractOverlayPresenterWidget (org.ovirt.engine.ui.webadmin.section.main.presenter.AbstractOverlayPresenterWidget)1 RevealOverlayContentEvent (org.ovirt.engine.ui.webadmin.section.main.presenter.RevealOverlayContentEvent)1 BookmarkModelProvider (org.ovirt.engine.ui.webadmin.uicommon.model.BookmarkModelProvider)1