use of org.ovirt.engine.core.common.businessentities.Bookmark in project ovirt-engine by oVirt.
the class BookmarkListModel method onRemove.
public void onRemove() {
Bookmark selectedBookmark = (Bookmark) getSelectedItem();
BookmarksParametersBase parameters = new BookmarksParametersBase(selectedBookmark.getId());
IFrontendActionAsyncCallback async = result -> postOnSave(result.getReturnValue());
getWindow().startProgress();
Frontend.getInstance().runAction(ActionType.RemoveBookmark, parameters, async);
}
use of org.ovirt.engine.core.common.businessentities.Bookmark in project ovirt-engine by oVirt.
the class BookmarkListModel method edit.
public void edit() {
org.ovirt.engine.core.common.businessentities.Bookmark bookmark = (org.ovirt.engine.core.common.businessentities.Bookmark) getSelectedItem();
if (getWindow() != null) {
return;
}
BookmarkModel model = new BookmarkModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().editBookmarkTitle());
model.setHelpTag(HelpTag.edit_bookmark);
// $NON-NLS-1$
model.setHashName("edit_bookmark");
model.setIsNew(false);
model.getName().setEntity(bookmark.getName());
model.getSearchString().setEntity(bookmark.getValue());
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnSave", this);
model.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
model.getCommands().add(tempVar2);
}
use of org.ovirt.engine.core.common.businessentities.Bookmark in project ovirt-engine by oVirt.
the class BookmarkListModel method syncSearch.
@Override
protected void syncSearch() {
super.syncSearch();
Frontend.getInstance().runQuery(QueryType.GetAllBookmarks, new QueryParametersBase(), new AsyncQuery<>((AsyncCallback<QueryReturnValue>) returnValue -> {
List<Bookmark> resultList = returnValue.getReturnValue();
if (resultList != null) {
Collections.sort(resultList, COMPARATOR);
}
setIsBookmarkInitiated(true);
setItems(resultList);
setIsBookmarkInitiated(false);
}));
}
use of org.ovirt.engine.core.common.businessentities.Bookmark 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);
}
}
}
}
use of org.ovirt.engine.core.common.businessentities.Bookmark in project ovirt-engine by oVirt.
the class BookmarkDaoTest method testGet.
/**
* Ensures that, if the id is valid, then retrieving a bookmark works as expected.
*/
@Test
public void testGet() {
Bookmark result = dao.get(existing_bookmark.getId());
assertNotNull(result);
assertEquals(existing_bookmark.getId(), result.getId());
}
Aggregations