use of org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder in project scout.rt by eclipse.
the class AbstractSqlBookmarkStorageService method readUserFolder.
@Override
protected BookmarkFolder readUserFolder(Object userId) {
Object[][] data = execSelectUserBookmarkFolder(userId);
for (int r = 0; r < data.length; r++) {
Object[] row = data[r];
long id = ((Number) row[0]).longValue();
try {
BookmarkFolder folder = execResolveBookmarkFolder(id, row[1]);
if (folder != null) {
folder.setId(id);
return folder;
}
} catch (RuntimeException p) {
LOG.warn("invalid bookmark folder binary data for id={}: {}", id, p);
}
}
return null;
}
use of org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder in project scout.rt by eclipse.
the class AbstractBookmarkMenu method createNewBookmark.
protected void createNewBookmark(int kind) {
Bookmark b = ClientSessionProvider.currentSession().getDesktop().createBookmark();
if (b != null) {
IBookmarkService service = BEANS.get(IBookmarkService.class);
b.setKind(kind);
IBookmarkForm form = null;
if (getConfiguredBookmarkForm() != null) {
try {
form = getConfiguredBookmarkForm().newInstance();
} catch (Exception e) {
BEANS.get(ExceptionHandler.class).handle(new ProcessingException("error creating instance of class '" + getConfiguredBookmarkForm().getName() + "'.", e));
}
}
if (form == null) {
form = new BookmarkForm();
}
if (kind == Bookmark.GLOBAL_BOOKMARK) {
form.setBookmarkRootFolder(service.getBookmarkData().getGlobalBookmarks());
} else if (kind == Bookmark.USER_BOOKMARK) {
form.setBookmarkRootFolder(service.getBookmarkData().getUserBookmarks());
}
form.setBookmark(b);
form.startNew();
form.waitFor();
if (form.isFormStored()) {
b.setTitle(form.getBookmark().getTitle());
b.setKeyStroke(form.getBookmark().getKeyStroke());
b.setOrder(form.getBookmark().getOrder());
BookmarkFolder folder = form.getFolder();
if (folder == null) {
folder = form.getBookmarkRootFolder();
}
folder.getBookmarks().add(b);
service.storeBookmarks();
}
}
}
use of org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder in project scout.rt by eclipse.
the class AbstractBookmarkTreeField method getParentBookmarkFolder.
private BookmarkFolder getParentBookmarkFolder(ITreeNode node) {
BookmarkFolder folder = getBookmarkRootFolder();
ITreeNode parentNode = node.getParentNode();
if (isFolderNode(parentNode)) {
folder = (BookmarkFolder) parentNode.getCell().getValue();
}
return folder;
}
use of org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder in project scout.rt by eclipse.
the class AbstractBookmarkTreeField method populateFolderContentRec.
/**
* @return true if populate of delta was successful
*/
private void populateFolderContentRec(ITreeNode parent, BookmarkFolder newParent) {
for (BookmarkFolder newFolder : newParent.getFolders()) {
FolderNode newNode = new FolderNode(newFolder);
getTree().addChildNode(parent, newNode);
populateFolderContentRec(newNode, newFolder);
}
for (Bookmark b : newParent.getBookmarks()) {
BookmarkNode newNode = new BookmarkNode();
newNode.getCellForUpdate().setValue(b);
getTree().addChildNode(parent, newNode);
}
}
use of org.eclipse.scout.rt.shared.services.common.bookmark.BookmarkFolder in project scout.rt by eclipse.
the class AbstractBookmarkStorageService method storeBookmarkData.
@Override
public BookmarkData storeBookmarkData(BookmarkData newData) {
Object userId = getCurrentUserId();
BookmarkFolder existingUserFolder = readUserFolder(userId);
if (existingUserFolder != null) {
BookmarkFolder existingSpoolFolder = existingUserFolder.getFolder(Bookmark.SPOOL_FOLDER_NAME);
if (existingSpoolFolder != null) {
newData.getUserBookmarks().getFolders().add(existingSpoolFolder);
processSpoolToInbox(newData.getUserBookmarks());
}
}
writeBookmarks(newData, userId);
return readBookmarks(userId);
}
Aggregations