ZK Developer's Reference/UI Patterns/Browser History Management
From application's viewpoint, it takes two steps to manage the browser's history:
- Add a bookmark to the browser's history for each of the visited states of your desktop.
- Listen to the onBookmarkChange event for bookmark change, and switch the state accordingly.
↑ Each bookmark is an arbitrary string added to the browser's history.
Tips:ZK will notify the application by broadcasting the onBookmarkChange event (an instance of the BookmarkEvent class) to all root components in the desktop.
public class BookmarkTesting extends GenericForwardComposer {
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
}
public void onClick$btn1(Event event){
desktop.setBookmark("btn1");
}
public void onClick$btn2(Event event){
desktop.setBookmark("btn2");
}
public void onBookmarkChange(BookmarkEvent event) throws Exception {
System.out.println("-- onBookmarkChange--");
System.out.println(event.getBookmark());
System.out.println("--/ onBookmarkChange--");
}
}
Url looks like:
http://localhpst/test/bookmark.zul#btn1
沒有留言:
張貼留言
留個話吧:)