if (source == addController) { // process add controller finished()
if (event.equals(Event.DONE_EVENT)) {
// default to myEntries search
cmc.deactivate();
ToolController toolC = detailsController.setEntry(addController.getAddedEntry(), urequest, false);
Component toolComp = (toolC == null ? null : toolC.getInitialComponent());
mainPanel.setContent(detailsController.getInitialComponent());
columnsLayoutCtr.setCol2(toolComp);
menuTree.setSelectedNodeId(myEntriesNodeId);
// ask if we should start the editor right now.
RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(addController.getAddedEntry());
if (handler.supportsEdit()) { // start Editor
removeAsListenerAndDispose(launchEditorDialog); // cleanup old // instance
launchEditorDialog = activateYesNoDialog(urequest, null, translate("add.launchedit.msg"), launchEditorDialog);
launchEditorDialog.setUserObject(addController.getAddedEntry());
return;
}
} else if (event.equals(Event.CANCELLED_EVENT)) {
cmc.deactivate();
} else if (event.equals(Event.FAILED_EVENT)) {
getWindowControl().setError(translate("add.failed"));
mainPanel.setContent(main);
}
} else if (source == searchController) {
RepositoryEntry selectedEntry = RepositoryManager.getInstance().lookupRepositoryEntry(searchController.getSelectedEntry().getKey());
if (selectedEntry == null) {
getWindowControl().setWarning(translate("warn.entry.meantimedeleted"));
main.setPage(VELOCITY_ROOT + "/index.html");
return;
}
if (event.getCommand().equals(RepositoryTableModel.TABLE_ACTION_SELECT_ENTRY)) {
// entry has been selected to be launched in the
// searchController
ToolController toolC = detailsController.setEntry(selectedEntry, urequest, false);
if (selectedEntry.getCanLaunch()) detailsController.doLaunch(urequest);
else if (selectedEntry.getCanDownload()) detailsController.doDownload(urequest);
else { // offer details view
Component toolComp = (toolC == null ? null : toolC.getInitialComponent());
columnsLayoutCtr.setCol2(toolComp);
mainPanel.setContent(detailsController.getInitialComponent());
}
} else if (event.getCommand().equals(RepositoryTableModel.TABLE_ACTION_SELECT_LINK)) {
// entry has been selected in the searchController
ToolController toolC = detailsController.setEntry(selectedEntry, urequest, false);
Component toolComp = (toolC == null ? null : toolC.getInitialComponent());
columnsLayoutCtr.setCol2(toolComp);
mainPanel.setContent(detailsController.getInitialComponent());
}
} else if (source == detailsController) { // back from details
if (event.equals(Event.DONE_EVENT)) {
if (backtocatalog) {
backtocatalog = false;
ToolController toolC = catalogCntrllr.createCatalogToolController();
Component toolComp = (toolC == null ? null : toolC.getInitialComponent());
columnsLayoutCtr.setCol2(toolComp);
mainPanel.setContent(catalogCntrllr.getInitialComponent());
} else {
Component toolComp = (mainToolC == null ? null : mainToolC.getInitialComponent());
columnsLayoutCtr.setCol2(toolComp);
mainPanel.setContent(main);
}
} else if (event instanceof EntryChangedEvent) {
Component toolComp = (mainToolC == null ? null : mainToolC.getInitialComponent());
columnsLayoutCtr.setCol2(toolComp);
mainPanel.setContent(main);
} else if (event.equals(Event.CHANGED_EVENT)) {
ToolController toolC = detailsController.getDetailsToolController();
Component toolComp = (toolC == null ? null : toolC.getInitialComponent());
columnsLayoutCtr.setCol2(toolComp);
}
} else if (source == mainToolC) {
// handles the tools events for the Repository Actions
handleToolEvents(urequest, event);
} else if (source == launchEditorDialog) {
if (DialogBoxUIFactory.isYesEvent(event)) {
// do
// launch
// editor
ToolController toolC = detailsController.setEntry((RepositoryEntry) launchEditorDialog.getUserObject(), urequest, false);
Component toolComp = (toolC == null ? null : toolC.getInitialComponent());
columnsLayoutCtr.setCol2(toolComp);
mainPanel.setContent(detailsController.getInitialComponent());
detailsController.doEdit(urequest);
} else {
// no, don't launch editor }
}
}
/*
* from the catalog controller its sending change events if the tools
* available have changed, e.g. no longer localTreeAdmin
*/
else if (source == catalogCntrllr) {
if (event == Event.CHANGED_EVENT) {
ToolController toolC = catalogCntrllr.createCatalogToolController();
Component toolComp = (toolC == null ? null : toolC.getInitialComponent());
columnsLayoutCtr.setCol2(toolComp);
} else if (event instanceof EntryChangedEvent) {
// REVIEW:pb:signal from the catalog to show Detail!
// REVIEW:pb:the first event is also a change event, signalling a change
// in the tools
// REVIEW:pb:the EntryChangedEvent is misused to signal "show details"
EntryChangedEvent entryChangedEvent = (EntryChangedEvent) event;
RepositoryEntry e = RepositoryManager.getInstance().lookupRepositoryEntry(entryChangedEvent.getChangedEntryKey());
if (e != null) {
backtocatalog = true;
ToolController toolC = detailsController.setEntry(e, urequest, false);
Component toolComp = (toolC == null ? null : toolC.getInitialComponent());
columnsLayoutCtr.setCol2(toolComp);
mainPanel.setContent(detailsController.getInitialComponent());
}
}