wikiPageBox.addNewWikiPageHandler(new WikiPageBox.WikiPageBoxHandler() {
@Override
public void onWikiPage(String wikiPageName) {
Place place = new WikiPagePlace(wikiPageName);
placeController.goTo(place);
}
});
wikiPageBox.addSelectWikiPageHandler(new WikiPageBox.WikiPageBoxHandler() {
@Override
public void onWikiPage(String wikiPageName) {
Place place = new WikiPagePlace(wikiPageName);
placeController.goTo(place);
}
});
wikiPageBox.addDeleteWikiPageHandler(new WikiPageBox.WikiPageBoxHandler() {
@Override
public void onWikiPage(String wikiPageName) {
eventBus.fireEvent(new DeleteWikiPageEvent(wikiPageName));
storage.delete(wikiPageName);
wikiPageBox.removeWikiPage(wikiPageName);
}
});
for (String wikiPageName: storage.findAll()) {
wikiPageBox.addWikiPage(wikiPageName);
}
if (eventBus != null) {
eventBus.addHandler(AddWikiPageEvent.TYPE, new AddWikiPageEventHandler() {
@Override
public void onAddWikiPage(AddWikiPageEvent event) {
wikiPageBox.addWikiPage(event.getWikiPageName());
}
});
eventBus.addHandler(PlaceChangeEvent.TYPE, new PlaceChangeEvent.Handler() {
@Override
public void onPlaceChange(PlaceChangeEvent event) {
if (event != null) {
Place place = event.getNewPlace();
if (place instanceof WikiPagePlace) {
WikiPagePlace p = (WikiPagePlace) place;
wikiPageBox.focusOnWikiPage(p.getWikiPageName());
}
}