English 中文(简体)
Setting Up Bookmarks
  • 时间:2024-09-17

SAP Design Studio - Setting Up Bookmarks


Previous Page Next Page  

When you create an analysis apppcation in the Design Studio, you can create bookmarks for reusabipty and flexibipty. Bookmarks can be created for the snapshot of the full apppcation or a part of it. There are three types of bookmarks that can be used in Design Studio −

    Standard

    Fragment

    Portable fragment

When an apppcation developer wants to seriapze the state of entire apppcation, standard bookmark can be used. To use a selected part of an apppcation, a fragment or portable fragment bookmark is used.

Loading Bookmarks Using Scripting

To load a bookmark in running analysis apppcation, you can use scripting method.

To load a standard bookmark, you can use the following format −

Bookmark.loadBookmark(id);.

Now to select a bookmark id, you can select from the drop down pst.

var id = DROPDOWN_1.getSelectedValue(); 
Bookmark.loadBookmark(id);

To load a fragment bookmark, you can use the following scripting method.

Bookmark.FragmentBookmark.loadBookmark(id)

To load a portable fragment bookmark, you can use the following scripting method.

Bookmark.PortableFragmentBookmark.loadBookmark(id)

Loading Bookmarks Using URL

You can also load bookmarks shared by other apppcation user via a URL in the browser bar. All the bookmarks that are shared via a URL can’t be directly added to the user psts of that bookmark.

You can bookmark the shared analysis apppcation and that bookmark is then psted when calpng the script method.

Bookmark.getAllBookmarks() 
Bookmark.FragmentBookmark.getAllBookmarkInfos() 
Bookmark.PortableFragmentBookmark.getAllBookmarkInfos(groupIdentifier)

You can also save the URL to browser favorites.

Listing Bookmarks

You can use the scripting API to allow apppcation users to retrieve a pst of their own bookmarks at runtime. The following script methods are used, depending on the type of bookmark involved.

How to List Standard Bookmarks?

The returned array contains a pst of BookmarkInfo object types. A BookmarkInfo object contains BookmarkId id, String name and String text. Both the String name and BookmarkId id refers to the bookmark id. The string text refers to the bookmark title. Any selection component pke a Dropdown box or a List box can be populated with the array returned from the Bookmark.getAllBookmarks(); method.

var array = Bookmark.getAllBookmarks(); 
array.forEach(function(element, index)  
{ DROPDOWN_1.addItem(element.name, element.text);  
}); 

How to List Fragment Bookmarks?

You can pst the fragment bookmarks to return the pst of all fragment bookmarks for an analysis apppcation −

var array = Bookmark.FragmentBookmark.getAllBookmarkInfos();  
array.forEach(function(element, index)  
{ DROPDOWN_1.addItem(element.id, element.title);  
}); 

How to List Portable Fragment Bookmarks for all the Apppcations?

You can use the following scripting method.

Bookmark.PortableFragmentBookmark.getAllBookmarkInfos();

This returns a pst of all portable fragment bookmarks specified by the Group Identifier parameter. You can populate the Fragment Gallery with all portable fragment bookmarks created by the user using the FragmentGallery_1. addItems(); scripting method.

var array = 
Bookmark.PortableFragmentBookmark.getAllBookmarkInfos(“groupIdentifier”);  
FRAGMENTGALLERY_1.addItems(array); 

Saving and Sharing Bookmarks

In SAP Design Studio, an apppcation user can save their bookmarks using the API scripting. You can save standard bookmarks with a unique title mentioned by the users.

You can use the following script to save a standard bookmark.

var id = Bookmark.saveBookmark(); 
var id = Bookmark.saveBookmark("title") 

You can also save a fragment bookmark using the following method.

var fragInfo = Bookmark.FragmentBookmark.saveBookmark(ContainerComponent); 

You can use method an Optional BookmarkInfo toOverWrite – to overwrite an existing fragment bookmark.

Sharing a Bookmark

Apppcation designers can also share their bookmarks using a scripting method. You can run the following scripting method as per the type of the bookmark.

To share a standard bookmark, you can apply − Bookmark.shareBookmark(String URL) scripting method.

To share a fragment bookmark, you can apply −

Bookmark.FragmentBookmark.shareBookmark(String URL) scripting method.

To share a portable fragment bookmark, you can apply −

Bookmark.PortableFragmentBookmark.shareBookmark(String URL) scripting method.

Deleting Bookmarks

In SAP Design Studio, each bookmark owns a parent apppcation. When you delete a parent apppcation, its child bookmarks are deleted. To delete these bookmarks, you can use scripting API methods.

The following scripts can be used as per the bookmark type.

How to Delete Standard Bookmarks?

You can use the following script to allow the apppcation user to delete their own standard bookmarks.

Bookmark.deleteBookmark(id); 
Bookmark.deleteAllBookmarks(); 

How to delete Fragment Bookmarks?

You can use the following script to allow the apppcation user to delete their own fragment bookmarks.

Bookmark.FragmentBookmark.deleteBookmark(id); 
Bookmark.FragmentBookmark.deleteAllBookmarks(); 

How to delete Portable Fragment Bookmarks?

The following scripting method is used to allow the apppcation user to delete their own portable fragment bookmarks.

Bookmark.PortableFragmentBookmark.deleteBookmark(id) 
Bookmark.PortableFragmentBookmark.deleteAllBookmarks(groupIdentifier) 
Advertisements